-
Notifications
You must be signed in to change notification settings - Fork 389
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
Optimize IP OSPF Parsers #780
base: main
Are you sure you want to change the base?
Conversation
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.
Huh... I wonder how such an unoptimized parser made it in in the first place. Thank you for addressing this!
If you wouldn't mind adding in a unittest or two to verify this works as expected we would greatly appreciate it!
I attempted to run the unit tests for the two parsers, but one is empty and one does not exist. I played around with it and it looks like the folder parsing job can't accommodate parsers that call multiple commands within the parser itself. I have the output for Show IP OSPF Interfaces here, however, it is empty.
If there is anything else you would like me to try, let me know. I have tested the optimized parsers on live devices and they do work (screenshots included in the original PR) just in case. |
Description
Optimized show ip ospf interfaces and show ip ospf neighbours detail parser to prevent parser from calling additional commands multiple times, speeding up the parsing. Additional commands needed for parsing are now called once at the beginning of the parser.
Resolves #746 and resolves #747
Motivation and Context
This change was made because the parsers were running for 15+ minutes for a single command on switches with many interfaces and/or neighbours, and device CPU spiked up to 100% for the entire duration due to the amount of commands that were being called throughout the parsing process.
Impact (If any)
Passes the load of parsing to the device running the parser rather than the network device.
Ex. Instead of running "show running-config | section router ospf " for all instances of ospf on the network device, the parser executes "show running-config | section router ospf" once and uses the output to search for every instance needed.
Screenshots:
There were no unit tests for these commands, so I tested the current and optimized parser on live devices, and compared the outputs to see if they were the same.
The only changes present are timers, as shown in the screenshots below. If you look to the side, you can see that the "changes" are all timers and are consistent.
Show IP OSPF Interfaces:
Show IP OSPF Neighbours Detail:
Checklist: