(config, oid, non_repeaters, max_repetitions, lookup_mib, ignore_nonincreasing_oid)
Call SNMP GETBULK on an oid.
Call SNMP GETBULK on an oid.
Call SNMP GETBULK on an oid .
def snmp_bulk(config, oid, non_repeaters, max_repetitions, lookup_mib, ignore_nonincreasing_oid):
    # type: (InstanceConfig, hlapi.ObjectType, int, int, bool, bool) -> Generator
    """Call SNMP GETBULK on an oid."""

    if config.device is None:
        raise RuntimeError('No device set')  # pragma: no cover

    def callback(  # type: ignore
        snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBindTable, cbCtx
    ):
        var_bind_table = [vbProcessor.unmakeVarBinds(snmpEngine, row, lookup_mib) for row in varBindTable]
        if ignore_nonincreasing_oid and errorIndication and isinstance(errorIndication, errind.OidNotIncreasing):
            errorIndication = None
        cbCtx['error'] = errorIndication
        cbCtx['var_bind_table'] = var_bind_table

    ctx = {}  # type: Dict[str, Any]

    var_binds = [oid]
    initial_var = vbProcessor.makeVarBinds(config._snmp_engine, var_binds)[0][0]

    gen = cmdgen.BulkCommandGenerator()

    while True:
        gen.sendVarBinds(
            config._snmp_engine,
            config.device.target,
            config._context_data.contextEngineId,
            config._context_data.contextName,
            non_repeaters,
            max_repetitions,
            vbProcessor.makeVarBinds(config._snmp_engine, var_binds),
            callback,
            ctx,
        )

        config._snmp_engine.transportDispatcher.runDispatcher()

        _handle_error(ctx, config)

        for var_binds in ctx['var_bind_table']:
            name, value = var_binds[0]
            if endOfMibView.isSameTypeWith(value):
                return
            if initial_var.isPrefixOf(name):
                yield var_binds[0]
            else:
                return
def snmp_bulk ( config , oid , non_repeaters , max_repetitions , lookup_mib , ignore_nonincreasing_oid ) : # type: (InstanceConfig, hlapi.ObjectType, int, int, bool, bool) -> Generator if config . device is None : raise RuntimeError ( 'No device set' ) # pragma: no cover def callback ( # type: ignore snmpEngine , sendRequestHandle , errorIndication , errorStatus , errorIndex , varBindTable , cbCtx ) : var_bind_table = [ vbProcessor . unmakeVarBinds ( snmpEngine , row , lookup_mib ) for row in varBindTable ] if ignore_nonincreasing_oid and errorIndication and isinstance ( errorIndication , errind . OidNotIncreasing ) : errorIndication = None cbCtx [ 'error' ] = errorIndication cbCtx [ 'var_bind_table' ] = var_bind_table ctx = { } # type: Dict[str, Any] var_binds = [ oid ] initial_var = vbProcessor . makeVarBinds ( config . _snmp_engine , var_binds ) [ 0 ] [ 0 ] gen = cmdgen . BulkCommandGenerator ( ) while True : gen . sendVarBinds ( config . _snmp_engine , config . device . target , config . _context_data . contextEngineId , config . _context_data . contextName , non_repeaters , max_repetitions , vbProcessor . makeVarBinds ( config . _snmp_engine , var_binds ) , callback , ctx , ) config . _snmp_engine . transportDispatcher . runDispatcher ( ) _handle_error ( ctx , config ) for var_binds in ctx [ 'var_bind_table' ] : name , value = var_binds [ 0 ] if endOfMibView . isSameTypeWith ( value ) : return if initial_var . isPrefixOf ( name ) : yield var_binds [ 0 ] else : return