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;
}
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;
}
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);
}
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;
}
Aggregations