diff options
Diffstat (limited to 'examples/v3arch/twisted/agent/ntforg/inform-v3.py')
-rw-r--r-- | examples/v3arch/twisted/agent/ntforg/inform-v3.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/examples/v3arch/twisted/agent/ntforg/inform-v3.py b/examples/v3arch/twisted/agent/ntforg/inform-v3.py index bb54673..def2ad6 100644 --- a/examples/v3arch/twisted/agent/ntforg/inform-v3.py +++ b/examples/v3arch/twisted/agent/ntforg/inform-v3.py @@ -62,15 +62,15 @@ config.addNotificationTarget( config.addContext(snmpEngine, '') config.addVacmUser(snmpEngine, 3, 'usr-md5-none', 'authNoPriv', (), (), (1,3,6)) -# Create default SNMP context where contextEngineId == SnmpEngineId +# Create Notification Originator App instance. +ntfOrg = ntforg.NotificationOriginator() + + # Create default SNMP context where contextEngineId == SnmpEngineId snmpContext = context.SnmpContext(snmpEngine) -# Create Notification Originator App instance. -ntfOrg = ntforg.NotificationOriginator(snmpContext) - # Error/confirmation receiver -def cbFun(cbCtx): - (errorIndication, errorStatus, errorIndex, varBinds) = cbCtx +def cbFun(response, *args): + snmpEngine, errorIndication, errorStatus, errorIndex, varBinds = response print('Notification status - %s' % ( errorIndication and errorIndication or 'delivered' ) @@ -79,14 +79,18 @@ def cbFun(cbCtx): reactor.stop() # Build and submit notification message to dispatcher -df = ntfOrg.sendNotification( +df = ntfOrg.sendVarBinds( snmpEngine, # Notification targets 'my-notification', - # Trap OID (SNMPv2-MIB::coldStart) + # SNMP Context + snmpContext, + # contextName + '', + # notification name (SNMPv2-MIB::coldStart) (1,3,6,1,6,3,1,1,5,1), - # ( (oid, value), ... ) - ( ((1,3,6,1,2,1,1,5,0), rfc1902.OctetString('system name')), ) + # additional var-binds: ( (oid, value), ... ) + [ ((1,3,6,1,2,1,1,5,0), rfc1902.OctetString('system name')) ] ) # Register error/response receiver function at deferred |