Swiss Army Conf
I humbly present to you, my first submission to Cisco DevNet's Automation Exchange. Written in Python, this tool offers those monitoring a network device with 3 avenues for viewing device configuration: NETCONF, RESTCONF and SSH. The results are automatically logged in XML, JSON and text formats, respectively.
About the LAB to run the demo:
We will be interacting with an Always-On Sandbox instance of a Cisco Cloud Services Router - CSR1000v
Sandbox URL: https://devnetsandbox.cisco.com/RM/Diagram/Index/27d9747a-db48-4565-8d44-df318fce37ad?diagramType=Topology
CSR1000V Host: ios-xe-mgmt.cisco.com
SSH Port: 8181
NETCONF Port: 10000
RESTCONF Ports: 9443 (HTTPS)
Credentials of this public available Sandbox to specify when prompted for it:
Username: developer
Password: C1sco12345
Dependencies: See requirements.txt
Walk
- Create and activate a virtual environment to conduct this lab in
- Fork and clone the GitHub repository:
git clone https://github.com/xanderstevenson/network-automation-demo.git
- Install required dependencies:
- cd network-automation-demo
- pip install -r requirements.txt
- Run the script
- You will be prompted to enter the credentials (username & password listed above)
- Make a choice from the options in this menu:
For the main 5 choices, a copy of the relevant log will be automatically copied as backup to a text file in your local repo.
Related Sandbox:
IOS XE on CSR Recommended Code Always On Sandbox
README.md
https://github.com/xanderstevenson/swiss-army-conf/blob/main/README.md
Acknowledgements:
-
For SSH, I used the config_manager Use Case in DevNet Automation Exchange by Cisco engineer Alex Manuelian, as a starting point.
-
For NETCONF, I used the NC-get-config repo in GitHub, by Joe Clarke, as a reference.
-
For the RESTCONF, I based my some of my module on an artile on UltraConfig.com.au by Matt Albrecht titled RESTCONF Tutorial - Everything you need to know about RESTCONF in 2020. I also referenced RC-get-config.py, by Joe Clarke, which is found in the CiscoDevNet python_code_samples_network.
-
I owe a major thank you to Tony Roman at DevNet, whose Model Driven Network
Automation with IOS-XE LTRCRT-2700 from Cisco Live 2019 saved me. I based a lot of my request calls on the paramenters and other nuances of using RESTCONF, NETCONF and SSH for network automation on a DevNEt Sandbox router.