Skip to content

Conversation

@bigevilbeard
Copy link
Contributor

Summary

• Updated pattern p8 to capture bitrate unit dynamically
• Added conversion logic to normalize all bitrates to bps
• Maintains backward compatibility and schema consistency

Fixes issue where parser fails on high-traffic VRFs displaying bitrates in mbps instead of bps, causing SchemaMissingKeyError.

Description

• Updated pattern p8 to capture bitrate unit dynamically: (?P<bitrate_unit>[kmgt]?bps)
• Added conversion logic to normalize all bitrates to bps for consistency
• Maintains backward compatibility with existing outputs
• No schema changes required

Motivation and Context

Pattern p8 hardcoded "bps" in the regex, causing it to fail matching when NX-OS displays high-traffic multicast routes with "mbps" or
other units. This resulted in SchemaMissingKeyError as the source dictionary was never created.

Impact (If any)

• Enhanced parser reliability for high-traffic multicast environments
• Supports all bitrate units: bps, kbps, mbps, gbps, tbps
• Normalizes output to consistent bps format
• No breaking changes to existing functionality

Screenshots:

Checklist:

• [x] I have updated the changelog.
• [ ] I have updated the documentation (If applicable).
• [ ] I have added tests to cover my changes (If applicable).
• [ ] All new and existing tests passed.
• [ ] All new code passed compilation.

- Updated pattern p8 to capture bitrate unit dynamically
- Added conversion logic to normalize all bitrates to bps
- Maintains backward compatibility and schema consistency

Fixes issue where parser fails on high-traffic VRFs displaying
bitrates in mbps instead of bps, causing SchemaMissingKeyError.
- Updated ShowIpMrouteSummary and ShowIpv6MrouteSummary parsers
- Modified regex pattern p8 to capture bitrate_unit (bps, kbps, mbps, gbps, tbps)
- Added conversion logic to normalize all bitrate values to bps format
- Maintains backward compatibility while supporting new unit formats
@bigevilbeard bigevilbeard requested a review from a team as a code owner November 14, 2025 15:09
Copy link
Collaborator

@ThomasJRyan ThomasJRyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could include a unittest to verify your changes that would be great

Comment on lines 1094 to 1095
#(*,G) 0 0 0 0 0.000 bps 2
p8 = re.compile(r'^\s*(?P<source>\S+) +(?P<packets>[0-9]+) +(?P<bytes>[0-9]+) +(?P<aps>[0-9]+) +(?P<pps>[0-9]+) +'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a new example with an example of what's being matched

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sir, adding now.

Comment on lines 1247 to 1248
#(*,G) 0 0 0 0 0.000 bps 2
p8 = re.compile(r'^\s*(?P<source>\S+) +(?P<packets>[0-9]+) +(?P<bytes>[0-9]+) +(?P<aps>[0-9]+) +(?P<pps>[0-9]+) +'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well

- Test conversion of mbps, kbps, gbps, tbps to bps
- Verify both IPv4 and IPv6 parsers handle all bitrate units
- Ensure normalized output maintains bps format
@Taarini Taarini merged commit ed40758 into CiscoTestAutomation:main Nov 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants