diff options
Diffstat (limited to 'examples/v3arch/asyncore/manager/cmdgen/send-packets-from-specific-interface.py')
-rw-r--r-- | examples/v3arch/asyncore/manager/cmdgen/send-packets-from-specific-interface.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/examples/v3arch/asyncore/manager/cmdgen/send-packets-from-specific-interface.py b/examples/v3arch/asyncore/manager/cmdgen/send-packets-from-specific-interface.py index 27acf769..2d6805fa 100644 --- a/examples/v3arch/asyncore/manager/cmdgen/send-packets-from-specific-interface.py +++ b/examples/v3arch/asyncore/manager/cmdgen/send-packets-from-specific-interface.py @@ -50,6 +50,7 @@ config.addTargetAddr( 'my-creds' ) + # Error/response receiver # noinspection PyUnusedLocal,PyUnusedLocal,PyUnusedLocal def cbFun(snmpEngine, sendRequestHandle, errorIndication, @@ -58,24 +59,22 @@ def cbFun(snmpEngine, sendRequestHandle, errorIndication, print(errorIndication) return if errorStatus: - print('%s at %s' % ( - errorStatus.prettyPrint(), - errorIndex and varBindTable[-1][int(errorIndex)-1][0] or '?' - ) - ) + print('%s at %s' % (errorStatus.prettyPrint(), + errorIndex and varBindTable[-1][int(errorIndex) - 1][0] or '?')) return # stop on error for varBindRow in varBindTable: for oid, val in varBindRow: print('%s = %s' % (oid.prettyPrint(), val.prettyPrint())) - return 1 # signal dispatcher to continue + return 1 # signal dispatcher to continue + # Prepare initial request to be sent cmdgen.NextCommandGenerator().sendVarBinds( snmpEngine, 'my-router', None, '', # contextEngineId, contextName - [ ((1,3,6,1,2,1,1), None), - ((1,3,6,1,2,1,11), None) ], + [((1, 3, 6, 1, 2, 1, 1), None), + ((1, 3, 6, 1, 2, 1, 11), None)], cbFun ) |