I sent snmptrap using following command
sudo snmptrap -v2c -c public '' .1.2.3.4.5.6.7.8.9 ifIndex i 2 ifAdminStatus i 1 1.3.6.1.4.1.9.9.599.1.3.1.1.1.0 x "0x34e2fd600a84"
I used prettyPrint() to format the output value in var binds. The problem is the output doesn't contain the leading zero. So the resulting output is something like
so.org.dod.internet.private.enterprises 9.9.599.1.3.1.1.1.0 = 0x34e2fd60a84
The result output has one 0 less than the original input. Is this a bug in prettyPrint or did I miss something here?
Edit
Here is my implementation. Inside this callback function
# Callback function for receiving notifications
def cbFun(snmpEngine, stateReference, contextEngineId, contextName,varBinds, cbCtx):
I have code block like this:
for name, val in varBinds:
oid, label, suffix = MIBView.getNodeName(name)
oidLabel = ".".join(map(str, label))
oidSuffix = ".".join(map(str, suffix))
oid_string = oid.prettyPrint()
value = val.prettyPrint()
The portion value = val.prettyPrint()
returns the hex value removing one 0 from two consecutive 0 pattern. So if print value using print value, I would get 0x34e2fd60a84. But I would except to get 0x34e2fd600a84.
That was a bug in pyasn1, and it was fixed in release 0.1.3 (current release is 0.1.9). You need to upgrade your pyasn1 or monkey-patch it if you can't upgrade for some reason.