OpenNMS API 1.2.3

org.opennms.netmgt.capsd.snmp
Class IfTableEntry

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.TreeMap
          extended byorg.opennms.netmgt.capsd.snmp.IfTableEntry
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable, java.util.SortedMap

public final class IfTableEntry
extends java.util.TreeMap

This object contains a list of all the elements defined in the MIB-II interface table. An instance object is initialized by calling the constructor and passing in a variable list from an SNMP PDU. The actual data can be recovered via the base class map interface.

Once an instance is created and its data set either via the constructor or from the update method, the actual elements can be retreived using the instance names. The names include: ifIndex,ifDescr, ifSpeed,etc al. The information can also be accessed by using the complete object identifer for the entry.

For more information on the individual fields, and to find out their respective object identifiers see RFC1213 from the IETF.

Author:
Sowmya , Weave , Jon Whetzel , OpenNMS
See Also:
RFC1213 , Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.TreeMap
 
Nested classes inherited from class java.util.AbstractMap
 
Field Summary
static java.lang.String IF_ADMIN_STATUS
           
static java.lang.String IF_DESCR
           
static java.lang.String IF_IN_DISCARDS
           
static java.lang.String IF_IN_ERRORS
           
static java.lang.String IF_IN_NUCAST
           
static java.lang.String IF_IN_OCTETS
           
static java.lang.String IF_IN_UCAST
           
static java.lang.String IF_IN_UKNOWN_PROTOS
           
static java.lang.String IF_INDEX
           
static java.lang.String IF_LAST_CHANGE
           
static java.lang.String IF_MTU
           
static java.lang.String IF_OPER_STATUS
           
static java.lang.String IF_OUT_DISCARDS
           
static java.lang.String IF_OUT_ERRORS
           
static java.lang.String IF_OUT_NUCAST
           
static java.lang.String IF_OUT_OCTETS
           
static java.lang.String IF_OUT_QLEN
           
static java.lang.String IF_OUT_UCAST
           
static java.lang.String IF_PHYS_ADDR
           
static java.lang.String IF_SPECIFIC
           
static java.lang.String IF_SPEED
           
static java.lang.String IF_TYPE
           
private static NamedSnmpVar[] ms_elemList
           The keys that will be supported by default from the TreeMap base class.
static SnmpObjectId ROOT
           The SnmpObjectId that represents the root of the interface tree.
static java.lang.String TABLE_OID
           The TABLE_OID is the object identifier that represents the root of the interface table in the MIB forest.
 
Fields inherited from class java.util.TreeMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
IfTableEntry()
           Creates a default instance of the interface table entry map.
IfTableEntry(SnmpVarBind[] vars)
           The class constructor used to initialize the object to its initial state.
 
Method Summary
static SnmpPduPacket getBulkPdu(int numInterfaces)
           This method is used to get a generic SNMPv2 GETBULK PDU that contains a single varbind -- the ifTable root oid.
static int getElementListSize()
           Returns the number of entries in the MIB-II ifTable element list.
static SnmpPduRequest getIfNumberPdu()
           This method will generate a packet that will go out and retrieve the ifNumber variable from the MIB, the variable that states the number of interfaces for the device.
static SnmpPduPacket getNextPdu()
           This method is used to get a generic SNMPv1 GETNEXT PDU that contains one varbind per member element.
static SnmpObjectId stop_oid()
           This method will determine where the cut off point will be for valid data from the response to the GETBULK packet.
 void update(SnmpVarBind[] vars)
           This method is used to update the map with the current information from the agent.
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, put, putAll, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Field Detail

IF_INDEX

public static final java.lang.String IF_INDEX
See Also:
Constant Field Values

IF_DESCR

public static final java.lang.String IF_DESCR
See Also:
Constant Field Values

IF_TYPE

public static final java.lang.String IF_TYPE
See Also:
Constant Field Values

IF_MTU

public static final java.lang.String IF_MTU
See Also:
Constant Field Values

IF_SPEED

public static final java.lang.String IF_SPEED
See Also:
Constant Field Values

IF_PHYS_ADDR

public static final java.lang.String IF_PHYS_ADDR
See Also:
Constant Field Values

IF_ADMIN_STATUS

public static final java.lang.String IF_ADMIN_STATUS
See Also:
Constant Field Values

IF_OPER_STATUS

public static final java.lang.String IF_OPER_STATUS
See Also:
Constant Field Values

IF_LAST_CHANGE

