Search in sources :

Example 16 with AlarmData

use of org.opennms.netmgt.xml.event.AlarmData in project opennms by OpenNMS.

the class EventdIT method sendNodeDownEvent.

/**
     * @param reductionKey
     * @param node
     * @return 
     */
private Event sendNodeDownEvent(String reductionKey, OnmsNode node) {
    EventBuilder e = MockEventUtil.createNodeDownEventBuilder("Test", node);
    if (reductionKey != null) {
        AlarmData data = new AlarmData();
        data.setAlarmType(1);
        data.setReductionKey(reductionKey);
        e.setAlarmData(data);
    } else {
        e.setAlarmData(null);
    }
    e.setLogDest("logndisplay");
    e.setLogMessage("testing");
    final Event event = e.getEvent();
    m_eventdIpcMgr.sendNow(event);
    return event;
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder) OnmsEvent(org.opennms.netmgt.model.OnmsEvent) Event(org.opennms.netmgt.xml.event.Event) AlarmData(org.opennms.netmgt.xml.event.AlarmData)

Example 17 with AlarmData

use of org.opennms.netmgt.xml.event.AlarmData in project opennms by OpenNMS.

the class MockEventUtil method createNodeDownEventBuilder.

/**
     * <p>createNodeDownEventBuilder</p>
     *
     * @param source a {@link java.lang.String} object.
     * @param node a {@link org.opennms.netmgt.mock.MockNode} object.
     * @return a {@link org.opennms.netmgt.model.events.EventBuilder} object.
     */
public static EventBuilder createNodeDownEventBuilder(String source, MockNode node) {
    EventBuilder event = createNodeEventBuilder(source, EventConstants.NODE_DOWN_EVENT_UEI, node);
    event.setSeverity(OnmsSeverity.MAJOR.getLabel());
    // <alarm-data reduction-key="%uei%:%dpname%:%nodeid%" alarm-type="1" auto-clean="false" />
    AlarmData alarmData = new AlarmData();
    alarmData.setReductionKey("%uei%:%dpname%:%nodeid%");
    alarmData.setAlarmType(1);
    alarmData.setAutoClean(false);
    event.setAlarmData(alarmData);
    return event;
}
Also used : EventBuilder(org.opennms.netmgt.model.events.EventBuilder) AlarmData(org.opennms.netmgt.xml.event.AlarmData)

Example 18 with AlarmData

use of org.opennms.netmgt.xml.event.AlarmData in project opennms by OpenNMS.

the class EventTranslatorConfigFactoryTest method setUpTestCloneEvent.

@Before
public void setUpTestCloneEvent() {
    event = new Event();
    AlarmData alarmData = new AlarmData();
    List<UpdateField> updateFields = new ArrayList<UpdateField>();
    UpdateField field1 = new UpdateField();
    field1.setFieldName(SEVERITY);
    UpdateField field2 = new UpdateField();
    field2.setFieldName(LOG_MSG);
    updateFields.add(field1);
    updateFields.add(field2);
    alarmData.setUpdateFieldCollection(updateFields);
    event.setAlarmData(alarmData);
}
Also used : UpdateField(org.opennms.netmgt.xml.event.UpdateField) ArrayList(java.util.ArrayList) Event(org.opennms.netmgt.xml.event.Event) AlarmData(org.opennms.netmgt.xml.event.AlarmData) Before(org.junit.Before)

Example 19 with AlarmData

use of org.opennms.netmgt.xml.event.AlarmData in project opennms by OpenNMS.

the class MockEventUtil method createNodeDownEventWithReason.

/**
     * <p>createNodeDownEventWithReason</p>
     *
     * @param source a {@link java.lang.String} object.
     * @param node a {@link org.opennms.netmgt.mock.MockNode} object.
     * @param reason a {@link java.lang.String} object.
     * @return a {@link org.opennms.netmgt.xml.event.Event} object.
     */
public static Event createNodeDownEventWithReason(String source, MockNode node, String reason) {
    Event event = createNodeEventWithReason(source, EventConstants.NODE_DOWN_EVENT_UEI, node, reason);
    event.setSeverity(OnmsSeverity.MAJOR.getLabel());
    // <alarm-data reduction-key="%uei%:%dpname%:%nodeid%" alarm-type="1" auto-clean="false" />
    AlarmData alarmData = new AlarmData();
    alarmData.setReductionKey("%uei%:%dpname%:%nodeid%");
    alarmData.setAlarmType(1);
    alarmData.setAutoClean(false);
    event.setAlarmData(alarmData);
    return event;
}
Also used : Event(org.opennms.netmgt.xml.event.Event) AlarmData(org.opennms.netmgt.xml.event.AlarmData)

Aggregations

AlarmData (org.opennms.netmgt.xml.event.AlarmData)19 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)14 Event (org.opennms.netmgt.xml.event.Event)6 ArrayList (java.util.ArrayList)5 UpdateField (org.opennms.netmgt.xml.event.UpdateField)5 Date (java.util.Date)3 Test (org.junit.Test)3 OnmsEvent (org.opennms.netmgt.model.OnmsEvent)2 Logmsg (org.opennms.netmgt.xml.event.Logmsg)2 Parm (org.opennms.netmgt.xml.event.Parm)2 ThrowableAnticipator (org.opennms.test.ThrowableAnticipator)2 InetAddress (java.net.InetAddress)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ObjectNotFoundException (org.hibernate.ObjectNotFoundException)1 Before (org.junit.Before)1 NorthboundAlarm (org.opennms.netmgt.alarmd.api.NorthboundAlarm)1 MockNode (org.opennms.netmgt.mock.MockNode)1 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)1 Value (org.opennms.netmgt.xml.event.Value)1