Registry / testing / pyats-connections

pyats-connections

JSON →
library26.5pypypiunverified

pyATS Connections is a sub-component of the pyATS end-to-end testing ecosystem, specializing in handling device connections to various network devices. It provides top-level abstractions and interfaces for creating connection classes, supporting CLI, REST, and NETCONF protocols. This library is crucial for enabling scripts to interact with network devices within the pyATS framework. The current version is 26.3, and it is actively maintained by Cisco Systems Inc. with frequent releases.

pip install pyats.connections
INSTALL
IMPORT
SIG · PYATS-CONNECTIONS
P
pyats-connections
testingpythonv26.5
Install
24.0s avg
Import
2267ms
Disk
240MB
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
✓ 0.05s
✓ 32.53s
py 3.11
✕ build_error
✓ 31.21s
py 3.12
✕ build_error
✓ 33.1s
py 3.13
✕ build_error
✓ 31.98s
py 3.9
✓ 0.05s
✓ 39.19s
240MB installed
● package 240MB
Code
Verified usage

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

loader
✓ from pyats.connections import loader
✗ from pyats.connections import loader

This quickstart demonstrates how to load a testbed definition from a YAML file, retrieve a device object, and attempt to establish a connection using `device.connect()`. It uses environment variables for credentials as a best practice. Note that the connection to a dummy IP (127.0.0.1) will fail in a real-world scenario without a reachable network device or mock device setup, but the code illustrates the API usage.

import os from pyats.topology import loader # Create a dummy testbed.yaml file for demonstration with open('testbed.yaml', 'w') as f: f.write(""" devices: CSR1: type: router os: iosxe credentials: default: username: '%ENV{PYATS_USER}' password: '%ENV{PYATS_PASSWORD}' connections: cli: protocol: ssh ip: 127.0.0.1 # Use a dummy IP for local execution port: 22 """) # Set dummy environment variables for quickstart (replace with actual or secure method) os.environ['PYATS_USER'] = os.environ.get('PYATS_USER', 'devnetuser') os.environ['PYATS_PASSWORD'] = os.environ.get('PYATS_PASSWORD', 'Cisco123!') try: # Load the testbed from the YAML file testbed = loader.load('testbed.yaml') # Get a specific device from the testbed device = testbed.devices['CSR1'] # Connect to the device (connection will fail with dummy IP, but demonstrates API) print(f"Attempting to connect to {device.name} at {device.connections['cli'].ip}...") device.connect(init_exec_params={'timeout': 5}) print(f"Successfully connected to {device.name}.") # Execute a command (will only reach here if connect succeeds) output = device.execute('show version') print("Show Version output:\n", output) except Exception as e: print(f"An error occurred: {e}") print("Note: Connection to 127.0.0.1 will likely fail unless a mock device is running or IP is changed.") finally: # Clean up the dummy testbed file os.remove('testbed.yaml')
Debug
Known issues
breakingpyATS and its components, including pyats-connections, will cease support for Python 3.9 starting November 2025.
fix
Upgrade your Python environment to 3.10 or newer (e.g., Python 3.12 or 3.13 are supported by version 26.3).
affects: <=25.7
gotchaIncorrect YAML syntax in testbed files (e.g., mixing tabs and spaces, wrong indentation) is a very common cause of failures.
fix
Always use spaces for indentation in YAML. Validate your testbed.yaml file thoroughly. Many issues stem from small formatting errors.
affects: All
gotchapyATS does not officially support Windows platforms.
fix
Run pyATS on Linux or macOS systems, or use Windows Subsystem for Linux (WSL).
affects: All
gotchaHardcoding sensitive credentials (usernames, passwords) directly in testbed YAML files or scripts is a security risk.
fix
Utilize environment variables (e.g., `%ENV{VAR_NAME}`) or dedicated secret management systems within your testbed files.
affects: All
Upgrade
Version history
26.5latest on PyPI · released May 28, 2026
Audit
Dependencies
pyatsrequiredpyats.connections is a core sub-component of the pyATS framework.
uniconrequiredThis package automatically installs Unicon, which provides unified CLI connection capabilities for pyATS.
PythonrequiredRequires Python version 3.8 or higher.
Agent activity
16 hits · last 30 days
node
16
Resources
pyats-connections — pip install pyats-connections · libregistry