org.opennms.netmgt.utils
Class IfLabel

java.lang.Object
  extended by org.opennms.netmgt.utils.IfLabel

public class IfLabel
extends Object

A convenience class for methods to encode/decode ifLabel descriptions for storing SNMP data in an RRD file.

Author:
Mike Davidson , Lawrence Karnowski , Seth Leger , OpenNMS

Field Summary
protected static Category log
           
 
Constructor Summary
IfLabel()
           
 
Method Summary
static String getIfLabel(int nodeId, String ipAddr)
           
static String getIfLabel(String name, String descr, String physAddr)
           
static String getIfLabelfromIfIndex(int nodeId, String ipAddr, int ifIndex)
           
static String[] getIfLabels(int nodeId)
          Get the interface labels for each interface on a given node.
static Map<String,String> getInterfaceInfoFromIfLabel(Connection conn, int nodeId, String ifLabel)
          Return a map of useful SNMP information for the interface specified by the nodeId and ifLabel.
static Map<String,String> getInterfaceInfoFromIfLabel(int nodeId, String ifLabel)
          Return a map of useful SNMP information for the interface specified by the nodeId and ifLabel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Category log
Constructor Detail

IfLabel

public IfLabel()
Method Detail

getInterfaceInfoFromIfLabel

public static Map<String,String> getInterfaceInfoFromIfLabel(Connection conn,
                                                             int nodeId,
                                                             String ifLabel)
                                                      throws SQLException
Return a map of useful SNMP information for the interface specified by the nodeId and ifLabel. Essentially a "decoding" algorithm for the ifLabel.

Parameters:
conn - Database connection
nodeId - Node id
ifLabel - Interface label of format: -
Returns:
Map of SNMP info keyed by 'snmpInterface' table column names for the interface specified by nodeId and ifLabel args.
Throws:
SQLException - if error occurs accessing the database.

getInterfaceInfoFromIfLabel

public static Map<String,String> getInterfaceInfoFromIfLabel(int nodeId,
                                                             String ifLabel)
                                                      throws SQLException
Return a map of useful SNMP information for the interface specified by the nodeId and ifLabel. Essentially a "decoding" algorithm for the ifLabel. Overloaded method which first obtains a database connection from the vault.

Parameters:
nodeId - Node id
ifLabel - Interface label of format: -
Returns:
Map of SNMP info keyed by 'snmpInterface' table column names for the interface specified by nodeId and ifLabel args.
Throws:
SQLException - if error occurs accessing the database.

getIfLabels

public static String[] getIfLabels(int nodeId)
                            throws SQLException
Get the interface labels for each interface on a given node.

Throws:
SQLException

getIfLabel

public static String getIfLabel(int nodeId,
                                String ipAddr)
                         throws SQLException
Throws:
SQLException

getIfLabelfromIfIndex

public static String getIfLabelfromIfIndex(int nodeId,
                                           String ipAddr,
                                           int ifIndex)
                                    throws SQLException,
                                           NumberFormatException
Throws:
SQLException
NumberFormatException

getIfLabel

public static String getIfLabel(String name,
                                String descr,
                                String physAddr)


Copyright © 2009. All Rights Reserved.