summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2011-05-30 11:13:31 +0000
committerelie <elie>2011-05-30 11:13:31 +0000
commit17e44c70398590b0acf280da24c6889dd24c167d (patch)
treeb6a8323759a4d98f84bb122a1d7f4fd594136f4a
parent62c76d57ecc360c431bada8d144a98bd4a24472e (diff)
downloadpysnmp-17e44c70398590b0acf280da24c6889dd24c167d.tar.gz
CommandGenerator.ignoreNonIncreasingOid can be used to control the
"OID not increasing" condition handling
-rw-r--r--CHANGES1
-rw-r--r--pysnmp/entity/rfc3413/oneliner/cmdgen.py12
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 970344b..1cb8471 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
Revision 4.1.16b
----------------
+- Oneliner CommandGenerator can now optionally ignore non-increasing OIDs.
- Default CommandResponder now skips non-compliant (Counter64) values
when responding to a v1 Manager.
- Fix to state information handling at CommandResponder app.
diff --git a/pysnmp/entity/rfc3413/oneliner/cmdgen.py b/pysnmp/entity/rfc3413/oneliner/cmdgen.py
index 64623c2..308ca6e 100644
--- a/pysnmp/entity/rfc3413/oneliner/cmdgen.py
+++ b/pysnmp/entity/rfc3413/oneliner/cmdgen.py
@@ -331,7 +331,7 @@ class AsynCommandGenerator:
asyncBulkCmd = bulkCmd
class CommandGenerator:
- lexicographicMode = None
+ lexicographicMode = ignoreNonIncreasingOid = None
def __init__(self, snmpEngine=None, asynCmdGen=None):
if asynCmdGen is None:
self.__asynCmdGen = AsynCommandGenerator(snmpEngine)
@@ -391,7 +391,10 @@ class CommandGenerator:
sendRequestHandle, errorIndication, errorStatus, errorIndex,
varBindTable, (self, varBindHead, varBindTotalTable, appReturn)
):
- if errorIndication or errorStatus:
+ if errorStatus or \
+ errorIndication and not self.ignoreNonIncreasingOid or \
+ errorIndication and self.ignoreNonIncreasingOid and \
+ not isinstance(errind.OidNotIncreasing, errorIndication):
appReturn['errorIndication'] = errorIndication
if errorStatus == 2:
# Hide SNMPv1 noSuchName error which leaks in here
@@ -453,7 +456,10 @@ class CommandGenerator:
sendRequestHandle, errorIndication, errorStatus, errorIndex,
varBindTable, (self, varBindHead, varBindTotalTable, appReturn)
):
- if errorIndication or errorStatus:
+ if errorStatus or \
+ errorIndication and not self.ignoreNonIncreasingOid or \
+ errorIndication and self.ignoreNonIncreasingOid and \
+ not isinstance(errind.OidNotIncreasing, errorIndication):
appReturn['errorIndication'] = errorIndication
appReturn['errorStatus'] = errorStatus
appReturn['errorIndex'] = errorIndex