Explore Python sample code

On-Box Python

Example scripts that leverage Cisco provided Python libraries allowing access to the configuration, operational state, or event data from the network element.

Execute CLI via Python

Leverage the CLI library to execute the “show version” command on the box.

TDR Test Every Interface

Leverage the CLI library with a TDR test run on every interface in “up” status.

EEM Config Changes to Spark

Monitor configuration changes and send a message to a Cisco Spark Room.

Off-Box Python

Examples that leverage one of the many exposed interfaces (NETCONF, RESTCONF, SNMP, SSH, etc) on a network element within a script.

MIB Walk with Python

Perform a MIB walk against a device leveraging the “netsnmp” library.

NETCONF Connection with Python

Connect to a device with NETCONF using the “ncclient” library for Python.

Boot Integrity Verification (BIV)

Analyze the Boot Integrity report to validate its authenticity and integrity.

Python & Network Controllers

In addition to using Python to automate device by device, Python can be used to interact with Network Controllers such as Cisco DNA Center or OpenDaylight.

Develop with Python SDKs and Tools

Learn YDK with Python for NETCONF/YANG

Hello World for YDK-Py

A collection of sample applications that use YDK-Py for network programmability. The hello-ydk.py script prints the uptime of a device running Cisco IOS XR.

Basic YDK-Py Apps

These apps illustrate simple examples of using YDK-Py to program a network device. They do not require significant model or programming experience.

YDK Learning Lab

Leveraging YANG Development Kit (YDK) for Programmatic Access to Network Devices.

Get started with On-Box Python and GuestShell

Check out these docs to learn more

Learn Python for Network Automation

Learn Network Programmability Basics

Jumpstart your journey into network programmability with this expert-led video course.

Intro to Coding Fundamentals

Get started with coding basics by learning the fundamentals of coding with Python and parsing JSON.

Intro to Cisco DNA Center REST APIs

Learn how to get started with authentication and then learn some simple examples.

WHICH VERSION OF PYTHON DOES YOUR DEVICE SUPPORT ON-BOX?

CAT 3650 CAT 3850 ISR 4K Nexus 3K/9K Nexus 5K/6K Nexus 7K
On-box Python 2.7 IOS-XE 16.5.1 IOS-XE 16.5.1 IOS-XE 16.5.1 N3K NX-OS 6.0
N9K NX-OS 7.0
N5K NX-OS 5.2
N6K NX-OS 6.0
NX-OS 6.1
On-box Python 3.x N/A N/A IOS-XE 16.5.1

Do you have any questions?

Join the discussion with the Networking experts and peers!

Looking for more resources?

Checkout the Networking Dev Center for all things network programmability on DevNet