Provisiond discovers services on capsd provisioned nodes
Description
Environment
Acceptance / Success Criteria
Lucidchart Diagrams
Activity

Jeff Gehlbach January 28, 2011 at 4:04 PM
Added a return in two places where Matt thought one was missing. Fix pushed to 1.8 in commit beba04b3dd6c4d5718a4884e2acd11015534793d and cherry-picked to master in commit 670b3d142d5041018e70554a7a93436287c62dab.

David Hustace January 28, 2011 at 1:40 PM
Matt could you take a quick look at this one?

David Hustace January 28, 2011 at 1:39 PM
I think you are right.

Jeff Gehlbach January 28, 2011 at 1:19 PM
I think a small omission bug in the Provisioner.handleNewSuspect(Event) method is the root cause of this problem. There should be a "return" at the bottom of the second if() block:
@EventHandler(uei = EventConstants.NEW_SUSPECT_INTERFACE_EVENT_UEI)
public void handleNewSuspectEvent(Event e) {
final String uei = e.getUei();
final String ip = e.getInterface();
if (ip == null) {
log().error("Received a "uei" event with a null ipAddress");
}
if (!getProvisionService().isDiscoveryEnabled()) {
log().info("Ignoring "uei" event for ip "ip" since discovery handling is disabled in provisiond");
}
Runnable r = new Runnable() {
public void run() {
try {
InetAddress addr = InetAddress.getByName(ip);
NewSuspectScan scan = createNewSuspectScan(addr);
Task t = scan.createTask();
t.schedule();
t.waitFor();
} catch (UnknownHostException ex) {
log().error("Unable to convert address "ip" from "uei" event to InetAddress", ex);
} catch (InterruptedException ex) {
log().error("Task interrupted waiting for new suspect scan of "ip" to finish", ex);
} catch (ExecutionException ex) {
log().error("An expected execution occurred waiting for new suspect scan of "ip" to finish", ex);
}
}
};
m_scheduledExecutor.execute(r);
}

Tarus Balog December 12, 2010 at 10:55 AM
Completely clean install, capsd only, no provisiond being used at all. Using standard discovery with newSuspectEvents and org.opennms.provisiond.enableDiscovery set to false.
Somehow, provisiond is acting on newSuspect events. I can make this happen at will (installed fresh OpenNMS on a VM, set scan="off" in capsd for all except ICMP, discovered the office subnet - lots of HTTP, FTP, SMTP, etc. discovered).
A client reported that OpenNMS was discovering services that were set scan=off in the capsd-configuration.xml file. I suggested that it might be provisiond somehow operating on these nodes unintentionally, and that they should edit the default foreigh source and see if it helped. It did.
So, I decided to recreate the issue. Spun up a VM, installed a fresh 1.8.7, edited capsd so that scan was only set to "on" for ICMP and started discovery. It discovered a number of services besides ICMP.
Workaround: make sure your default foreign source matches your capsd-configuration.