use of org.opennms.netmgt.config.poller.outages.Outage in project opennms by OpenNMS.
the class ScheduledOutagesRestServiceIT method testSetOutage.
@Test
public void testSetOutage() throws Exception {
String url = "/sched-outages";
String outage = "<?xml version=\"1.0\"?>" + "<outage name='test-outage' type='specific'>" + "<time day='friday' begins='13:20:00' ends='15:30:00' />" + "<time begins='17-Feb-2012 19:20:00' ends='18-Feb-2012 22:30:00' />" + "<node id='11' />" + "</outage>";
sendPost(url, outage, 201, null);
Outage out = getXmlObject(m_jaxbContext, "/sched-outages/test-outage", 200, Outage.class);
Assert.assertNotNull(out);
Assert.assertEquals("13:20:00", out.getTimes().get(0).getBegins());
// Update the outage slightly
outage = "<?xml version=\"1.0\"?>" + "<outage name='test-outage' type='specific'>" + "<time day='friday' begins='14:20:00' ends='15:30:00' />" + "<time begins='17-Feb-2012 19:20:00' ends='18-Feb-2012 22:30:00' />" + "<node id='11' />" + "</outage>";
sendPost(url, outage, 204, null);
out = getXmlObject(m_jaxbContext, "/sched-outages/test-outage", 200, Outage.class);
Assert.assertNotNull(out);
Assert.assertEquals("14:20:00", out.getTimes().get(0).getBegins());
}
use of org.opennms.netmgt.config.poller.outages.Outage in project opennms by OpenNMS.
the class ScheduledOutagesRestService method isInterfaceInOutage.
@GET
@Path("{outageName}/interfaceInOutage/{ipAddr}")
@Produces(MediaType.TEXT_PLAIN)
public String isInterfaceInOutage(@PathParam("outageName") String outageName, @PathParam("ipAddr") String ipAddr) {
validateAddress(ipAddr);
Outage outage = getOutage(outageName);
Boolean inOutage = m_pollOutagesConfigFactory.isInterfaceInOutage(ipAddr, outage) && m_pollOutagesConfigFactory.isCurTimeInOutage(outage);
return inOutage.toString();
}
Aggregations