-
Notifications
You must be signed in to change notification settings - Fork 5
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
Clean up issues with IP address parsing in several places #322
Clean up issues with IP address parsing in several places #322
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
Test results 3 files 3 suites 1m 23s ⏱️ Results for commit ee31ed7. ♻️ This comment has been updated with latest results. |
I have not tested this extensively against real-world equipment, as I ran out of time: Gotta go on vacation :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #322 +/- ##
==========================================
+ Coverage 98.57% 98.61% +0.05%
==========================================
Files 77 77
Lines 9699 9671 -28
==========================================
- Hits 9560 9537 -23
+ Misses 139 134 -5 ☔ View full report in Codecov by Sentry. |
Quality Gate passedIssues Measures |
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.
I would only want this to be merged after testing against real-life equipment, otherwise it looks good. I have removed the parse_ip
function from utils since it is not used now.
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.
without having done any testing myself this looks fine 👍
I'll probably run some manual tests tomorrow
So, have any of you tested, @stveit or @johannaengland , or I should I go ahead? I see I have a potential uncommitted simplification of the BGP trap processing code that would parse an IP address as well... |
I have not. But I remember @stveit saying in a standup meeting last week that he was planning on testing it |
Zino seems to be running fine with these changes from what I can tell |
PySNMP doesn't necessarily pretty-print InetAddress and IpAddress value types as anything useful for us (This are textual conventions of an OctetString, and PySNMP tends to just raw-dog the octet string into something like a hexadecimal string representation of the content). If the value type is `InetAddress` or `IpAddress` we can expect `ipaddress.ip_address()` to properly parse the raw bytes into an IPv4Address or IPv6Address object.
`InetAddress` and `IpAddress` MIB values are now expected to be returned as IPv4Address or IPv6Address objects from the SNMP layer.
The BGP state monitor task would test for membership in this list using IPv4Address or IPv6Address objects, but the list contained raw strings, so the tests would never match.
3da1744
to
eedf00b
Compare
I rebased this on the latest master due to conflicts. Have tested myself against real-world equipment now and found no issues. |
eedf00b
to
94bba1d
Compare
94bba1d
to
ee31ed7
Compare
Quality Gate passedIssues Measures |
Scope and purpose
Mainly this fixes the issue of parsing the values of
InetAddress
andIpAddress
type MIB objects at the level of thezino.snmp._mib_value_to_python()
function. Once fixed there, using theparse_ip
utility function becomes superfluous, so these instances can be removed.There was also some strange issue with comparing strings to IP address objects which was resolved.
There may be similar updates to had in the trap observers (some of which parse the raw object values for IP address itself).
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Zino can be found in the
README.