summaryrefslogtreecommitdiff
path: root/examples/v3arch/manager
diff options
context:
space:
mode:
authorelie <elie>2010-11-14 23:17:39 +0000
committerelie <elie>2010-11-14 23:17:39 +0000
commit0f77f8e91bab9c0e2c760c01e20d75878b79b481 (patch)
tree548a02dd61ec013007657052167c1e80dcd33d04 /examples/v3arch/manager
parent4723092cd66ab6bb352db17b7ae5c0182df54884 (diff)
downloadpysnmp-0f77f8e91bab9c0e2c760c01e20d75878b79b481.tar.gz
* getVarBindTable() does not filter SNMP exception values anymore
* getVarBindTable() of v1 API now returns Null instead of None * GETNEXT/GETBULK apps now track EOM condition automatically
Diffstat (limited to 'examples/v3arch/manager')
-rw-r--r--examples/v3arch/manager/bulkgen.py19
-rw-r--r--examples/v3arch/manager/nextgen.py17
2 files changed, 13 insertions, 23 deletions
diff --git a/examples/v3arch/manager/bulkgen.py b/examples/v3arch/manager/bulkgen.py
index 4ebeb8a..9c7eb75 100644
--- a/examples/v3arch/manager/bulkgen.py
+++ b/examples/v3arch/manager/bulkgen.py
@@ -36,21 +36,16 @@ def cbFun(sendRequesthandle, errorIndication, errorStatus, errorIndex,
varBindTable, cbCtx):
if errorIndication:
print errorIndication
- return
+ return # stop on error
if errorStatus:
- print errorStatus.prettyPrint()
- return
+ print '%s at %s\n' % (
+ errorStatus.prettyPrint(),
+ errorIndex and varBindTable[-1][int(errorIndex)-1] or '?'
+ )
+ return # stop on error
for varBindRow in varBindTable:
for oid, val in varBindRow:
- if val is None:
- print oid.prettyPrint()
- else:
- print '%s = %s' % (oid.prettyPrint(), val.prettyPrint())
- for oid, val in varBindTable[-1]:
- if val is not None:
- break
- else:
- return # stop on end-of-table
+ print '%s = %s' % (oid.prettyPrint(), val.prettyPrint())
return 1 # continue walking
cmdgen.BulkCommandGenerator().sendReq(
diff --git a/examples/v3arch/manager/nextgen.py b/examples/v3arch/manager/nextgen.py
index f0b8878..9e9a502 100644
--- a/examples/v3arch/manager/nextgen.py
+++ b/examples/v3arch/manager/nextgen.py
@@ -40,19 +40,14 @@ def cbFun(sendRequestHandle, errorIndication, errorStatus, errorIndex,
# SNMPv1 response may contain noSuchName error *and* SNMPv2c exception,
# so we ignore noSuchName error here
if errorStatus and errorStatus != 2:
- print errorStatus.prettyPrint()
- return
+ print '%s at %s\n' % (
+ errorStatus.prettyPrint(),
+ errorIndex and varBindTable[-1][int(errorIndex)-1] or '?'
+ )
+ return # stop on error
for varBindRow in varBindTable:
for oid, val in varBindRow:
- if val is None:
- print oid.prettyPrint()
- else:
- print '%s = %s' % (oid.prettyPrint(), val.prettyPrint())
- for oid, val in varBindTable[-1]:
- if val is not None:
- break
- else:
- return # stop on end-of-table
+ print '%s = %s' % (oid.prettyPrint(), val.prettyPrint())
return 1 # continue walking
cmdgen.NextCommandGenerator().sendReq(