puresnmp_plugins.mpm.v3 module
This module contains the implementation for the SNMPv3 message-processing model
- class puresnmp_plugins.mpm.v3.V3EncodingResult(data: bytes, security_model: SecurityModel[Any, Any] | None = None)
Bases:
AbstractEncodingResult
A simple data-structure representing the output for encoded messages
- security_model: SecurityModel[PlainMessage, PlainMessage | EncryptedMessage] | None = None
The security model that was applied by the message-processing module
- class puresnmp_plugins.mpm.v3.V3MPM(transport_handler: Callable[[bytes], Awaitable[bytes]], lcd: Dict[str, Any])
Bases:
MessageProcessingModel
[V3EncodingResult
,SecurityModel
[PlainMessage
,PlainMessage
|EncryptedMessage
]]This class contains the concrete implementation for the v3 message-processing-model.
- decode(whole_msg: bytes, credentials: Credentials) PDU
Convert bytes (as received raw from the network) into an SNMP PDU
- Parameters:
whole_msg – The message as received from the network
credentials – Credentials which will be used if required by the model.
- Returns:
A plain SNMP PDU
- async encode(request_id: int, credentials: Credentials, engine_id: bytes, context_name: bytes, pdu: PDU) V3EncodingResult
Convert an SNMP PDU into raw bytes for the network.
- Parameters:
request_id – A unique ID for the request.
credentials – Credentials which are used by the model if needed (encryption, authentication, …).
engine_id – The engine-id for use in SNMPv3.
puresnmp.util
contains helper methods to create those according to the RFC.context_name – An identifier for the SNMPv3 context
pdu – The plain SNMP PDU to process
- Returns:
Raw bytes that can be sent to the network
- puresnmp_plugins.mpm.v3.create(transport_handler: Callable[[bytes], Awaitable[bytes]], lcd: Dict[str, Any]) MessageProcessingModel[V3EncodingResult, SecurityModel[PlainMessage, PlainMessage | EncryptedMessage]]
Creates a new instance of the V3 message-processing-model