summaryrefslogtreecommitdiff
path: root/examples/v3arch/agent/ntforg/inform-multiple-protocols.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/v3arch/agent/ntforg/inform-multiple-protocols.py')
-rw-r--r--examples/v3arch/agent/ntforg/inform-multiple-protocols.py26
1 files changed, 10 insertions, 16 deletions
diff --git a/examples/v3arch/agent/ntforg/inform-multiple-protocols.py b/examples/v3arch/agent/ntforg/inform-multiple-protocols.py
index a3fbb8d..8f70ef9 100644
--- a/examples/v3arch/agent/ntforg/inform-multiple-protocols.py
+++ b/examples/v3arch/agent/ntforg/inform-multiple-protocols.py
@@ -18,7 +18,7 @@
#
from pysnmp.entity import engine, config
from pysnmp.carrier.asynsock.dgram import udp
-from pysnmp.entity.rfc3413 import ntforg, context
+from pysnmp.entity.rfc3413 import ntforg
from pysnmp.proto.api import v2c
# Create SNMP engine instance
@@ -80,9 +80,6 @@ config.addVacmUser(snmpEngine, 3, 'usr-md5-none', 'authNoPriv', (), (), (1,3,6))
# Create Notification Originator App instance.
ntfOrg = ntforg.NotificationOriginator()
-# Create default SNMP context where contextEngineId == SnmpEngineId
-snmpContext = context.SnmpContext(snmpEngine)
-
# Error/confirmation receiver
def cbFun(snmpEngine, sendRequestHandle, errorIndication,
errorStatus, errorIndex, varBinds, cbCtx):
@@ -94,18 +91,15 @@ def cbFun(snmpEngine, sendRequestHandle, errorIndication,
# Build and submit notification message to dispatcher
sendRequestHandle = ntfOrg.sendVarBinds(
snmpEngine,
- # Notification targets
- 'my-notification',
- # SNMP Context
- snmpContext,
- # contextName
- '',
- # notification name (SNMPv2-MIB::coldStart)
- (1,3,6,1,6,3,1,1,5,1),
- # instance Index
- None,
- # additional var-binds: ( (oid, value), ... )
- [ ((1,3,6,1,2,1,1,1,0), v2c.OctetString('Example Notificator')) ],
+ 'my-notification', # notification targets
+ None, '', # contextEngineId, contextName
+ # var-binds
+ [
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::coldStart
+ ((1,3,6,1,6,3,1,1,4,1,0), v2c.ObjectIdentifier((1,3,6,1,6,3,1,1,5,1))),
+ # additional var-binds: ( (oid, value), ... )
+ ((1,3,6,1,2,1,1,1,0), v2c.OctetString('Example Notificator'))
+ ],
cbFun
)