puresnmp.exc module

Exceptions for the puresnmp package.

Most exceptions in this module are based on RFC 3416

exception puresnmp.exc.AuthorizationError(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 16

The “error-status” value

exception puresnmp.exc.BadValue(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

This error is returned whenever a variable is set using an incompatible type.

DEFAULT_MESSAGE: str = 'Bad value'

Default message to report for this error (if not overridden)

IDENTIFIER: int = 3

The “error-status” value

exception puresnmp.exc.CommitFailed(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 14

The “error-status” value

exception puresnmp.exc.EmptyMessage

Bases: SnmpError

Raised when trying to decode an SNMP-Message with no content.

exception puresnmp.exc.ErrorResponse(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: SnmpError

A superclass used when the SNMP agent responded with additional error information.

DEFAULT_MESSAGE: str = 'unknown error'

Default message to report for this error (if not overridden)

IDENTIFIER: int = 0

The “error-status” value

static construct(error_status: int, offending_oid: ObjectIdentifier, message: str = '') ErrorResponse

Creates a new instance of an ErrorResponse class, using the proper subclass for the given error_status value. The message is optional, and if not specified, will use the default message for the given class.

error_status: int

the raw (int) value of the error-status as returned by the SNMP agent.

offending_oid: ObjectIdentifier

the OID identified in the error message which caused the error.

exception puresnmp.exc.FaultySNMPImplementation

Bases: SnmpError

Exception which indicates an unexpected response from an SNMP agent.

exception puresnmp.exc.GenErr(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

This error is returned for any error which is not covered in the previous error classes.

DEFAULT_MESSAGE: str = 'General Error (genErr)'

Default message to report for this error (if not overridden)

IDENTIFIER: int = 5

The “error-status” value

exception puresnmp.exc.InconsistentName(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 18

The “error-status” value

exception puresnmp.exc.InconsistentValue(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 12

The “error-status” value

exception puresnmp.exc.InvalidResponseId

Bases: SnmpError

Exception which is raised when a response is received that did not correspond to the request-id

exception puresnmp.exc.MissingPlugin(ns: str, needle: Any, haystack: List[Any])

Bases: SnmpError

Raised when a pluggable module could not be found

Parameters:
  • ns – The plugin namespace

  • needle – The identifier that was looked up

  • haystack – The known identifiers

exception puresnmp.exc.NoAccess(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

This error is returned whenever .

DEFAULT_MESSAGE: str = 'No Access!'

Default message to report for this error (if not overridden)

IDENTIFIER: int = 6

The “error-status” value

exception puresnmp.exc.NoCreation(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 11

The “error-status” value

exception puresnmp.exc.NoSuchOID(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

This error is returned in any of the following cases:

  • the targeted OID does not support “snmp-set” operations

  • the targeted OID does not exist.

  • the targeted OID is an SMI aggregate type.

  • the targeted OID does not precede a known name in the MIB view.

DEFAULT_MESSAGE: str = 'No such name/oid'

Default message to report for this error (if not overridden)

IDENTIFIER: int = 2

The “error-status” value

exception puresnmp.exc.NotInTimeWindow(oid: str, value: int, reporting: str)

Bases: SnmpError

This exception is raised when a message is outside the time window

See also

RFC-3414 - Section 3.2 - Processing an Incoming SNMP Message

Reference description on how to handle incoming messages.

exception puresnmp.exc.NotWritable(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 17

The “error-status” value

exception puresnmp.exc.ReadOnly(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

This error is returned whenever a variable is set which is not writable.

DEFAULT_MESSAGE: str = 'Value is read-only!'

Default message to report for this error (if not overridden)

IDENTIFIER: int = 4

The “error-status” value

exception puresnmp.exc.ResourceUnavailable(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 13

The “error-status” value

exception puresnmp.exc.SnmpError

Bases: Exception

Generic exception originating from the puresnmp package. Every SNMP related error inherits from this class.

exception puresnmp.exc.Timeout(message: str)

Bases: SnmpError

Wrapper for network timeouts.

This wraps both “socket.timeout” and “asyncio.TimeoutError”

exception puresnmp.exc.TooBig(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

This error is returned whenever the size of the generatred response exceeds a size-limit defined by the queried device.

DEFAULT_MESSAGE: str = 'SNMP response was too big!'

Default message to report for this error (if not overridden)

IDENTIFIER: int = 1

The “error-status” value

exception puresnmp.exc.TooManyVarbinds(num_oids: int)

Bases: SnmpError

Exception which is raised when the number of VarBinds exceeds the limit defined in RFC 3416.

exception puresnmp.exc.UndoFailed(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 15

The “error-status” value

exception puresnmp.exc.UnknownAuthModel(ns: str, needle: Any, haystack: List[Any])

Bases: MissingPlugin

Exception which is raised when working with an unsupported/unknown authentication

exception puresnmp.exc.UnknownMessageProcessingModel(ns: str, needle: Any, haystack: List[Any])

Bases: MissingPlugin

Raised if a message was not formatted according to any known model

exception puresnmp.exc.UnknownPrivacyModel(ns: str, needle: Any, haystack: List[Any])

Bases: MissingPlugin

Exception which is raised when the security model in use is unknown.

exception puresnmp.exc.UnknownSecurityModel(ns: str, needle: Any, haystack: List[Any])

Bases: MissingPlugin

This exception is raised when something goes wrong with a security model

exception puresnmp.exc.WrongEncoding(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 9

The “error-status” value

exception puresnmp.exc.WrongLength(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 8

The “error-status” value

exception puresnmp.exc.WrongType(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 7

The “error-status” value

exception puresnmp.exc.WrongValue(offending_oid: ObjectIdentifier, message: str = '', error_status: int = 0)

Bases: ErrorResponse

IDENTIFIER: int = 10

The “error-status” value