Pybites Logo

Call a cisco nexus 9k device

Level: Intermediate (score: 3)

Cisco Nexus 9k devices is one of the first network equipment with comprehensive API programmatic access from Cisco. API capabilities might be familiar to developers working with web apps but they are new to network engineers.

In this Bite we will practice making API calls to the Cisco Nexus device and retrieve information from it. The focus of the Bite is on the HTTP header requirements, the API request body, and general interaction between Python scripts and network devices.

You can find more information about the Cisco Nexus API in the following links:

We are going to make an API call to a Cisco Nexus 9k device using the requests library and parse out the returned output for the current NX-OS version.

The call format will be json-rpc with the command type being cli.

The remote device is an always-on lab device provided by Cisco DevNet:

  • Nexus 9000v Host : sbx-nxos-mgmt.cisco.com
  • NXAPI Ports: 443 (HTTPS)
  • Username: admin
  • Password: Admin_1234!

Note: due to the current setup, you can use the verify=False kwarg in your requests post.

Good luck and code more Python!