diff options
author | Ilya Etingof <etingof@gmail.com> | 2016-04-01 22:58:56 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2016-04-01 22:58:56 +0200 |
commit | 020791a97232849c9504024834906dd4a4ffb36c (patch) | |
tree | 6e5d69aa01877ee004efb77645b8148e586610cc /examples/v3arch/asyncore/agent/ntforg/v2c-inform.py | |
parent | 9541f201e33cd613995cee2e7a7656aa687deb51 (diff) | |
download | pysnmp-git-020791a97232849c9504024834906dd4a4ffb36c.tar.gz |
pep8 reformatted
Diffstat (limited to 'examples/v3arch/asyncore/agent/ntforg/v2c-inform.py')
-rw-r--r-- | examples/v3arch/asyncore/agent/ntforg/v2c-inform.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/examples/v3arch/asyncore/agent/ntforg/v2c-inform.py b/examples/v3arch/asyncore/agent/ntforg/v2c-inform.py index 8c3c90b4..1de1a2fb 100644 --- a/examples/v3arch/asyncore/agent/ntforg/v2c-inform.py +++ b/examples/v3arch/asyncore/agent/ntforg/v2c-inform.py @@ -28,7 +28,7 @@ from pysnmp.proto.api import v2c snmpEngine = engine.SnmpEngine() # SecurityName <-> CommunityName mapping (+ transport binding) -config.addV1System(snmpEngine, 'my-area', 'public', +config.addV1System(snmpEngine, 'my-area', 'public', transportTag='all-my-managers') # Specify security settings per SecurityName (SNMPv2c -> 1) @@ -58,34 +58,36 @@ config.addNotificationTarget( # Allow NOTIFY access to Agent's MIB by this SNMP model (2), securityLevel # and SecurityName config.addContext(snmpEngine, '') -config.addVacmUser(snmpEngine, 2, 'my-area', 'noAuthNoPriv', (), (), (1,3,6)) +config.addVacmUser(snmpEngine, 2, 'my-area', 'noAuthNoPriv', (), (), (1, 3, 6)) # *** SNMP engine configuration is complete by this line *** # Create Notification Originator App instance. ntfOrg = ntforg.NotificationOriginator() + # Error/confirmation receiver # noinspection PyUnusedLocal,PyUnusedLocal,PyUnusedLocal,PyUnusedLocal,PyUnusedLocal def cbFun(snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBinds, cbCtx): print('Notification %s, status - %s' % ( sendRequestHandle, errorIndication and errorIndication or 'delivered' - ) ) + ) + # Build and submit notification message to dispatcher sendRequestHandle = ntfOrg.sendVarBinds( snmpEngine, 'my-notification', # notification targets - None, '', # contextEngineId, contextName + 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))), + ((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')), - ((1,3,6,1,2,1,1,5,0), v2c.OctetString('Notificator Example')) + ((1, 3, 6, 1, 2, 1, 1, 1, 0), v2c.OctetString('Example Notificator')), + ((1, 3, 6, 1, 2, 1, 1, 5, 0), v2c.OctetString('Notificator Example')) ], cbFun ) |