Search in sources :

Example 1 with Interface

use of org.opennms.netmgt.config.poller.outages.Interface 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);
}
Also used : Outage(org.opennms.netmgt.config.poller.outages.Outage) Time(org.opennms.netmgt.config.poller.outages.Time) Interface(org.opennms.netmgt.config.poller.outages.Interface)

Example 2 with Interface

use of org.opennms.netmgt.config.poller.outages.Interface 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);
}
Also used : Outage(org.opennms.netmgt.config.poller.outages.Outage) Time(org.opennms.netmgt.config.poller.outages.Time) SimpleDateFormat(java.text.SimpleDateFormat) Interface(org.opennms.netmgt.config.poller.outages.Interface) Date(java.util.Date)

Aggregations

Interface (org.opennms.netmgt.config.poller.outages.Interface)2 Outage (org.opennms.netmgt.config.poller.outages.Outage)2 Time (org.opennms.netmgt.config.poller.outages.Time)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1