summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorelie <elie>2010-12-13 01:16:13 +0000
committerelie <elie>2010-12-13 01:16:13 +0000
commita466a021fb992cd87185415a56db876e41992c85 (patch)
tree6cb80679becaa3f055ca57e77cfc513a31334dec /examples
parent07b8e7a99c340673fcf7962c2258933d24806017 (diff)
downloadpysnmp-a466a021fb992cd87185415a56db876e41992c85.tar.gz
callback API changed to make it simpler and mode uniform with the rest of
CommandGenerators.
Diffstat (limited to 'examples')
-rw-r--r--examples/v3arch/twisted/manager/bulkgen.py13
-rw-r--r--examples/v3arch/twisted/manager/nextgen.py13
2 files changed, 12 insertions, 14 deletions
diff --git a/examples/v3arch/twisted/manager/bulkgen.py b/examples/v3arch/twisted/manager/bulkgen.py
index 4a6f07f..c6f3efd 100644
--- a/examples/v3arch/twisted/manager/bulkgen.py
+++ b/examples/v3arch/twisted/manager/bulkgen.py
@@ -41,8 +41,8 @@ config.addSocketTransport(
# Twisted API follows
def receiveResponse(
- (errorIndication, errorStatus, errorIndex, varBindTable),
- bulkCmdGen, snmpEngine):
+ (errorIndication, errorStatus, errorIndex, varBindTable, df),
+ ):
if errorIndication:
print 'Error: ', errorIndication
reactor.stop()
@@ -63,11 +63,10 @@ def receiveResponse(
break
else:
reactor.stop() # no more objects available
+ return
- df = bulkCmdGen.sendReq(
- snmpEngine, 'myRouter', 0, 25, varBindTable[-1]
- )
- df.addCallback(receiveResponse, bulkCmdGen, snmpEngine)
+ df.addCallback(receiveResponse) # continue walking
+ return 1
bulkCmdGen = cmdgen.BulkCommandGenerator()
@@ -75,6 +74,6 @@ df = bulkCmdGen.sendReq(
snmpEngine, 'myRouter', 0, 25, (((1,3,6,1,2), None),)
)
-df.addCallback(receiveResponse, bulkCmdGen, snmpEngine)
+df.addCallback(receiveResponse)
reactor.run()
diff --git a/examples/v3arch/twisted/manager/nextgen.py b/examples/v3arch/twisted/manager/nextgen.py
index e072871..704b870 100644
--- a/examples/v3arch/twisted/manager/nextgen.py
+++ b/examples/v3arch/twisted/manager/nextgen.py
@@ -41,8 +41,8 @@ config.addSocketTransport(
# Twisted API follows
def receiveResponse(
- (errorIndication, errorStatus, errorIndex, varBindTable),
- nextCmdGen, snmpEngine):
+ (errorIndication, errorStatus, errorIndex, varBindTable, df)
+ ):
if errorIndication:
print 'Error: ', errorIndication
reactor.stop()
@@ -63,11 +63,10 @@ def receiveResponse(
break
else:
reactor.stop() # no more objects available
+ return
- df = nextCmdGen.sendReq(
- snmpEngine, 'myRouter', varBindTable[-1]
- )
- df.addCallback(receiveResponse, nextCmdGen, snmpEngine)
+ df.addCallback(receiveResponse) # continue walking
+ return 1
nextCmdGen = cmdgen.NextCommandGenerator()
@@ -75,6 +74,6 @@ df = nextCmdGen.sendReq(
snmpEngine, 'myRouter', (((1,3,6,1,2,1,1), None),)
)
-df.addCallback(receiveResponse, nextCmdGen, snmpEngine)
+df.addCallback(receiveResponse)
reactor.run()