Mission: Programming with NETCONF and Python

In this lab you will leverage the skills you've learned in the previous Module labs to use NETCONF and YANG to retrieve interface statistics from a CSR1000v and post the results to a Cisco Spark Room.


Completion Time: 30 Minutes

  • Use pyang to identify and investigate the target model
  • Leverage ncclient to retrieve operational data from the device
  • Format the returned data into a human friendly format
  • Post the results to a Spark Room


Before completing this lab you should have a basic understanding of working with YANG Data Models and leveraging ncclient to make NETCONF connections to a router. It is suggested you complete the previous Learning Labs in this Module.

Other Labs

Sandbox Access and Code

To complete this lab you need access to a network device that supports NETCONF. The lab is designed to leverage the CSR1000v contained within the dCloud DevNet Express for DNA Sandbox environment.

During this lab you will be updating code files that are available in the module06/lab05_mission directory of the devnet-express-code-samples repository on GitHub.

Install "xmltodict" Python Module

The code in this mission leverages the Python module "xmltodict" to make working with the XML data simpler. Before running the code examples, you'll need to install this module into your Python environment with this command.

pip install xmltodict