In this lesson, we will cover:

  • What is pyATS?
  • What are some of the key features that it can provide?
  • What are the various layers of pyATS?

What is pyATS?

Cisco pyATS is a Python framework and set of libraries for performing network testing. Originally developed internally within Cisco for testing, back in 2013, it gained popularity, resulting in Cisco later making it publicly available.

Some of the key features that pyATS provides are:

  • Multi-vendor parsing of unstructured data into structured data.
  • Profiling and differential comparisons of the network state.
  • Helper libraries that assist with working multiple devices and structured data sets.
  • Testing frameworks to structure and provide reporting for your tests.

The pyATS framework consists of various layers. The layers are:

pyATS

The core pyATS framework deals with the lower level mechanics, such as device connection setup and handling the execution of commands on the devices. pyATS core also defines one of the most fundamental components within the framework, the testbed.

A testbed, typically represented in YAML, describes the topology that will be tested. For example, it contains the hostnames, the IPs, and the credentials we will use to connect to the devices.

The testbed comprises of various objects; each object is a Python object that we can interact with. The objects that make up the testbed/test topology include Devices, Interfaces, and Links. As you would expect, the testbed/topology can consist of multiple devices, with each device having multiple interfaces, etc.

The objects within the testbed also provide various methods that allow us to perform a range of actions and operations against it, such as:

device.connect()
device.ping("1.1.1.1")
device.execute("show version")

pyATS also provides different frameworks and libraries for creating test cases, allowing you to build out your tests in a structured and standardised way. Utilising pyATS core for this will also enable you to remove some heavy lifting, such as logging, reporting, and run-time execution, typically required when building out a suite of tests.

Genie

Genie sits on top of the pyATS core layer, utilising and abstracting the underlying libraries and frameworks that pyATS core presents. Genie provides an extensive library of multi-vendor parsers (known as Genie Parsers) for converting raw text into structured text. Genie also provides the following, which reside under Genie Models:

  • Conf - A platform-agnostic set of Python modules and attributes used to configure devices.
  • Ops - This allows you to learn a given feature/protocol by combining multiple parsers. These parsed results are then aggregated into a single structured result.

Integrations

Sitting above the Genie layer, we have Integrations. This layer provides various libraries and plugins that further abstract the underlying pyATS/Genie layers, allowing us to take full advantage of pyATS at a higher level.

For example, we can easily define keyword values for test cases without writing any Python or understanding the lower-level semantics using the Robot Framework integration.

pyats-components

Note: It is worth mentioning that the majority of the pyATS (and Genie) is open source. However, some parts of the pyATS core are still internal to Cisco.

Master Network Automation
Join today and get access to:
  • 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
  • Monthly online meetups
  • Monthly guest speakers

100% Satisfaction Guaranteed!
Cancel your membership at any time.


Join Today