Registry / devops / genie-libs-parser

genie-libs-parser

JSON →
library26.5pypypi✓ verified 85d ago

Genie Libs Parser, currently at version 26.3, is a sub-component of the pyATS and Genie framework designed to parse raw device output (CLI, XML, YANG) into structured Python data structures. It provides a vast collection of parsers for various network operating systems and commands. The project follows a regular release cadence, often aligned with pyATS and Genie releases, with frequent additions of new parsers and APIs. [2, 8]

pip install pyats[full]
INSTALL
IMPORT
SIG · GENIE-LIBS-PARSER
G
genie-libs-parser
devopspythonv26.5
Install
34.5s avg
Import
2292ms
Disk
785MB
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
✓ 0.05s
✓ 46.1s
py 3.11
✕ build_error
✓ 44.9s
py 3.12
✕ build_error
✓ 48.09s
py 3.13
✕ build_error
✓ 46.35s
py 3.9
✓ 0.05s
✓ 56.16s
785MB installed
● package 785MB
Code
Verified usage

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

loader
from pyats.topology import loader
from pyats.topology import loader
parse
from pyats.utils import parse
from pyats.topology import loader

This quickstart demonstrates how to use `genie-libs-parser` to parse device CLI output into a structured dictionary. It shows both the recommended `device.parse()` method (simulating output for offline use) and direct instantiation of a parser class. A dummy `Device` object is created to provide the necessary context for the parsers. In a live environment, the `device` object would be loaded from a pyATS testbed and connected to a physical or virtual device. [8 in previous search, 1]

import os from pyats.topology import Device from genie.libs.parser.iosxe.show_version import ShowVersion # Simulate a device object for demonstration (in a real scenario, use pyats.topology.loader) device = Device(name='my_router', os='iosxe') # This is a hack to allow parsing without an active connection, typically used for offline parsing device.custom.setdefault('abstraction', {})['order'] = ['os', 'platform'] # Simulate CLI output cli_output = ''' Cisco IOS XE Software, Version 17.03.04a Cisco IOS Software [Dublin], ISR Software (X86_64_LINUX_IOSD_UNIVERSALK9-VIRT_STD_ML), Version 17.3.4a, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2021 by Cisco Systems, Inc. Compiled Wed 21-Apr-21 02:40 by mcpre ROM: System Bootstrap, Version 17.3.1R my_router uptime is 1 week, 2 days, 3 hours, 4 minutes System returned to ROM by reload System image file is "bootflash:isr4400-universalk9.17.03.04a.SPA.bin" Last reload reason: PowerSupplyFailure ''' # --- Option 1: Using device.parse() (recommended) --- # In a real scenario, device.parse() would execute the command on the device. # For offline parsing, you can pass the 'output' argument. parsed_data_via_device = device.parse('show version', output=cli_output) print("Parsed data via device.parse():\n", parsed_data_via_device) # --- Option 2: Directly instantiating a parser class (less common for general use) --- parser = ShowVersion(device=device) # The device object provides context (OS, etc.) parsed_data_via_class = parser.parse(output=cli_output) print("\nParsed data via direct class instantiation:\n", parsed_data_via_class)
Debug
Known issues
gotchaParser schemas and regex patterns are highly dependent on the exact CLI output of a device. Minor changes in device OS versions or command output formatting can cause parsers to fail silently or return incomplete data.
fix
Always validate parsed output against expected schema, especially after device OS upgrades. Consider using Genie's 'learn' feature for baseline validation and 'diff' for change detection. If an existing parser fails, it may require a fix or a custom parser to be developed. [9 in previous search]
affects: All versions
breakingDirect arguments like 'username', 'enable_password' for Unicon (a core pyATS connection library) have been deprecated and replaced by a 'credentials' dictionary.
fix
Update connection configurations to use the `credentials` dictionary within your testbed YAML or device object, e.g., `device.credentials.default.username = 'admin'`. [5 in previous search]
affects: Older pyATS/Genie versions leading up to and including some 24.x versions. (Specifically noted in a GitHub issue dated April 2020 related to Unicon plugins).
gotchaWhen running pyATS/Genie with Nornir using multiple workers, issues have been reported where Genie processing can fail.
fix
If encountering parsing issues with Nornir multi-worker setups, consider collecting output with Nornir and then processing it with Genie in a single-threaded manner, or limit Nornir's worker count to 1 for parser-intensive tasks. [18 in previous search]
affects: Reported with Nornir 2.20 and older pyATS/Genie versions.
gotchaSome parser modules might contain syntax errors, particularly in older or custom parsers, leading to `SyntaxError` exceptions during execution.
fix
Check the traceback for the specific parser file and line number. If it's a built-in parser, ensure your `genie-libs-parser` package is up to date. If it's a custom parser, review the Python syntax. [15 in previous search]
affects: Specific versions where a parser file might have been introduced with a bug.
Upgrade
Version history
26.5latest on PyPI · released May 28, 2026
Audit
Dependencies
pyatsrequiredgenie-libs-parser is a core component of the pyATS framework.
genierequiredProvides the overall library system and device abstraction for parser interaction.
genie.metaparserrequiredThe underlying engine for creating and managing parsers.
Agent activity
17 hits · last 30 days
node
13
Amazon
1
Resources