Fix: Support mbps/kbps/gbps in show ip mroute summary parser#971
Merged
Taarini merged 3 commits intoCiscoTestAutomation:mainfrom Nov 14, 2025
Merged
Conversation
- 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
ThomasJRyan
requested changes
Nov 14, 2025
Collaborator
ThomasJRyan
left a comment
There was a problem hiding this comment.
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]+) +' |
Collaborator
There was a problem hiding this comment.
Please add a new example with an example of what's being matched
Contributor
Author
There was a problem hiding this comment.
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]+) +' |
- 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
ThomasJRyan
approved these changes
Nov 14, 2025
Taarini
approved these changes
Nov 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.