use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorEvent in project netvirt by opendaylight.
the class ArpMonitorEventListener method onMonitorEvent.
@Override
public void onMonitorEvent(MonitorEvent notification) {
Long monitorId = notification.getEventData().getMonitorId();
MacEntry macEntry = AlivenessMonitorUtils.getMacEntryFromMonitorId(monitorId);
if (macEntry == null) {
LOG.debug("No MacEntry found associated with the monitor Id {}", monitorId);
return;
}
LivenessState livenessState = notification.getEventData().getMonitorState();
if (livenessState.equals(LivenessState.Down)) {
String vpnName = macEntry.getVpnName();
String learntIp = macEntry.getIpAddress().getHostAddress();
LearntVpnVipToPort vpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, learntIp);
if (vpnVipToPort != null && macEntry.getCreatedTime().equals(vpnVipToPort.getCreationTime())) {
jobCoordinator.enqueueJob(ArpMonitoringHandler.buildJobKey(macEntry.getIpAddress().getHostAddress(), macEntry.getVpnName()), new ArpMonitorStopTask(macEntry, dataBroker, alivenessManager));
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorEvent in project genius by opendaylight.
the class AlivenessMonitor method publishNotification.
void publishNotification(final Long monitorId, final LivenessState state) {
LOG.debug("Sending notification for id {} - state {}", monitorId, state);
EventData data = new EventDataBuilder().setMonitorId(monitorId).setMonitorState(state).build();
MonitorEvent event = new MonitorEventBuilder().setEventData(data).build();
final ListenableFuture<?> eventFuture = notificationPublishService.offerNotification(event);
Futures.addCallback(eventFuture, new FutureCallback<Object>() {
@Override
public void onFailure(Throwable error) {
LOG.warn("Error in notifying listeners for id {} - state {}", monitorId, state, error);
}
@Override
public void onSuccess(Object arg) {
LOG.trace("Successful in notifying listeners for id {} - state {}", monitorId, state);
}
}, callbackExecutorService);
}
Aggregations