Your resource for web content, online publishing
and the distribution of digital products.
S M T W T F S
 
 
 
 
 
1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
 
 
 
 
 
 
 
 
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30
 

Network Test and Automation: PyATS 101 in 5 Minutes

DATE POSTED:November 18, 2024

\

Don't spend your time doing work a well-trained monkey could do | From automate the boring stuff with python book

\ Automation is not a replacement for our workforce; it presents an opportunity to embrace agility in a constantly evolving digital society.

\ Considering network engineers' numerous tedious tasks each week, automation becomes a crucial ingredient for success.

\ Beyond the hype and rankings, ==Python== has emerged as the de facto language for automation. Its elegant syntax and versatility have led to the creation of amazing tools.

What is Cisco PyATS

==pyATS==, which stands for Python Automated Test System, was developed by Cisco Systems to automate testing and validate networks. It is often called a "Swiss Army knife" due to its ability to perform a wide range of tasks beyond conventional expectations. In addition to automated testing, pyATS supports network configuration testing and updates,…

\

  • Language: Python, it is oriented for DevOps and NetDevOps

  • Typical usage: Network configuration tests, anomaly detection, connectivity validation…

  • Objective: Automating network tests and validation by providing a modular and extensible environment.

    Main modules
  • PyATS: the main framework for automated tests.

  • Genie: Collection of automation libraries for configuring, analyzing, and verifying network data.

\

:::info PyATS is a big ecosystem of innovations where we can do amazing and it goes beyond Cisco environments!

:::

How to install pyATS quickly on Windows Subsystem for Linux ( Ubuntu 24.04 LTS)

The best way to install pyATS is to create a Python virtual environment and this is the quickest way to do it by observing the capture below

Creating the python virtual env for pyATS

installing pyATS

Installing pyATS in the python virtual environment

\ To install ==Genie== the process is the same!

Checking the installation

Checking pyats if it is installed

\ The pyats framework is installed

\ \ The genie library is installed

\ PyATS and Genie are installed with their packages.

Verifying PyATS versions

\

pyats version check

\ verifying pyATS version

\ After running the command we see the version,pyATS is properly installed and we can achieve amazing things we want.

Key concepts to know about pyATS

What makes pyATS unique is its abstraction, and to understand it better, you need to engage with these abstractions!

\

  • Testbed: This is the representation of network environments. A YAML file describes devices, their roles, and IP addresses, and here is how it looks when the file is written.

    \

# Step 0: list of devices devices: iosxr1: # Step 1: OS and Type type: iosxr-Prod os: iosxr # Step 2: credentials credentials: default: username: admin password: Hacker@204k # Step 3: connection parameters connections: vty: protocol: ssh ip: test-mgmt.talesoftechnology.com port: 8080

\

  • Test scripts: python scripts that contain all instructions for every test.
  • Parsers: with an impressive library and over 1500 parsers, Genie expertly converts raw text into structured text.
  • Triggers: they enable specific automated actions, in response to events, in other words, they are similar to webhooks.
Main features and use cases
  • States comparison: network comparison state before and after a change or update.
  • Report and journaling: it generates test reports and detailed logs for every
  • Multi-environment execution: it is compatible with physical and virtual environments.
Practical use cases
  • State validation: Compare the configuration status of a device before and after a change to ensure there is no configuration drift.
  • Anomaly detection: Automate the identification of anomalies in device configurations or states.
  • Connectivity Test: Use ping or traceroute commands to check connectivity between devices

\

Conclusion

Now you know how to install pyATS using the Windows Subsystem for Linux, and you don’t need a lengthy guide! You understand the basic concepts; even though pyATS can seem abstract, the best way to grasp it is through interaction with various abstractions.

\ Automation is essential for agility today, you don’t have to reinvent the wheel with tedious tasks.

\ With pyATS, you can save time and reduce stress compared to handling everything manually.

\ In the next article, you will learn how to create a testbed, and we will demystify pyATS, it’s not as hard as you think!