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.

Upgrade went relatively smooth. It is needed to upgrade both VIRL server as well as VM Maestro client. There was 1 issue that I faced where connectivity to the “VIRL software” tab was very slow and the image download took a long time. It eventually worked.

To run NXOS 7.2.0 with NXAPI, please follow the steps below:

  • I have used my first interface in VIRL server for NAT, I have 4 other adapters with host-only networking. The second adapter is used for management flat network. By default, this is in the 172.16.1.x network. It is needed to make sure that the custom network used for the second adapter is mapped to 172.16.1.x network. In my case, I have used VMnet2 and following is the VMnet2 configuration in my host machine.
Ethernet adapter VMware Network Adapter VMnet2:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::1d31:f261:b304:2ff%41
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :
  • In VM Maestro design tab, select NXOS 7.2.0 switch with management network set to “Flat network” and simulate the switch.
  • In the nxos console, configure the mgmt0 interface IP to the management port IP address that is displayed in the simulation tab.
switch# show interface mgmt 0
mgmt0 is up
admin state is up
  Hardware: Ethernet, address: fa16.3e18.f7c7 (bia fa16.3e18.f7c7)
  Internet Address is

nxosv(config)# show version 
Cisco Nexus Operating System (NX-OS) Software
TAC support:
NX-OSv is a demo version of the Nexus Operating System

  loader:    version N/A
  kickstart: version 7.2(0)D1(1) [build 7.2(0)ZD(0.120)]
  system:    version 7.2(0)D1(1) [build 7.2(0)ZD(0.120)]
  kickstart image file is: bootflash:///titanium-d1-kickstart.7.2.0.ZD.0.120.bin
  kickstart compile time:  3/8/2015 1:00:00 [03/08/2015 11:04:12]
  system image file is:    bootflash:///titanium-d1.7.2.0.ZD.0.120.bin
  system compile time:     3/8/2015 1:00:00 [03/08/2015 15:34:48]
  •  Enable “feature nxapi” and “nxapi sandbox”.
nxosv# show nxapi 

NX-API:       Enabled         Sandbox:      Enabled     
HTTP Port:    80              HTTPS Port:   Disabled 

At this point, we should be able to access NXAPI using a browser in the host machine and configure/monitor the nexus virtual switch.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s