use of org.opennms.netmgt.config.poller.outages.Time in project opennms by OpenNMS.
the class MockPollerConfig method addScheduledOutage.
public void addScheduledOutage(Package pkg, String outageName, String dayOfWeek, String beginTime, String endTime, String ipAddr) {
Outage outage = new Outage();
outage.setName(outageName);
outage.setType("weekly");
Interface iface = new Interface();
iface.setAddress(ipAddr);
outage.addInterface(iface);
Time time = new Time();
time.setDay(dayOfWeek);
time.setBegins(beginTime);
time.setEnds(endTime);
outage.addTime(time);
getObject().addOutage(outage);
pkg.addOutageCalendar(outageName);
}
use of org.opennms.netmgt.config.poller.outages.Time in project opennms by OpenNMS.
the class MockPollerConfig method addScheduledOutage.
/**
* Adds a scehduled outage to pkg from begin to end, for the nodeid
* @param pkg - the package to which
* @param outageName - a name, arbitrary
* @param begin - time, in seconds since epoch, when the outage starts
* @param end - time, in seconds since the epoch, when the outage ends
* @param nodeid - the node the outage applies to
*/
public void addScheduledOutage(Package pkg, String outageName, long begin, long end, int nodeid) {
Outage outage = new Outage();
outage.setName(outageName);
Node node = new Node();
node.setId(nodeid);
outage.addNode(node);
Time time = new Time();
Date beginDate = new Date(begin);
Date endDate = new Date(end);
time.setBegins(new SimpleDateFormat(BasicScheduleUtils.FORMAT1).format(beginDate));
time.setEnds(new SimpleDateFormat(BasicScheduleUtils.FORMAT1).format(endDate));
outage.addTime(time);
getObject().addOutage(outage);
pkg.addOutageCalendar(outageName);
}
use of org.opennms.netmgt.config.poller.outages.Time in project opennms by OpenNMS.
the class MockPollerConfig method addScheduledOutage.
public void addScheduledOutage(Package pkg, String outageName, long begin, long end, String ipAddr) {
Outage outage = new Outage();
outage.setName(outageName);
Interface iface = new Interface();
iface.setAddress(ipAddr);
outage.addInterface(iface);
Time time = new Time();
Date beginDate = new Date(begin);
Date endDate = new Date(end);
time.setBegins(new SimpleDateFormat(BasicScheduleUtils.FORMAT1).format(beginDate));
time.setEnds(new SimpleDateFormat(BasicScheduleUtils.FORMAT1).format(endDate));
outage.addTime(time);
getObject().addOutage(outage);
pkg.addOutageCalendar(outageName);
}
Aggregations