diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-03-10 11:09:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-10 11:09:37 +0100 |
commit | 56fdac6185368e1f68413a66d9cccefd9bf03546 (patch) | |
tree | e844e9cc1d2adb7e60cb95208d74edd68e406ed7 | |
parent | 295497c48e0ed8f7302ec4d347a83d0aab4b4f9f (diff) | |
parent | 3f82c7fb1abfb4a38a146e746c4af33d0684ee83 (diff) | |
download | pysnmp-git-56fdac6185368e1f68413a66d9cccefd9bf03546.tar.gz |
Merge pull request #42 from ryban/twisted_non_increasing_oid
Add ignoreNonIncreasingOid option for twisted nextCmd and bulkCmd
-rw-r--r-- | pysnmp/hlapi/twisted/cmdgen.py | 13 |
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: |