avatar Bite 201. Call a Cisco Nexus 9k device

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!

Login and get coding
go back Intermediate level
Bitecoin 3X

93 out of 100 users completed this Bite.
Will you be the 94th person to crack this Bite?
Resolution time: ~80 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 9.0 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help