diff options
Diffstat (limited to 'examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-transports-and-protocols.py')
-rw-r--r-- | examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-transports-and-protocols.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-transports-and-protocols.py b/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-transports-and-protocols.py index a19bc11..fc4a358 100644 --- a/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-transports-and-protocols.py +++ b/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-transports-and-protocols.py @@ -12,19 +12,19 @@ # * include managed object information specified as var-bind objects pair # from pysnmp.entity.rfc3413.oneliner import ntforg -from pysnmp.entity.rfc3413 import context from pysnmp.entity import engine -from pysnmp.proto import rfc1902 # List of targets in the followin format: # ( ( authData, transportTarget ), ... ) targets = ( # 1-st target (SNMPv2c over IPv4/UDP) ( ntforg.CommunityData('public'), - ntforg.UdpTransportTarget(('localhost', 162)) ), + ntforg.UdpTransportTarget(('localhost', 162)), + ntforg.ContextData() ), # 2-nd target (SNMPv3 over IPv4/UDP) ( ntforg.UsmUserData('usr-md5-des', 'authkey1', 'privkey1'), - ntforg.UdpTransportTarget(('localhost', 162)) ) + ntforg.UdpTransportTarget(('localhost', 162)), + ntforg.ContextData() ), ) def cbFun(snmpEngine, sendRequestHandle, errorIndication, @@ -43,17 +43,16 @@ snmpEngine = engine.SnmpEngine() ntfOrg = ntforg.AsyncNotificationOriginator() -for authData, transportTarget in targets: +for authData, transportTarget, contextData in targets: sendPduHandle = ntfOrg.sendNotification( snmpEngine, authData, transportTarget, - context.SnmpContext(snmpEngine), - ntforg.null, - 'inform', - ntforg.MibVariable('SNMPv2-MIB', 'coldStart'), - ( ( rfc1902.ObjectName('1.3.6.1.2.1.1.1.0'), - rfc1902.OctetString('my name') ), ), + contextData, + 'inform', # NotifyType + ntforg.NotificationType( + ntforg.ObjectIdentity('SNMPv2-MIB', 'coldStart') + ).addVarBinds( ( '1.3.6.1.2.1.1.1.0', 'my name' ) ), cbInfo=(cbFun, None) ) |