X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=nbinotifications%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fnbinotifications%2Flistener%2FNbiNotificationsListenerImpl.java;h=37b4c0181618044108e0d79435ca70ad5a7fa102;hb=274148a8d813140f86e1f9770ba992b072c1a5cd;hp=e72b2282a82f26827719ba0583167d6a8926b8cc;hpb=c3a98ef9475e9ce8ec866978df75394c3df639bf;p=transportpce.git diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java index e72b2282a..37b4c0181 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java @@ -9,59 +9,62 @@ package org.opendaylight.transportpce.nbinotifications.listener; import java.util.Map; import org.opendaylight.transportpce.nbinotifications.producer.Publisher; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NbiNotificationsListenerImpl implements NbiNotificationsListener { private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsListenerImpl.class); - private final Map> publishersServiceMap; + private final Map> publishersServiceMap; private final Map> publishersAlarmMap; - public NbiNotificationsListenerImpl(Map> publishersServiceMap, + public NbiNotificationsListenerImpl(Map> publishersServiceMap, Map> publishersAlarmMap) { this.publishersServiceMap = publishersServiceMap; this.publishersAlarmMap = publishersAlarmMap; } @Override - public void onPublishNotificationService(PublishNotificationService notification) { + public void onPublishNotificationProcessService(PublishNotificationProcessService notification) { LOG.info("Receiving request for publishing notification service"); - String topic = notification.getTopic(); - if (!publishersServiceMap.containsKey(topic)) { - LOG.error("Unknown topic {}", topic); + String publisherName = notification.getPublisherName(); + if (!publishersServiceMap.containsKey(publisherName)) { + LOG.error("Unknown publisher {}", publisherName); return; } - Publisher publisher = publishersServiceMap.get(topic); - publisher.sendEvent(new NotificationServiceBuilder().setCommonId(notification.getCommonId()) - .setConnectionType(notification.getConnectionType()).setMessage(notification.getMessage()) + Publisher publisher = publishersServiceMap.get(publisherName); + publisher.sendEvent(new NotificationProcessServiceBuilder() + .setCommonId(notification.getCommonId()) + .setConnectionType(notification.getConnectionType()) + .setMessage(notification.getMessage()) .setOperationalState(notification.getOperationalState()) .setResponseFailed(notification.getResponseFailed()) .setServiceAEnd(notification.getServiceAEnd()) .setServiceName(notification.getServiceName()) - .setServiceZEnd(notification.getServiceZEnd()).build(), notification.getConnectionType().getName()); + .setServiceZEnd(notification.getServiceZEnd()) + .build(), notification.getConnectionType().getName()); } @Override public void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) { LOG.info("Receiving request for publishing notification alarm service"); - String topic = notification.getTopic(); - if (!publishersAlarmMap.containsKey(topic)) { - LOG.error("Unknown topic {}", topic); + String publisherName = notification.getPublisherName(); + if (!publishersAlarmMap.containsKey(publisherName)) { + LOG.error("Unknown topic {}", publisherName); return; } - Publisher publisherAlarm = publishersAlarmMap.get(topic); - publisherAlarm.sendEvent(new NotificationAlarmServiceBuilder().setConnectionType(notification - .getConnectionType()) + Publisher publisherAlarm = publishersAlarmMap.get(publisherName); + publisherAlarm.sendEvent(new NotificationAlarmServiceBuilder() + .setConnectionType(notification.getConnectionType()) .setMessage(notification.getMessage()) .setOperationalState(notification.getOperationalState()) .setServiceName(notification.getServiceName()) - .build(), "alarm" + notification.getConnectionType().getName()); + .build(), "alarm" + notification.getConnectionType().getName()); } }