pysnmp.sourceforge.net
HOME QUICK START DOCUMENTATION EXAMPLES DOWNLOAD
DEVELOPMENT | CONTACT |

Table of content

Network management «
PySNMP architecture
Standard SNMP Apps
Security configuration
Transport configuration
MIB variables
Other MIB Services

WARNING: you are reading historical documentation! Please, refer here.

Managed Objects names and values

On the protocol level, a Managed Object Instance is represented by a pair of Name and Value items collectively called a Variable-Binding. In PySNMP oneliner API, a Managed Object Instance is represented by a two-component sequence of two objects -- one represents Managed Object Name or Managed Object Instance Name, and the other - Managed Object Instance Value. The types of these objects may vary, details follow.

Managed Objects Names

Managed Object or Managed Object Instance Name is an instance of ObjectName class which is derived from PyASN1 ObjectIdentifier. In most cases, PySNMP oneliner API will automatically create an instance of ObjectName class from its initialization value which can be:

In order to make use of additional information related to Managed Objects, such as their human-friendly representation, associated value type, description of intended use and other details contained in MIBs, the MibVariable class instances may be used interchangeably instead of ObjectName objects.

class MibVariable( varName )

Create an object representing a varying amount of Managed Object Name information. At the bare minimum MibVariable object will only hold an OBJECT IDENTIFIER that identifies particular Managed Object. However more information on Managed Object may be gathered by PySNMP during the course of SNMP request processing. All the extra information comes through a lookup at a MIB where particular Managed Object is specified.

The mandatory varName argument must hold a valid initializer for ObjectIdentifier kind of objects.

or

class MibVariable( mibName, symName, *indices )

Create an object potentially representing all MIB information on particular Managed Object. By the moment of instantiation no additional information is acquired, but during the later stages of SNMP request processing, PySNMP will attempt to lookup additional information at the MIB named mibName for the object registered there under name symName.

If requested MIB or symbol can not be found, the PySnmpError exception will be thrown.

The mandatory mibName and symName arguments refer to the names under which particular Managed Object is specified in the MIB (e.g. 'IF-MIB' and 'ifTable' respectively). Both parameters are Python strings.

The optional indices sequence semantics depend on the type of MIB Object refered by mibName and symName parameters.

  • For MibTableColumn objects indices are a sequence of Conceptual Table Instance ID in a human-friendly form (e.g. "127.0.0.1"-indexed element of a IP-MIB::ipAdEntAddr column)
  • For MibScalar objects indices are interpreted as an sub-OBJECT IDENTIFIER

Methods of the MibVariable objects are as follows:

getMibSymbol( )

Return a sequence of mibName, symName and indices identifying arbitrary Managed Object.

getOid( )

Return Managed Object Name in form of ObjectIdentifier object.

getMibNode( )

Return MIB information in form of a Managed Object identified by this particular name.

isFullyResolved( )

Return True if MIB lookup for initial initializers was successful and complete MIB information is available.

Managed Objects Values

Managed Object Instance Value is an instance of some PyASN1 class or its SNMP-specific derivative. The latter case reflects SNMP-specific ASN.1 sub-type.

PySNMP implementation of SNMPv3 architecture always exposes, SMIv2 definitions for Managed Objects are always used regardless of the underlying SNMP protocol version being talked with a peer. For instance, an SNMPv3 Manager will always report SMIv2 types even when working to SNMPv1 Agent (which is SMIv1-compliant).

The list of Managed Object Instance Value classes follows.

class Integer( value )

Create a SMIv2 Integer object. The value parameter should be an integer value. Instances of this class mimic basic properties of a Python integer. SMIv2 Integer class is derived from PyASN1 Integer.

class Integer32( value )

Create a SMIv2 Integer32 object. This object is similar to Integer class instance.

class OctetIdentifier( value )

Create a SMIv2 OctetIdentifier object. The value parameter could be a tuple of integer sub-IDs or a human-friendly string form like ".1.3.6.1.3.1". SMIv2 OctetString class is derived from PyASN1 OctetIdentifier.

class OctetString( value )

Create a SMIv2 OctetString object. The value parameter should be a string value. Instances of this class mimic basic properties of a Python string. SMIv2 OctetString class is derived from PyASN1 OctetString.

class IpAddress( value )

Create a SMIv2 IpAddress object. The value parameter should be an IP address expressed in quad-dotted notation (e.g. "127.0.0.1"). SMIv2 IpAddress class is derived from PyASN1 OctetString.

class Counter32( value )

Create a SMIv2 Counter32 object. Besides different value constraints, this object is similar to Integer class instance.

class Gauge32( value )

Create a SMIv2 Gauge32 object. Besides different value constraints, this object is similar to Integer class instance.

class Unsigned32( value )

Create a SMIv2 Unsigned32 object. Besides different value constraints, this object is similar to Integer class instance.

class TimeTicks( value )

Create a SMIv2 TimeTicks object. Besides different value constraints, this object is similar to Integer class instance.

class Opaque( value )

Create a SMIv2 Opaque object. This object is similar to OctetString class instance.

class Counter64( value )

Create a SMIv2 Counter64 object. Besides different value constraints, this object is similar to Integer class instance.

class Bits( value )

Create a SMIv2 Bits object. The value parameter should be sequence of names of bits raised to one. Unmentioned bits default to zero. The Bits class is derived from PyASN1 OctetString.

All the above types are directly used by SNMP protocol and can be exchanged between user application and PySNMP in the course of SNMP engine operations through PySNMP APIs. However, by SNMP design, some additional information on specific Managed Objects Instances value ranges and human-friendly representation can be carried by MIBs in form of TEXTUAL-CONVENTION SMI constructs. PySNMP implements this feature in form of TextualConvention class which is actually a derivative of one of the above Managed Objects Instance Value classes so objects of these classes can be used interchangeably in all PySNMP APIs.

For more information on SNMP Managed Value objects properties, refer to their base classes in PyASN1 documentation.


Need help? Try PySNMP mailing lists or report to library maintainers.
SourceForge Logo