Commits

Anonymous committed 6027a09

fix to Twisted-based NotificationOriginator to make it serving INFORMs again

Comments (0)

Files changed (2)

   at once. Although RFC2576 does not suggest error-status -> v2c exception
   translation, historically pysnmp used to perform it for a long time so we
   can't easily stop doing that.
+- Fix to Twisted-based NotificationOriginator to make it serving INFORMs again.
 - Fix to rfc2576.v1tov2() logic: errorStatus = noSuchName is now translated
   into rfc1905.noSuchObject exception value for *all* var-bindings. Although
   this is not mentioned in RFC, it looks as a more consistent approach.

pysnmp/entity/rfc3413/twisted/ntforg.py

 from pysnmp.entity.rfc3413 import ntforg
 from pyasn1.compat.octets import null
 
+def _cbFun(sendRequestHandle, errorIndication,
+           errorStatus, errorIndex, varBinds, cbCtx):
+    cbCtx.callback((errorIndication, errorStatus, errorIndex, varBinds))
+
 class NotificationOriginator(ntforg.NotificationOriginator):
     def sendNotification(
         self,
             notificationTarget,
             notificationName,
             additionalVarBinds,
-            None,
+            _cbFun,
             df,
             contextName=null
             )
         return df
-
-    def _handleResponse(
-        self,
-        sendRequestHandle,
-        errorIndication,
-        cbFun,
-        cbCtx):
-        cbCtx.callback((sendRequestHandle, errorIndication))