-
Notifications
You must be signed in to change notification settings - Fork 419
Fix: Support mbps/kbps/gbps in show ip mroute summary parser #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Support mbps/kbps/gbps in show ip mroute summary parser #971
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
left a comment
There was a problem hiding this 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
| #(*,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]+) +' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sir, adding now.
| #(*,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]+) +' |
There was a problem hiding this comment.
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
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.