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.py
resulted 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.py
and the newv1_trap.py
. a. Even then, I wasn't sure how to best ensure thatTrapV1
would be initialized and loaded into theX690Type
type 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 thevarbinds
already came back as anObjectIdentifier
(vs. astr
) - so I'm keeping the same for theenterprise
. Both anObjectIdentifier
andIPv4Address
add 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.IpAddress
has anything to offer over anipaddress.IPv4Address
, ax690.types.Integer
over anint
, or apuresnmp.types.TimeTicks
over 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!