diff options
author | elie <elie> | 2014-06-09 13:07:07 +0000 |
---|---|---|
committer | elie <elie> | 2014-06-09 13:07:07 +0000 |
commit | 8028defd666d85a94a7dec1a74c57681bf43e398 (patch) | |
tree | 4559f70d244f42b133ea10a0faa5f9ecbe873e19 | |
parent | 6f029f3261e05e1a367614cb3cb7bb29b77cb9a4 (diff) | |
download | pysnmp-git-8028defd666d85a94a7dec1a74c57681bf43e398.tar.gz |
sendNotification() API correction
5 files changed, 15 insertions, 14 deletions
diff --git a/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py b/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py index 7d9b497b..a19bc117 100644 --- a/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py +++ b/examples/hlapi/asyncore/agent/ntforg/multiple-informs-at-once.py @@ -46,10 +46,10 @@ ntfOrg = ntforg.AsyncNotificationOriginator() for authData, transportTarget in targets: sendPduHandle = ntfOrg.sendNotification( snmpEngine, - context.SnmpContext(snmpEngine), authData, transportTarget, - cmdgen.ContextData(), + context.SnmpContext(snmpEngine), + ntforg.null, 'inform', ntforg.MibVariable('SNMPv2-MIB', 'coldStart'), ( ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'), diff --git a/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py b/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py index 1fdee69b..a075fdaa 100644 --- a/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py +++ b/examples/hlapi/asyncore/agent/ntforg/multiple-traps-at-once.py @@ -34,10 +34,10 @@ ntfOrg = ntforg.AsyncNotificationOriginator() for authData, transportTarget in targets: ntfOrg.sendNotification( snmpEngine, - context.SnmpContext(snmpEngine), authData, transportTarget, - ntforg.ContextData(), + context.SnmpContext(snmpEngine), + ntforg.null, 'trap', ntforg.MibVariable('SNMPv2-MIB', 'coldStart'), ( ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'), diff --git a/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py b/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py index bf04e671..088b72b9 100644 --- a/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py +++ b/examples/hlapi/asyncore/agent/ntforg/running-multiple-snmp-engines-at-once.py @@ -74,10 +74,10 @@ for authData, transportTarget in targets: snmpEngineA or snmpEngineB sendPduHandle = ntfOrg.sendNotification( snmpEngine, - context.SnmpContext(snmpEngine), authData, transportTarget, - ntforg.ContextData(), + context.SnmpContext(snmpEngine), + ntforg.null, 'inform', ntforg.MibVariable('SNMPv2-MIB', 'coldStart'), ( ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'), diff --git a/pysnmp/entity/rfc3413/ntforg.py b/pysnmp/entity/rfc3413/ntforg.py index 422c2cf3..6ab232bd 100644 --- a/pysnmp/entity/rfc3413/ntforg.py +++ b/pysnmp/entity/rfc3413/ntforg.py @@ -253,9 +253,9 @@ class NotificationOriginator: def sendVarBinds(self, snmpEngine, + notificationTarget, snmpContext, contextName, - notificationTarget, notificationName, instanceIndex, additionalVarBinds=(), @@ -439,9 +439,9 @@ def _sendNotification(self, cbFun = _sendNotificationCbFun return self.sendVarBinds(snmpEngine, + notificationTarget, self.snmpContext, contextName, - notificationTarget, notificationName, instanceIndex, additionalVarBinds, diff --git a/pysnmp/hlapi/asyncore/ntforg.py b/pysnmp/hlapi/asyncore/ntforg.py index b65f2e1c..357d150f 100644 --- a/pysnmp/hlapi/asyncore/ntforg.py +++ b/pysnmp/hlapi/asyncore/ntforg.py @@ -6,7 +6,6 @@ from pysnmp.entity.rfc3413.oneliner.mibvar import MibVariable from pysnmp.entity.rfc3413.oneliner.auth import CommunityData, UsmUserData from pysnmp.entity.rfc3413.oneliner.target import UdpTransportTarget, \ Udp6TransportTarget, UnixTransportTarget -from pysnmp.entity.rfc3413.oneliner.ctx import ContextData from pysnmp.entity.rfc3413.oneliner import cmdgen # Auth protocol @@ -113,8 +112,9 @@ class AsyncNotificationOriginator(cmdgen.AsyncCommandGenerator): ) del cache['auth'][authDataKey] - def sendNotification(self, snmpEngine, snmpContext, - authData, transportTarget, contextData, + def sendNotification(self, snmpEngine, + authData, transportTarget, + snmpContext, contextName, notifyType, notificationType, instanceIndex, varBinds=(), @@ -155,7 +155,7 @@ class AsyncNotificationOriginator(cmdgen.AsyncCommandGenerator): cache['mibViewController'], oidOnly=True ) - return ntforg.NotificationOriginator().sendVarBinds(snmpEngine, snmpContext, contextData.contextName, notifyName, notificationType, instanceIndex, self.makeVarBinds(snmpEngine, varBinds), __cbFun, (lookupNames, lookupValues, cbFun, cbCtx)) + return ntforg.NotificationOriginator().sendVarBinds(snmpEngine, notifyName, snmpContext, contextName, notificationType, instanceIndex, self.makeVarBinds(snmpEngine, varBinds), __cbFun, (lookupNames, lookupValues, cbFun, cbCtx)) # substitute sendNotification return object for backward compatibility class ErrorIndicationReturn: @@ -230,8 +230,9 @@ class AsynNotificationOriginator(cmdgen.AsynCommandGenerator): notificationType = MibVariable(notificationType[0][0], notificationType[0][1], *notificationType[1:]).resolveWithMib(self.mibViewController) return self.__asyncNtfOrg.sendNotification( - self.snmpEngine, self.snmpContext, - authData, transportTarget, ContextData(contextName=contextName), + self.snmpEngine, + authData, transportTarget, + self.snmpContext, contextName, notifyType, notificationType, None, varBinds, (__cbFun, cbInfo), lookupNames, lookupValues |