puresnmp.types module

SMI Types / Structure types which are not defined in the x690 protocol (see also x690).

See RFC 1155 section 3.2.3 for a description of the types and RFC 3416 for the definition of the new types.

Note

The IPv6 type is not defined in the default RFCs and needs to be post-processed.

class puresnmp.types.Counter(value: ~typing.Union[int, ~x690.types._SENTINEL_UNINITIALISED] = <x690.types._SENTINEL_UNINITIALISED object>)

Bases: Integer

SNMP type for counters.

SIGNED = False
TAG: int = 1

The x690 identifier for the type

TYPECLASS: TypeClass = 'application'

The x690 type-class (universal, application or context)

pyvalue: Union[TWrappedPyType, _SENTINEL_UNINITIALISED]

The decoded (or to-be encoded) Python value

class puresnmp.types.Counter64(value: ~typing.Union[int, ~x690.types._SENTINEL_UNINITIALISED] = <x690.types._SENTINEL_UNINITIALISED object>)

Bases: Integer

As defined in RFC 2578

SIGNED = False
TAG: int = 6

The x690 identifier for the type

TYPECLASS: TypeClass = 'application'

The x690 type-class (universal, application or context)

pyvalue: Union[TWrappedPyType, _SENTINEL_UNINITIALISED]

The decoded (or to-be encoded) Python value

class puresnmp.types.Gauge(value: ~typing.Union[~x690.types.TWrappedPyType, ~x690.types._SENTINEL_UNINITIALISED] = <x690.types._SENTINEL_UNINITIALISED object>)

Bases: Integer

SNMP type for gauges.

SIGNED = False
TAG: int = 2

The x690 identifier for the type

TYPECLASS: TypeClass = 'application'

The x690 type-class (universal, application or context)

pyvalue: Union[TWrappedPyType, _SENTINEL_UNINITIALISED]

The decoded (or to-be encoded) Python value

class puresnmp.types.IpAddress(value: ~typing.Union[~x690.types.TWrappedPyType, ~x690.types._SENTINEL_UNINITIALISED] = <x690.types._SENTINEL_UNINITIALISED object>)

Bases: X690Type[IPv4Address]

SNMP Type for IPv4 Addresses

NATURE = [<TypeNature.PRIMITIVE: 'primitive'>, <TypeNature.CONSTRUCTED: 'constructed'>]

The x690 “private/constructed” information

TAG: int = 0

The x690 identifier for the type

TYPECLASS: TypeClass = 'application'

The x690 type-class (universal, application or context)

static decode_raw(data: bytes, slc: slice = slice(None, None, None)) IPv4Address

Converts raw-bytes to an ip-address instance

>>> IpAddress.decode_raw(b"\xc0\x00\x02\x01")
IPv4Address('192.0.2.1')
encode_raw() bytes

Converts ip-address instance into raw bytes

>>> IpAddress(ip_address('192.0.2.1')).encode_raw()
b'\xc0\x00\x02\x01'
pyvalue: Union[TWrappedPyType, _SENTINEL_UNINITIALISED]

The decoded (or to-be encoded) Python value

class puresnmp.types.NsapAddress(value: ~typing.Union[~x690.types.TWrappedPyType, ~x690.types._SENTINEL_UNINITIALISED] = <x690.types._SENTINEL_UNINITIALISED object>)

Bases: Integer

Wrapped type for an NSAP Address

TAG: int = 5

The x690 identifier for the type

TYPECLASS: TypeClass = 'application'

The x690 type-class (universal, application or context)

pyvalue: Union[TWrappedPyType, _SENTINEL_UNINITIALISED]

The decoded (or to-be encoded) Python value

class puresnmp.types.Opaque(value: Union[str, bytes, _SENTINEL_UNINITIALISED] = b'')

Bases: OctetString

The Opaque type is to be considered to carry “any” binary data.

It is up to the application to know how to interpret this data and is passed through transparently by the SNMP protocol.

TAG: int = 4

The x690 identifier for the type

TYPECLASS: TypeClass = 'application'

The x690 type-class (universal, application or context)

pyvalue: Union[TWrappedPyType, _SENTINEL_UNINITIALISED]

The decoded (or to-be encoded) Python value

class puresnmp.types.TimeTicks(value: ~typing.Union[~datetime.timedelta, int, ~x690.types._SENTINEL_UNINITIALISED] = <x690.types._SENTINEL_UNINITIALISED object>)

Bases: Integer

SNMP type for time ticks exposed as Python datetime.timedelta

SIGNED = False
TAG: int = 3

The x690 identifier for the type

TYPECLASS: TypeClass = 'application'

The x690 type-class (universal, application or context)

pythonize() Optional[timedelta]

Convert to Python type

pyvalue: Union[TWrappedPyType, _SENTINEL_UNINITIALISED]

The decoded (or to-be encoded) Python value

puresnmp.types.main() int

Entrypoint for:

python -m puresnmp.types

This will output a RST formatted document containing the available types. This function was written to generate a documentation page with the available types.