Devnet
pyATS
3 Get Started

Get Started with pyATS

In this guide, you will discover how pyATS and its accompanying library, Genie, form an ecosystem aimed at streamlining and standardizing the setup and execution of automated network tests. We'll delve into the core components of pyATS, explore its features, and outline the steps for a swift installation to kickstart your work with the pyATS framework.

To embark on your journey with pyATS, let's delve into the fundamental concepts and features.

Testbeds in pyATS

A pivotal concept in pyATS is the Testbed. Testbeds act as representations of network devices within your infrastructure, providing a platform for executing tests. While testbeds are essentially Python key-value objects, pyATS simplifies their utilization by parsing testbed information from YAML files. This approach caters to network engineers with varying programming proficiencies, facilitating a quick start with pyATS. Testbeds, outlined in YAML files, describe devices and their interconnections, forming the network topology. They serve for both manual testing and automated test execution.

Exploring pyATS Features

Let's delve deeper into the core features of pyATS:

  • Connections Management: Facilitates the binding of connection instances to corresponding device instances.
  • Configuration Management: Utilizes the conf module to configure network devices without manual configuration building.
  • Parsers: Standardizes CLI output into Python dictionaries, enabling the creation and execution of reusable automation scripts.
  • Network Profiling: Analyzes current network operational status and tracks changes.
  • Network States Comparison: Compares snapshots to highlight differences between device configuration and operational states.
  • Automation Harness: AEtest (Automation Easy Testing) provides a simple yet robust framework for defining, executing, and debugging testcases and testscripts.

Runtime Environment

Easypy offers a standardized runtime environment for executing testscripts within pyATS. It facilitates the aggregation of testscripts into jobs, integrates various pyATS modules, and archives resulting information for post-mortem debugging.

Objects in a Testbed

While most users start with YAML-formatted testbed files in pyATS, it's important to note that under the surface, the pyATS testbed is a Python object. As proficiency grows, users may opt for more sophisticated means of building test bed files, including Python dictionaries. However, YAML remains the most accessible format. Testbeds consist of three primary blocks: testbed, devices, and topology.

Key pyATS Concepts and Features

Understanding essential pyATS concepts and features is crucial for harnessing its benefits and crafting effective test scripts. Here's an in-depth look at some key concepts and features:

  • Connections Manager: Manages communication with target devices, offering resource allocation and conflict management.
  • Configuration Manager: Automates device configuration following a common structure across platforms.
  • Parsers: Convert device output into Python dictionaries for standardized processing.
  • Network Profiling: Provides a representation of current device operational states across different platforms.
  • Network States Comparison: Compares snapshots to identify and analyze differences in device states.
  • AEtest: A robust automation harness for defining, executing, and debugging testcases and testscripts.

AEtest Testscript Structure

In pyATS, the AEtest Package facilitates the creation and execution of testscripts. The AEtest testscript structure is modular and straightforward, comprising three major container sections: CommonSetup, Testcases, and Common Cleanup.

Quick Installation of pyATS

Before diving into pyATS, ensure your environment meets the prerequisites outlined in the documentation (opens in a new tab). pyATS operates smoothly on most Linux-based systems, including Debian, Ubuntu, and RedHat, as well as MacOS 10.13 or higher. For Windows environments, consider installing the Windows Subsystem for Linux. Alternatively, utilize Docker containers.

Here's a concise guide for installing pyATS:

  1. Verify Python 3.7.x or higher is installed.

    $ python -V
    Python 3.10.1
  2. Build a virtual environment (e.g., using venv).

    $ python -m venv ~/pyats
  3. Activate the virtual environment.

    $ source ~/pyats/bin/activate
    (pyats) $
  4. Install the core pyATS library and Genie.

    $ pip install pyats genie
  5. Verify the installation.

    $ pyats version check
    You are currently running pyATS version: 22.7.1
    Python: 3.10.1 [64bit]
    
      Package                      Version
      ---------------------------- -------
      genie                        22.7
      pyats                        22.7.1

Ensure to review the official documentation for detailed installation instructions and updates.