Skip to content

SNMP Set Issue #1

@Alestrio

Description

@Alestrio

Hello,
I'm trying an SNMP set based on your lib.

Here's my code :

    def set_interface_vlan(self, interface_id, vlan_id):
        self.set(self.OIDS['interfaces']['sets']['vlan']+f'.{interface_id}', vlan_id)

And here's the error :

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\uvicorn\middleware\debug.py", line 96, in __call__
    raise exc from None
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\uvicorn\middleware\debug.py", line 93, in __call__
    await self.app(scope, receive, inner_send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\fastapi\applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\middleware\errors.py", line 181, in __call__
    raise exc
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\middleware\errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\exceptions.py", line 82, in __call__
    raise exc
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\routing.py", line 61, in app
    response = await func(request)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\fastapi\routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\fastapi\routing.py", line 161, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\starlette\concurrency.py", line 39, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\anyio\to_thread.py", line 28, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 805, in run_sync_in_worker_thread
    return await future
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 743, in run
    result = func(*args)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\api\api_run.py", line 65, in set_vlan_on_interface
    if gateway.set_interface_vlan(if_id, body.vlan_id):
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\api\snmp\snmpGateway.py", line 104, in set_interface_vlan
    self.set(self.OIDS['interfaces']['sets']['vlan']+f'.{interface_id}', vlan_id)
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\api\snmp\snmp_utils.py", line 60, in set
    errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().setCmd(
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\pysnmp\entity\rfc3413\oneliner\cmdgen.py", line 193, in setCmd
    for (errorIndication,
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\pysnmp\hlapi\asyncore\sync\cmdgen.py", line 214, in setCmd
    cmdgen.setCmd(snmpEngine, authData, transportTarget,
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\pysnmp\hlapi\asyncore\cmdgen.py", line 241, in setCmd
    contextData.contextName, vbProcessor.makeVarBinds(snmpEngine, varBinds),
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\pysnmp\hlapi\varbinds.py", line 34, in makeVarBinds
    elif isinstance(varBind[0][0], tuple):  # legacy
  File "C:\Users\ALESTRIO\Documents\Projet\sdn-api\venv\lib\site-packages\pysnmp\smi\rfc1902.py", line 708, in __getitem__
    raise SmiError('%s object not fully initialized' % self.__class__.__name__)
pysnmp.smi.error.SmiError: ObjectType object not fully initialized

What's the cause of this adn how to fix it ?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions