Registry / testing / pyats-topology

pyats-topology

JSON →
library26.5pypypiunverified

pyATS Topology is a core component of the Cisco pyATS framework, providing robust objects and parsing capabilities for network testbed YAML definitions. It allows users to define network devices, links, and connections, enabling automated interaction with the network infrastructure for testing and operational tasks. The library is actively maintained and typically updated in sync with major pyATS framework releases, which occur quarterly or as needed.

pip install pyats-topology
INSTALL
IMPORT
SIG · PYATS-TOPOLOGY
P
pyats-topology
testingpythonv26.5
Install
8.6s avg
Import
—
Disk
126MB
Pass rate
7/ 10
Env Coverage7 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v26.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 9.5s
py 3.11
✕ build_error
✓ 8.15s
py 3.12
✕ build_error
✓ 6.6s
py 3.13
✕ build_error
✓ 7.03s
py 3.9
✓ —
✓ 11.63s
126MB installed
● package 126MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Testbed
✓ from pyats.topology import Testbed
✗ from pyats.topology import Testbed

Demonstrates loading a testbed YAML file and accessing a defined device and its connection details. This is the fundamental way to interact with network topology in pyATS.

from pyats.topology import loader import os # Create a dummy testbed YAML file for demonstration testbed_yaml_content = """ name: MyTestbed devices: router1: type: iosxe os: iosxe connections: cli: protocol: ssh ip: 10.0.0.1 port: 22 rest: protocol: rest port: 443 """ testbed_file_path = 'my_testbed.yaml' with open(testbed_file_path, 'w') as f: f.write(testbed_yaml_content) # Load the testbed testbed = loader.load(testbed_file_path) # Access devices and connections device = testbed.devices['router1'] print(f"Testbed Name: {testbed.name}") print(f"Device Name: {device.name}, Type: {device.type}, OS: {device.os}") print(f"CLI Connection IP: {device.connections['cli'].ip}") # Clean up the dummy file os.remove(testbed_file_path)
Debug
Known issues
breakingMajor pyATS framework upgrades (e.g., v20.x to v21.x) often introduce changes to the testbed YAML schema or object access patterns. For example, direct attribute access like `device.connections.cli` might require using dictionary-style access `device.connections['cli']` or vice-versa depending on the version.
fix
Always review the official pyATS release notes and migration guides for your specific version upgrade. Update your testbed YAML files and Python scripts accordingly.
affects: All major pyATS releases, typically quarterly.
deprecatedOlder versions of pyATS Topology might have used methods like `testbed.find_device('name')` or `testbed.get_device_by_name('name')`. These methods are typically superseded by direct dictionary access `testbed.devices['name']` for consistency and performance.
fix
Update your code to use `testbed.devices['device_name']` for accessing devices within a loaded testbed object.
affects: Prior to pyATS v20.x, potentially earlier v21.x releases.
gotchaThe `connections` attribute of a `Device` object is a dictionary or an object that behaves like one. Accessing a non-existent connection (e.g., `device.connections['nonexistent_protocol']`) will raise a `KeyError`, which can be common during initial testbed development or debugging.
fix
Always check for the existence of a connection protocol before attempting to access it, e.g., `if 'cli' in device.connections: ...` or use `.get('cli')` with a default value.
affects: All versions
Upgrade
Version history
26.5latest on PyPI · released May 28, 2026
Audit
Dependencies
pyatsrequiredCore pyATS framework functionality and context is required for full operation.
pyyamlrequiredRequired for parsing testbed YAML files.
Agent activity
16 hits · last 30 days
node
16
Resources
pyats-topology — pip install pyats-topology · libregistry