org.opennms.netmgt.capsd.snmp
Class IpAddrTable

java.lang.Object
  extended by org.opennms.netmgt.snmp.CollectionTracker
      extended by org.opennms.netmgt.snmp.AggregateTracker
          extended by org.opennms.netmgt.capsd.snmp.SnmpTable
              extended by org.opennms.netmgt.capsd.snmp.IpAddrTable
All Implemented Interfaces:
org.opennms.netmgt.snmp.Collectable

public class IpAddrTable
extends SnmpTable

IpAddrTable uses a SnmpSession to collect the ipAddrTable entries It implements the SnmpHandler to receive notifications when a reply is received/error occurs in the SnmpSession used to send requests /recieve replies.

Author:
James Zuo , Sowmya , Weave , OpenNMS
See Also:
RFC1213

Field Summary
 
Fields inherited from class org.opennms.netmgt.snmp.CollectionTracker
GEN_ERR, NO_ERR, NO_SUCH_NAME_ERR, TOO_BIG_ERR
 
Constructor Summary
IpAddrTable(java.net.InetAddress address)
           Constructs an IpAddrTable object that is used to collect the address elements from the remote agent.
 
Method Summary
protected  SnmpTableEntry createTableEntry(org.opennms.netmgt.snmp.SnmpObjId base, org.opennms.netmgt.snmp.SnmpInstId inst, java.lang.Object val)
           
 java.net.InetAddress[] getIfAddressAndMask(int ifIndex)
           
 int getIfIndex(java.net.InetAddress address)
           
static int getIfIndex(java.util.List ipAddrEntries, java.lang.String ipAddress)
           This method is used to find the ifIndex of an interface given the interface's IP address.
static java.net.InetAddress getIpAddress(java.util.List ipAddrEntries, int ifIndex)
           This method is used to find the corresponding IP Address for the indexed interface.
static java.util.List getIpAddresses(java.util.List ipAddrEntries)
          Returns all Internet addresses in the ipAddrEntry list.
static java.util.List getIpAddresses(java.util.List ipAddrEntries, int ifIndex)
          Returns all Internet addresses at the corresponding index.
static java.lang.String getNetmask(java.util.List ipAddrEntries, int ifIndex)
           This method is used to find the corresponding netmask for the indexed interface.
protected  org.apache.log4j.Category log()
           
 
Methods inherited from class org.opennms.netmgt.capsd.snmp.SnmpTable
getEntries, reportGenErr, reportNoSuchNameErr, storeResult
 
Methods inherited from class org.opennms.netmgt.snmp.AggregateTracker
buildNextPdu, isFinished, setFailed, setTimedOut
 
Methods inherited from class org.opennms.netmgt.snmp.CollectionTracker
failed, getCollectionTracker, getParent, reportTooBigErr, setParent, timedOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IpAddrTable

public IpAddrTable(java.net.InetAddress address)

Constructs an IpAddrTable object that is used to collect the address elements from the remote agent. Once all the elements are collected, or there is an error in the collection the signaler object is notified to inform other threads.

Parameters:
address - TODO
See Also:
IpAddrTableEntry
Method Detail

createTableEntry

protected SnmpTableEntry createTableEntry(org.opennms.netmgt.snmp.SnmpObjId base,
                                          org.opennms.netmgt.snmp.SnmpInstId inst,
                                          java.lang.Object val)
Specified by:
createTableEntry in class SnmpTable

getIpAddress

public static java.net.InetAddress getIpAddress(java.util.List ipAddrEntries,
                                                int ifIndex)

This method is used to find the corresponding IP Address for the indexed interface. The list of IP Address entries are searched until the first IP Address is found for the interface. The IP Address is then returned as a string. If there is no interface corresponding to the index then a null is returned to the caller.

Parameters:
ipAddrEntries - List of IpAddrTableEntry objects to search
ifIndex - The interface index to search for
Returns:
IP Address for the indexed interface.

getIpAddresses

public static java.util.List getIpAddresses(java.util.List ipAddrEntries,
                                            int ifIndex)
Returns all Internet addresses at the corresponding index. If the address cannot be resolved then a null reference is returned.

Parameters:
ipAddrEntries - List of IpAddrTableEntry objects to search
ifIndex - The index to search for.
Returns:
list of InetAddress objects representing each of the interfaces IP addresses.

getIpAddresses

public static java.util.List getIpAddresses(java.util.List ipAddrEntries)
Returns all Internet addresses in the ipAddrEntry list. If the address cannot be resolved then a null reference is returned.

Parameters:
ipAddrEntries - List of IpAddrTableEntry objects to search
Returns:
list of InetAddress objects representing each of the interfaces IP addresses.

getIfIndex

public static int getIfIndex(java.util.List ipAddrEntries,
                             java.lang.String ipAddress)

This method is used to find the ifIndex of an interface given the interface's IP address. The list of ipAddrTable entries are searched until an interface is found which has a matching IP address. The ifIndex of that interface is then returned. If no match is found -1 is returned.

Parameters:
ipAddrEntries - List of IpAddrTableEntry objects to search
ipAddress - The IP address to search for
Returns:
ifIndex of the interface with the specified IP address

getNetmask

public static java.lang.String getNetmask(java.util.List ipAddrEntries,
                                          int ifIndex)

This method is used to find the corresponding netmask for the indexed interface. The list of IP Address table entries are searched until the first netmask address is found for the interface. The netmask is then returned as a string. If there is no interface corresponding to the index then a null is returned.

Parameters:
ipAddrEntries - List of IpAddrTableEntry objects to search
ifIndex - The interface index to search for.
Returns:
The netmask for the interface.

getIfAddressAndMask

public java.net.InetAddress[] getIfAddressAndMask(int ifIndex)

getIfIndex

public int getIfIndex(java.net.InetAddress address)

log

protected final org.apache.log4j.Category log()


Copyright © 2007. All Rights Reserved.