|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.capsd.snmp.IfXTable
The IfXTable uses a SnmpSession to collect the entries in the remote agent's interface extensions table. It implements the SnmpHandler to receive notifications and handle errors associated with the data collection. Data is collected using a series of GETNEXT PDU request to walk multiple parts of the interface table at once. The number of SNMP packets should not exceed the number of interface + 1, assuming no lost packets or error conditions occur.
Field Summary | |
private java.util.List |
m_entries
The list of interfaces from the remote's interface extensions table. |
private boolean |
m_error
Flag indicating if query was successful or if the collection failed. |
private static char[] |
m_hexDigit
|
private int |
m_ifNumber
Used for storing the ifNumber variable from the MIB, the number of interfaces a device possesses. |
private int |
m_ifNumberRequestId
The request id associated with the GetNext PDU generated to retrieve the number of interfaces associated with the remote host. |
private int |
m_responses
For SNMPv1 used to keep track of the number of SNMP response packets received. |
private Signaler |
m_signal
Used to synchronize the class to ensure that the session has finished collecting data before the value of success or failure is set, and control is returned to the caller. |
private SnmpObjectId |
m_stopAt
This will be the OID where the information should cut off from the return packet from the GETBULK command. |
private int |
m_version
Used to generate the proper command for fetching the SNMP data from the agent (via GETBULK for version 2 or GETNEXT for version 1. |
private SnmpVarBind[] |
tempStorage
Used as a temporary storage space for all the data collected from the SNMP response packets for SNMP v2. |
Constructor Summary | |
private |
IfXTable()
The default constructor is marked as private and will always throw an exception. |
|
IfXTable(SnmpSession session,
Signaler signaler)
Constructs an IfXTable object that is used to collect the interface elements from the remote agent. |
|
IfXTable(SnmpSession session,
Signaler signaler,
int version)
Constructs an IfXTable object that is used to collect the interface elements from the remote agent. |
Method Summary | |
boolean |
failed()
Returns the success or failure code for collection of the data. |
java.util.List |
getEntries()
Returns the list of entry maps that can be used to access all the information about the interface extensions table. |
void |
snmpInternalError(SnmpSession session,
int error,
SnmpSyntax pdu)
This method is part of the SnmpHandler interface and called when an internal error happens in a session. |
void |
snmpReceivedPdu(SnmpSession session,
int command,
SnmpPduPacket pdu)
This method is used to process received SNMP PDU packets from the remote agent. |
void |
snmpTimeoutError(SnmpSession session,
SnmpSyntax pdu)
This method is part of the SnmpHandler interface and is invoked when the SnmpSession does not receive a reply after exhausting the retransmission attempts. |
static java.lang.String |
toHexString(byte[] physAddr)
This method converts the physical address, normally six bytes, into a hexidecimal string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final char[] m_hexDigit
private java.util.List m_entries
The list of interfaces from the remote's interface extensions table. The list contains a set of IfXTableEntry objects that were collected from the remote host.
IfXTableEntry
private boolean m_error
Flag indicating if query was successful or if the collection failed.
private Signaler m_signal
Used to synchronize the class to ensure that the session has finished collecting data before the value of success or failure is set, and control is returned to the caller.
private int m_version
Used to generate the proper command for fetching the SNMP data from the agent (via GETBULK for version 2 or GETNEXT for version 1.
private int m_ifNumberRequestId
The request id associated with the GetNext PDU generated to retrieve the number of interfaces associated with the remote host.
private SnmpObjectId m_stopAt
This will be the OID where the information should cut off from the return packet from the GETBULK command.
private int m_ifNumber
Used for storing the ifNumber variable from the MIB, the number of interfaces a device possesses.
private SnmpVarBind[] tempStorage
Used as a temporary storage space for all the data collected from the SNMP response packets for SNMP v2. After receiving all the data, the information will be sorted so that it mimics the SNMP v1 data storage; one map per interface containing all the necessary MIB values.
private int m_responses
For SNMPv1 used to keep track of the number of SNMP response packets received. For SNMPv2 used to keep track of the total number of varbinds received in SNMP response packets. For both SNMPv1 and SNMPv2 this value is used to determine when all the necessary SNMP data has been retrieved.
Constructor Detail |
private IfXTable() throws java.lang.UnsupportedOperationException
The default constructor is marked as private and will always throw an exception. This is done to disallow the constructor to be called. Since any instance of this class must have an SnmpSession and Signaler to properly work, the correct constructor must be used.
java.lang.UnsupportedOperationException
- Always thrown from this method since it is not supported.IfXTable(SnmpSession, Signaler)
public IfXTable(SnmpSession session, Signaler signaler)
Constructs an IfXTable object that is used to collect the interface elements from the remote agent. Once all the interfaces are collected, or there is an error in the collection the signaler object is notified to inform other threads.
session
- The session with the remote agent.signaler
- The object to notify waiters.IfXTableEntry
public IfXTable(SnmpSession session, Signaler signaler, int version)
Constructs an IfXTable object that is used to collect the interface elements from the remote agent. Once all the interfaces are collected, or there is an error in the collection the signaler object is notified to inform other threads.
session
- The session with the remote agent.signaler
- The object to notify waiters.version
- SNMP version to useIfXTableEntry
Method Detail |
public boolean failed()
Returns the success or failure code for collection of the data.
public java.util.List getEntries()
Returns the list of entry maps that can be used to access all the information about the interface extensions table.
public void snmpReceivedPdu(SnmpSession session, int command, SnmpPduPacket pdu)
This method is used to process received SNMP PDU packets from the remote agent. The method is part of the SnmpHandler interface and will be invoked when a PDU is successfully decoded. The method is passed the receiving session, the PDU command, and the actual PDU packet.
When all the data has been received from the session the signaler object, initialized in the constructor, is signaled. In addition, the receiving instance will call notifyAll() on itself at the same time.
For SNMP version 2 devices, all the received data enters a temporary array. After the collecting process, the method sorts the data so that each interface has its own map.
snmpReceivedPdu
in interface SnmpHandler
session
- The SNMP Session that received the PDUcommand
- The command contained in the received pdupdu
- The actual received PDU.public void snmpInternalError(SnmpSession session, int error, SnmpSyntax pdu)
This method is part of the SnmpHandler interface and called when an internal error happens in a session. This is usually the result of an I/O error. This method will not be called if the session times out sending a packet, see snmpTimeoutError for timeout handling.
snmpInternalError
in interface SnmpHandler
session
- The session that had an unexpected errorerror
- The error conditionpdu
- The PDU being sent when the error occuredsnmpTimeoutError(org.opennms.protocols.snmp.SnmpSession, org.opennms.protocols.snmp.SnmpSyntax)
,
SnmpHandler
public void snmpTimeoutError(SnmpSession session, SnmpSyntax pdu)
This method is part of the SnmpHandler interface and is invoked when the SnmpSession does not receive a reply after exhausting the retransmission attempts.
snmpTimeoutError
in interface SnmpHandler
session
- The session invoking the error handlerpdu
- The PDU that the remote failed to respond to.SnmpHandler
public static java.lang.String toHexString(byte[] physAddr)
This method converts the physical address, normally six bytes, into a hexidecimal string. The string is not prefixed with the traditional "0x", but is the raw hexidecimal string in upper case.
NOTICE: The string is converted based on the starndard US-ASCII table. Each NIBBLE is converted to an integer and added to the character '0' (Zero).
physAddr
- The physical address to convert to a string.
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |