In my earlier blogs, I had covered basics of Netconf and Yang and how to use Netconf to configure Cisco devices. Recently, I came across this Python ncclient library that simplifies the configuration/monitoring of Networking devices that supports Netconf. Using ncclient library, we can programmatically configure and monitor devices using Netconf. I also found out that Cisco Openstack Neutron plugin uses ncclient library to program the Nexus switches.
I have used Cisco Nexus 3k switch and Cisco VIRL NXOS switch for the examples in this blog.
In my earlier blog on configuring Cisco Nexus devices using Netconf, I covered the following netconf requests.
- “get” request using filter to display configuration.
- “edit-config” request to change configuration.
- “exec-command” to execute raw CLI requests.
In this blog, I will cover the above same tests using Python ncclient library. Even though the examples below are tried from Python interactive shell, the same can be executed as a Python program as well.
First step is to import the ncclient library and create a connection:
Continue reading Netconf Python ncclient
In this blog, I will cover the steps that I did to connect Cisco NXOS VIRL switch instance to Arista vEoS switch instance. We can connect any Cisco switch simulated in VIRL, I just picked the NXOS switch type. CML/VIRL supports majority of Cisco switches as VM as well as few external switches from Juniper, Vyatta. External virtual or physical switches can be connected to Cisco switches running inside VIRL using VM Networking magic. I just think it is cool to connect Virtual devices, try out real-time network configurations and see how the device responds.
- Install CML/VIRL using the procedure here.
- Install vEoS using the procedure here.
- I used VMPlayer to run VIRL and vEoS. Connecting across Virtualbox and VMWare player is little painful.
Following is the network I created:
Continue reading Connecting NXOS VIRL instance to Arista vEoS
In this blog, I will cover the steps to get NXAPI working with NXOS image in VIRL. For more details on CML/VIRL, please refer to my earlier blog series. Running NXAPI with VIRL image makes it easy to write automation scripts without needing a physical switch.
Earlier, I had installed VIRL February release(0.9.17) which included the VIRL STD 0.10.13.11. To run NXAPI which is supported in NXOS 7.2.0 version, it is needed to upgrade VIRL to the latest version. I tried running NXOS 7.2.0 in VIRL 0.10.13.11. Even though I was able to enable “feature nxapi”, I was not able to configure management IP and be able to connect from outside.
VIRL’s latest April release(0.9.242) has the following components:
- VM Maestro 1.2.2 Build Dev-211
- VIRL STD 0.10.14.20
There are 2 approaches to upgrade VIRL.
- Full upgrade which upgrades both VIRL and OS related stuff.
- Quick upgrade which upgrades only VIRL. Based on the VIRL 0.9.242 upgrade note here, it is fine to do quick upgrade for users running VIRL STD 0.10.13.11. For folks outside Cisco, I am not sure if VIRL 0.9.242 is released outside.
Continue reading Cisco NXAPI with VIRL
Earlier, I had written about Cisco NXOS device configuration/monitoring using Python and OnePK. Recently, I came across NXAPI approach to configure and monitor NXOS devices. NXAPI uses either http/https to connect to NXOS devices and talk using NXOS CLI. For configuration, CLI is encoded in XML/JSON. For monitoring, CLI is encoded in XML/JSON and the results are returned in similar format that makes it easy to parse. I also saw this blog and nxos-ansible project from Jason where he has created Ansible modules using NXAPI. In this blog, I will cover NXAPI basics and my experience in trying Pycsco library and nxos-ansible modules from Jason. Thanks to Jason, he has done a nice job abstracting the NXAPI into higher level functions and Ansible modules and this can help others to build up on top of it rather than working from scratch.
NXAPI is available on Nexus 3k and 9k devices. I have access to N3K device and I tried this there. To enable NXAPI, we need to execute “feature nxapi” from config prompt. NXAPI also provides a sandbox environment which can be accessed using http from the management ip address. With the sandbox environment, we can execute NXOS CLI commands and get output in JSON or XML format. Following image is a snapshot of the sandbox. Continue reading Cisco NXAPI
This blog is part of my series on Devops for Networking. In this blog, I will cover how to configure and monitor Cisco NXOS devices using Netconf. In 1 of my earlier blogs, I have provided basics of Netconf and Yang.
I have used Nexus 3k switch for my experiments below.
Netconf has the following layers:
- Transport protocol is sshv2.
- rpc request section contains namespace related details.
- Operations section could be different operations like edit-config, get-config, commit, lock etc.
- Content section contains the actual device operation in XML format. The schema for the content can either be specified in XSD format or using Yang. Cisco NXOS devices support XSD format and I will use it in this blog.
Continue reading Cisco device configuration using Netconf
This blog is part of my series on Devops for Networking. onePK is Cisco’s attempt to expose a standard set of APIs to configure and monitor across multiple different Cisco devices. Orchestration and automation applications can use these standard APIs to talk to Cisco devices. In this blog, I will cover a brief overview of onePK and how to get started with onePK to write applications on top of it.
Following block diagram from Cisco gives different blocks involved in onePK.
Continue reading Cisco device configuration using OnePK
This blog is part of my series on Devops for Networking. As I indicated in 1 of my earlier blog, majority of Network devices still have CLI as the only means of configuration and monitoring. CLI is not automation friendly because of obvious reasons. In the last few years, Cisco NXOS devices provides CLI output in XML and JSON format. This allows much easier ways to parse the CLI output which aids in automation. In this blog, I will cover some examples of monitoring Cisco NXOS devices using Python interface to interact with the device and get useful information.
Continue reading Nexus devices CLI parsing using Python, XML and JSON