puresnmp.pdu module¶
Models for SNMP PDUs (Request/Response messages).
PDUs all have a common structure, which is handled in the
PDU class. The different (basic) PDU types only differ in
their type identifier header (f.ex. b'\xa0' for a
GetRequest).
A SNMP PDU contains the following elements:
- request-id
A unique ID used to match requests with responses. Each reques/response pair share this value.
- error-status
An integer defining an error-state. In
puresnmpthey are mapped to exceptions of the classpuresnmp.exc.ErrorResponse.- error-index
If applicable, this identifies the Request OID that caused the error (1-indexed.)
- varbinds
A key/value pair representing the payload of the PDU. For requests, the value should be
x690.types.Null
- class puresnmp.pdu.BulkGetRequest(request_id: int, non_repeaters: int, max_repeaters: int, *oids: ObjectIdentifier)¶
Bases:
PDURepresents a SNMP GetBulk request
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.EndOfMibView(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
-
Sentinel value to detect the SNMP
endOfMibViewmarker- NATURE = [TypeNature.PRIMITIVE]¶
The x690 “private/constructed” information
- TYPECLASS: TypeClass = 'context'¶
The x690 type-class (universal, application or context)
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.GetNextRequest(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
Bases:
GetRequestRepresents an SNMP GetNext Request.
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.GetRequest(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
Bases:
PDURepresents an SNMP Get Request.
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.GetResponse(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
Bases:
PDURepresents an SNMP basic response (this may be returned for other requests than GET as well).
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.InformRequest(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
Bases:
PDURepresents an SNMP Inform request
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.NoSuchInstance(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
-
Sentinel value to detect noSuchInstance
- NATURE = [TypeNature.PRIMITIVE]¶
The x690 “private/constructed” information
- TYPECLASS: TypeClass = 'context'¶
The x690 type-class (universal, application or context)
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.NoSuchObject(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
-
Sentinel value to detect noSuchObject
- NATURE = [TypeNature.PRIMITIVE]¶
The x690 “private/constructed” information
- TYPECLASS: TypeClass = 'context'¶
The x690 type-class (universal, application or context)
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.PDU(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
Bases:
X690Type[PDUContent]The superclass for SNMP Messages (GET, SET, GETNEXT, …)
- classmethod decode_raw(data: bytes, slc: slice = slice(None, None, None)) PDUContent¶
This method takes a
bytesobject and converts it to an application object. This is callable from each subclass ofPDU.
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.PDUContent(request_id: int, varbinds: List[VarBind], error_status: int = 0, error_index: int = 0)¶
Bases:
objectA helper class to wrap PDU data into a single “value” variable for x.690 types.
- class puresnmp.pdu.Report(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
Bases:
PDURepresents an SNMP report
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value
- class puresnmp.pdu.SetRequest(value: ~x690.types.TWrappedPyType | ~x690.types._SENTINEL_UNINITIALISED = <x690.types._SENTINEL_UNINITIALISED object>)¶
Bases:
PDURepresents an SNMP SET Request.
- pyvalue: TWrappedPyType | _SENTINEL_UNINITIALISED¶
The decoded (or to-be encoded) Python value