[pysnmp-dev] error on NOTIFICATION-TYPE with OBJECTS
Brought to you by:
elie
From: Andrea N. <nic...@gm...> - 2014-06-26 01:43:16
|
I Ilya. I get serialization errors when I try to send notify with using definition with nested object, also my object have the getValue redefine to have dynamic resolution: the mib is like: ... snmpHeartbeatNotification NOTIFICATION-TYPE OBJECTS { snmpHeartbeatRate } STATUS current DESCRIPTION "This notification will typically be sent every 30 seconds." ::= { snmpNotificationsPrefix 1 } ... and the class has a method like that: class Var(SuperClass): def readGet(self, name, *args): return name, self.syntax.clone(getValue()) above my fix: Index: pysnmp-4.2.5/pysnmp/entity/rfc3413/ntforg.py =================================================================== --- pysnmp-4.2.5.orig/pysnmp/entity/rfc3413/ntforg.py 2013-06-05 14:16:33.000000000 +0200 +++ pysnmp-4.2.5/pysnmp/entity/rfc3413/ntforg.py 2014-06-26 03:24:36.617993524 +0200 @@ -244,7 +244,7 @@ mibNode = mibNode.getNode(mibNode.name + instanceIndex) else: mibNode = mibNode.getNextNode(mibNode.name) - varBinds.append((mibNode.name, mibNode.syntax)) + varBinds.append(mibNode.readGet(mibNode.name)) debug.logger & debug.flagApp and debug.logger('sendNotification: processed notification object %s, instance index %s, var-bind %s' % (notificationObject, instanceIndex is None and "<first>" or instanceIndex, mibNode)) elif notificationName: # numeric OID varBinds.append( on the same file there is also an error: in the function sendNotification, line 170 you forgot to declare at function begin something like : self.__pendingNotifications[metaSendPduHandle] = 0 so all the line like : except error.StatusInformation: if not self.__pendingNotifications[metaSendPduHandle] go in KeyError to avoid the error is not better write like above?: if metaSendPduHandle not in self.__pendingNotifications: Andrea |