Registry / testing / genie-libs-clean

genie-libs-clean

JSON →
library26.5pypypiunverified

Genie Libs Clean (version 26.3) is a component of the CiscoTestAutomation's Genie framework, providing functionalities for cleaning network devices. It automates tasks such as removing configurations, upgrading/downgrading OS, and reloading devices to prepare them for new test runs or restore them to a known state. It is actively maintained as part of the broader Genie/pyATS ecosystem, with a release cadence tied to the pyATS framework.

pip install genie-libs-clean
INSTALL
IMPORT
SIG · GENIE-LIBS-CLEAN
G
genie-libs-clean
testingpythonv26.5
Install
37.2s avg
Import
Disk
685MB
Pass rate
7/ 10
Env Coverage7 / 10
glibc
3.93.13
musl
3.93.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
✓ —
✓ 35.2s
py 3.11
✕ build_error
✓ 34.63s
py 3.12
✕ build_error
✓ 36.83s
py 3.13
✕ build_error
✓ 35.35s
py 3.9
✓ —
✓ 43.75s
685MB installed
● package 685MB
Code
Verified usage

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

Clean
from genie import Clean
from genie.libs.clean import Clean

This quickstart demonstrates how to instantiate and prepare a `Clean` object with a device and a basic clean YAML process. It shows the correct import and initialization. Note that `clean_obj.go()` is commented out to prevent actual device interaction in a basic runnable example; in a real environment, it would execute the defined clean stages on the device.

import os import yaml from pyats.topology import Device from genie.libs.clean.clean import Clean # --- This example uses a mock device for demonstration --- # In a real scenario, `device` would come from a pyATS testbed file # and `device.connect()` would establish a connection. device = Device(name="dut1", os="iosxe", connections={'cli': {'protocol': 'ssh'}}) print(f"Created mock device: {device.name}") # Define a simple clean YAML process. In a real test, this # would often be loaded from a file or generated dynamically. clean_yaml_process = """ clean: order: - stage: clear_logging - stage: reload """ # Instantiate the Clean object with the device and the clean definition try: clean_obj = Clean(device=device, clean_info=yaml.safe_load(clean_yaml_process)) print("Clean object instantiated successfully.") # Execute the clean process. # IMPORTANT: clean_obj.go() would execute actual commands on the device. # For this quickstart, we are simulating its call. # To run for real, ensure device is connected and testbed setup correctly. print("Simulating clean process execution (clean_obj.go() is commented out).") # clean_obj.go() print("Quickstart demonstration completed.") except Exception as e: print(f"An error occurred during quickstart: {e}") print("Ensure all dependencies (pyATS, genie) are installed and versions are compatible.")
Debug
Known issues
breakingVersion compatibility between `pyATS`, `genie`, and `genie-libs-clean` is critical. Mismatched major versions can lead to `ImportError`s, `AttributeError`s, or unexpected behavior.
fix
Always install `pyats` and `genie` packages from the same release train (e.g., `pip install pyats==<X> genie==<X> genie.libs.clean==<X>`). Refer to Cisco's official pyATS/Genie documentation for version compatibility matrices.
affects: All versions
gotchaThe `Clean` process relies heavily on specific device configurations, parsers, and operating system support within the pyATS testbed and Genie libraries. Misconfigured devices, unsupported OS versions, or missing custom parsers will lead to clean stage failures.
fix
Thoroughly review your pyATS testbed file, ensure the device OS is correctly specified, and verify that the required Genie parsers and device-specific functionalities are available for your device and OS version. Check detailed logs for underlying errors during clean execution.
affects: All versions
gotchaThe `clean_info` YAML structure is highly schema-driven. Incorrect indentation, misspelled stage names, or invalid arguments within the YAML definition will cause the `Clean` object to fail during initialization or execution.
fix
Always validate your clean YAML against the expected schema provided in the Genie documentation. Pay close attention to stage names (e.g., `install_os`, `apply_configuration`, `reload`) and their required arguments.
affects: All versions
Upgrade
Version history
26.5latest on PyPI · released May 28, 2026
Audit
Dependencies
pyatsrequiredCore automation framework on which Genie and its libraries are built.
genierequiredThe main Genie framework, required for core Genie functionalities.
Agent activity
14 hits · last 30 days
node
14
Resources
genie-libs-clean — pip install genie-libs-clean · libregistry