|
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.ReparentViaSmb
This class is designed to reparent interfaces in the database based on the SMB protocol. Specifically, if two nodes in the 'node' table have identical NetBIOS names it is assumed that those two nodes actually represent different interfaces (physical or alias'd) on the same box. The node with the lowest nodeID becomes the "reparent node" and the other nodes are considered duplicates. All interfaces under each duplicate node are then reparented under the "reparent node" and the duplicate node(s) are flagged in the database as deleted (nodeType='D').
Nested Class Summary | |
private static class |
ReparentViaSmb.LightWeightIfEntry
LightWeightIfEntry is designed to hold specific information about an IP interface in the database such as its IP address, its parent node id, and its managed status and represents a lighter weight version of the DbIpInterfaceEntry class. |
private static class |
ReparentViaSmb.LightWeightNodeEntry
This class is a lighter weight version of the DbNodeEntry class for use in SMB reparenting. |
Field Summary | |
private java.sql.Connection |
m_connection
Database connection |
private java.util.List |
m_existingNodeList
List of LightWeightNodeEntry objects intialized from the content of the 'node' table. |
private static java.util.List |
m_netbiosNamesToSkip
Contains hard-coded list of NetBIOS names which are not subject to reparenting via SMB. |
private java.util.Map |
m_reparentedIfMap
Contains a mapping of reparent nodes and the list of interfaces which were reparented under them. |
private java.util.Map |
m_reparentNodeMap
Contains of mapping of reparent nodes and the list of duplicate nodes associated with them. |
(package private) static java.lang.String |
SQL_DB_DELETE_NODE
|
(package private) static java.lang.String |
SQL_DB_REPARENT_IF_SERVICES
|
(package private) static java.lang.String |
SQL_DB_REPARENT_IP_INTERFACE
|
(package private) static java.lang.String |
SQL_DB_REPARENT_SNMP_INTERFACE
|
(package private) static java.lang.String |
SQL_DB_RETRIEVE_INTERFACES
|
(package private) static java.lang.String |
SQL_DB_RETRIEVE_NODE
|
(package private) static java.lang.String |
SQL_DB_RETRIEVE_NODES
SQL Statements |
Constructor Summary | |
private |
ReparentViaSmb()
The class' default constructor. |
|
ReparentViaSmb(java.sql.Connection connection)
Class constructor. |
Method Summary | |
private void |
buildNodeLists()
This method is responsible for building a list of existing nodes from the 'node' table and then processing that list of nodes in order to determine if there are any nodes which must be reparented because they share the same NetBIOS name with another node. |
private void |
generateEvents()
Generates appropriate events to inform other OpenNMS processes of the database changes. |
private void |
reparentInterfaces()
This method is responsible for reparenting interfaces belonging to duplicate nodes under the appropriate reparent node id. |
private void |
sendInterfaceReparentedEvent(java.lang.String ipAddr,
java.lang.String ipHostName,
int newNodeId,
int oldNodeId,
DbNodeEntry reparentNodeEntry)
This method is responsible for generating a interfaceReparented event and sending it to Eventd. |
void |
sync()
Performs reparenting if necessary and generates appropriate events to inform other OpenNMS processes of any database changes.. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final java.lang.String SQL_DB_RETRIEVE_NODES
static final java.lang.String SQL_DB_RETRIEVE_NODE
static final java.lang.String SQL_DB_RETRIEVE_INTERFACES
static final java.lang.String SQL_DB_REPARENT_IP_INTERFACE
static final java.lang.String SQL_DB_REPARENT_SNMP_INTERFACE
static final java.lang.String SQL_DB_REPARENT_IF_SERVICES
static final java.lang.String SQL_DB_DELETE_NODE
private java.sql.Connection m_connection
private java.util.List m_existingNodeList
private java.util.Map m_reparentedIfMap
private java.util.Map m_reparentNodeMap
private static java.util.List m_netbiosNamesToSkip
Constructor Detail |
private ReparentViaSmb() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
- Always thrown by the constructor.public ReparentViaSmb(java.sql.Connection connection)
connection
- Database connectionMethod Detail |
private void buildNodeLists() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs querying the database.public void sync() throws java.sql.SQLException
java.sql.SQLException
- if error occurs updating the databaseprivate void reparentInterfaces() throws java.sql.SQLException
java.sql.SQLException
- if error occurs updating the databaseprivate void generateEvents()
private void sendInterfaceReparentedEvent(java.lang.String ipAddr, java.lang.String ipHostName, int newNodeId, int oldNodeId, DbNodeEntry reparentNodeEntry)
ipAddr
- IP address of interface which was reparentedipHostName
- IP Host Name for the interfacenewNodeId
- Interface's new nodeIDoldNodeId
- Interface's old nodeIDreparentNodeEntry
- DbNodeEntry object with all info associated with the reparent
node
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |