Registry / testing / genie-libs-sdk

genie-libs-sdk

JSON →
library26.3pypypiunverified

Genie.libs.sdk is a sub-component of the Cisco pyATS and Genie framework, providing a rich library of pre-built 'Triggers' and 'Verifications'. These are reusable test cases and automation actions designed to facilitate rapid development, simplify test automation, and validate network device states. The library is actively maintained by Cisco Systems Inc., with frequent releases aligning with the broader pyATS/Genie ecosystem (typically monthly or bi-monthly major versions, currently at 26.3).

testingdevopsdata
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
✓ —
✓ 25.64s
py 3.11
4/8 runs
✓ 24.53s
py 3.12
4/8 runs
✓ 26.16s
py 3.13
4/8 runs
✓ 25.23s
py 3.9
✓ —
✓ 32.31s
685MB installed
● package 685MB
Code
Verified usage

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

from genie.libs.sdk.triggers.template.trigger_reload import TriggerReload

This quickstart demonstrates how to load a testbed and execute a pre-built 'Trigger' from `genie.libs.sdk` using the `gRun` function from `genie.harness.main`. It includes a minimal `testbed.yaml` example and uses `TriggerReload` as a representative trigger. For actual execution, ensure a reachable network device configured in the testbed and necessary environment variables for credentials.

import os from genie.testbed import load from genie.harness.main import gRun from genie.libs.sdk.triggers.template.trigger_reload import TriggerReload # Create a dummy testbed.yaml for demonstration purposes # In a real scenario, this would be a network device testbed file. # Ensure your environment variables are set for device credentials. # E.g., export PYATS_USERNAME=admin, export PYATS_PASSWORD=Cisco123 testbed_content = ''' devices: R1: os: iosxe type: router connections: cli: protocol: ssh ip: 127.0.0.1 port: 2222 # Use a mock SSH server or a reachable device credentials: default: username: ${PYATS_USERNAME} password: ${PYATS_PASSWORD} ''' with open('testbed.yaml', 'w') as f: f.write(testbed_content) # Set dummy environment variables if not already set os.environ.setdefault('PYATS_USERNAME', 'mockuser') os.environ.setdefault('PYATS_PASSWORD', 'mockpass') def main(): # Load the testbed from the YAML file testbed = load('testbed.yaml') # Define the trigger to run # In a real scenario, this would target a specific device and its OS # For this example, we assume R1 is the 'uut' (unit under test) by default for TriggerReload # A custom datafile might be needed for specific trigger parameters or device mappings # Execute the trigger using gRun. # The TriggerReload acts as a placeholder for demonstration. # For a true reload, 'R1' would need to be a real device and reachable. try: print("\n--- Running TriggerReload on R1 ---") gRun(testbed=testbed, trigger_uids=["TriggerReload"], trigger_datafile=""" extends: "%CALLABLE{genie.libs.sdk.genie_yamls.datafile(trigger)}" TriggerReload: devices: R1: command: 'reload' """ ) print("TriggerReload completed (or skipped if no real device was found).") except Exception as e: print(f"An error occurred during gRun: {e}") if __name__ == '__main__': main()
Debug
Known footguns
breakingPython 3.6 support has been deprecated and removed in recent pyATS/Genie versions (e.g., v22.4). Users on Python 3.6 will encounter errors and must upgrade to Python 3.7+.
gotchaWhen upgrading pyATS/Genie, users might encounter `ImportError` for specific patterns (e.g., `cannot import name 'Csr1000vPatterns'`). This often indicates a version mismatch between core pyATS/Genie and its plugins (like Unicon) or internal refactoring.
gotchaUsing `genie.libs.sdk` (and the broader Genie/pyATS framework) with multi-threaded applications like certain Nornir versions (e.g., Nornir 2.20 with >1 worker) has historically led to issues, particularly with the abstraction library loading layer.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
29 hits · last 30 days
gptbot
4
ahrefsbot
4
amazonbot
4
script
1
bingbot
1
bytedance
1
googlebot
1
chatgpt-user
1
Resources