puresnmp_plugins.mpm.v1 module

This module provides the plugin for SNMPv1 message processing

class puresnmp_plugins.mpm.v1.V1EncodingResult(data: bytes, security_model: SecurityModel[Any, Any] | None = None)

Bases: AbstractEncodingResult

security_model: SecurityModel[PDU, Sequence] | None = None

The security model that was applied by the message-processing module

class puresnmp_plugins.mpm.v1.V1MPM(transport_handler: Callable[[bytes], Awaitable[bytes]], lcd: Dict[str, Any])

Bases: MessageProcessingModel[V1EncodingResult, SecurityModel[PDU, Sequence]]

Message Processing Model for SNMPv1

decode(whole_msg: bytes, credentials: Credentials) PDU

Convert an SNMPv2c message into a PDU instance

async encode(request_id: int, credentials: Credentials, engine_id: bytes, context_name: bytes, pdu: PDU) V1EncodingResult

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.v1.create(transport_handler: Callable[[bytes], Awaitable[bytes]], lcd: Dict[str, Any]) MessageProcessingModel[V1EncodingResult, SecurityModel[PDU, Sequence]]

Creates a new instance for V1 message processing