In this lesson, we will cover:

  • What is Genie Parse?
  • What parsers are supported?
  • How to perform Genie parsing via the command line.
  • How to perform Genie parsing using Python.

The scripts and code for this lesson can be found within the pyATS repo under the directory: 003_genie/parse/.

What is Genie Parse?

Genie parse provides the ability to parse a given command into structured output. By having the output in a structured format, we can work with the data in a programmatic way, such as looping over the data or extracting certain elements.

For example, if we were to collect the show int ip br output, we would get an output much similar to this.

leaf1-ios#show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0        YES NVRAM  up                    up
GigabitEthernet0/1        YES NVRAM  up                    up
GigabitEthernet0/2         unassigned      YES NVRAM  down                  down

This isn’t ideal! How would we pull out a given value from this block of text? Regex? Ouch! Instead, we can parse this through Genie parse to get structured output like so:

{'interface': {'GigabitEthernet0/0': {'interface_is_ok': 'YES',
                                      'ip_address': '',
                                      'method': 'NVRAM',
                                      'protocol': 'up',
                                      'status': 'up'},
               'GigabitEthernet0/1': {'interface_is_ok': 'YES',
                                      'ip_address': '',
                                      'method': 'NVRAM',
                                      'protocol': 'up',
                                      'status': 'up'},

With our data structured, we can now use programmatic methods for working with the data, such as performing key-value lookups, like so:


Supported Parsers

Genie supports various NOS’s (Network Operating Systems), as shown below. Furthermore, numerous parsers (on average, 10 to 40) are added in each pyATS release cycle.

  • IOS
  • NXOS
  • ASA - Cisco Adaptive Security Appliance Software
  • LINUX - Linux operating system
  • JUNOS - Juniper Junos
  • SROS - Nokia SROS
  • VIPTELA - Viptela operating system
  • APIC - Cisco API
  • DNAC - Cisco DNAC Centre

A full list of commands which are supported can be found below:

The page is interactive so that you can enter in command, and the supported NOS will be presented:


Alternatively, you can filter by network operating system as shown below:


Ready to Master Network Automation? Start Your Journey Today!
Our membership provides:
  • Full deep-dive course library (inc. Batfish, pyATS, Netmiko)
  • Code repositories inc. full course code, scripts and examples
  • 24x7 multi-vendor labs (Arista, Cisco, Juniper)
  • Private online community
  • Live monthly tech sessions
  • Access to tech session library

Join Now ➜
Close You've successfully subscribed to Packet Coders.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.