use of org.opennms.netmgt.poller.ServiceMonitor in project opennms by OpenNMS.
the class DefaultPollService method getServiceMonitor.
private ServiceMonitor getServiceMonitor(PolledService polledService) {
Assert.notNull(m_monitors, "setServiceMonitorLocators must be called before any other operations");
ServiceMonitor monitor = (ServiceMonitor) m_monitors.get(polledService.getSvcName());
// Assert.notNull(monitor, "Unable to find monitor for service "+polledService.getSvcName());
return monitor;
}
use of org.opennms.netmgt.poller.ServiceMonitor in project opennms by OpenNMS.
the class RadiusAuthMonitorTest method testResponses.
@Test
public void testResponses() throws Exception {
mockSrv.start(true, false);
final Map<String, Object> m = new ConcurrentSkipListMap<String, Object>();
final ServiceMonitor monitor = new RadiusAuthMonitor();
final MonitoredService svc = MonitorTestUtils.getMonitoredService(99, InetAddressUtils.addr("127.0.0.1"), "RADIUS");
m.put("user", "testing");
m.put("password", "password");
m.put("retry", "1");
m.put("secret", "testing123");
m.put("authtype", "chap");
final PollStatus status = monitor.poll(svc, m);
MockUtil.println("Reason: " + status.getReason());
assertEquals(PollStatus.SERVICE_AVAILABLE, status.getStatusCode());
}
use of org.opennms.netmgt.poller.ServiceMonitor in project opennms by OpenNMS.
the class RadiusAuthMonitorTest method testTTLSResponse.
@Test
@Ignore("have to have a EAP-TTLS radius server set up")
public void testTTLSResponse() throws Exception {
mockSrv.start(true, false);
final Map<String, Object> m = new ConcurrentSkipListMap<String, Object>();
final ServiceMonitor monitor = new RadiusAuthMonitor();
final MonitoredService svc = MonitorTestUtils.getMonitoredService(99, InetAddressUtils.addr("127.0.0.1"), "RADIUS");
m.put("user", "testing");
m.put("password", "12");
m.put("retry", "1");
m.put("secret", "testing123");
m.put("authtype", "eap-ttls");
m.put("inner-user", "anonymous");
final PollStatus status = monitor.poll(svc, m);
MockUtil.println("Reason: " + status.getReason());
System.out.println("Reason" + status.getReason());
assertEquals(PollStatus.SERVICE_AVAILABLE, status.getStatusCode());
}
use of org.opennms.netmgt.poller.ServiceMonitor in project opennms by OpenNMS.
the class RadiusAuthMonitorTest method testBadResponses.
@Test
public void testBadResponses() throws Exception {
mockSrv.start(true, false);
final Map<String, Object> m = new ConcurrentSkipListMap<String, Object>();
final ServiceMonitor monitor = new RadiusAuthMonitor();
final MonitoredService svc = MonitorTestUtils.getMonitoredService(99, InetAddressUtils.addr("127.0.0.1"), "RADIUS");
m.put("user", "testing");
m.put("password", "12");
m.put("retry", "1");
m.put("secret", "testing123");
m.put("authtype", "chap");
final PollStatus status = monitor.poll(svc, m);
MockUtil.println("Reason: " + status.getReason());
assertEquals(PollStatus.SERVICE_UNAVAILABLE, status.getStatusCode());
MockLogAppender.assertLogMatched(Level.DEBUG, "response returned, but request was not accepted");
}
use of org.opennms.netmgt.poller.ServiceMonitor in project opennms by OpenNMS.
the class RadiusAuthMonitorTest method testTimeOut.
@Test
public void testTimeOut() throws Exception {
// do not start raddius server
final Map<String, Object> m = new ConcurrentSkipListMap<String, Object>();
final ServiceMonitor monitor = new RadiusAuthMonitor();
final MonitoredService svc = MonitorTestUtils.getMonitoredService(99, InetAddressUtils.addr("127.0.0.1"), "RADIUS");
m.put("user", "testing");
m.put("password", "12");
m.put("retry", "1");
m.put("secret", "testing123");
m.put("authtype", "chap");
final PollStatus status = monitor.poll(svc, m);
MockUtil.println("Reason: " + status.getReason());
assertEquals(PollStatus.SERVICE_UNAVAILABLE, status.getStatusCode());
MockLogAppender.assertLogMatched(Level.DEBUG, "Error while attempting to connect to the RADIUS service on localhost");
}
Aggregations