puresnmp
puresnmp copied to clipboard
Add SNMPv1 trap support.
- Contributes to #36.
@exhuma: I'm open to any feedback, your own updates or changes, or anything else that should be done in support towards having these updates merged. Specifically:
- I'm not sure if there was a better way for me to structure this into the pull request, but this includes a dependency on #111 as a prior pull request here.
- I experimented with a few different options around "where" to put the trap model. It didn't feel right to simply add all of it into
v1.py. Adding it as a sibling tov1.pyresulted in it being automatically loaded as a potential mpm plugin, which it isn't one. Ultimately, I think it closer topdu.py- so I'm leading with including it as a sibling of that, and commenting as such within both the existingpdu.pyand the newv1_trap.py. a. Even then, I wasn't sure how to best ensure thatTrapV1would be initialized and loaded into theX690Typetype registry. For now, this is handled with a reference fromv1.py. - I'm still undecided as to the best types to use and return in
TrapV1Content. For example, the OID's in thevarbindsalready came back as anObjectIdentifier(vs. astr) - so I'm keeping the same for theenterprise. Both anObjectIdentifierandIPv4Addressadd functionality on top of a basestr, so it seems to make sense to keep those there - where as I can't see that apuresnmp.types.IpAddresshas anything to offer over anipaddress.IPv4Address, ax690.types.Integerover anint, or apuresnmp.types.TimeTicksover adatetime.timedelta? - Additional unit test included. :-)
@exhuma ?
@exhuma - is this something you can please review, consider for inclusion, and/or provide any feedback on? Thanks!