-
Notifications
You must be signed in to change notification settings - Fork 420
Closed
Description
Description
The parser for show ip mroute summary fails when bitrate values are displayed in units other than "bps" (e.g., mbps, kbps, gbps).
Problem
Pattern p8 in ShowIpMrouteSummary class hardcodes "bps" in the regex and in the dictionary update, causing schema validation failures when NX-OS displays high-traffic multicast routes with "mbps" or other units.
Environment
- Device: Nexus 9000 switches (VXLAN fabric and non-VXLAN)
- pyATS version: 25.9
- genie.libs.parser version: 25.9
- Parser file:
genieparser/src/genie/libs/parser/nxos/show_mcast.py - Parser class:
ShowIpMrouteSummary
Error Message
Traceback (most recent call last):
File "src/genie/cli/commands/parser.py", line 339, in genie.cli.commands.parser.ParserCommand.parse
File "src/genie/conf/base/device.py", line 536, in genie.conf.base.device.Device.parse
File "src/genie/conf/base/device.py", line 576, in genie.conf.base.device.Device._get_parser_output
File "src/genie/conf/base/device.py", line 574, in genie.conf.base.device.Device._get_parser_output
File "src/genie/metaparser/_metaparser.py", line 342, in genie.metaparser._metaparser.MetaParser.parse
File "src/genie/metaparser/_metaparser.py", line 322, in genie.metaparser._metaparser.MetaParser.parse
File "src/genie/metaparser/util/schemaengine.py", line 419, in genie.metaparser.util.schemaengine.Schema.validate
genie.metaparser.util.exceptions.SchemaMissingKeyError: Missing keys: [['vrf', 'vrf_prod_1', 'address_family', 'ipv4', 'groups', '239.1.1.32/32', 'source'], ['vrf', 'vrf_prod_1', 'address_family', 'ipv4', 'groups', '239.1.1.33/32', 'source'], ... (47 groups total)]
Reproduction Steps
- Run
show ip mroute summary vrf <vrf_name>on a VRF with high bitrate multicast traffic - Output shows bitrate as "26.173 mbps" instead of "27.200 bps"
- Pattern
p8fails to match the source line because it expects literal "bps" - No
sourcedictionary is created for the group - Parser fails with
SchemaMissingKeyError
Root Cause Analysis
The parser works correctly on:
- VRFs with low traffic (displays as "bps")
- VRFs with no active sources (displays as "0.000 bps")
Pattern p8 (line ~85):
p8 = re.compile(r'^\s*(?P\S+) +(?P[0-9]+) +(?P[0-9]+) +(?P[0-9]+) +(?P[0-9]+) +'
r'(?P[0-9.]+) +bps +(?P[0-9]+)$')
^^^
Hardcoded "bps" - cannot match "mbps"Expected Behavior
Parser should handle all bitrate units that NX-OS can display:
- bps (bits per second)
- kbps (kilobits per second)
- mbps (megabits per second)
- gbps (gigabits per second)
- tbps (terabits per second)
Proposed Fix
- Update pattern
p8to capture the bitrate unit dynamically:
p8 = re.compile(r'^\s*(?P\S+) +(?P[0-9]+) +(?P[0-9]+) +(?P[0-9]+) +(?P[0-9]+) +'
r'(?P[0-9.]+) +(?P[kmgt]?bps) +(?P[0-9]+)$')- Add conversion logic to normalize all bitrates to bps for consistency:
conversion_factors = {
'bps': 1,
'kbps': 1000,
'mbps': 1000000,
'gbps': 1000000000,
'tbps': 1000000000000
}
bitrate_in_bps = bitrate_value * conversion_factors.get(bitrate_unit, 1)- Store normalized value while maintaining schema compatibility:
'bitrate': bitrate_in_bps,
'bitrate_unit': 'bps'Testing Performed
- Tested after
clear ip mroute statistics(0.000 bps) - works - Tested with low traffic VRFs (27.200 bps) - works
- Tested with high traffic VRFs (26.173 mbps) - fails without fix, works with fix
- Verified same switch, different VRFs behave differently based on traffic levels
Metadata
Metadata
Assignees
Labels
No labels