summaryrefslogtreecommitdiff
path: root/examples/v3arch/agent/ntforg/inform-v3.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/v3arch/agent/ntforg/inform-v3.py')
-rw-r--r--examples/v3arch/agent/ntforg/inform-v3.py24
1 files changed, 7 insertions, 17 deletions
diff --git a/examples/v3arch/agent/ntforg/inform-v3.py b/examples/v3arch/agent/ntforg/inform-v3.py
index facebe3..ef5355a 100644
--- a/examples/v3arch/agent/ntforg/inform-v3.py
+++ b/examples/v3arch/agent/ntforg/inform-v3.py
@@ -13,7 +13,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
@@ -54,11 +54,8 @@ config.addVacmUser(snmpEngine, 3, 'usr-md5-none', 'authNoPriv', (), (), (1,3,6))
# *** SNMP engine configuration is complete by this line ***
-# Create default SNMP context where contextEngineId == SnmpEngineId
-snmpContext = context.SnmpContext(snmpEngine)
-
# Create Notification Originator App instance.
-ntfOrg = ntforg.NotificationOriginator(snmpContext)
+ntfOrg = ntforg.NotificationOriginator()
# Error/confirmation receiver
def cbFun(snmpEngine, sendRequestHandle, errorIndication,
@@ -71,18 +68,11 @@ 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,5,0), v2c.OctetString('system name')) ],
+ 'my-notification', # notification targets
+ None, '', # contextEngineId, contextName
+ # var-binds: SNMPv2-MIB::coldStart, ...
+ [ ((1,3,6,1,6,3,1,1,5,1), v2c.ObjectIdentifier((1,3,6,1,6,3,1,1,5,1))),
+ ((1,3,6,1,2,1,1,5,0), v2c.OctetString('system name')) ],
cbFun
)