public static final java.lang.String IF_LAST_CHANGE
See Also:
Constant Field Values

IF_IN_OCTETS

public static final java.lang.String IF_IN_OCTETS
See Also:
Constant Field Values

IF_IN_UCAST

public static final java.lang.String IF_IN_UCAST
See Also:
Constant Field Values

IF_IN_NUCAST

public static final java.lang.String IF_IN_NUCAST
See Also:
Constant Field Values

IF_IN_DISCARDS

public static final java.lang.String IF_IN_DISCARDS
See Also:
Constant Field Values

IF_IN_ERRORS

public static final java.lang.String IF_IN_ERRORS
See Also:
Constant Field Values

IF_IN_UKNOWN_PROTOS

public static final java.lang.String IF_IN_UKNOWN_PROTOS
See Also:
Constant Field Values

IF_OUT_OCTETS

public static final java.lang.String IF_OUT_OCTETS
See Also:
Constant Field Values

IF_OUT_UCAST

public static final java.lang.String IF_OUT_UCAST
See Also:
Constant Field Values

IF_OUT_NUCAST

public static final java.lang.String IF_OUT_NUCAST
See Also:
Constant Field Values

IF_OUT_DISCARDS

public static final java.lang.String IF_OUT_DISCARDS
See Also:
Constant Field Values

IF_OUT_ERRORS

public static final java.lang.String IF_OUT_ERRORS
See Also:
Constant Field Values

IF_OUT_QLEN

public static final java.lang.String IF_OUT_QLEN
See Also:
Constant Field Values

IF_SPECIFIC

public static final java.lang.String IF_SPECIFIC
See Also:
Constant Field Values

ms_elemList

private static NamedSnmpVar[] ms_elemList

The keys that will be supported by default from the TreeMap base class. Each of the elements in the list are an instance of the SNMP Interface table. Objects in this list should be used by multiple instances of this class.


TABLE_OID

public static final java.lang.String TABLE_OID

The TABLE_OID is the object identifier that represents the root of the interface table in the MIB forest.

See Also:
Constant Field Values

ROOT

public static final SnmpObjectId ROOT

The SnmpObjectId that represents the root of the interface tree. It is created when the class is initialized and contains the value of TABLE_OID.

See Also:
TABLE_OID
Constructor Detail

IfTableEntry

public IfTableEntry()

Creates a default instance of the interface table entry map. The map represents a singular instance of the interface table. Each column in the table for the loaded instance may be retreived either through its name or object identifier.

The initial table is constructied with zero elements in the map.


IfTableEntry

public IfTableEntry(SnmpVarBind[] vars)

The class constructor used to initialize the object to its initial state. Although the object's attributes and data can be changed after its created, this constructor will initialize all the variables as per their named varbind in the passed array. This array should have been collected from an SnmpPduRequest that was received from a remote host.

Parameters:
vars - The array of variable bindings.
Method Detail

update

public void update(SnmpVarBind[] vars)

This method is used to update the map with the current information from the agent. The array of variables should be all the elements in the interfaces row.

This does not clear out any column in the actual ifEntry row that does not have a definition.

Parameters:
vars - The variables in the interface row.

getNextPdu

public static SnmpPduPacket getNextPdu()

This method is used to get a generic SNMPv1 GETNEXT PDU that contains one varbind per member element. The PDU can then be used to perform an SNMP walk of the MIB-II interface table on remote host via consecutive SNMPv1 GETNEXT requests.

Returns:
An SnmpPduPacket with the command of GETNEXT and one varbind for each member variable.

getBulkPdu

public static SnmpPduPacket getBulkPdu(int numInterfaces)

This method is used to get a generic SNMPv2 GETBULK PDU that contains a single varbind -- the ifTable root oid. The PDU can then be used to perform an SNMP walk of the MIB-II interface table on remote host via SNMPv2 GETBULK REQUESTS.

Returns:
An SnmpPduPacket with the command of GETBULK.

stop_oid

public static SnmpObjectId stop_oid()

This method will determine where the cut off point will be for valid data from the response to the GETBULK packet. By using the size of the element list, listed above, we can determine the proper index for this task.


getIfNumberPdu

public static SnmpPduRequest getIfNumberPdu()

This method will generate a packet that will go out and retrieve the ifNumber variable from the MIB, the variable that states the number of interfaces for the device.


getElementListSize

public static int getElementListSize()

Returns the number of entries in the MIB-II ifTable element list.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.