|
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.SuspectEventProcessor
This class is designed to scan/capability check a suspect interface, update the database based on the information collected from the device, and generate events necessary to notify the other OpenNMS services. The constructor takes a string which is the IP address of the interface to be scanned.
Field Summary | |
(package private) java.lang.String |
m_suspectIf
IP address of new suspect interface |
private static java.lang.String |
SELECT_METHOD_MAX
|
private static java.lang.String |
SELECT_METHOD_MIN
|
private static java.lang.String |
SQL_RETRIEVE_INTERFACE_NODEID_PREFIX
SQL statement to retrieve the node identifier for a given IP address |
private static java.lang.String |
SQL_RETRIEVE_IPINTERFACES_ON_NODEID
SQL statement to retrieve the ipaddresses for a given node ID |
Constructor Summary | |
(package private) |
SuspectEventProcessor(java.lang.String ifAddress)
Constructor. |
Method Summary | |
private void |
addInterfaces(java.sql.Connection dbc,
DbNodeEntry node,
boolean useExistingNode,
java.net.InetAddress ifaddr,
IfCollector collector)
This method is responsble for inserting new entries into the ipInterface table for each interface found to be associated with the suspect interface during the capabilities scan. |
private void |
addSupportedProtocols(DbNodeEntry node,
java.net.InetAddress ifaddr,
java.util.List protocols,
boolean addrUnmanaged,
int ifIndex,
Package ipPkg)
Responsible for iterating inserting an entry into the ifServices table for each protocol supported by the interface. |
private static java.util.List |
buildLBSnmpAddressList(IfCollector collector)
Builds a list of InetAddress objects representing each of the interfaces from the IfCollector object which support SNMP and have a valid ifIndex and is a loopback interface. |
private static java.util.List |
buildSnmpAddressList(IfCollector collector)
Builds a list of InetAddress objects representing each of the interfaces from the IfCollector object which support SNMP and have a valid ifIndex. |
(package private) static java.net.InetAddress |
compareAndSelectPrimary(java.net.InetAddress currentIf,
java.net.InetAddress oldPrimary,
java.lang.String method)
Utility method which compares two InetAddress objects based on the provided method (MIN/MAX) and returns the InetAddress which is to be considered the primary interface. |
private void |
createAndSendDuplicateIpaddressEvent(int nodeId,
java.lang.String ipAddr)
This method is responsible for creating and sending a 'duplicateIPAddress' event to Eventd |
private void |
createAndSendNodeAddedEvent(DbNodeEntry nodeEntry)
This method is responsible for creating and sending a 'nodeAdded' event to Eventd |
private void |
createAndSendNodeGainedInterfaceEvent(int nodeId,
java.net.InetAddress ipAddr)
This method is responsible for creating and sending a 'nodeGainedInterface' event to Eventd |
private void |
createAndSendNodeGainedServiceEvent(DbNodeEntry nodeEntry,
java.net.InetAddress ipAddr,
java.lang.String svcName,
java.lang.String qualifier)
This method is responsible for creating and sending a 'nodeGainedService' event to Eventd |
private void |
createAndSendPrimarySnmpInterfaceChangedEvent(int nodeId,
java.net.InetAddress newPrimaryIf,
java.net.InetAddress oldPrimaryIf)
This method is responsible for generating a primarySnmpInterfaceChanged event and sending it to eventd.. |
private void |
createAndSendReinitializePrimarySnmpInterfaceEvent(int nodeId,
java.net.InetAddress primarySnmpIf)
This method is responsible for generating a reinitializePrimarySnmpInterface event and sending it to eventd. |
private DbNodeEntry |
createNode(java.sql.Connection dbc,
java.net.InetAddress ifaddr,
IfCollector collector)
This method is responsble for inserting a new node into the node table. |
private java.net.InetAddress |
determinePrimaryInterface(IfCollector collector)
This method is responsbile for determining the node's primary IP interface from among all the node's IP interfaces. |
private void |
generateSnmpDataCollectionEvents(DbNodeEntry nodeEntry,
java.net.InetAddress oldPrimary,
java.net.InetAddress newPrimary)
Determines if any SNMP data collection related events need to be generated based upon the results of the current rescan. |
private java.lang.String |
getDuplicateIpaddress(java.util.List ipListA,
java.util.List ipListB)
This method is used to verify if there is a same ipaddress existing in two sets of ipaddresses, and return the first ipaddress that is the same in both sets as a string. |
private DbNodeEntry |
getExistingNodeEntry(java.sql.Connection dbc,
IfCollector collector)
This method is responsible for determining if a node already exists in the database for the current interface. |
(package private) static int |
getIfType(java.net.InetAddress ipaddr,
IfSnmpCollector snmpc)
Utility method which determines returns the ifType for the passed IP address. |
(package private) static java.util.List |
getPrimarySnmpInterfaceFromDb(java.sql.Connection dbc,
DbNodeEntry node)
Returns a list of InetAddress object(s) of the primary SNMP interface(s) (if one or more exists). |
(package private) static boolean |
hasIfIndex(java.net.InetAddress ipaddr,
IfSnmpCollector snmpc)
Utility method which determines if the passed IfSnmpCollector object contains an ifIndex value for the passed IP address. |
void |
run()
This is where all the work of the class is done. |
private void |
sendInterfaceEvents(DbNodeEntry node,
boolean useExistingNode,
java.net.InetAddress ifaddr,
IfCollector collector)
This method is responsible for creating all the necessary interface-level events for the node and sending them to Eventd. |
(package private) static void |
setPrimarySnmpInterface(java.sql.Connection dbc,
DbNodeEntry node,
java.net.InetAddress newPrimarySnmpIf,
java.net.InetAddress oldPrimarySnmpIf)
Responsible for setting the value of the 'isSnmpPrimary' field of the ipInterface table to 'P' (Primary) for the primary SNMP interface address. |
(package private) static boolean |
supportsSnmp(java.util.List supportedProtocols)
Utility method which checks the provided list of supported protocols to determine if the SNMP service is present. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.lang.String SQL_RETRIEVE_INTERFACE_NODEID_PREFIX
private static final java.lang.String SQL_RETRIEVE_IPINTERFACES_ON_NODEID
private static final java.lang.String SELECT_METHOD_MIN
private static final java.lang.String SELECT_METHOD_MAX
java.lang.String m_suspectIf
Constructor Detail |
SuspectEventProcessor(java.lang.String ifAddress)
ifAddress
- Suspect interface address.Method Detail |
private DbNodeEntry getExistingNodeEntry(java.sql.Connection dbc, IfCollector collector) throws java.sql.SQLException
dbc
- Connection to the database.collector
- Interface collector object
java.sql.SQLException
- Thrown if an error occurs retrieving the parent nodeid from
the database.private java.lang.String getDuplicateIpaddress(java.util.List ipListA, java.util.List ipListB)
ipListA
- a collection of ip addresses.ipListB
- a collection of ip addresses.
private DbNodeEntry createNode(java.sql.Connection dbc, java.net.InetAddress ifaddr, IfCollector collector) throws java.sql.SQLException
dbc
- Database connection.ifaddr
- Suspect interfacecollector
- Interface collector containing SMB and SNMP info collected
from the remote device.
java.sql.SQLException
- if an error occurs inserting the new node.private void addInterfaces(java.sql.Connection dbc, DbNodeEntry node, boolean useExistingNode, java.net.InetAddress ifaddr, IfCollector collector) throws java.sql.SQLException
dbc
- Database connection.node
- DbNodeEntry object representing the suspect interface's parent
node table entryuseExistingNode
- False if a new node was created for the suspect interface.
True if an existing node entry was found under which the the
suspect interface is to be added.ifaddr
- Suspect interfacecollector
- Interface collector containing SMB and SNMP info collected
from the remote device.
java.sql.SQLException
- if an error occurs adding interfaces to the ipInterface
table.private void addSupportedProtocols(DbNodeEntry node, java.net.InetAddress ifaddr, java.util.List protocols, boolean addrUnmanaged, int ifIndex, Package ipPkg) throws java.sql.SQLException
node
- Node entryifaddr
- Interface addressprotocols
- List of supported protocolsaddrUnmanaged
- Boolean flag indicating if interface is managed or unmanaged
according to the Capsd configuration.ifIndex
- Interface index or -1 if index is not knownipPkg
- Poller package to which the interface belongs
java.sql.SQLException
- if an error occurs adding interfaces to the ipInterface
table.static boolean supportsSnmp(java.util.List supportedProtocols)
supportedProtocols
- List of supported protocol objects.
static boolean hasIfIndex(java.net.InetAddress ipaddr, IfSnmpCollector snmpc)
ipaddr
- IP addresssnmpc
- SNMP collection
static int getIfType(java.net.InetAddress ipaddr, IfSnmpCollector snmpc)
ipaddr
- IP addresssnmpc
- SNMP collection
static java.net.InetAddress compareAndSelectPrimary(java.net.InetAddress currentIf, java.net.InetAddress oldPrimary, java.lang.String method)
currentIf
- Interface with which to compare the 'oldPrimary' address.oldPrimary
- Primary interface to be compared against the 'currentIf'
address.method
- Comparison method to be used (either "min" or "max")
private static java.util.List buildLBSnmpAddressList(IfCollector collector)
collector
- IfCollector object containing SNMP and SMB info.
private static java.util.List buildSnmpAddressList(IfCollector collector)
collector
- IfCollector object containing SNMP and SMB info.
private java.net.InetAddress determinePrimaryInterface(IfCollector collector)
collector
- IfCollector object containing SNMP and SMB info.
public void run()
run
in interface java.lang.Runnable
static java.util.List getPrimarySnmpInterfaceFromDb(java.sql.Connection dbc, DbNodeEntry node) throws java.sql.SQLException
dbc
- Database connection.node
- DbNodeEntry object representing the interface's parent node
table entry
java.sql.SQLException
- if an error occurs updating the ipInterface tablestatic void setPrimarySnmpInterface(java.sql.Connection dbc, DbNodeEntry node, java.net.InetAddress newPrimarySnmpIf, java.net.InetAddress oldPrimarySnmpIf) throws java.sql.SQLException
dbc
- Database connection.node
- DbNodeEntry object representing the suspect interface's parent
node table entrynewPrimarySnmpIf
- New primary SNMP interface.oldPrimarySnmpIf
- Old primary SNMP interface.
java.sql.SQLException
- if an error occurs updating the ipInterface tableprivate void generateSnmpDataCollectionEvents(DbNodeEntry nodeEntry, java.net.InetAddress oldPrimary, java.net.InetAddress newPrimary)
nodeEntry
- DbNodeEntry object of the node being rescanned.oldPrimary
- Old primary SNMP interfacenewPrimary
- New primary SNMP interfaceprivate void createAndSendPrimarySnmpInterfaceChangedEvent(int nodeId, java.net.InetAddress newPrimaryIf, java.net.InetAddress oldPrimaryIf)
nodeId
- Nodeid of node being rescanned.newPrimaryIf
- new primary SNMP interface addressoldPrimaryIf
- old primary SNMP interface addressprivate void createAndSendReinitializePrimarySnmpInterfaceEvent(int nodeId, java.net.InetAddress primarySnmpIf)
nodeId
- Nodeid of node being rescanned.primarySnmpIf
- Primary SNMP interface address.private void sendInterfaceEvents(DbNodeEntry node, boolean useExistingNode, java.net.InetAddress ifaddr, IfCollector collector)
node
- DbNodeEntry object for the parent node.useExistingNode
- TRUE if existing node was used, FALSE if new node was created.ifaddr
- Target interface addresscollector
- Interface collector containing SNMP and SMB info.private void createAndSendNodeAddedEvent(DbNodeEntry nodeEntry)
nodeEntry
- DbNodeEntry object for the newly created node.private void createAndSendDuplicateIpaddressEvent(int nodeId, java.lang.String ipAddr)
nodeId
- Interface's parent node identifier.ipAddr
- Interface's IP addressprivate void createAndSendNodeGainedInterfaceEvent(int nodeId, java.net.InetAddress ipAddr)
nodeId
- Interface's parent node identifier.ipAddr
- Interface's IP addressprivate void createAndSendNodeGainedServiceEvent(DbNodeEntry nodeEntry, java.net.InetAddress ipAddr, java.lang.String svcName, java.lang.String qualifier)
nodeEntry
- Interface's parent node identifier.ipAddr
- Interface's IP addresssvcName
- Service namequalifier
- Service qualifier (typically the port on which the service was
found)
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |