One of the questions that gets asked most often around NetDevOps is,

“I love the concept of NetDevOps, but I’m not a
software developer. I’ve been a network engineer for X years,
and I don’t know how to code…where do I  start?”

You can start with Python. It’s a great programming language that is easy to read, easy to write, powerful yet intuitive. It comes out-of-the-box with many great packages and modules required for network automation, and has consistently ranked as one of the top programming languages of the decade. Even Cisco is teaching you Python!

But picking up programming can be challenging. It takes time to master a language, even more to understand its various design paradigms and pick the right tool (e.g., paramiko, netmiko, or pexpect), and then build reusable functions and libraries to drive your network devices.

So, is Python THE answer?

The short answer is yes, but you don’t have to start with the language – that might be a bit dry. To dive into network automation and NetDevOps by starting with Python dicts, functions, and classes is a bit like getting into baking and going straight to the wheat mill. Instead, consider getting the right cake mix as a first step and see your end product take shape – go down the path of customization and tinkering only when you dig deeper, and gain comfort in the art.

pyATS | Genie: Command Line

Build using Python, Cisco pyATS & Genie comes out of the box with ready-to-use libraries, and step-by-step guides on how to leverage the power of these libraries, catering to engineers of all kinds of needs and skill levels.

For starters, the built-in shell interface enables you to harness the power of Genie libraries and dabble into the world of network automation without any programming expertise. The command requires only a YAML input file that describes your testbed/device connectivity and credentials information.

pyATS 1

From there on, you can use the Genie parse command to process any of the 1000+ (and counting) parsers that Genie features out of the box.

pyATS 2

pyATS 2_3

This command connects to your testbed device, issues the provided CLI command, find & invokes the right parser for this platform, and returns the parsed data structure in JSON format.

This, in conjunction with Genie diff command, allows you to make quick yet stateful comparisons of your device operational states pre/post changes. Imagine for instance, that you kept a copy of your known-good device operational state in a repository. When your network is misbehaving, probe again and compare:


As opposed to a typical text comparison editors that highlights EVERYTHING that has changed,


The Genie diff engine generates a human-readable Linux diff-like syntax of exactly what changed, based on the parsed data-structure object in Python.


This stateful parsed data structure comparison takes into account dynamic values (such as counters, timestamps, uptimes), and automatically excludes them from the output. The result enables you to immediately pin point the issue at hand, and resolve as needed.

But wait! It gets even better

Genie isn’t just a library of open-source parsers. Above the parsing layer, Genie represents networks devices and their features with its own YANG-inspired Python object models. These higher level models are designed to be programmer-friendly, and agnostic across different Network OS/Platforms. You can use them to easily and thoroughly inspect your network for whole-feature based operational state changes.


Diff output:


In the above example, our topology experienced an unknown failure that led to total traffic loss. Armed with Genie, you can immediate determine that Ethernet2/1 on our Nexus switch lost connectivity, leading to the loss of all OSPF neighbors.

How cool is that?

Sum Up

Python is great for network automation, but pyATS & Genie shell commands provides a much easier time to ramp-up and be productive FAST! The three basic commands:

  • genie parse
  • genie learn
  • genie diff

enables any network engineer to immediately perform some degree of stateful DevOps verification/automation without any programming. Combining this with some icing on the cake, Network as Code: storing your configuration and over-time operational state outputs into Git, you now have:

  1. an over-time view of how your network configuration changed
  2. an over-time snapshot of your network’s operational status

Your ability to debug your network’s failures just quadrupled!

Do It Yourself

There’s no better way to learn something than to get your hands dirty. Head over to the pyATS & Genie learning section on DevNet and practice what you’ve just read:

Still want more? Register now for NetDevOps Live! In Season 2, episode 8 of this FREE webinar, we’ll dig deeper in to the world of network automation, and how to test your network, using Cisco pyATS & Genie.

We’d love to hear what you think. Ask a question or leave a comment below.
And stay connected with Cisco DevNet on social!

Twitter @CiscoDevNet | Facebook | LinkedIn

Visit the new Developer Video Channel


Siming Yuan

Sr. Technical Leader, Engineering

DevX, Core Software Group