The pysnmp.proto.api.alpha sub-package implements a relatively high-level, protocol version neutral API to SNMP protocol objects as a set of mix-in classes to ASN-1 based SNMP protocol objects.
To make use of the alpha API, user needs to "import" the pysnmp.proto.api.alpha package into his/her application -- importing this package causes all its components to be mixed-into corresponding low-level SNMP protocol classes (such as rfc1157.Message, rfc1157.VarBindList etc).
The constants defined in this package are:
SNMP protocol version IDs. These are used to indicate SNMP protocol version used within the Alpha API.
A dictionary of protocol implementation modules indexed by protocol version IDs. It is used for provisioning uniform access to SNMP protocol items over various SNMP versions. For example:
>>> from pysnmp.proto.api.alpha import protoVersions, protoVersionId1, protoVersionId2c >>> for protoVersionId in [ protoVersionId1, protoVersionId2c ]: ... print protoVersions[protoVersionId].Message pysnmp.proto.rfc1157.Message pysnmp.proto.rfc1905.Message >>>
SNMP PDU types. These are used to determine the type of arbitrary SNMP PDU object.
The classes provided by this package are:
A Choice of all known message versions. May be used for decoding serialized messages of opaque type into concrete SNMP message object. For example:
>>> from pysnmp.proto.api import alpha >>> someMsgStream = '0\x19\x02\x01\x00\x04\x06public\xa0\x0c\x02\x02\x02\x13\ \x02\x01\x00\x02\x01\x000\x00' >>> metaMsg = alpha.MetaMessage() >>> metaMsg.berDecode(someMsgStream) >>> metaMsg MetaMessage(1=Message(version=Version(0), community=Community('public'), pdu=Pdus(get_request=GetRequestPdu(request_id=RequestId(531), error_status=ErrorStatus(0), error_index=ErrorIndex(0), variable_bindings=VarBindList()))))
This package provides the following facilities:
Alpha API methods may raise exceptions based on pysnmp.proto.api.error.ApiError base class.