Category Archives: devops

Cisco NXAPI with VIRL

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 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 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

There are 2 approaches to upgrade VIRL.

  1. Full upgrade which upgrades both VIRL and OS related stuff.
  2. 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 For folks outside Cisco, I am not sure if VIRL 0.9.242 is released outside.

Continue reading Cisco NXAPI with VIRL

Ansible for Arista EoS

This is a continuation of my previous blog on Arista Eapi. Ansible provides a recipe driven approach to manage servers/switches, I have covered Ansible in some of my previous blogs. In this blog, I will cover the following:

  • Ansible modules for Arista device
  • Ansible galaxy eos role for Arista device

There are 2 approaches to use Ansible with Arista device. Following picture from Arista illustrates this point:


  • The first approach is called remote approach from Ansible perspective. Here the ansible python script is transferred to Arista device using ssh and the python script is executed on the Arista device which connects locally to the device using Pyeapi which in turn talks through eapi.
  • The second approach is called local approach from Ansible perspective. Here the Ansible python script is run locally in the client machine which in turn talks to Pyeapi library which in turn talks to the remote device using eapi.
  • Typically, network devices dont allow running scripts directly on the device. In that case, only second option would be possible. In Arista’s case, there are no restrictions like this and both the approaches can be used for Ansible based automation.

Continue reading Ansible for Arista EoS

Arista Eapi and pyeapi

I had covered basics of Arista EoS and vEoS in my previous blog. Arista’s Eapi gives programmatic approach to manage Arista devices. Arista’s Pyeapi Python  library is built on top of Eapi. In this blog, I will cover the following:

  • Eapi
  • Pyeapi library

I have used Arista vEoS for trying out all examples below without needing a physical Arista device. That shows the power of virtual device.

There is lot of similarity between Arista’s Eapi and Cisco’s NXAPI. I covered NXAPI in 1 of my earlier blogs. Arista’s Eapi is equivalent to Cisco’s NXAPI, Arista’s Pyapi library is equivalent to Cisco’s Pycsco library. Arista’s Eapi provides http/https access to the Arista router/switch through which we can send standard CLI commands and the output is received in JSON/XML formatted output. There is no need to do screen scraping with this approach, this makes it devops friendly. Arista’ Pyeapi is available as a github project.


To enable Eapi in Arista device, do “management api http-commands” in config prompt. Following is the output in my Arista vEoS switch:

Continue reading Arista Eapi and pyeapi

Arista EoS and vEoS

I had heard some good things about Arista EoS(Extensible Operating System). I have never used Arista switches before. I did some reading on Arista EoS and I also tried their VEoS which is their Virtual machine offering for running Arista switch as VM. In this blog, I will share some of my experiences.

EoS Overview:

I found this block diagram in Arista White paper:


Following are the things that I liked:

Continue reading Arista EoS and vEoS


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.

Enabling NXAPI:

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

Cisco UCS Platform Emulator

Earlier, I had written a blog on Cisco UCS automation using Python SDK. At that time, I used real UCS system to test my scripts. Cisco UCS PE(Platform Emulator) emulates UCSM(UCS Manager) software and we can run this as a VM. Different types of hardware(Fabric Interconnect, FEX/IOM, Servers, adapters, power supply) can be added to create a complex UCS system. We can do majority of the configurations and can trigger different conditions to see how UCSM reacts. Obviously, traffic related testing cannot be done with this. For scripting, UCS PE is a perfect solution. In this blog, I will cover what I did to get UCS PE up and running.


VMWare Player 6.05 running on Windows 7.


Download the PE zip files. I used version 2.2(3a). Unzip them and import into VMplayer. Choose the default configurations, 3 NAT interfaces are created by default.

Basic configuration:

Continue reading Cisco UCS Platform Emulator

Ansible for Network Automation – Part 2

This blog is part of my series on Devops for Networking. In the previous blog, I covered basics of Ansible and how to get started with it. In this blog, I will cover a sample application that I wrote with Ansible. This Ansible application builds on UCS sdk utility that I covered in a previous blog. The UCS python utility displays the inventory of UCS system. I have made that utility as an Ansible module and extended the application to display the inventory of a list of UCS systems that are defined in the host list. This project is more to illustrate the usecase for Ansible.

The source code for the project can be found here. There are 3 files listed here:

getucs.yml - YAML file that defines the playbook
getucsinfo - New module that is defined. This file needs to be in "usr/share/ansible" - getucsinfo module uses functions in this library. This file needs to be in PYTHONPATH.The library provides utility functions to get UCS inventory.

Continue reading Ansible for Network Automation – Part 2