(config, oids, lookup_mib)
return ctx['var_binds']
Call SNMP GET on a list of oids.
Call SNMP GET on a list of oids.
Call SNMP GET on a list of oids .
def snmp_get(config, oids, lookup_mib):
    # type: (InstanceConfig, list, bool) -> list
    """Call SNMP GET on a list of oids."""

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

    def callback(  # type: ignore
        snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBinds, cbCtx
    ):
        var_binds = vbProcessor.unmakeVarBinds(snmpEngine, varBinds, lookup_mib)

        cbCtx['error'] = errorIndication
        cbCtx['var_binds'] = var_binds

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

    var_binds = vbProcessor.makeVarBinds(config._snmp_engine, oids)

    cmdgen.GetCommandGenerator().sendVarBinds(
        config._snmp_engine,
        config.device.target,
        config._context_data.contextEngineId,
        config._context_data.contextName,
        var_binds,
        callback,
        ctx,
    )

    config._snmp_engine.transportDispatcher.runDispatcher()

    _handle_error(ctx, config)

    return ctx['var_binds']
def snmp_get ( config , oids , lookup_mib ) : # type: (InstanceConfig, list, bool) -> list if config . device is None : raise RuntimeError ( 'No device set' ) # pragma: no cover def callback ( # type: ignore snmpEngine , sendRequestHandle , errorIndication , errorStatus , errorIndex , varBinds , cbCtx ) : var_binds = vbProcessor . unmakeVarBinds ( snmpEngine , varBinds , lookup_mib ) cbCtx [ 'error' ] = errorIndication cbCtx [ 'var_binds' ] = var_binds ctx = { } # type: Dict[str, Any] var_binds = vbProcessor . makeVarBinds ( config . _snmp_engine , oids ) cmdgen . GetCommandGenerator ( ) . sendVarBinds ( config . _snmp_engine , config . device . target , config . _context_data . contextEngineId , config . _context_data . contextName , var_binds , callback , ctx , ) config . _snmp_engine . transportDispatcher . runDispatcher ( ) _handle_error ( ctx , config ) return ctx [ 'var_binds' ]