BULKWALK command

async pysnmp.hlapi.asyncio.bulk_walk_cmd(snmpEngine: Any, authData: Any, transportTarget: Any, contextData: Any, nonRepeaters: int, maxRepetitions: int, *varBinds: Any, **options: Any) → AsyncGenerator[SnmpResponse, None]

Walk a subtree with GETBULK, yielding one row at a time.

What walk_cmd() is to next_cmd(), this is to bulk_cmd(): it reissues until the subtree runs out and stops there, rather than handing back one response. GETBULK overshoots the end of a subtree by design – the agent fills maxRepetitions rows whether or not they belong to what was asked for – so the tail of the last response is trimmed rather than yielded.

Parameters:
  • snmpEngine (SnmpEngine) – Class instance representing SNMP engine.

  • authData (CommunityData or UsmUserData) – Class instance representing SNMP credentials.

  • transportTarget (UdpTransportTarget or Udp6TransportTarget) – Class instance representing transport type along with SNMP peer address.

  • contextData (ContextData) – Class instance representing SNMP ContextEngineId and ContextName values.

  • nonRepeaters (int) – How many of the bindings are fetched once rather than walked.

  • maxRepetitions (int) – How many rows to ask the agent for per request. A value larger than the response can hold is answered with fewer, not an error.

  • *varBinds (ObjectType) – One or more class instances naming the subtrees to walk.

Other Parameters:

**options – The same walk options walk_cmd() takes, on top of those bulk_cmd() takes.

Yields:
  • errorIndication (str) – True value indicates SNMP engine error.

  • errorStatus (str) – True value indicates SNMP PDU error.

  • errorIndex (int) – Non-zero value refers to varBinds[errorIndex-1]

  • varBinds (tuple) – A sequence of ObjectType class instances representing MIB variables returned in this row.

Examples

>>> from pysnmp.hlapi.asyncio import *
>>>
>>> async def run():
...     async for (errorIndication, errorStatus, errorIndex,
...                varBinds) in bulk_walk_cmd(
...         SnmpEngine(),
...         CommunityData('public'),
...         UdpTransportTarget(('demo.pysnmp.com', 161)),
...         ContextData(),
...         0, 25,
...         ObjectType(ObjectIdentity('IF-MIB', 'ifTable')),
...     ):
...         print(errorIndication, errorStatus, errorIndex, varBinds)
>>>