Genie Parser

repository·main·Indexed 42 days ago

https://github.com/ciscotestautomation/genieparser

A sub-component of the Genie library within the pyATS framework designed to parse network device command outputs into structured, object-oriented data. It provides extensive parsing support for Cisco IOS, IOSXE, IOSXR, and NXOS, covering protocols and features such as BGP, EIGRP, ISIS, MPLS, LISP, and CDP.

Tokens
44.2K
Snippets
30
Records
181
Agent score
54%

What's inside Genie Parser

  1. Breaking Change: ISIS Database Parser Schema Update

    main

    In the January 2023 update, the ShowIsisDatabase parser underwent a non-backwards compatible change to support multiple interfaces under a single device.

    Change Details:

    • The schema was modified to store interfaces in a list instead of a dictionary (is_dict changed to is_list).
    • This affects ShowIsisDatabaseVerbose, ShowIsisDatabaseDetail, and all related ShowIsisDatabase tests.

    Action Required: If you rely on the ShowIsisDatabase parser output, you must update your code to iterate over a list of interfaces rather than accessing them via a dictionary key.

  2. IOS-XE Parser Migrations and Updates

    main

    Some IOS-XE parsers were moved to specific sub-platform directories (e.g., iosxe/cat9k) or updated to handle new software releases:

    Moved to iosxe/cat9k

    • show fabric ap summary
    • show access tunnel summary
    • show processes platform | c wncd
    • show processes platform | i wncd
    • show plat soft proc slot sw standby r0 monitor | c wncd
    • show plat soft proc slot sw standby r0 monitor | i wncd

    Updated Parsers

    • show ap summary: Updated to handle 0 APs and output changes in IOS-XE 17.10.
    • show bootvar / show boot: Modified in show_platform.py and show_issu.py.
    • Stacking Support: The <state> argument in certain parsers was updated to validate both standalone and stack device commands (active or standby).
  3. Format a changelog for Genie Parser contributions

    main

    When contributing to Genie Parser, you must provide exactly one changelog file per pull request. Use the following structured templates to categorize changes under New (for additions or modifications) and Fix (for bug fixes or schema updates).

    Organize entries by Operating System (e.g., NXOS, IOSXE, IOS) and then by the specific Parser Class affected.

    --------------------------------------------------------------------------------
                                New
    --------------------------------------------------------------------------------
    * <OS>
        * <Added|Modified> <Class>:
            * <New Show Command|Command>
    
    --------------------------------------------------------------------------------
                                Fix
    --------------------------------------------------------------------------------
    * <OS>
        * <Added|Modified|Removed> <Class>:
            * Changes made
  4. IOSXE Parser Fixes and Improvements

    main

    Recent updates to IOSXE parsers include:

    • BGP IPv6 Support: ShowBgpAllDetail now supports IPv6 next-hop lines with link-local addresses (RFC5549), preventing crashes.
    • LISP DN-string Support: ShowLispSiteSuperParser, ShowLispSiteDetailSuperParser, ShowLispSubscriptionSuperParser, ShowLispSubscriptionPrefixSuperParser, ShowLispServerSubscriptionSuperParser, and ShowLispServerSubscriptionPrefixSuperParser have been updated to accept distinguished-name (DN) style EID prefixes (e.g., firewall, dual-stack).
    • Schema Flexibility:
      • ShowSdmPrefer: vrf_count is now optional.
      • ShowMacAddressTableCount / ShowMacAddressTableCountVlan: total_mac_address_space is now optional.
      • ShowOspfv3RibRedistribution: Added optional source_vrf key and regex support.
      • ShowModule: Relaxed schema to handle blank/empty module slots in stacked configurations.
    • Command Specific Fixes:
      • ShowPortSecurityAddress: Now handles multiple MACs per interface and allows spaces/parentheses in remaining_age.
      • SnmpGetBulk: Updated status handling to ensure success only after matching SNMP response, MIB, or hex value output.
      • ShowIpv6Interface: Optimized regex compilation and nested output creation.
      • ShowIpv6InterfaceBrief: Added parsing for unnumbered interface references.
      • ShowDeviceTrackingDatabaseMacDetails: Improved handling for MACs with no bound IP.
      • ShowInventory (rv1): Fixed PID-keyed clobber for multi-chassis SVL pairs.
  5. Modified IOS-XE Parsers (July 2025)

    main

    Updates to existing IOS-XE parsers:

    • show inventory: Updated regex patterns to support new output formats.
    • show platform resources: Updated schema to support new output formats.
    • show platform hardware fed active fwd-asic resource tcam utilization: Now supports the extended command show platform hardware fed active fwd-asic resource tcam utilization {asic} slice-id {slice_id}.
    • show platform hardware fed switch active fwd-asic insight vrf-ports: Split into two separate classes to handle different command formats.
  6. Running CI folder parsing tests

    main

    The Ci_Folder_Parsing.Py test utility has been updated with the following capabilities:

    • Use the -F flag to display only failed tests.
    • Run a job using: pyats run job Folder_Parsing_Job.py.
    • Use the -V flag to include the Show commands output in the test results.
    pyats run job Folder_Parsing_Job.py
    # To show only failed tests:
    pyats run job Folder_Parsing_Job.py -F
    # To include command output:
    pyats run job Folder_Parsing_Job.py -V
  7. Install the Genie Parser package

    main

    You can install the full Genie library or specifically target the Parser sub-component using pip.

    To install the complete Genie framework:

    pip install genie

    To install or upgrade only the Parser package:

    pip install --upgrade genie.libs.parser

    To install alpha or beta versions of the parser, use the --pre flag:

    pip install --pre genie.libs.parser
  8. New IOS-XR Parsers

    main

    The following updates were made for IOS-XR:

    • ShowRplRoutePolicy: Fixed as-path in block in p19.match to correctly capture data.
    • MonitorInterface: Added missing empty_output_arguments.json files.
    • ShowBundle: wait_while_timer_ms in schema now supports both integer and string values.
    • ShowL2vpnXconnect: Updated regex patterns p3 and p6 for various outputs.