Yenie Parser
Yenie Parser is a Python package for parsing Cisco CLI command output into structured dictionaries without importing the full Cisco Genie/pyATS stack.
The parser set covers command templates adapted from Cisco Genie parser files. Results use Genie-compatible dictionary shapes where the upstream parser defines them.
Install
This package is intended to work with normal Python packaging tools once published:
pip install yenie-parser
Usage
Python API
import yenie_parser
parsed = yenie_parser.parse(
platform="iosxe",
command="show device-tracking database",
raw_output=raw_cli_output,
)
Currently, parser supports these platforms:
iosxe
The parser accepts only raw command output. It does not connect to devices or execute commands.
By default, parse(...) returns None when parsing fails. That includes
unsupported platforms, unsupported commands, ambiguous command matches, parser
execution failures, and raw output that matches a command but produces no
structured data.
Failure behavior can be adjusted for strict validation, warnings, or legacy fallback values:
parsed = yenie_parser.parse(
platform="iosxe",
command="show device-tracking database",
raw_output=raw_cli_output,
strict=False,
warn=False,
on_failure="none",
)
Supported on_failure values are:
"none": returnNoneon failure. This is the default."empty_dict": return{}on failure for legacy callers."raw_output": return the originalraw_outputstring on failure.
When strict=True, parse failures raise Yenie Parser exceptions instead of
returning the configured on_failure value. When warn=True, parse failures
emit a standard-library warning using YenieParserWarning.
Command matching strips extra whitespace and is case-insensitive. It does not
rewrite Cisco command tokens, so device-tracking and device tracking are
different commands.
Available command templates can be inspected with:
commands = yenie_parser.supported_commands("iosxe")
Parser registry and command-match metadata are cached after first use. To move that first-use work out of a timed collection path, preload parser metadata before parsing:
yenie_parser.preload(
platform="iosxe",
commands=[
"show interfaces status",
"show cdp neighbors detail",
"show mac address-table",
],
)
Calling yenie_parser.preload() without commands (or platform) warms all supported IOS-XE
command templates. If you are developing parser modules in a long-lived Python
process, clear those caches with:
yenie_parser.clear_caches()
CLI
The installed package provides a yenie-parser terminal command:
yenie-parser parse \
--platform iosxe \
--command "show device-tracking database" \
--raw-output "Binding Table has 1 entries, 0 dynamic (limit 200000)"
Multiline command output can also be read from a file or stdin:
yenie-parser parse -p iosxe -c "show device-tracking database" --raw-file output.txt
cat output.txt | yenie-parser parse -p iosxe -c "show device-tracking database"
Parser failure behavior mirrors the Python API:
yenie-parser parse \
-p iosxe \
-c "show device-tracking database" \
--raw-file output.txt \
--strict \
--warn \
--on-failure none
Supported parser templates can be listed or searched:
yenie-parser list
yenie-parser list "authentication s"
yenie-parser list --search "authentication s"
yenie-parser list --command "show authentication sessions"
Package metadata is available with:
yenie-parser --version
Attribution
Parser behavior is derived from the Apache-2.0 licensed Cisco Genie parser project:
- Repository: https://github.com/CiscoTestAutomation/genieparser
- Source paths:
src/genie/libs/parser/iosxe/show_device_tracking.pysrc/genie/libs/parser/iosxe/show_authentication_sessions.pysrc/genie/libs/parser/iosxe/show_inventory.pysrc/genie/libs/parser/iosxe/show_cdp.pysrc/genie/libs/parser/iosxe/show_arp.pysrc/genie/libs/parser/iosxe/show_fdb.pysrc/genie/libs/parser/iosxe/show_interface.pysrc/genie/libs/parser/iosxe/show_run.pysrc/genie/libs/parser/iosxe/show_routing.pysrc/genie/libs/parser/iosxe/show_aaa.pysrc/genie/libs/parser/iosxe/show_cts.pysrc/genie/libs/parser/iosxe/show_platform.py
See docs/conversions/ for conversion metadata.
Release files for yenie-parser 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yenie_parser-0.5.3.tar.gz | 275.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yenie_parser-0.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 560.6 kB
Release files / yenie_parser-0.5.3.tar.gz
| Download URL | yenie_parser-0.5.3.tar.gz |
|---|---|
| Size | 275.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9c7e87cbef8098cb052231e33bb9374797802932981586490247d94ca94e0be
|
|
BLAKE2b-256 checksum How to use checksums |
0584c97360f5245ff9586270d597c4d820eb29231811a10bf20d0faed07c5e3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / yenie_parser-0.5.3-py3-none-any.whl
| Download URL | yenie_parser-0.5.3-py3-none-any.whl |
|---|---|
| Size | 284.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71f7724ea7759bf6267f5541548435cfe4f8a80a4a1f79040d064460e0aa9382
|
|
BLAKE2b-256 checksum How to use checksums |
36ac77b19663ff456766bda39d07ced6b143c20cc98e695a72f5bba40b699791
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|