Utilities

This section shows general objects and helper functions that are used with this package.

Base SNMP Package

class balderhub.snmpagent.lib.utils.SnmpPackage(version: str, community: str, error_status: int, error_index: int, variable_bindings: List[VarBind])

Bases: object

Base snmp package class which describes a single SNMP package in this balderhub environment

get_value_of(oid) str | int | None

This method returns the value for the given OID that is contained in the internal variable_bindings list.

Parameters:

oid – the oid of the variable that should be returned

Returns:

the value of the given oid

class balderhub.snmpagent.lib.utils.VarBind(name: str, value: str | int | None)

Bases: object

A single var bind object which is part of the most SnmpPackage objects

PySNMP Support

balderhub.snmpagent.lib.utils.get_var_binds_from_pysnmp_response(response) List[VarBind]

Helper function that extracts the VarBind objects from a pysnmp command

Parameters:

response – the var-bind object which is returned from pysnmp

Returns:

a list with all balderhub VarBind objects