summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Van Gilder <rvangilder1@gmail.com>2017-03-09 15:58:12 -0800
committerRyan Van Gilder <rvangilder1@gmail.com>2017-03-09 15:58:12 -0800
commit3f82c7fb1abfb4a38a146e746c4af33d0684ee83 (patch)
treee844e9cc1d2adb7e60cb95208d74edd68e406ed7
parent295497c48e0ed8f7302ec4d347a83d0aab4b4f9f (diff)
downloadpysnmp-git-3f82c7fb1abfb4a38a146e746c4af33d0684ee83.tar.gz
Add ignoreNonIncreasingOid option for twisted nextCmd and bulkCmd
-rw-r--r--pysnmp/hlapi/twisted/cmdgen.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pysnmp/hlapi/twisted/cmdgen.py b/pysnmp/hlapi/twisted/cmdgen.py
index b910ab63..274573f7 100644
--- a/pysnmp/hlapi/twisted/cmdgen.py
+++ b/pysnmp/hlapi/twisted/cmdgen.py
@@ -11,6 +11,7 @@ from pysnmp.hlapi.lcd import *
from pysnmp.hlapi.varbinds import *
from pysnmp.hlapi.twisted.transport import *
from pysnmp.entity.rfc3413 import cmdgen
+from pysnmp.proto import errind
from twisted.internet.defer import Deferred
from twisted.python.failure import Failure
@@ -278,6 +279,9 @@ def nextCmd(snmpEngine, authData, transportTarget, contextData,
* `lookupMib` - load MIB and resolve response MIB variables at
the cost of slightly reduced performance. Default is `True`.
+ * `ignoreNonIncreasingOid` - continue iteration even if response
+ MIB variables (OIDs) are not greater then request MIB variables.
+ Default is `False`.
Returns
-------
@@ -341,6 +345,9 @@ def nextCmd(snmpEngine, authData, transportTarget, contextData,
errorIndication, errorStatus, errorIndex,
varBindTable, cbCtx):
lookupMib, deferred = cbCtx
+ if options.get('ignoreNonIncreasingOid', False) and errorIndication and \
+ isinstance(errorIndication, errind.OidNotIncreasing):
+ errorIndication = None
if errorIndication:
deferred.errback(Failure(errorIndication))
else:
@@ -404,6 +411,9 @@ def bulkCmd(snmpEngine, authData, transportTarget, contextData,
* `lookupMib` - load MIB and resolve response MIB variables at
the cost of slightly reduced performance. Default is `True`.
+ * `ignoreNonIncreasingOid` - continue iteration even if response
+ MIB variables (OIDs) are not greater then request MIB variables.
+ Default is `False`.
Returns
-------
@@ -468,6 +478,9 @@ def bulkCmd(snmpEngine, authData, transportTarget, contextData,
errorIndication, errorStatus, errorIndex,
varBindTable, cbCtx):
lookupMib, deferred = cbCtx
+ if options.get('ignoreNonIncreasingOid', False) and errorIndication and \
+ isinstance(errorIndication, errind.OidNotIncreasing):
+ errorIndication = None
if errorIndication:
deferred.errback(Failure(errorIndication))
else: