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
685MB installed
● package 685MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TriggerReload
✓ from genie.libs.sdk.triggers.template.trigger_reload import TriggerReload
✗ 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 issues
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+.fixUpgrade your Python environment to version 3.7 or newer.
affects: <= 22.3 (support ends), >= 22.4 (unsupported)
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.fixPerform a clean reinstallation or upgrade all `pyats` and `genie` related packages simultaneously: `pip install --upgrade pyats genie genie.libs.sdk genie.libs.parser genie.libs.ops unicon` (and other specific plugins you use). Consider using a virtual environment.
affects: All versions during upgrades
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.fixEnsure you are on the latest versions of `genie.libs.sdk` and `pyATS`, as these issues have reportedly been fixed. If problems persist, consider reducing worker count or investigating process-based parallelism if supported by the integrating library.
affects: Older versions when used with multi-threaded runners
Upgrade
Version history
26.5latest on PyPI · released May 28, 2026
Audit
Dependencies
genierequiredGenie.libs.sdk is a sub-component of the Genie framework and requires the core 'genie' package for full functionality and the pyATS test harness.
pyatsrequiredGenie is built on top of the pyATS framework, which provides the core test automation infrastructure (testbed management, connections, logging).
uniconoptionalUsed by pyATS and Genie for device connectivity, interaction, and state machine handling.
ruamel.yamloptionalRequired for parsing YAML testbed and data files.