Cisco pyATS Test Framework

repository·main·Indexed 41 days ago

https://github.com/ciscotestautomation/pyats

A Python-based test framework for network automation. It includes AEReport for generating TRADe-compatible XML test reports via a server-client model and aetest for structured test script execution with a hierarchical object model and managed runtime environments.

Tokens
194.9K
Snippets
550
Records
807
Agent score
52%

What's inside pyATS

  1. What is pyATS?

    main

    pyATS (Python Automated Test Systems) is a Python 3-based test automation infrastructure designed for next-generation Cisco mainstream automation. It is engineered to be independent of other infrastructures and is suitable for various testing scenarios, including:

    • White-box unit-testing
    • Black-box testing
    • Feature testing
    • Performance and scale testing

    It is designed for Agile, rapid development iterations and is built to be highly compatible with existing tooling and infrastructure while following a Pythonic, object-oriented paradigm.

  2. Overview of the pyats validate command

    main

    The pyats validate command is a helper utility providing subcommands to validate various pyATS input files, formats, and content. It is primarily used to ensure that YAML files (testbeds, datafiles, and configs) are syntactically correct and logically complete before they are consumed by the automation framework.

    Available Subcommands:

    • datafile: Validates YAML-based datafile syntax and expansion.
    • jinja2_config: Validates Genie config file Jinja2 rendering.
    • testbed: Validates testbed YAML syntax and schema adherence.
  3. Overview of the pyats.aetest package

    main
    The pyats.aetest package is the core framework for defining and executing automated test suites in pyATS. It provides the fundamental building blocks for creating test scripts, including test cases, sections, steps, and execution logic. The package is organized into several specialized subpackages and submodules to handle different aspects of the test lifecycle.
  4. Overview of pyATS Command Line Tools

    main

    pyATS provides a suite of built-in command-line utilities for managing the lifecycle of test automation, including environment creation, development, execution, and validation.

    Available CLI tools include:

    • pyats: The primary entry point for pyATS operations.
    • pyats_create: Used for creating pyATS environments or projects.
    • pyats_develop: Tools for developing pyATS extensions or scripts.
    • pyats_logs: Utilities for managing and inspecting logs.
    • pyats_migrate: Used for migrating configurations or environments.
    • pyats_run: The command used to execute test runs.
    • pyats_secret: Manages secrets and sensitive configuration data.
    • pyats_shell: Provides a shell interface within the pyATS context.
    • pyats_undevelop: Reverts or cleans up development environments.
    • pyats_validate: Used for validating test results or configurations.
    • pyats_version: Displays the installed version of pyATS and its components.
  5. Overview of the pyats.datastructures package

    main
    The pyats.datastructures package provides a collection of specialized data structures designed for network automation and testing tasks. It includes enhanced dictionary types, tree structures, and utility classes to handle complex configuration data and hierarchical information more efficiently than standard Python collections.
  6. Overview of asynchronous execution in pyATS

    main

    pyATS provides tools and concepts to support asynchronous execution, allowing programs and functions to run in parallel and independently of the main program flow. The goal is to improve performance by leveraging available CPUs and I/O limits without requiring the user to manage the underlying logistics and overhead.

    Rather than reinventing Python's built-in threading or multiprocessing libraries, the pyATS async module builds upon them to automate common boilerplate tasks required in test automation, such as:

    • Log file management: Handling logs generated by parallel processes.
    • Connection resilience: Re-establishing lost connections or sessions.
    • Resource management: Handling resource sharing and locking (e.g., managing shared Telnet/SSH connections).
    • Inter-process communication: Facilitating two-way communication and state synchronization between processes.