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

Field Summary
protected static ThreadCategory log
          Constant log
 
Constructor Summary
IfLabel()
           
 
Method Summary
static String getIfLabel(int nodeId, String ipAddr)
          getIfLabel
static String getIfLabel(String name, String descr, String physAddr)
          getIfLabel
static String getIfLabelfromIfIndex(int nodeId, String ipAddr, int ifIndex)
          getIfLabelfromIfIndex
static String getIfLabelfromSnmpIfIndex(int nodeId, int ifIndex)
          Return the ifLabel as a string for the given node and ifIndex.
static String[] getIfLabels(int nodeId)
          Get the interface labels for each interface on a given node.
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 ThreadCategory log
Constant log

Constructor Detail

IfLabel

public IfLabel()
Method Detail

getInterfaceInfoFromIfLabel

public 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. Essentially a "decoding" algorithm for the ifLabel.

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.

Parameters:
nodeId - a int.
Returns:
an array of String objects.
Throws:
SQLException - if any.

getIfLabel

public static String getIfLabel(int nodeId,
                                String ipAddr)

getIfLabel

Parameters:
nodeId - a int.
ipAddr - a String object.
Returns:
a String object.

getIfLabelfromIfIndex

public static String getIfLabelfromIfIndex(int nodeId,
                                           String ipAddr,
                                           int ifIndex)

getIfLabelfromIfIndex

Parameters:
nodeId - a int.
ipAddr - a String object.
ifIndex - a int.
Returns:
a String object.

getIfLabelfromSnmpIfIndex

public static String getIfLabelfromSnmpIfIndex(int nodeId,
                                               int ifIndex)
Return the ifLabel as a string for the given node and ifIndex. Intended for use with non-ip interfaces.

Parameters:
nodeId - a int.
ifIndex - a int.
Returns:
String

getIfLabel

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

getIfLabel

Parameters:
name - a String object.
descr - a String object.
physAddr - a String object.
Returns:
a String object.


Copyright © 2011. All Rights Reserved.