Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.12'
Browse files Browse the repository at this point in the history
Conflicts:
	opennms-provision/opennms-provisiond/src/main/java/org/opennms/netmgt/provision/service/DefaultProvisionService.java
	opennms-provision/opennms-provisiond/src/test/java/org/opennms/netmgt/provision/service/NewSuspectScanTest.java
  • Loading branch information
Benjamin Reed committed Jan 9, 2014
2 parents eef7f3f + 3ebb450 commit c56178e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Expand Up @@ -1158,8 +1158,13 @@ protected OnmsNode doInsert() {

// @ipv6
final OnmsNode node = new OnmsNode(createDistPollerIfNecessary("localhost", "127.0.0.1"));
node.setLabel(hostname == null ? ipAddress : hostname);
node.setLabelSource(hostname == null ? NodeLabelSource.ADDRESS : NodeLabelSource.HOSTNAME);
if (hostname == null || ipAddress.equals(hostname)) {
node.setLabel(ipAddress);
node.setLabelSource(NodeLabelSource.ADDRESS);
} else {
node.setLabel(hostname);
node.setLabelSource(NodeLabelSource.HOSTNAME);
}
node.setForeignSource(foreignSource == null ? FOREIGN_SOURCE_FOR_DISCOVERED_NODES : foreignSource);
node.setType(NodeType.ACTIVE);
node.setLastCapsdPoll(now);
Expand Down
Expand Up @@ -100,6 +100,12 @@ public void setAttribute(String key, String value) {
m_node.setSysObjectId(value);
} else if (key.equals("sysName")) {
m_node.setSysName(value);
// If the node is labeled as just the IP address from the newSuspect that created it,
// use the SNMP sysName value instead and update the label source to indicate this
if ("A".equals(m_node.getLabelSource())) {
m_node.setLabel(value);
m_node.setLabelSource("S");
}
}

}
Expand Down
Expand Up @@ -254,6 +254,7 @@ public void testScanNewSuspectWithForeignSource() throws Exception {
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_SERVICE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(InetAddressUtils.addr("172.20.2.201")).setService("SNMP").getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_SERVICE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(InetAddressUtils.addr("172.20.2.204")).setService("SNMP").getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.REINITIALIZE_PRIMARY_SNMP_INTERFACE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(InetAddressUtils.addr("172.20.2.201")).getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_LABEL_CHANGED_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).getEvent())
anticipator.anticipateEvent(new EventBuilder(EventConstants.PROVISION_SCAN_COMPLETE_UEI, "Provisiond").setNodeid(nextNodeId).getEvent());

String foreignSource = "Testie";
Expand Down Expand Up @@ -353,6 +354,7 @@ public void testScanNewSuspectNoIpAddrTable() throws Exception {
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(ip).getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_SERVICE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(ip).setService("SNMP").getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.REINITIALIZE_PRIMARY_SNMP_INTERFACE_EVENT_UEI, "Provisiond").setNodeid(nextNodeId).setInterface(ip).getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_LABEL_CHANGED_EVENT_UEI, "Provisiond").setNodeid(1).getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.PROVISION_SCAN_COMPLETE_UEI, "Provisiond").setNodeid(nextNodeId).getEvent());

final NewSuspectScan scan = m_provisioner.createNewSuspectScan(ip, null);
Expand Down
2 changes: 1 addition & 1 deletion smoke-test/pom.xml
Expand Up @@ -9,7 +9,7 @@
<artifactId>smoke-test</artifactId>
<name>OpenNMS Smoke Test</name>
<properties>
<seleniumVersion>2.37.1</seleniumVersion>
<seleniumVersion>2.39.0</seleniumVersion>
</properties>
<dependencies>
<dependency>
Expand Down

0 comments on commit c56178e

Please sign in to comment.