{"id":13609926,"url":"https://github.com/twr14152/Network-Automation-Scripts_Python3","last_synced_at":"2025-04-12T22:32:14.782Z","repository":{"id":92054229,"uuid":"98738279","full_name":"twr14152/Network-Automation-Scripts_Python3","owner":"twr14152","description":"Network automation using various python modules in Python3","archived":false,"fork":false,"pushed_at":"2024-07-29T10:28:50.000Z","size":537,"stargazers_count":61,"open_issues_count":0,"forks_count":48,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-01T19:53:44.860Z","etag":null,"topics":["eapi","multiprocessing","napalm","netconf","netmiko","nxapi","python","python3","restconf","telnetlib"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twr14152.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-29T14:38:58.000Z","updated_at":"2024-07-29T10:28:53.000Z","dependencies_parsed_at":"2024-01-06T02:55:16.444Z","dependency_job_id":"4ad35a1b-d6a3-4f8f-b36f-475c26f849be","html_url":"https://github.com/twr14152/Network-Automation-Scripts_Python3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twr14152%2FNetwork-Automation-Scripts_Python3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twr14152%2FNetwork-Automation-Scripts_Python3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twr14152%2FNetwork-Automation-Scripts_Python3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twr14152%2FNetwork-Automation-Scripts_Python3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twr14152","download_url":"https://codeload.github.com/twr14152/Network-Automation-Scripts_Python3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223549034,"owners_count":17163580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eapi","multiprocessing","napalm","netconf","netmiko","nxapi","python","python3","restconf","telnetlib"],"created_at":"2024-08-01T19:01:39.334Z","updated_at":"2024-11-07T16:30:22.898Z","avatar_url":"https://github.com/twr14152.png","language":"Python","funding_links":[],"categories":["python3"],"sub_categories":[],"readme":"# Network-Automation-Scripts using Python3\n# Libraries: Pyeapi, Netmiko, Napalm, Telnetlib, Restconf, Nxapi, Nornir, Netconf\nThis repository holds various automation scripts I've written over the years. \nMy goal has been to use this as a repository for knowledge retention as well knowledge sharing.\nI plan to continue to grow this respository as long as I'm still doing stuff in the network automation space.\n\nThis has been a iterative learning process for me and I will be archiving or deleting scripts that no longer have value.\n\n### DNAC\n- Grabbing data out of DNAC\n    - get_device_dnac.py\n    - get_client_health_info.py\n\n### Meraki\n- Using requests to GET data from the meraki dashboard api (Orgs and Networks)\n- Using requests POST to create a network through the meraki dashboard api\n- Using requests PUT to update a SSID on a wireless device through the meraki dashboard api \n\n### Network Controller\n- Playing around with Packet Tracer and testing out its network controller\n- Grab network device info - network_controller/get_device_info.py\n- Grab more generic info from network devices - network_controller/get_all_devices_info.py\n- Update network devices (site wide) - network_controller/update_device_config.py\n\n### Nornir - TestDrive \n- Cisco IOS - GNS3 lab - nornir/using_netmiko_plugin\n- Arista Ceos lab - nornir/using_napalm_plugin \n- Testing newer version of Nornir, not backwards compatible with version 1.x\n\n### Netconf\n- Getting used to xmlns is a challenge and can be frustrating. Took me a while to find the proper xmlns to config a loopback\n- Wrote a script to find out where that xmlns is in the server capabilities dump\n    - netconf_svr_capability.py\n    - netconf_svr_capability_ouput.txt\n- Documentation around netconf is not intuitive from my point of view\n- This will be a trial and error process. \n- Script to config loopback interface\n    - netconf_config_device.py - configured a loopback on devnet router\n    - netconf_config_device_output.text - results\n- Script to do config backups. \n    - netconf_iosxe_cfg_bkup.py - rewrite of netconf_config_bkup.py\n    - netconf_config_bkup.py - goes out pulls running config and places it in config_bkup/ directory\n    - netconf_config_output.txt - the results of the script\n- First time using netconf\n  - netconf_ex1.py\n  - netconf_get_conf.py\n\n### Nxapi \n- Minor update to the  to make output from commands more readable \n  - added : print(json.dumps(response, indent=2, sort_keys=True))\n  - added nxapi_script02.py and nxapi_script02_output.txt for comparison to original script\n- Found this api documentation to be lacking\n- Script examples I found were rigid and not very flexible\n- Created a script to allow user to enter any commands (config/show) w/o having to rewrite the script.\n  - nxapi_script_ex1.py\n\n### Restconf \n- Created two scripts one to create an interface and the other to delete it\n    - create_intf.py\n    - delete_intf.py\n    - script_output.txt\n    \n### Pyeapi - Python client for Arista eAPI \n - Created some scripts for use with ceoslab\n - pyeapi_w_out_conf.py - using pyeapi without config file\n - Cleaning up directory archived some scripts and created interactive script folder\n - Posted configs and validation scripts for ceos demo\n - Posted configs and validation from demo\n - hidden host config file, needs to be located in ~/.eapi.conf\n - created two sample scripts\n\n### Netmiko testing\n- Got a request today to help someone write a script. Created folder and will keep the scripts in there. \n    - script_requests/req_config_script_07292020.py \n- Haven't messed around with Netmiko in quite a while decided to play around and try and update an old script to have both (show/conf) functionality.\n- It's painfully slow as I haven't added any features such as MP to it to speed it up, but it was working with the devnet CSRs.\n- Basically the script will ask the user if this is going to be a configuration or show commands script. Depending on the answer the script will do one or the other.  \n  - test_stuff/interactive_script.py \n  - test_stuff/interactive_script_output.txt\n- NetworkDiscovery/host_file_and_script/ has the most pragmatic scripts for doing network discovery (ie..scripts that run show commands and captures the results and saves them to files)\n- Netmiko scripts for running show commands can be found in the NetworkDiscovery folder \n  - show_commands.py - easiest for every day troubleshooting and operations and lab work\n- Python3.7 works with the scripts as written. Python3.8 is not yet ready. \n- Reorganized some config scripts into config_scripts folder\n  - Scripts are self explanatory\n- Created a script to go out and automatically determine the device_type for a host_list or seedfile.\n  - NetworkDiscovery/host_file_and_script/auto_detect_script.py\n- sample script to connect to juniper device\n  - juniper_script1.py\n  - juniper_conf_from_file.py\n- scp \n  - file transfers to veos devices hosted using vagrant\n  - file transfers to multiple devices using containerized eos or ceos \n- Network-Automation-Scripts_Python3/netmiko/NetworkDiscovery/host_file_and_script/\n  - ios_discovery_enable_mode.py - if enable pw is required\n  - ios_discovery_script.py - if username/password priv level 15\n  - host_file.txt\n- Added 3 examples of how to use jinja templates with netmiko\n - conf_bgp_r4_r5_using_class_obj. - uses class object to populate template\n - conf_bgp_r4_r5_using_dict.py - uses dictionaries to populate template\n - conf_bgp_yaml_jinja2.py - uses yaml files to populate a jinja2 template\n- Created new script that provide you a sandbox to say how many devices, what devices, and what to configure on each\n    - ssh_sandbox.py\n- Created a very basic ssh script useful for discovery + updated with error handling\n- Created script that can handle multiple device with multiple unique configuration files\n- Added multiprocessing to speed up\n    - netmiko_multi_dev_cfg.py\n- Added multiprocessing Pools to scripts to speed them up\n    - netmiko_script5.py\n    - netmiko_show_cmds.py\n    - netmiko speed comparison between serial and multi-processing pools\n- netmiko_script#.py\n- capture output of scripts\n\n### Napalm for eos\n- /config_scripts/conf_merge \n- /config_scripts\n- Tested with ipython(python3.6) - EOS_lab_Napalm_test_results\n- napalm_eos_script1.py\n\n### Napalm for cisco ios\n- napalm discovery script and post script\n    - discovery_ios_svc_now.py\n    - post_svc_now_rest_api.py\n- created a config_scripts directory added new script\n    - script_config_ios.py\n- added new get_facts and get config script to directory\n- Testing with python3 napalm_base and napalm_ios\n- In my gns3 environment I'm using the following code\n    - C7200-ADVENTERPRISEK9-M, Version 15.2(4)S7\n    - IOS provides access to a subset of napalms features\n    - EOS has been a more feature rich testbed with napalm\n\n### Telnetlib module\n- Added script that works with devices that require enable password\n- Use python3 telnetlib module\n- capture output of scripts\n\n### Misc stuff\n- script to find duplicate ips\n  - findingDupIPs.py\n- simple way to iterate through cli commands when running a script\n  - loop_thru_cli_cmds.py\n  - loop_thru_cli_cmds_output.txt\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwr14152%2FNetwork-Automation-Scripts_Python3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwr14152%2FNetwork-Automation-Scripts_Python3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwr14152%2FNetwork-Automation-Scripts_Python3/lists"}