use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class IfIndexNullIT method setUp.
@Before
public void setUp() {
MockLogAppender.setupLogging();
final MockForeignSourceRepository mfsr = new MockForeignSourceRepository();
final ForeignSource fs = new ForeignSource();
fs.setName("default");
fs.addDetector(new PluginConfig("SNMP", "org.opennms.netmgt.provision.detector.snmp.SnmpDetector"));
mfsr.putDefaultForeignSource(fs);
m_provisioner.getProvisionService().setForeignSourceRepository(mfsr);
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class MultipleImportIT method setUp.
@Before
public void setUp() {
MockLogAppender.setupLogging();
final MockForeignSourceRepository mfsr = new MockForeignSourceRepository();
final ForeignSource fs = new ForeignSource();
fs.setName("default");
fs.addDetector(new PluginConfig("ICMP", "org.opennms.netmgt.provision.service.MockServiceDetector"));
mfsr.putDefaultForeignSource(fs);
m_provisioner.getProvisionService().setForeignSourceRepository(mfsr);
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class NewSuspectScanIT method setUp.
@Before
public void setUp() throws Exception {
m_eventSubscriber.getEventAnticipator().reset();
if (m_distPollerDao.findAll().size() == 0) {
OnmsDistPoller distPoller = new OnmsDistPoller(DistPollerDao.DEFAULT_DIST_POLLER_ID);
distPoller.setLabel("localhost");
distPoller.setLocation(MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID);
distPoller.setType(OnmsMonitoringSystem.TYPE_OPENNMS);
m_distPollerDao.save(distPoller);
}
m_foreignSource = new ForeignSource();
m_foreignSource.setName("imported:");
m_foreignSource.setScanInterval(Duration.standardDays(1));
final PluginConfig detector = new PluginConfig("SNMP", "org.opennms.netmgt.provision.detector.snmp.SnmpDetector");
detector.addParameter("timeout", "1000");
detector.addParameter("retries", "0");
m_foreignSource.addDetector(detector);
m_foreignSourceRepository = new MockForeignSourceRepository();
m_foreignSourceRepository.putDefaultForeignSource(m_foreignSource);
m_provisionService.setForeignSourceRepository(m_foreignSourceRepository);
m_provisioner.start();
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class ProvisionerIT method testRequisitionedCategoriesWithPolicies.
@Test(timeout = 300000)
public void testRequisitionedCategoriesWithPolicies() throws Exception {
final int nextNodeId = m_nodeDao.getNextNodeId();
final ForeignSource fs = m_foreignSourceRepository.getForeignSource("empty");
final PluginConfig policy = new PluginConfig("addDumbCategory", NodeCategorySettingPolicy.class.getName());
policy.addParameter("category", "Dumb");
policy.addParameter("label", "test");
fs.addPolicy(policy);
m_foreignSourceRepository.save(fs);
importFromResource("classpath:/provisioner-testCategories-oneCategory.xml", Boolean.TRUE.toString());
// after import, we should have 1 category, because policies haven't been applied yet
OnmsNode n = getNodeDao().get(nextNodeId);
assertEquals(1, n.getCategories().size());
assertEquals("TotallyMadeUpCategoryName", n.getCategories().iterator().next().getName());
assertEquals(0, n.getRequisitionedCategories().size());
runPendingScans();
// when the scan has completed, both categories should have been applied
n = getNodeDao().get(nextNodeId);
assertEquals(2, n.getCategories().size());
assertTrue(n.hasCategory("TotallyMadeUpCategoryName"));
assertTrue(n.hasCategory("Dumb"));
}
use of org.opennms.netmgt.provision.persist.foreignsource.PluginConfig in project opennms by OpenNMS.
the class IpInterfaceScanTest method runTest.
/**
* Run test.
*
* @param ipAddress the IP address
* @param ipMatch the IP match
* @param expectedResult the expected result
*/
private void runTest(String ipAddress, String ipMatch, boolean expectedResult) {
PluginConfig detectorConfig = new PluginConfig();
detectorConfig.addParameter("ipMatch", ipMatch);
Assert.assertEquals(expectedResult, IpInterfaceScan.shouldDetect(detectorConfig, InetAddressUtils.addr(ipAddress)));
}
Aggregations