use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class IpInterfaceScan method run.
/** {@inheritDoc} */
@Override
public void run(final BatchTask currentPhase) {
// This call returns a collection of new ServiceDetector instances
final Collection<PluginConfig> detectorConfigs = getProvisionService().getDetectorsForForeignSource(getForeignSource() == null ? "default" : getForeignSource());
LOG.info("Detecting services for node {}/{} on address {}: found {} detectors", getNodeId(), getForeignSource(), str(getAddress()), detectorConfigs.size());
for (final PluginConfig detectorConfig : detectorConfigs) {
if (shouldDetect(detectorConfig, getAddress())) {
currentPhase.add(createDetectorTask(currentPhase, getProvisionService(), detectorConfig, getNodeId(), getAddress(), getLocation()));
}
}
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class FastFilesystemForeignSourceRepositoryTest method createForeignSource.
private ForeignSource createForeignSource(String foreignSource) throws Exception {
ForeignSource fs = new ForeignSource(foreignSource);
fs.addDetector(new PluginConfig("HTTP", "org.opennms.netmgt.provision.detector.simple.HttpDetector"));
fs.addPolicy(new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy"));
m_foreignSourceRepository.save(fs);
m_foreignSourceRepository.flush();
// Give enough time to watcher's thread to cache the requisition
Thread.sleep(2000);
return fs;
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class MockForeignSourceRepositoryTest method createForeignSource.
private ForeignSource createForeignSource(String foreignSource) throws Exception {
ForeignSource fs = new ForeignSource(foreignSource);
fs.addDetector(new PluginConfig("HTTP", "org.opennms.netmgt.provision.detector.simple.HttpDetector"));
fs.addPolicy(new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy"));
m_foreignSourceRepository.save(fs);
m_foreignSourceRepository.flush();
return fs;
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class CachingForeignSourceRepositoryTest method testDefaultForeignSource.
@Test
public void testDefaultForeignSource() throws Exception {
createRequisition();
List<String> detectorList = Arrays.asList(new String[] { "DNS", "FTP", "HTTP", "HTTPS", "ICMP", "IMAP", "LDAP", "NRPE", "POP3", "SMTP", "SNMP", "SSH" });
String uuid = UUID.randomUUID().toString();
ForeignSource defaultForeignSource = m_foreignSourceRepository.getForeignSource(uuid);
assertEquals("name must match requested foreign source repository name", uuid, defaultForeignSource.getName());
assertEquals("scan-interval must be 1 day", 86400000, defaultForeignSource.getScanInterval().getMillis());
assertEquals("foreign source must have no default policies", 0, defaultForeignSource.getPolicies().size());
List<String> fsNames = new ArrayList<String>();
for (PluginConfig config : defaultForeignSource.getDetectors()) {
fsNames.add(config.getName());
}
assertEquals("detector list must match expected defaults", detectorList, fsNames);
assertTrue("foreign source must be tagged as default", defaultForeignSource.isDefault());
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class CachingForeignSourceRepositoryTest method createForeignSource.
private ForeignSource createForeignSource(String foreignSource) throws Exception {
ForeignSource fs = new ForeignSource(foreignSource);
fs.addDetector(new PluginConfig("HTTP", "org.opennms.netmgt.provision.detector.simple.HttpDetector"));
fs.addPolicy(new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy"));
m_foreignSourceRepository.save(fs);
m_foreignSourceRepository.flush();
return fs;
}
Aggregations