use of org.opennms.netmgt.provision.detector.snmp.SnmpDetector in project opennms by OpenNMS.
the class ProvisionerRescanExistingFalseIT method setUp.
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging(true, "ERROR");
SnmpPeerFactory.setInstance(m_snmpPeerFactory);
assertTrue(m_snmpPeerFactory instanceof ProxySnmpAgentConfigFactory);
m_eventAnticipator = m_mockEventIpcManager.getEventAnticipator();
//((TransactionAwareEventForwarder)m_provisioner.getEventForwarder()).setEventForwarder(m_mockEventIpcManager);
m_provisioner.start();
m_foreignSource = new ForeignSource();
m_foreignSource.setName("noRescanOnImport");
m_foreignSource.setScanInterval(Duration.standardDays(1));
final PluginConfig icmpDetector = new PluginConfig("ICMP", IcmpDetector.class.getName());
icmpDetector.addParameter("timeout", "500");
icmpDetector.addParameter("retries", "0");
m_foreignSource.addDetector(icmpDetector);
final PluginConfig snmpDetector = new PluginConfig("SNMP", SnmpDetector.class.getName());
snmpDetector.addParameter("timeout", "500");
snmpDetector.addParameter("retries", "0");
m_foreignSource.addDetector(snmpDetector);
m_foreignSourceRepository = new MockForeignSourceRepository();
m_foreignSourceRepository.save(m_foreignSource);
m_foreignSourceRepository.flush();
m_provisionService.setForeignSourceRepository(m_foreignSourceRepository);
m_scheduledExecutor.pause();
}
use of org.opennms.netmgt.provision.detector.snmp.SnmpDetector in project opennms by OpenNMS.
the class ProvisionerIT method setUp.
@Before
public void setUp() throws Exception {
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);
}
SnmpPeerFactory.setInstance(m_snmpPeerFactory);
assertTrue(m_snmpPeerFactory instanceof ProxySnmpAgentConfigFactory);
// ensure this property is unset for tests and set it only in tests that need it
System.getProperties().remove("org.opennms.provisiond.enableDeletionOfRequisitionedEntities");
m_eventAnticipator = m_mockEventIpcManager.getEventAnticipator();
m_provisioner.start();
m_foreignSource = new ForeignSource();
m_foreignSource.setName("imported:");
m_foreignSource.setScanInterval(Duration.standardDays(1));
final PluginConfig policy = new PluginConfig("setCategory", NodeCategorySettingPolicy.class.getName());
policy.addParameter("category", "TestCategory");
policy.addParameter("label", "localhost");
m_foreignSource.addPolicy(policy);
m_foreignSourceRepository = new MockForeignSourceRepository();
m_foreignSourceRepository.save(m_foreignSource);
final ForeignSource emptyForeignSource = new ForeignSource();
emptyForeignSource.setName("empty");
emptyForeignSource.setScanInterval(Duration.standardDays(1));
m_foreignSourceRepository.save(emptyForeignSource);
final ForeignSource snmpForeignSource = new ForeignSource();
snmpForeignSource.setName("snmp");
snmpForeignSource.setScanInterval(Duration.standardDays(1));
final PluginConfig snmpDetector = new PluginConfig("SNMP", SnmpDetector.class.getName());
snmpForeignSource.addDetector(snmpDetector);
m_foreignSourceRepository.save(snmpForeignSource);
m_foreignSourceRepository.flush();
m_provisionService.setForeignSourceRepository(m_foreignSourceRepository);
// make sure node scan scheduler is running initially
getScanExecutor().resume();
getScheduledExecutor().pause();
}
Aggregations