Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hlapi.asyncio: support ignoreNonIncreasingOid #364

Open
wants to merge 1 commit into
base: release-4.4.13
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pysnmp/hlapi/asyncio/cmdgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from pysnmp.hlapi.varbinds import *
from pysnmp.hlapi.asyncio.transport import *
from pysnmp.entity.rfc3413 import cmdgen
from pysnmp.proto import errind

try:
import asyncio
Expand Down Expand Up @@ -304,6 +305,10 @@ 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.
Be aware that setting it to `True` may cause infinite loop between
SNMP management and agent applications. Default is `False`.

Yields
------
Expand Down Expand Up @@ -355,6 +360,9 @@ def __cbFun(snmpEngine, sendRequestHandle,
lookupMib, future = cbCtx
if future.cancelled():
return
if (options.get('ignoreNonIncreasingOid', False) and
errorIndication and isinstance(errorIndication, errind.OidNotIncreasing)):
errorIndication = None
try:
varBindsUnmade = [vbProcessor.unmakeVarBinds(snmpEngine,
varBindTableRow,
Expand Down Expand Up @@ -427,6 +435,10 @@ 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.
Be aware that setting it to `True` may cause infinite loop between
SNMP management and agent applications. Default is `False`.

Yields
------
Expand Down Expand Up @@ -497,6 +509,9 @@ def __cbFun(snmpEngine, sendRequestHandle,
lookupMib, future = cbCtx
if future.cancelled():
return
if (options.get('ignoreNonIncreasingOid', False) and
errorIndication and isinstance(errorIndication, errind.OidNotIncreasing)):
errorIndication = None
try:
varBindsUnmade = [vbProcessor.unmakeVarBinds(snmpEngine,
varBindTableRow,
Expand Down