Python is not the only language being used for network automation but the combination of being an easy to learn language, and many code samples and utilities has made it a go-to language for network engineers. Checkout all the resources available for developing with Python and Cisco Networking!
Example scripts that leverage Cisco provided Python libraries allowing access to the configuration, operational state, or event data from the network element.
Leverage the CLI library to execute the “show version” command on the box.
Leverage the CLI library with a TDR test run on every interface in “up” status.
Monitor configuration changes and send a message to a Cisco Spark Room.
Examples that leverage one of the many exposed interfaces (NETCONF, RESTCONF, SNMP, SSH, etc) on a network element within a script.
Perform a MIB walk against a device leveraging the “netsnmp” library.
Connect to a device with NETCONF using the “ncclient” library for Python.
Use RESTCONF to configure the IP address on an interface.
In addition to using Python to automate device by device, Python can be used to interact with Network Controllers such as APIC-EM, APIC, or OpenDaylight.
Retrieve inventory database information of the entire network using the REST API.
Query and display a table of all clients connected to network devices.
Leverage the ACI Toolkit to retrieve the list of tenants configured on an APIC controller.
The acitoolkit exposes a subset of the ACI object model in a way that is meant to provide an introduction to the ACI concepts and allow users to get the most common workflows up and running as quickly as possible.
Cobra is a Python SDK that provides the developer with native ways to interact with the ACI API and object model. With Cobra, developers can quickly build powerful applications against ACI fabrics.
The NX Toolkit is a set of python libraries that allow basic configuration of the Cisco Nexus Switch. It is intended to allow users to quickly begin using the REST API and accelerate the learning curve necessary to begin using the Switch.
YANG Development Kit (YDK) was developed to facilitate network programmability using data models. YDK-gen takes YANG models as input and produces Python APIs (YDK-Py) that mirror the structure of the models.
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.
These apps illustrate simple examples of using YDK-Py to program a network device. They do not require significant model or programming experience.
Leveraging YANG Development Kit (YDK) for Programmatic Access to Network Devices.
Check out these docs to learn more
WHICH VERSION OF PYTHON DOES YOUR DEVICE SUPPORT?
Join the discussion with the Networking experts and peers!
Check out what Cisco Digital Networking Architecture is all about.