Refactor NBINotifications and serviceHandlerImpl 26/97126/11
authorThierry Jiao <thierry.jiao@orange.com>
Tue, 10 Aug 2021 09:21:36 +0000 (11:21 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Thu, 26 Aug 2021 07:36:40 +0000 (09:36 +0200)
This refactoring renames the models in YANG nbi-notifications file.
It also corrects a few typos, notifications and simplifies conditions.

Signed-off-by: Thierry Jiao <thierry.jiao@orange.com>
Change-Id: Ia23d44b2a158b4828b68c4a9ab2df0dcb121f034

41 files changed:
api/src/main/yang/nbi-notifications@2021-08-13.yang [moved from api/src/main/yang/nbi-notifications@2021-06-28.yang with 86% similarity]
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/impl/DmaapClientProvider.java
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImpl.java
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/EventsApi.java
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/JsonConfigurator.java
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceModule.java [moved from dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationServiceModule.java with 73% similarity]
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceSerializer.java [moved from dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationServiceSerializer.java with 74% similarity]
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceAEndSerializer.java
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceZEndSerializer.java
dmaap-client/src/test/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImplTest.java
lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java
lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImpl.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProvider.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializer.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializer.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializer.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/utils/NbiNotificationsUtils.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/consumer/SubscriberTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImplTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImplTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/producer/PublisherTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializerTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializerTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializerTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializerTest.java
nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/utils/NotificationServiceDataUtils.java
nbinotifications/src/test/resources/event.json
nbinotifications/src/test/resources/expected_event.json
nbinotifications/src/test/resources/expected_event_alarm_service.json
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListener.java
servicehandler/src/main/resources/OSGI-INF/blueprint/servicehandler-blueprint.xml
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImplTest.java
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListenerTest.java
tests/transportpce_tests/common/test_utils.py
tests/transportpce_tests/with_docker/test02_nbinotifications.py

similarity index 86%
rename from api/src/main/yang/nbi-notifications@2021-06-28.yang
rename to api/src/main/yang/nbi-notifications@2021-08-13.yang
index d61c3993a56aeb56c61338279279d182699be33c..4bed2f803ff2ce422943ae979fd7f080d4978902 100644 (file)
@@ -24,6 +24,11 @@ module nbi-notifications {
     "YANG definitions for using REST API in NBI notifications module. Copyright
      (c) 2020 ORANGE and others. All rights reserved.";
 
+  revision 2021-08-13 {
+    description
+      "Rename the groupings, containers and RPCs";
+  }
+
   revision 2021-06-28 {
     description
       "Implement new models, RPC for service alarms";
@@ -34,7 +39,7 @@ module nbi-notifications {
       "Initial revision of NBI notifications";
   }
 
-  grouping notification-service {
+  grouping notification-process-service {
     leaf message {
       type string;
       mandatory true;
@@ -103,10 +108,10 @@ module nbi-notifications {
     }
   }
 
-  container notification-service {
+  container notification-process-service {
     description
       "Model used to send a notification from a service request";
-    uses notification-service;
+    uses notification-process-service;
   }
 
   container notification-alarm-service {
@@ -115,7 +120,7 @@ module nbi-notifications {
     uses notification-alarm-service;
     }
 
-  rpc get-notifications-service {
+  rpc get-notifications-process-service {
     description "Get the notifications service sent by ServiceHandler through filtering connection type";
     input {
       leaf connection-type {
@@ -138,8 +143,8 @@ module nbi-notifications {
       }
     }
     output {
-      list notification-service {
-        uses notification-service;
+      list notifications-process-service {
+        uses notification-process-service;
       }
     }
   }
@@ -167,30 +172,30 @@ module nbi-notifications {
       }
     }
     output {
-      list notification-alarm-service {
+      list notifications-alarm-service {
         uses notification-alarm-service;
       }
     }
   }
 
-  notification publish-notification-service {
-    description "Publish the notifications service for topic";
-    leaf topic {
+  notification publish-notification-process-service {
+    description "Publish the notifications service through a publisher";
+    leaf publisher-name {
       type string;
       mandatory true;
       description
-        "Topic where to send the notification service";
+        "Name of the publisher";
      }
-     uses notification-service;
+     uses notification-process-service;
   }
 
   notification publish-notification-alarm-service {
-    description "Publish the notifications service alarm for topic";
-    leaf topic {
+    description "Publish the notifications service alarm through a publisher";
+    leaf publisher-name {
       type string;
       mandatory true;
       description
-        "Topic where to send the notification service alarm";
+        "Name of the publisher";
      }
      uses notification-alarm-service;
   }
index 1da61d040f0c7ab2dc03fac4794b9ea0a9caa166..63bee535759a193a9fbd5a6ee41b3654db684f94 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.transportpce.dmaap.client.impl;
 
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.transportpce.dmaap.client.listener.NbiNotificationsListenerImpl;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index d5003ce128a9fcf04e883614060a6f6a83379757..4a91e6a4cf1d80cb2c9572797af898cc57a3d442 100644 (file)
@@ -17,9 +17,9 @@ import org.glassfish.jersey.logging.LoggingFeature;
 import org.opendaylight.transportpce.dmaap.client.resource.EventsApi;
 import org.opendaylight.transportpce.dmaap.client.resource.config.JsonConfigurator;
 import org.opendaylight.transportpce.dmaap.client.resource.model.CreatedEvent;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
-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.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,7 +43,7 @@ public class NbiNotificationsListenerImpl implements NbiNotificationsListener {
     }
 
     @Override
-    public void onPublishNotificationService(PublishNotificationService notification) {
+    public void onPublishNotificationProcessService(PublishNotificationProcessService notification) {
         try {
             CreatedEvent response = api.sendEvent(topic, notification);
             LOG.info("Response received {}", response);
index b1a5ae03659151a58c1238591a8bb6f9703eb5d6..e6f167824b5fe5be45a55bec1e35c6e6384bd72f 100644 (file)
@@ -14,7 +14,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import org.opendaylight.transportpce.dmaap.client.resource.model.CreatedEvent;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
 
 @Path("/events")
 public interface EventsApi {
@@ -23,6 +23,6 @@ public interface EventsApi {
     @Consumes(MediaType.APPLICATION_JSON)
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/{topic}")
-    CreatedEvent sendEvent(@PathParam("topic") String topic, PublishNotificationService event);
+    CreatedEvent sendEvent(@PathParam("topic") String topic, PublishNotificationProcessService event);
 
 }
index 62676c0ee4a947d1bfeaa11b466aefb7dc2ef567..d6035d2059462f53557ef4fd0473642700a03984 100644 (file)
@@ -22,7 +22,7 @@ public class JsonConfigurator implements ContextResolver<ObjectMapper> {
         mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
         mapper.enable(SerializationFeature.INDENT_OUTPUT);
         mapper.registerModule(new JavaTimeModule());
-        mapper.registerModule(new PublishNotificationServiceModule());
+        mapper.registerModule(new PublishNotificationProcessServiceModule());
     }
 
     @Override
@@ -13,19 +13,19 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev1
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.Lgx;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.Port;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEnd;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEnd;
 
 //This class is a temporary workaround while waiting jackson
 //support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
-public class PublishNotificationServiceModule extends SimpleModule {
+public class PublishNotificationProcessServiceModule extends SimpleModule {
 
     private static final long serialVersionUID = 1L;
 
-    public PublishNotificationServiceModule() {
+    public PublishNotificationProcessServiceModule() {
         super(PackageVersion.VERSION);
-        addSerializer(PublishNotificationService.class, new PublishNotificationServiceSerializer());
+        addSerializer(PublishNotificationProcessService.class, new PublishNotificationProcessServiceSerializer());
         addSerializer(Lgx.class, new LgxSerializer());
         addSerializer(Port.class, new PortSerializer());
         addSerializer(RxDirection.class, new RxDirectionSerializer());
@@ -11,19 +11,19 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.databind.SerializerProvider;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 import java.io.IOException;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
 
 // This class is a temporary workaround while waiting jackson
 // support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
-public class PublishNotificationServiceSerializer extends StdSerializer<PublishNotificationService> {
+public class PublishNotificationProcessServiceSerializer extends StdSerializer<PublishNotificationProcessService> {
     private static final long serialVersionUID = 1L;
 
-    public PublishNotificationServiceSerializer() {
-        super(PublishNotificationService.class);
+    public PublishNotificationProcessServiceSerializer() {
+        super(PublishNotificationProcessService.class);
     }
 
     @Override
-    public void serialize(PublishNotificationService value, JsonGenerator gen, SerializerProvider provider)
+    public void serialize(PublishNotificationProcessService value, JsonGenerator gen, SerializerProvider provider)
             throws IOException {
         if (value != null) {
             gen.writeStartObject();
@@ -31,7 +31,7 @@ public class PublishNotificationServiceSerializer extends StdSerializer<PublishN
             gen.writeStringField("message", value.getMessage());
             gen.writeStringField("response-failed", value.getResponseFailed());
             gen.writeStringField("service-name", value.getServiceName());
-            gen.writeStringField("topic", value.getTopic());
+            gen.writeStringField("publisher-name", value.getPublisherName());
             if (value.getOperationalState() != null) {
                 gen.writeStringField("operational-state", value.getOperationalState().getName());
             }
index 8e28cb46d628818be030c8724ae057b132465443..e05e0fcbb6f91ab923d4b6cee91a51e509a15444 100644 (file)
@@ -11,7 +11,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.databind.SerializerProvider;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 import java.io.IOException;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEnd;
 
 // This class is a temporary workaround while waiting jackson
 // support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
index 485d00ac55865851c3bcf5f8adaf45134106b165..2e1ae283596e3da6a2eb9e5c96bd326333d01425 100644 (file)
@@ -11,7 +11,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.databind.SerializerProvider;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 import java.io.IOException;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEnd;
 
 // This class is a temporary workaround while waiting jackson
 // support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
index 39bdc0c563d81a0bb30600be6c125e69553f9cf2..0b1a4512f55a71ac62157961ca0b4dc7815f6134 100644 (file)
@@ -19,16 +19,17 @@ import org.glassfish.jersey.test.JerseyTest;
 import org.glassfish.jersey.test.TestProperties;
 import org.junit.Test;
 import org.opendaylight.transportpce.dmaap.client.resource.EventsApiStub;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.LoggerFactory;
 
@@ -47,15 +48,15 @@ public class NbiNotificationsListenerImplTest extends JerseyTest {
         listAppender.start();
         logger.addAppender(listAppender);
         NbiNotificationsListener listener = new NbiNotificationsListenerImpl("http://localhost:9998", null, null);
-        PublishNotificationService notification = new PublishNotificationServiceBuilder().setCommonId("CommonId")
+        PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
+                .setCommonId("CommonId")
                 .setMessage("Service implemented")
                 .setOperationalState(State.InService)
-                .setTopic("topic")
+                .setPublisherName("publisher")
                 .setConnectionType(ConnectionType.Service)
                 .setServiceAEnd(new ServiceAEndBuilder()
                         .setClli("clli")
-                        .setNodeId(new org.opendaylight.yang.gen.v1.http
-                                .org.openroadm.common.node.types.rev181130.NodeIdType("nodeidtype"))
+                        .setNodeId(new NodeIdType("nodeidtype"))
                         .setServiceFormat(ServiceFormat.Ethernet)
                         .setServiceRate(Uint32.valueOf(100))
                         .setRxDirection(new RxDirectionBuilder().build())
@@ -63,16 +64,15 @@ public class NbiNotificationsListenerImplTest extends JerseyTest {
                         .build())
                 .setServiceZEnd(new ServiceZEndBuilder()
                         .setClli("clli")
-                        .setNodeId(new org.opendaylight.yang.gen.v1.http
-                                .org.openroadm.common.node.types.rev181130.NodeIdType("nodeidtype"))
+                        .setNodeId(new NodeIdType("nodeidtype"))
                         .setServiceFormat(ServiceFormat.Ethernet)
                         .setServiceRate(Uint32.valueOf(100))
                         .setRxDirection(new RxDirectionBuilder().build())
                         .setTxDirection(new TxDirectionBuilder().build())
                         .build())
                 .build();
-        listener.onPublishNotificationService(notification);
-        // as onPublishNotificationService is a void method, we check log message to be sur everything went well
+        listener.onPublishNotificationProcessService(notification);
+        // as onPublishNotificationService is a void method, we check log message to be sure everything went well
         List<ILoggingEvent> logsList = listAppender.list;
         assertEquals("Response received CreatedEvent [serverTimeMs=1, count=1]", logsList.get(1).getFormattedMessage());
 
index 7ea47d2780420d1884ea15bcb063c62226a892a0..6a6d2506d41de01dca234c987825097bfa885109 100644 (file)
@@ -122,9 +122,9 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
     /**
      * List of publisher topics.
      */
-    private final List<String> publisherTopicList = Arrays.asList("PceListener", "ServiceHandlerOperations",
+    private final List<String> publisherServiceList = Arrays.asList("PceListener", "ServiceHandlerOperations",
             "ServiceHandler", "RendererListener");
-    private final List<String> publisherTopicAlarmList = Arrays.asList("ServiceListener");
+    private final List<String> publisherAlarmList = Arrays.asList("ServiceListener");
 
     public TransportPCEImpl(LightyServices lightyServices, boolean activateNbiNotification) {
         LOG.info("Initializing transaction providers ...");
@@ -200,7 +200,7 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
                 lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
         ServicehandlerImpl servicehandler = new ServicehandlerImpl(lightyServices.getBindingDataBroker(),
             pathComputationService, rendererServiceOperations, lightyServices.getBindingNotificationPublishService(),
-            pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations, "N/A");
+            pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations);
         servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(),
                 lightyServices.getRpcProviderService(), lightyServices.getNotificationService(),
                 serviceDataStoreOperations, pceListenerImpl, serviceListener, rendererListenerImpl,
@@ -229,7 +229,7 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
         if (activateNbiNotification) {
             LOG.info("Creating nbi-notifications beans ...");
             nbiNotificationsProvider = new NbiNotificationsProvider(
-                    publisherTopicList, publisherTopicAlarmList, null, null, lightyServices.getRpcProviderService(),
+                    publisherServiceList, publisherAlarmList, null, null, lightyServices.getRpcProviderService(),
                     lightyServices.getNotificationService(), lightyServices.getAdapterContext().currentSerializer());
         }
     }
index 2b2575c3019886f6dae776235b7d2c822fce2e67..e4c88df0f93045ce4a6cb0800b456f9c3e3894b8 100644 (file)
@@ -348,7 +348,7 @@ public final class TPCEUtils {
                     .getInstance(),
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.$YangModuleInfoImpl
                     .getInstance(),
-            org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.$YangModuleInfoImpl
+            org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.$YangModuleInfoImpl
                     .getInstance());
 
     private static final Set<YangModuleInfo> TPCE_YANG_MODEL = Stream.concat(
index 60fd5517f71edbe1ce4fd958a665cc868b30f52e..77f6f8552c3cf590a60f2d82cb0fb98a30f0de07 100644 (file)
@@ -13,15 +13,17 @@ import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.nbinotifications.consumer.Subscriber;
 import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceDeserializer;
 import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceDeserializer;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceInput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceOutputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceInput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceOutputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
@@ -29,37 +31,32 @@ import org.slf4j.LoggerFactory;
 
 public class NbiNotificationsImpl implements NbiNotificationsService {
     private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsImpl.class);
-    private final JsonStringConverter<org.opendaylight.yang.gen.v1
-        .nbi.notifications.rev210628.NotificationService> converterService;
-    private final JsonStringConverter<org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.NotificationAlarmService> converterAlarmService;
+    private final JsonStringConverter<NotificationProcessService> converterService;
+    private final JsonStringConverter<NotificationAlarmService> converterAlarmService;
     private final String server;
 
-    public NbiNotificationsImpl(JsonStringConverter<org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.NotificationService> converterService,
-                                JsonStringConverter<org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.NotificationAlarmService> converterAlarmService, String server) {
+    public NbiNotificationsImpl(JsonStringConverter<NotificationProcessService> converterService,
+                                JsonStringConverter<NotificationAlarmService> converterAlarmService, String server) {
         this.converterService = converterService;
         this.converterAlarmService = converterAlarmService;
         this.server = server;
     }
 
     @Override
-    public ListenableFuture<RpcResult<GetNotificationsServiceOutput>> getNotificationsService(
-            GetNotificationsServiceInput input) {
+    public ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> getNotificationsProcessService(
+            GetNotificationsProcessServiceInput input) {
         LOG.info("RPC getNotificationsService received");
         if (input == null || input.getIdConsumer() == null || input.getGroupId() == null) {
             LOG.warn("Missing mandatory params for input {}", input);
-            return RpcResultBuilder.success(new GetNotificationsServiceOutputBuilder().build()).buildFuture();
+            return RpcResultBuilder.success(new GetNotificationsProcessServiceOutputBuilder().build()).buildFuture();
         }
-        Subscriber<org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService,
-                NotificationService> subscriber = new Subscriber<>(input.getIdConsumer(), input.getGroupId(), server,
-                converterService, NotificationServiceDeserializer.class);
-        List<NotificationService> notificationServiceList = subscriber
-                .subscribe(input.getConnectionType().getName(), NotificationService.QNAME);
-        GetNotificationsServiceOutputBuilder output = new GetNotificationsServiceOutputBuilder()
-                .setNotificationService(notificationServiceList);
-        return RpcResultBuilder.success(output.build()).buildFuture();
+        Subscriber<NotificationProcessService, NotificationsProcessService> subscriber = new Subscriber<>(
+                input.getIdConsumer(), input.getGroupId(), server, converterService,
+                NotificationServiceDeserializer.class);
+        List<NotificationsProcessService> notificationServiceList = subscriber
+                .subscribe(input.getConnectionType().getName(), NotificationsProcessService.QNAME);
+        return RpcResultBuilder.success(new GetNotificationsProcessServiceOutputBuilder()
+                .setNotificationsProcessService(notificationServiceList).build()).buildFuture();
     }
 
     @Override
@@ -70,13 +67,12 @@ public class NbiNotificationsImpl implements NbiNotificationsService {
             LOG.warn("Missing mandatory params for input {}", input);
             return RpcResultBuilder.success(new GetNotificationsAlarmServiceOutputBuilder().build()).buildFuture();
         }
-        Subscriber<org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService,
-                NotificationAlarmService> subscriber = new Subscriber<>(input.getIdConsumer(), input.getGroupId(),
-                server, converterAlarmService, NotificationAlarmServiceDeserializer.class);
-        List<NotificationAlarmService> notificationAlarmServiceList = subscriber
-                .subscribe("alarm" + input.getConnectionType().getName(), NotificationAlarmService.QNAME);
-        GetNotificationsAlarmServiceOutputBuilder output = new GetNotificationsAlarmServiceOutputBuilder()
-                .setNotificationAlarmService(notificationAlarmServiceList);
-        return RpcResultBuilder.success(output.build()).buildFuture();
+        Subscriber<NotificationAlarmService, NotificationsAlarmService> subscriber = new Subscriber<>(
+                input.getIdConsumer(), input.getGroupId(), server, converterAlarmService,
+                NotificationAlarmServiceDeserializer.class);
+        List<NotificationsAlarmService> notificationAlarmServiceList = subscriber
+                .subscribe("alarm" + input.getConnectionType().getName(), NotificationsAlarmService.QNAME);
+        return RpcResultBuilder.success(new GetNotificationsAlarmServiceOutputBuilder()
+                .setNotificationsAlarmService(notificationAlarmServiceList).build()).buildFuture();
     }
 }
index 0d578de956fa8d4bad3fce7e837f0dec73fc9e73..24c0383e4dbfb516383666a734612d217a8b5089 100644 (file)
@@ -18,9 +18,10 @@ import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsL
 import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
 import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
 import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NbiNotificationsService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.slf4j.Logger;
@@ -29,37 +30,34 @@ import org.slf4j.LoggerFactory;
 public class NbiNotificationsProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsProvider.class);
-    private static Map<String, Publisher<org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.NotificationService>> publishersServiceMap =  new HashMap<>();
+    private static Map<String, Publisher<NotificationProcessService>> publishersServiceMap =  new HashMap<>();
     private static Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap =  new HashMap<>();
-
     private final RpcProviderService rpcService;
-    private ObjectRegistration<NbiNotificationsService> rpcRegistration;
-    private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
-    private NotificationService notificationService;
-    private final JsonStringConverter<org.opendaylight.yang.gen.v1
-        .nbi.notifications.rev210628.NotificationService> converterService;
+    private final NotificationService notificationService;
+    private final JsonStringConverter<NotificationProcessService> converterService;
     private final JsonStringConverter<NotificationAlarmService> converterAlarmService;
     private final String subscriberServer;
+    private ObjectRegistration<NbiNotificationsService> rpcRegistration;
+    private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
 
 
-    public NbiNotificationsProvider(List<String> topicsService, List<String> topicsAlarm,
+    public NbiNotificationsProvider(List<String> publishersService, List<String> publishersAlarm,
             String subscriberServer, String publisherServer,
             RpcProviderService rpcProviderService, NotificationService notificationService,
             BindingDOMCodecServices bindingDOMCodecServices) {
         this.rpcService = rpcProviderService;
         this.notificationService = notificationService;
         converterService =  new JsonStringConverter<>(bindingDOMCodecServices);
-        for (String topic: topicsService) {
-            LOG.info("Creating publisher for topic {}", topic);
-            publishersServiceMap.put(topic, new Publisher<>(topic, publisherServer, converterService,
-                    NotificationServiceSerializer.class));
+        for (String publisherService: publishersService) {
+            LOG.info("Creating publisher for the following class {}", publisherService);
+            publishersServiceMap.put(publisherService, new Publisher<>(publisherService, publisherServer,
+                    converterService, NotificationServiceSerializer.class));
         }
         converterAlarmService = new JsonStringConverter<>(bindingDOMCodecServices);
-        for (String topic: topicsAlarm) {
-            LOG.info("Creating publisher for topic {}", topic);
-            publishersAlarmMap.put(topic, new Publisher<>(topic, publisherServer, converterAlarmService,
-                    NotificationAlarmServiceSerializer.class));
+        for (String publisherAlarm: publishersAlarm) {
+            LOG.info("Creating publisher for the following class {}", publisherAlarm);
+            publishersAlarmMap.put(publisherAlarm, new Publisher<>(publisherAlarm, publisherServer,
+                    converterAlarmService, NotificationAlarmServiceSerializer.class));
         }
         this.subscriberServer = subscriberServer;
     }
@@ -79,8 +77,7 @@ public class NbiNotificationsProvider {
      * Method called when the blueprint container is destroyed.
      */
     public void close() {
-        for (Publisher<org.opendaylight.yang.gen.v1
-                .nbi.notifications.rev210628.NotificationService> publisher : publishersServiceMap.values()) {
+        for (Publisher<NotificationProcessService> publisher : publishersServiceMap.values()) {
             publisher.close();
         }
         for (Publisher<NotificationAlarmService> publisherAlarm : publishersAlarmMap.values()) {
index e72b2282a82f26827719ba0583167d6a8926b8cc..37b4c0181618044108e0d79435ca70ad5a7fa102 100644 (file)
@@ -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<String, Publisher<NotificationService>> publishersServiceMap;
+    private final Map<String, Publisher<NotificationProcessService>> publishersServiceMap;
     private final Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap;
 
-    public NbiNotificationsListenerImpl(Map<String, Publisher<NotificationService>> publishersServiceMap,
+    public NbiNotificationsListenerImpl(Map<String, Publisher<NotificationProcessService>> publishersServiceMap,
                                         Map<String, Publisher<NotificationAlarmService>> 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<NotificationService> publisher = publishersServiceMap.get(topic);
-        publisher.sendEvent(new NotificationServiceBuilder().setCommonId(notification.getCommonId())
-                .setConnectionType(notification.getConnectionType()).setMessage(notification.getMessage())
+        Publisher<NotificationProcessService> 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<NotificationAlarmService> publisherAlarm = publishersAlarmMap.get(topic);
-        publisherAlarm.sendEvent(new NotificationAlarmServiceBuilder().setConnectionType(notification
-                .getConnectionType())
+        Publisher<NotificationAlarmService> 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());
     }
 }
index 4612d84bc6faa698f717fbb34c1b9e6df232f316..c08dbfb2fa9ceda56cd4a45569f65738437271a1 100644 (file)
@@ -11,17 +11,17 @@ import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import org.apache.kafka.common.serialization.Deserializer;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NotificationAlarmServiceDeserializer implements Deserializer<NotificationAlarmService> {
+public class NotificationAlarmServiceDeserializer implements Deserializer<NotificationsAlarmService> {
     private static final Logger LOG = LoggerFactory.getLogger(NotificationAlarmServiceDeserializer.class);
-    private JsonStringConverter<org.opendaylight.yang.gen.v1
-        .nbi.notifications.rev210628.NotificationAlarmService> converter;
+    private JsonStringConverter<NotificationAlarmService> converter;
 
     @SuppressWarnings("unchecked")
     @Override
@@ -29,37 +29,33 @@ public class NotificationAlarmServiceDeserializer implements Deserializer<Notifi
         LOG.info("Deserializer configuration {}", configs);
         if (configs.containsKey(ConfigConstants.CONVERTER)
                 && configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter<?>) {
-            converter = (JsonStringConverter<org.opendaylight.yang.gen.v1
-                    .nbi.notifications.rev210628.NotificationAlarmService>) configs
-                    .get(ConfigConstants.CONVERTER);
+            converter = (JsonStringConverter<NotificationAlarmService>) configs.get(ConfigConstants.CONVERTER);
         }
     }
 
     @Override
-    public NotificationAlarmService deserialize(String topic, byte[] data) {
+    public NotificationsAlarmService deserialize(String topic, byte[] data) {
         if (converter == null) {
             throw new IllegalArgumentException(
                     "Converter should be configured through configure method of deserializer");
         }
         String value = new String(data, StandardCharsets.UTF_8);
         // The message published is
-        // org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationService
+        // org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService
         // we have to map it to
         // org.opendaylight.yang.gen
-        // .v1.nbi.notifications.rev201130.get.notifications.service.output.NotificationService
-        org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService mappedString = converter
-                .createDataObjectFromJsonString(YangInstanceIdentifier.of(
-                        org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService.QNAME),
-                        value,
-                        JSONCodecFactorySupplier.RFC7951);
-        if (mappedString != null) {
-            LOG.info("Reading event {}", mappedString);
-            return new NotificationAlarmServiceBuilder().setConnectionType(mappedString.getConnectionType())
-                    .setMessage(mappedString.getMessage())
-                    .setOperationalState(mappedString.getOperationalState())
-                    .setServiceName(mappedString.getServiceName())
-                    .build();
+        // .v1.nbi.notifications.rev210813.get.notifications.service.output.NotificationsAlarmService
+        NotificationAlarmService mappedString = converter.createDataObjectFromJsonString(
+                YangInstanceIdentifier.of(NotificationAlarmService.QNAME), value, JSONCodecFactorySupplier.RFC7951);
+        if (mappedString == null) {
+            return null;
         }
-        return null;
+        LOG.info("Reading event {}", mappedString);
+        return new NotificationsAlarmServiceBuilder()
+                .setConnectionType(mappedString.getConnectionType())
+                .setMessage(mappedString.getMessage())
+                .setOperationalState(mappedString.getOperationalState())
+                .setServiceName(mappedString.getServiceName())
+                .build();
     }
 }
index c2ce676eef5293f62846925b9ceb44054001c012..fcf5f026fe1dcdd48a82675b7fe78720f5047523 100644 (file)
@@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import org.apache.kafka.common.serialization.Serializer;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.slf4j.Logger;
@@ -36,8 +36,7 @@ public class NotificationAlarmServiceSerializer implements Serializer<Notificati
     @Override
     public byte[] serialize(String topic, NotificationAlarmService data) {
         if (converter == null) {
-            throw new IllegalArgumentException(
-                    "Converter should be" + "configured through configure method of serializer");
+            throw new IllegalArgumentException("Converter should be configured through configure method of serializer");
         }
         if (data == null) {
             return new byte[0];
index 81f02ac9451f230d62e4dfdf127b8c90b339efb8..eab7f3618f9eb031e94a0c789a850f8d2b8d62fc 100644 (file)
@@ -11,17 +11,17 @@ import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import org.apache.kafka.common.serialization.Deserializer;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NotificationServiceDeserializer implements Deserializer<NotificationService> {
+public class NotificationServiceDeserializer implements Deserializer<NotificationsProcessService> {
     private static final Logger LOG = LoggerFactory.getLogger(NotificationServiceDeserializer.class);
-    private JsonStringConverter<org.opendaylight.yang.gen.v1
-        .nbi.notifications.rev210628.NotificationService> converter;
+    private JsonStringConverter<NotificationProcessService> converter;
 
     @SuppressWarnings("unchecked")
     @Override
@@ -29,39 +29,38 @@ public class NotificationServiceDeserializer implements Deserializer<Notificatio
         LOG.info("Deserializer configuration {}", configs);
         if (configs.containsKey(ConfigConstants.CONVERTER)
                 && configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter<?>) {
-            converter = (JsonStringConverter<org.opendaylight.yang.gen.v1
-                    .nbi.notifications.rev210628.NotificationService>) configs
-                    .get(ConfigConstants.CONVERTER);
+            converter = (JsonStringConverter<NotificationProcessService>) configs.get(ConfigConstants.CONVERTER);
         }
     }
 
     @Override
-    public NotificationService deserialize(String topic, byte[] data) {
+    public NotificationsProcessService deserialize(String topic, byte[] data) {
         if (converter == null) {
             throw new IllegalArgumentException(
                     "Converter should be configured through configure method of deserializer");
         }
         String value = new String(data, StandardCharsets.UTF_8);
         // The message published is
-        // org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationService
+        // org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService
         // we have to map it to
         // org.opendaylight.yang.gen
-        // .v1.nbi.notifications.rev201130.get.notifications.service.output.NotificationService
-        org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService mappedString = converter
-                .createDataObjectFromJsonString(YangInstanceIdentifier.of(
-                        org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService.QNAME),
-                        value,
-                        JSONCodecFactorySupplier.RFC7951);
-        if (mappedString != null) {
-            LOG.info("Reading event {}", mappedString);
-            return new NotificationServiceBuilder().setCommonId(mappedString.getCommonId())
-                    .setConnectionType(mappedString.getConnectionType()).setMessage(mappedString.getMessage())
-                    .setOperationalState(mappedString.getOperationalState())
-                    .setResponseFailed(mappedString.getResponseFailed()).setServiceName(mappedString.getServiceName())
-                    .setServiceAEnd(mappedString.getServiceAEnd()).setServiceZEnd(mappedString.getServiceZEnd())
-                    .build();
+        // .v1.nbi.notifications.rev210813.get.notifications.service.output.NotificationService
+        NotificationProcessService mappedString = converter.createDataObjectFromJsonString(
+                YangInstanceIdentifier.of(NotificationProcessService.QNAME), value, JSONCodecFactorySupplier.RFC7951);
+        if (mappedString == null) {
+            return null;
         }
-        return null;
+        LOG.info("Reading event {}", mappedString);
+        return new NotificationsProcessServiceBuilder()
+                .setCommonId(mappedString.getCommonId())
+                .setConnectionType(mappedString.getConnectionType())
+                .setMessage(mappedString.getMessage())
+                .setOperationalState(mappedString.getOperationalState())
+                .setResponseFailed(mappedString.getResponseFailed())
+                .setServiceName(mappedString.getServiceName())
+                .setServiceAEnd(mappedString.getServiceAEnd())
+                .setServiceZEnd(mappedString.getServiceZEnd())
+                .build();
     }
 
 }
index bc99d90c9cb55e577b07ecf4ea91d71b0ecd4cab..b3f6ae119c5d86cb44be50145ef48da9c6ea9b6b 100644 (file)
@@ -12,15 +12,15 @@ import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import org.apache.kafka.common.serialization.Serializer;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NotificationServiceSerializer implements Serializer<NotificationService> {
+public class NotificationServiceSerializer implements Serializer<NotificationProcessService> {
     private static final Logger LOG = LoggerFactory.getLogger(NotificationServiceSerializer.class);
-    private JsonStringConverter<NotificationService> converter;
+    private JsonStringConverter<NotificationProcessService> converter;
 
     @SuppressWarnings("unchecked")
     @Override
@@ -28,21 +28,21 @@ public class NotificationServiceSerializer implements Serializer<NotificationSer
         LOG.info("Deserializer configuration {}", configs);
         if (configs.containsKey(ConfigConstants.CONVERTER)
                 && configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter<?>) {
-            converter = (JsonStringConverter<NotificationService>) configs.get(ConfigConstants.CONVERTER);
+            converter = (JsonStringConverter<NotificationProcessService>) configs.get(ConfigConstants.CONVERTER);
         }
     }
 
     @Override
-    public byte[] serialize(String topic, NotificationService data) {
+    public byte[] serialize(String topic, NotificationProcessService data) {
         if (converter == null) {
-            throw new IllegalArgumentException(
-                    "Converter should be" + "configured through configure method of serializer");
+            throw new IllegalArgumentException("Converter should be configured through configure method of serializer");
         }
         if (data == null) {
             return new byte[0];
         }
         try {
-            InstanceIdentifier<NotificationService> iid = InstanceIdentifier.builder(NotificationService.class).build();
+            InstanceIdentifier<NotificationProcessService> iid = InstanceIdentifier
+                    .builder(NotificationProcessService.class).build();
             String serialized = converter.createJsonStringFromDataObject(iid, data, JSONCodecFactorySupplier.RFC7951);
             LOG.info("Serialized event {}", serialized);
             return serialized.getBytes(StandardCharsets.UTF_8);
index d1a4ceecad6d1614be13e8b1332039ed9bde85f3..0c00503b751c8f1f459bb455743488ec606017d4 100644 (file)
@@ -22,8 +22,7 @@ public final class NbiNotificationsUtils {
 
     public static Properties loadProperties(String propertyFileName) {
         Properties props = new Properties();
-        InputStream inputStream = NbiNotificationsUtils.class.getClassLoader()
-                .getResourceAsStream(propertyFileName);
+        InputStream inputStream = NbiNotificationsUtils.class.getClassLoader().getResourceAsStream(propertyFileName);
         try {
             if (inputStream != null) {
                 props.load(inputStream);
index 168f43d257219429645cddad19547240c243b668..7e5fcf615a00f5bbb55194a2df6fe253b3fe44f5 100644 (file)
@@ -22,18 +22,18 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.transportpce.nbinotifications.utils.NotificationServiceDataUtils;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
 
 public class SubscriberTest extends AbstractTest {
     private static final String TOPIC = "topic";
     private static final int PARTITION = 0;
-    private MockConsumer<String, NotificationService> mockConsumer;
-    private MockConsumer<String, NotificationAlarmService> mockConsumerAlarm;
-    private Subscriber<org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.NotificationService, NotificationService> subscriberService;
-    private Subscriber<org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.NotificationAlarmService, NotificationAlarmService> subscriberAlarmService;
+    private MockConsumer<String, NotificationsProcessService> mockConsumer;
+    private MockConsumer<String, NotificationsAlarmService> mockConsumerAlarm;
+    private Subscriber<NotificationProcessService, NotificationsProcessService> subscriberService;
+    private Subscriber<NotificationAlarmService, NotificationsAlarmService> subscriberAlarmService;
 
     @Before
     public void setUp() {
@@ -46,7 +46,7 @@ public class SubscriberTest extends AbstractTest {
     @Test
     public void subscribeServiceShouldBeSuccessful() {
         // from https://www.baeldung.com/kafka-mockconsumer
-        ConsumerRecord<String, NotificationService> record = new ConsumerRecord<>(
+        ConsumerRecord<String, NotificationsProcessService> record = new ConsumerRecord<>(
                 TOPIC, PARTITION, 0L, "key", NotificationServiceDataUtils.buildReceivedEvent());
         mockConsumer.schedulePollTask(() -> {
             mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC, PARTITION)));
@@ -57,7 +57,8 @@ public class SubscriberTest extends AbstractTest {
         TopicPartition tp = new TopicPartition(TOPIC, PARTITION);
         startOffsets.put(tp, 0L);
         mockConsumer.updateBeginningOffsets(startOffsets);
-        List<NotificationService> result = subscriberService.subscribe(TOPIC, NotificationService.QNAME);
+        List<NotificationsProcessService> result = subscriberService.subscribe(TOPIC,
+                NotificationsProcessService.QNAME);
         assertEquals("There should be 1 record", 1, result.size());
         assertTrue("Consumer should be closed", mockConsumer.closed());
     }
@@ -65,7 +66,7 @@ public class SubscriberTest extends AbstractTest {
     @Test
     public void subscribeAlarmShouldBeSuccessful() {
         // from https://www.baeldung.com/kafka-mockconsumer
-        ConsumerRecord<String, NotificationAlarmService> record = new ConsumerRecord<>(
+        ConsumerRecord<String, NotificationsAlarmService> record = new ConsumerRecord<>(
                 TOPIC, PARTITION, 0L, "key", NotificationServiceDataUtils.buildReceivedAlarmEvent());
         mockConsumerAlarm.schedulePollTask(() -> {
             mockConsumerAlarm.rebalance(Collections.singletonList(new TopicPartition(TOPIC, PARTITION)));
@@ -76,7 +77,8 @@ public class SubscriberTest extends AbstractTest {
         TopicPartition tp = new TopicPartition(TOPIC, PARTITION);
         startOffsets.put(tp, 0L);
         mockConsumerAlarm.updateBeginningOffsets(startOffsets);
-        List<NotificationAlarmService> result = subscriberAlarmService.subscribe(TOPIC, NotificationAlarmService.QNAME);
+        List<NotificationsAlarmService> result = subscriberAlarmService.subscribe(TOPIC,
+                NotificationsAlarmService.QNAME);
         assertEquals("There should be 1 record", 1, result.size());
         assertTrue("Consumer should be closed", mockConsumerAlarm.closed());
     }
index c121eb75a28c852bb7a4cd25420d353965700d8f..dc8fdeac0d6804ec11933c029b36186a722dd707 100644 (file)
@@ -16,10 +16,12 @@ import org.junit.Test;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceInputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsAlarmServiceOutput;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceInputBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.GetNotificationsServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public class NbiNotificationsImplTest extends AbstractTest {
@@ -27,31 +29,30 @@ public class NbiNotificationsImplTest extends AbstractTest {
 
     @Before
     public void setUp() {
-        JsonStringConverter<org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.NotificationService> converter = new JsonStringConverter<>(
+        JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
                 getDataStoreContextUtil().getBindingDOMCodecServices());
-        JsonStringConverter<org.opendaylight.yang.gen.v1
-                .nbi.notifications.rev210628.NotificationAlarmService> converterAlarm = new JsonStringConverter<>(
+        JsonStringConverter<NotificationAlarmService> converterAlarm = new JsonStringConverter<>(
                 getDataStoreContextUtil().getBindingDOMCodecServices());
         nbiNotificationsImpl = new NbiNotificationsImpl(converter, converterAlarm,"localhost:8080");
     }
 
     @Test
     public void getNotificationsServiceEmptyDataTest() throws InterruptedException, ExecutionException {
-        ListenableFuture<RpcResult<GetNotificationsServiceOutput>> result =
-                nbiNotificationsImpl.getNotificationsService(new GetNotificationsServiceInputBuilder().build());
-        assertNull("Should be null", result.get().getResult().getNotificationService());
+        ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> result =
+                nbiNotificationsImpl.getNotificationsProcessService(
+                        new GetNotificationsProcessServiceInputBuilder().build());
+        assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
     }
 
     @Test
     public void getNotificationsServiceTest() throws InterruptedException, ExecutionException {
-        GetNotificationsServiceInputBuilder builder = new GetNotificationsServiceInputBuilder()
+        GetNotificationsProcessServiceInputBuilder builder = new GetNotificationsProcessServiceInputBuilder()
                 .setGroupId("groupId")
                 .setIdConsumer("consumerId")
                 .setConnectionType(ConnectionType.Service);
-        ListenableFuture<RpcResult<GetNotificationsServiceOutput>> result =
-                nbiNotificationsImpl.getNotificationsService(builder.build());
-        assertNull("Should be null", result.get().getResult().getNotificationService());
+        ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> result =
+                nbiNotificationsImpl.getNotificationsProcessService(builder.build());
+        assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
     }
 
     @Test
@@ -62,6 +63,6 @@ public class NbiNotificationsImplTest extends AbstractTest {
                 .setConnectionType(ConnectionType.Service);
         ListenableFuture<RpcResult<GetNotificationsAlarmServiceOutput>> result =
                 nbiNotificationsImpl.getNotificationsAlarmService(builder.build());
-        assertNull("Should be null", result.get().getResult().getNotificationAlarmService());
+        assertNull("Should be null", result.get().getResult().getNotificationsAlarmService());
     }
 }
index d8e832ead06f4a2d1cb8d6f81939a12ab8fddb11..c66efdbbc0eff599beb66f7b13ebbafefb041895 100644 (file)
@@ -21,16 +21,16 @@ import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
 
 public class NbiNotificationsListenerImplTest extends AbstractTest {
     @Mock
-    private Publisher<NotificationService> publisherService;
+    private Publisher<NotificationProcessService> publisherService;
     @Mock
     private Publisher<NotificationAlarmService> publisherAlarm;
 
@@ -43,21 +43,31 @@ public class NbiNotificationsListenerImplTest extends AbstractTest {
     public void onPublishNotificationServiceTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
                 Map.of("test", publisherAlarm));
-        PublishNotificationService notification = new PublishNotificationServiceBuilder().setTopic("test")
-                .setCommonId("commonId").setConnectionType(ConnectionType.Service).setMessage("Service deleted")
-                .setOperationalState(State.OutOfService).setServiceName("service name").build();
-        listener.onPublishNotificationService(notification);
+        PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
+                .setPublisherName("test")
+                .setCommonId("commonId")
+                .setConnectionType(ConnectionType.Service)
+                .setMessage("Service deleted")
+                .setOperationalState(State.OutOfService)
+                .setServiceName("service name")
+                .build();
+        listener.onPublishNotificationProcessService(notification);
         verify(publisherService, times(1)).sendEvent(any(), anyString());
     }
 
     @Test
-    public void onPublishNotificationServiceWrongTopicTest() {
+    public void onPublishNotificationServiceWrongPublisherTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
                 Map.of("test", publisherAlarm));
-        PublishNotificationService notification = new PublishNotificationServiceBuilder().setTopic("wrongtopic")
-                .setCommonId("commonId").setConnectionType(ConnectionType.Service).setMessage("Service deleted")
-                .setOperationalState(State.OutOfService).setServiceName("service name").build();
-        listener.onPublishNotificationService(notification);
+        PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
+                .setPublisherName("wrongPublisher")
+                .setCommonId("commonId")
+                .setConnectionType(ConnectionType.Service)
+                .setMessage("Service deleted")
+                .setOperationalState(State.OutOfService)
+                .setServiceName("service name")
+                .build();
+        listener.onPublishNotificationProcessService(notification);
         verify(publisherService, times(0)).sendEvent(any(), anyString());
     }
 
@@ -65,21 +75,28 @@ public class NbiNotificationsListenerImplTest extends AbstractTest {
     public void onPublishNotificationAlarmServiceTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
                 Map.of("test", publisherAlarm));
-        PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder().setTopic("test")
-                .setConnectionType(ConnectionType.Service).setMessage("The service is now inService")
-                .setOperationalState(State.OutOfService).setServiceName("service name").build();
+        PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
+                .setPublisherName("test")
+                .setConnectionType(ConnectionType.Service)
+                .setMessage("The service is now inService")
+                .setOperationalState(State.OutOfService)
+                .setServiceName("service name")
+                .build();
         listener.onPublishNotificationAlarmService(notification);
         verify(publisherAlarm, times(1)).sendEvent(any(), anyString());
     }
 
     @Test
-    public void onPublishNotificationAlarmServiceWrongTopicTest() {
+    public void onPublishNotificationAlarmServiceWrongPublisherTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
                 Map.of("test", publisherAlarm));
         PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
-                .setTopic("wrongtopic").setConnectionType(ConnectionType.Service)
-                .setMessage("The service is now inService").setOperationalState(State.OutOfService)
-                .setServiceName("service name").build();
+                .setPublisherName("wrongPublisher")
+                .setConnectionType(ConnectionType.Service)
+                .setMessage("The service is now inService")
+                .setOperationalState(State.OutOfService)
+                .setServiceName("service name")
+                .build();
         listener.onPublishNotificationAlarmService(notification);
         verify(publisherAlarm, times(0)).sendEvent(any(), anyString());
     }
index 7218a222cbc854a0d522afe307792625fe84f61e..86e33307bda1b2366405c2557a3f47219481f334 100644 (file)
@@ -22,17 +22,17 @@ import org.opendaylight.transportpce.nbinotifications.serialization.ConfigConsta
 import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
 import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 
 public class PublisherTest extends AbstractTest {
-    private JsonStringConverter<NotificationService> converterService;
+    private JsonStringConverter<NotificationProcessService> converterService;
     private JsonStringConverter<NotificationAlarmService> converterAlarm;
-    private Publisher<NotificationService> publisherService;
+    private Publisher<NotificationProcessService> publisherService;
     private Publisher<NotificationAlarmService> publisherAlarm;
-    private MockProducer<String, NotificationService> mockProducer;
+    private MockProducer<String, NotificationProcessService> mockProducer;
     private MockProducer<String, NotificationAlarmService> mockAlarmProducer;
 
     @Before
@@ -54,10 +54,10 @@ public class PublisherTest extends AbstractTest {
     @Test
     public void sendEventServiceShouldBeSuccessful() throws IOException {
         String json = Files.readString(Paths.get("src/test/resources/event.json"));
-        NotificationService notificationService = converterService
-                .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationService.QNAME),
+        NotificationProcessService notificationProcessService = converterService
+                .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationProcessService.QNAME),
                         json, JSONCodecFactorySupplier.RFC7951);
-        publisherService.sendEvent(notificationService, notificationService.getConnectionType().name());
+        publisherService.sendEvent(notificationProcessService, notificationProcessService.getConnectionType().name());
         assertEquals("We should have one message", 1, mockProducer.history().size());
         assertEquals("Key should be test", "test", mockProducer.history().get(0).key());
     }
index 2998b256051ca68f889c24ccdeb5e895f12b2b01..b0d156a2a66af52ad617f562c0fc76bbc85f5604 100755 (executable)
@@ -16,19 +16,19 @@ import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService;
 
 public class NotificationAlarmServiceDeserializerTest extends AbstractTest {
 
     @Test
     public void deserializeTest() throws IOException {
-        JsonStringConverter<org.opendaylight.yang.gen.v1
-                .nbi.notifications.rev210628.NotificationAlarmService> converter =
+        JsonStringConverter<NotificationAlarmService> converter =
                 new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
         NotificationAlarmServiceDeserializer deserializer = new NotificationAlarmServiceDeserializer();
         Map<String, Object> configs = Map.of(ConfigConstants.CONVERTER, converter);
         deserializer.configure(configs, false);
-        NotificationAlarmService readEvent = deserializer.deserialize("Test",
+        NotificationsAlarmService readEvent = deserializer.deserialize("Test",
                 Files.readAllBytes(Paths.get("src/test/resources/event_alarm_service.json")));
         deserializer.close();
         assertEquals("Service name should be service1", "service1", readEvent.getServiceName());
index ed276cbf21e6360674fea252ea2310dbdc63c60a..605c85158d6b34c1ea11fea8c8e60bb23f1cb4ea 100755 (executable)
@@ -20,7 +20,7 @@ import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 
index 430e7d8e2493f4496dff5157d7c281cd605ac925..12f7a80f33c2bdf19a2f1d0709878833f711ab8e 100644 (file)
@@ -16,18 +16,19 @@ import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.get.notifications.service.output.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
 
 public class NotificationServiceDeserializerTest extends AbstractTest {
 
     @Test
     public void deserializeTest() throws IOException {
-        JsonStringConverter<org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService> converter =
-                new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
+        JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
+                getDataStoreContextUtil().getBindingDOMCodecServices());
         NotificationServiceDeserializer deserializer = new NotificationServiceDeserializer();
         Map<String, Object> configs = Map.of(ConfigConstants.CONVERTER, converter);
         deserializer.configure(configs, false);
-        NotificationService readEvent = deserializer.deserialize("Test",
+        NotificationsProcessService readEvent = deserializer.deserialize("Test",
                 Files.readAllBytes(Paths.get("src/test/resources/event.json")));
         deserializer.close();
         assertEquals("Service name should be service1", "service1", readEvent.getServiceName());
index ca11dda9ce0ff2cfbf781190f852f6f345ad43f5..4a4868bbd29d36a66f69bcd44da38b910de70372 100644 (file)
@@ -20,7 +20,7 @@ import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
 import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.NotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 
@@ -28,11 +28,11 @@ public class NotificationServiceSerializerTest extends AbstractTest {
 
     @Test
     public void serializeTest() throws IOException {
-        JsonStringConverter<NotificationService> converter =
+        JsonStringConverter<NotificationProcessService> converter =
                 new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
         String json = Files.readString(Paths.get("src/test/resources/event.json"));
-        NotificationService notificationService = converter
-                .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationService.QNAME),
+        NotificationProcessService notificationService = converter
+                .createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationProcessService.QNAME),
                         json, JSONCodecFactorySupplier.RFC7951);
         NotificationServiceSerializer serializer = new NotificationServiceSerializer();
         Map<String, Object> configs = Map.of(ConfigConstants.CONVERTER, converter);
index c2ad2ff94e79f8144151138acbe3b493eeb7b03d..4f660f10037f790dd46efc72d7c20dbbb98fe9e1 100644 (file)
@@ -10,15 +10,21 @@ package org.opendaylight.transportpce.nbinotifications.utils;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.LgxBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
-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.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+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.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class NotificationServiceDataUtils {
@@ -26,8 +32,8 @@ public final class NotificationServiceDataUtils {
     private NotificationServiceDataUtils() {
     }
 
-    public static NotificationService buildSendEventInput() {
-        NotificationServiceBuilder notificationServiceBuilder = new NotificationServiceBuilder()
+    public static NotificationProcessService buildSendEventInput() {
+        return new NotificationProcessServiceBuilder()
                 .setMessage("message")
                 .setServiceName("service1")
                 .setOperationalState(State.InService)
@@ -35,17 +41,12 @@ public final class NotificationServiceDataUtils {
                 .setCommonId("commond-id")
                 .setConnectionType(ConnectionType.Service)
                 .setServiceZEnd(getServiceZEndBuild().build())
-                .setServiceAEnd(getServiceAEndBuild().build());
-
-        return notificationServiceBuilder.build();
+                .setServiceAEnd(getServiceAEndBuild().build())
+                .build();
     }
 
-    public static org.opendaylight.yang.gen.v1
-        .nbi.notifications.rev210628.get.notifications.service.output.NotificationService buildReceivedEvent() {
-        org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.get.notifications.service.output.NotificationServiceBuilder
-            notificationServiceBuilder = new org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.get.notifications.service.output.NotificationServiceBuilder()
+    public static NotificationsProcessService buildReceivedEvent() {
+        return new NotificationsProcessServiceBuilder()
                 .setMessage("message")
                 .setServiceName("service1")
                 .setOperationalState(State.InService)
@@ -53,28 +54,24 @@ public final class NotificationServiceDataUtils {
                 .setCommonId("commond-id")
                 .setConnectionType(ConnectionType.Service)
                 .setServiceZEnd(getServiceZEndBuild().build())
-                .setServiceAEnd(getServiceAEndBuild().build());
-
-        return notificationServiceBuilder.build();
+                .setServiceAEnd(getServiceAEndBuild().build())
+                .build();
     }
 
-    public static org.opendaylight.yang.gen.v1
-            .nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmService
-            buildReceivedAlarmEvent() {
-        org.opendaylight.yang.gen.v1
-                .nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmServiceBuilder
-                notificationAlarmServiceBuilder = new org.opendaylight.yang.gen.v1
-                .nbi.notifications.rev210628.get.notifications.alarm.service.output.NotificationAlarmServiceBuilder()
+    public static NotificationsAlarmService buildReceivedAlarmEvent() {
+        return new NotificationsAlarmServiceBuilder()
                 .setMessage("message")
                 .setServiceName("service1")
                 .setOperationalState(State.InService)
-                .setConnectionType(ConnectionType.Service);
-        return notificationAlarmServiceBuilder.build();
+                .setConnectionType(ConnectionType.Service)
+                .build();
     }
 
     public static ServiceAEndBuilder getServiceAEndBuild() {
         return new ServiceAEndBuilder()
-                .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
+                .setClli("clli")
+                .setServiceFormat(ServiceFormat.OC)
+                .setServiceRate(Uint32.valueOf(1))
                 .setNodeId(new NodeIdType("XPONDER-1-2"))
                 .setTxDirection(getTxDirection())
                 .setRxDirection(getRxDirection());
@@ -82,31 +79,51 @@ public final class NotificationServiceDataUtils {
 
     public static ServiceZEndBuilder getServiceZEndBuild() {
         return new ServiceZEndBuilder()
-                .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
+                .setClli("clli")
+                .setServiceFormat(ServiceFormat.OC)
+                .setServiceRate(Uint32.valueOf(1))
                 .setNodeId(new NodeIdType("XPONDER-1-2"))
                 .setTxDirection(getTxDirection())
                 .setRxDirection(getRxDirection());
     }
 
     private static TxDirection getTxDirection() {
-        return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
-                .endpoint.TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
-                .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
-                .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
-                .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
-                        .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
+        return new TxDirectionBuilder()
+                .setPort(new PortBuilder()
+                        .setPortDeviceName("device name")
+                        .setPortName("port name")
+                        .setPortRack("port rack")
+                        .setPortShelf("port shelf")
+                        .setPortSlot("port slot")
+                        .setPortSubSlot("port subslot")
+                        .setPortType("port type")
+                        .build())
+                .setLgx(new LgxBuilder()
+                        .setLgxDeviceName("lgx device name")
+                        .setLgxPortName("lgx port name")
+                        .setLgxPortRack("lgx port rack")
+                        .setLgxPortShelf("lgx port shelf")
+                        .build())
                 .build();
     }
 
     private static RxDirection getRxDirection() {
-        return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
-                .endpoint.RxDirectionBuilder()
-                .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
-                        .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
-                        .setLgxPortShelf("lgx port shelf").build())
+        return new RxDirectionBuilder()
+                .setPort(new PortBuilder()
+                        .setPortDeviceName("device name")
+                        .setPortName("port name")
+                        .setPortRack("port rack")
+                        .setPortShelf("port shelf")
+                        .setPortSlot("port slot")
+                        .setPortSubSlot("port subslot")
+                        .setPortType("port type")
+                        .build())
+                .setLgx(new LgxBuilder()
+                        .setLgxDeviceName("lgx device name")
+                        .setLgxPortName("lgx port name")
+                        .setLgxPortRack("lgx port rack")
+                        .setLgxPortShelf("lgx port shelf")
+                        .build())
                 .build();
     }
 }
index 9e85e38f27a774b1bfc8f372d6d304e74b739421..2c3106880388b3618dcb5a80b12e66a9cd947c44 100644 (file)
@@ -1,5 +1,5 @@
 {
-    "notification-service": {
+    "notification-process-service": {
         "service-z-end": {
             "service-format": "OC",
             "node-id": "XPONDER-1-2",
index 499c7e47a5e843be835e3c0d269301c1c47840c0..25a6b851db2517f355676fdb5d3a7a9b8c53e521 100644 (file)
@@ -1,90 +1,90 @@
 {
-  "notification-service": {
-    "service-z-end": {
-      "clli": "clli",
-      "service-rate": 1,
-      "node-id": "XPONDER-1-2",
-      "rx-direction": {
-        "lgx": {
-          "lgx-port-name": "lgx port name",
-          "lgx-port-shelf": "lgx port shelf",
-          "lgx-port-rack": "lgx port rack",
-          "lgx-device-name": "lgx device name"
+  "notification-process-service":{
+    "common-id":"commond-id",
+    "message":"message",
+    "operational-state":"inService",
+    "service-z-end":{
+      "node-id":"XPONDER-1-2",
+      "service-rate":1,
+      "clli":"clli",
+      "service-format":"OC",
+      "tx-direction":{
+        "port":{
+          "port-name":"port name",
+          "port-slot":"port slot",
+          "port-sub-slot":"port subslot",
+          "port-device-name":"device name",
+          "port-shelf":"port shelf",
+          "port-type":"port type",
+          "port-rack":"port rack"
         },
-        "port": {
-          "port-shelf": "port shelf",
-          "port-rack": "port rack",
-          "port-device-name": "device name",
-          "port-name": "port name",
-          "port-slot": "port slot",
-          "port-type": "port type",
-          "port-sub-slot": "port subslot"
+        "lgx":{
+          "lgx-port-shelf":"lgx port shelf",
+          "lgx-port-rack":"lgx port rack",
+          "lgx-port-name":"lgx port name",
+          "lgx-device-name":"lgx device name"
         }
       },
-      "service-format": "OC",
-      "tx-direction": {
-        "lgx": {
-          "lgx-port-name": "lgx port name",
-          "lgx-port-shelf": "lgx port shelf",
-          "lgx-port-rack": "lgx port rack",
-          "lgx-device-name": "lgx device name"
+      "rx-direction":{
+        "port":{
+          "port-name":"port name",
+          "port-slot":"port slot",
+          "port-sub-slot":"port subslot",
+          "port-device-name":"device name",
+          "port-shelf":"port shelf",
+          "port-type":"port type",
+          "port-rack":"port rack"
         },
-        "port": {
-          "port-shelf": "port shelf",
-          "port-rack": "port rack",
-          "port-device-name": "device name",
-          "port-name": "port name",
-          "port-slot": "port slot",
-          "port-type": "port type",
-          "port-sub-slot": "port subslot"
+        "lgx":{
+          "lgx-port-shelf":"lgx port shelf",
+          "lgx-port-rack":"lgx port rack",
+          "lgx-port-name":"lgx port name",
+          "lgx-device-name":"lgx device name"
         }
       }
     },
-    "connection-type": "service",
-    "operational-state": "inService",
-    "common-id": "commond-id",
-    "service-a-end": {
-      "clli": "clli",
-      "service-rate": 1,
-      "node-id": "XPONDER-1-2",
-      "rx-direction": {
-        "lgx": {
-          "lgx-port-name": "lgx port name",
-          "lgx-port-shelf": "lgx port shelf",
-          "lgx-port-rack": "lgx port rack",
-          "lgx-device-name": "lgx device name"
+    "service-name":"service1",
+    "connection-type":"service",
+    "service-a-end":{
+      "node-id":"XPONDER-1-2",
+      "service-rate":1,
+      "clli":"clli",
+      "service-format":"OC",
+      "tx-direction":{
+        "port":{
+          "port-name":"port name",
+          "port-slot":"port slot",
+          "port-sub-slot":"port subslot",
+          "port-device-name":"device name",
+          "port-shelf":"port shelf",
+          "port-type":"port type",
+          "port-rack":"port rack"
         },
-        "port": {
-          "port-shelf": "port shelf",
-          "port-rack": "port rack",
-          "port-device-name": "device name",
-          "port-name": "port name",
-          "port-slot": "port slot",
-          "port-type": "port type",
-          "port-sub-slot": "port subslot"
+        "lgx":{
+          "lgx-port-shelf":"lgx port shelf",
+          "lgx-port-rack":"lgx port rack",
+          "lgx-port-name":"lgx port name",
+          "lgx-device-name":"lgx device name"
         }
       },
-      "service-format": "OC",
-      "tx-direction": {
-        "lgx": {
-          "lgx-port-name": "lgx port name",
-          "lgx-port-shelf": "lgx port shelf",
-          "lgx-port-rack": "lgx port rack",
-          "lgx-device-name": "lgx device name"
+      "rx-direction":{
+        "port":{
+          "port-name":"port name",
+          "port-slot":"port slot",
+          "port-sub-slot":"port subslot",
+          "port-device-name":"device name",
+          "port-shelf":"port shelf",
+          "port-type":"port type",
+          "port-rack":"port rack"
         },
-        "port": {
-          "port-shelf": "port shelf",
-          "port-rack": "port rack",
-          "port-device-name": "device name",
-          "port-name": "port name",
-          "port-slot": "port slot",
-          "port-type": "port type",
-          "port-sub-slot": "port subslot"
+        "lgx":{
+          "lgx-port-shelf":"lgx port shelf",
+          "lgx-port-rack":"lgx port rack",
+          "lgx-port-name":"lgx port name",
+          "lgx-device-name":"lgx device name"
         }
       }
     },
-    "service-name": "service1",
-    "response-failed": "",
-    "message": "message"
+    "response-failed":""
   }
 }
\ No newline at end of file
index 403e6dc3dd485885c48505b118740d017a6f63d3..b194ee19fa22de6afb3c6e623b045fbc3d4e5801 100755 (executable)
@@ -1,8 +1,8 @@
 {
   "notification-alarm-service": {
+    "message": "The service is now inService",
     "operational-state": "inService",
     "service-name": "service1",
-    "connection-type": "service",
-    "message": "The service is now inService"
+    "connection-type": "service"
   }
 }
\ No newline at end of file
index e176348fe2e64246d2ed8a20dc8feb436577e9db..43d40309ade60183756728c32b50fd27a0318af5 100644 (file)
@@ -80,10 +80,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempSer
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfo.TailRetention;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfoBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
@@ -95,11 +95,12 @@ import org.slf4j.LoggerFactory;
  */
 public class ServicehandlerImpl implements OrgOpenroadmServiceService {
     private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
+    private static final String PUBLISHER = "ServiceHandler";
     private static final String TEMP_SERVICE_CREATE_MSG = "tempServiceCreate: {}";
     private static final String TEMP_SERVICE_DELETE_MSG = "tempServiceDelete: {}";
     private static final String SERVICE_RESTORATION_MSG = "serviceRestoration: {}";
     private static final String SERVICE_RECONFIGURE_MSG = "serviceReconfigure: {}";
-    private static final String SERVICE_FEASABILITY_CHECK_MSG = "serviceFeasabilityCheck: {}";
+    private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
     private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
     private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
 
@@ -111,15 +112,13 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
     private RendererListenerImpl rendererListenerImpl;
     private NetworkModelListenerImpl networkModelListenerImpl;
     private NotificationPublishService notificationPublishService;
-    private final String topic;
 
     //TODO: remove private request fields as they are in global scope
 
     public ServicehandlerImpl(DataBroker databroker, PathComputationService pathComputationService,
             RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
             PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
-            NetworkModelListenerImpl networkModelListenerImpl, ServiceDataStoreOperations serviceDataStoreOperations,
-            String topic) {
+            NetworkModelListenerImpl networkModelListenerImpl, ServiceDataStoreOperations serviceDataStoreOperations) {
         this.db = databroker;
         this.serviceDataStoreOperations = serviceDataStoreOperations;
         this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
@@ -128,7 +127,6 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         this.rendererListenerImpl = rendererListenerImpl;
         this.networkModelListenerImpl = networkModelListenerImpl;
         this.notificationPublishService =  notificationPublishService;
-        this.topic = topic;
     }
 
 
@@ -188,14 +186,16 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
         if (output == null) {
             LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
-            sendNbiNotification(new PublishNotificationServiceBuilder()
+            sendNbiNotification(new PublishNotificationProcessServiceBuilder()
                     .setServiceName(input.getServiceName())
                     .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
                     .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
-                    .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType())
+                    .setCommonId(input.getCommonId())
+                    .setConnectionType(input.getConnectionType())
                     .setResponseFailed(LogMessages.ABORT_PCE_FAILED)
                     .setMessage("ServiceCreate request failed ...")
                     .setOperationalState(State.Degraded)
+                    .setPublisherName(PUBLISHER)
                     .build());
             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
@@ -230,7 +230,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         //Check presence of service to be deleted
         Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
         Services service;
-        if (!serviceOpt.isPresent()) {
+        if (serviceOpt.isEmpty()) {
             LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
             return ModelMappingUtils.createDeleteServiceReply(
                     input, ResponseCodes.FINAL_ACK_YES,
@@ -253,14 +253,16 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
 
         if (output == null) {
             LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
-            sendNbiNotification(new PublishNotificationServiceBuilder()
+            sendNbiNotification(new PublishNotificationProcessServiceBuilder()
                     .setServiceName(service.getServiceName())
                     .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
                     .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
-                    .setCommonId(service.getCommonId()).setConnectionType(service.getConnectionType())
+                    .setCommonId(service.getCommonId())
+                    .setConnectionType(service.getConnectionType())
                     .setMessage("ServiceDelete request failed ...")
                     .setOperationalState(State.InService)
                     .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
+                    .setPublisherName(PUBLISHER)
                     .build());
             return ModelMappingUtils.createDeleteServiceReply(
                     input, ResponseCodes.FINAL_ACK_YES,
@@ -283,7 +285,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
                 RpcActions.ServiceFeasibilityCheck);
         if (! validationResult.isSuccess()) {
-            LOG.warn(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
+            LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
             return ModelMappingUtils.createCreateServiceReply(
                     input, ResponseCodes.FINAL_ACK_YES,
                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
@@ -295,10 +297,10 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
-        LOG.debug(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.PCE_CALLING);
+        LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
         if (output == null) {
-            LOG.warn(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
+            LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
         }
@@ -314,7 +316,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         String serviceName = input.getServiceName();
         LOG.info("RPC serviceReconfigure received for {}", serviceName);
         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
-        if (!servicesObject.isPresent()) {
+        if (servicesObject.isEmpty()) {
             LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
             return ModelMappingUtils.createCreateServiceReply(
                 input,
@@ -402,13 +404,12 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
             if (softConstraints == null) {
                 LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
                 serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
-                serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
             } else {
                 LOG.info("converting hard constraints to soft constraints ...");
                 serviceInput.setSoftConstraints(
                         DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
-                serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
             }
+            serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
         }
         this.pceListenerImpl.setInput(serviceInput);
         this.pceListenerImpl.setServiceReconfigure(true);
@@ -453,7 +454,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         String serviceName = input.getServiceName();
         LOG.info("RPC serviceReroute received for {}", serviceName);
         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
-        if (!servicesObject.isPresent()) {
+        if (servicesObject.isEmpty()) {
             LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
             return ModelMappingUtils.createRerouteServiceReply(
                     input, ResponseCodes.FINAL_ACK_NO,
@@ -528,7 +529,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
 
         /*
          * Upon receipt of service-deleteService RPC, service header and sdnc-request
-         * header compliancy are verified.
+         * header compliance are verified.
          */
         LOG.debug("checking Service Compliance ...");
         ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
@@ -546,7 +547,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.temp.service.list.Services>
                 service =
             this.serviceDataStoreOperations.getTempService(commonId);
-        if (!service.isPresent()) {
+        if (service.isEmpty()) {
             LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
             return ModelMappingUtils.createDeleteServiceReply(
                     input, ResponseCodes.FINAL_ACK_YES,
@@ -656,7 +657,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
      * Send notification to NBI notification in order to publish message.
      * @param service PublishNotificationService
      */
-    private void sendNbiNotification(PublishNotificationService service) {
+    private void sendNbiNotification(PublishNotificationProcessService service) {
         try {
             notificationPublishService.putNotification(service);
         } catch (InterruptedException e) {
index 305c4156ee37b4cafe11e918c55d07aaf1ffbd31..16e2fd58ecd28a0c6625c05dc31f2c22fc2ff225 100644 (file)
@@ -28,17 +28,17 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.RpcStatusEx;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParameters;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.response.parameters.sp.ResponseParametersBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class PceListenerImpl implements TransportpcePceListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(PceListenerImpl.class);
-    private static final String TOPIC = "PceListener";
+    private static final String PUBLISHER = "PceListener";
 
     private ServicePathRpcResult servicePathRpcResult;
     private RendererServiceOperations rendererServiceOperations;
@@ -147,13 +147,14 @@ public class PceListenerImpl implements TransportpcePceListener {
      * @return true is status is Successful, false otherwise.
      */
     private boolean checkStatus(ServicePathRpcResult notification) {
-        PublishNotificationService nbiNotification = getPublishNotificationService(notification);
-        PublishNotificationServiceBuilder publishNotificationServiceBuilder = new PublishNotificationServiceBuilder(
-                nbiNotification);
+        PublishNotificationProcessService nbiNotification = getPublishNotificationProcessService(notification);
+        PublishNotificationProcessServiceBuilder publishNotificationProcessServiceBuilder =
+                new PublishNotificationProcessServiceBuilder(nbiNotification);
         switch (servicePathRpcResult.getStatus()) {
             case Failed:
                 LOG.error("PCE path computation failed !");
-                nbiNotification = publishNotificationServiceBuilder.setMessage("ServiceCreate request failed ...")
+                nbiNotification = publishNotificationProcessServiceBuilder
+                        .setMessage("ServiceCreate request failed ...")
                         .setResponseFailed("PCE path computation failed !")
                         .setOperationalState(State.Degraded).build();
                 sendNbiNotification(nbiNotification);
@@ -167,7 +168,8 @@ public class PceListenerImpl implements TransportpcePceListener {
             default:
                 LOG.error("PCE path computation returned an unknown RpcStatusEx code {}",
                         servicePathRpcResult.getStatus());
-                nbiNotification = publishNotificationServiceBuilder.setMessage("ServiceCreate request failed ...")
+                nbiNotification = publishNotificationProcessServiceBuilder
+                        .setMessage("ServiceCreate request failed ...")
                         .setResponseFailed("PCE path computation returned an unknown RpcStatusEx code!")
                         .setOperationalState(State.Degraded).build();
                 sendNbiNotification(nbiNotification);
@@ -175,17 +177,19 @@ public class PceListenerImpl implements TransportpcePceListener {
         }
     }
 
-    private PublishNotificationService getPublishNotificationService(ServicePathRpcResult notification) {
-        PublishNotificationServiceBuilder nbiNotificationBuilder = new PublishNotificationServiceBuilder();
+    private PublishNotificationProcessService getPublishNotificationProcessService(ServicePathRpcResult notification) {
+        PublishNotificationProcessServiceBuilder nbiNotificationBuilder =
+                new PublishNotificationProcessServiceBuilder();
         if (input != null) {
             nbiNotificationBuilder.setServiceName(input.getServiceName())
                     .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
                     .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
-                    .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType());
+                    .setCommonId(input.getCommonId())
+                    .setConnectionType(input.getConnectionType());
         } else {
             nbiNotificationBuilder.setServiceName(notification.getServiceName());
         }
-        nbiNotificationBuilder.setTopic(TOPIC);
+        nbiNotificationBuilder.setPublisherName(PUBLISHER);
         return nbiNotificationBuilder.build();
     }
 
@@ -202,13 +206,13 @@ public class PceListenerImpl implements TransportpcePceListener {
             return;
         }
         Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
-        PublishNotificationServiceBuilder nbiNotificationBuilder = new PublishNotificationServiceBuilder()
+        PublishNotificationProcessServiceBuilder nbiNotificationBuilder = new PublishNotificationProcessServiceBuilder()
                 .setServiceName(service.getServiceName())
                 .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
                 .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
                 .setCommonId(service.getCommonId())
                 .setConnectionType(service.getConnectionType())
-                .setTopic(TOPIC);
+                .setPublisherName(PUBLISHER);
         if (servicePathRpcResult.getStatus() == RpcStatusEx.Failed) {
             LOG.info("PCE cancel resource failed !");
             sendNbiNotification(nbiNotificationBuilder
@@ -302,7 +306,7 @@ public class PceListenerImpl implements TransportpcePceListener {
      * Send notification to NBI notification in order to publish message.
      * @param service PublishNotificationService
      */
-    private void sendNbiNotification(PublishNotificationService service) {
+    private void sendNbiNotification(PublishNotificationProcessService service) {
         try {
             notificationPublishService.putNotification(service);
         } catch (InterruptedException e) {
index 1ca8fafa6e086c7a16143f7f74cb61bfe496b766..0a6e6f1e6862469b09f2e7d26183f4aac4cc6a80 100644 (file)
@@ -27,10 +27,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191
 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.OtnLinkType;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationServiceBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.notification.service.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
  */
 public class RendererListenerImpl implements TransportpceRendererListener {
 
-    private static final String TOPIC = "RendererListener";
+    private static final String PUBLISHER = "RendererListener";
     private static final Logger LOG = LoggerFactory.getLogger(RendererListenerImpl.class);
     private RendererRpcResultSp serviceRpcResultSp;
     private ServiceDataStoreOperations serviceDataStoreOperations;
@@ -98,7 +98,7 @@ public class RendererListenerImpl implements TransportpceRendererListener {
             case Failed:
                 LOG.error("Renderer service delete failed !");
                 Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
-                sendNbiNotification(new PublishNotificationServiceBuilder()
+                sendNbiNotification(new PublishNotificationProcessServiceBuilder()
                         .setServiceName(service.getServiceName())
                         .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
                         .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
@@ -107,7 +107,7 @@ public class RendererListenerImpl implements TransportpceRendererListener {
                         .setResponseFailed("Renderer service delete failed !")
                         .setMessage("ServiceDelete request failed ...")
                         .setOperationalState(service.getOperationalState())
-                        .setTopic(TOPIC)
+                        .setPublisherName(PUBLISHER)
                         .build());
                 return;
             case Pending:
@@ -162,12 +162,12 @@ public class RendererListenerImpl implements TransportpceRendererListener {
 
         updateOtnTopology(notification, false);
 
-        PublishNotificationServiceBuilder nbiNotificationBuilder = new PublishNotificationServiceBuilder()
+        PublishNotificationProcessServiceBuilder nbiNotificationBuilder = new PublishNotificationProcessServiceBuilder()
                 .setServiceName(input.getServiceName())
                 .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
                 .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
                 .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType())
-                .setTopic(TOPIC);
+                .setPublisherName(PUBLISHER);
         OperationResult operationResult;
         String serviceTemp = "";
         if (tempService) {
@@ -231,7 +231,7 @@ public class RendererListenerImpl implements TransportpceRendererListener {
     private void onFailedServiceImplementation(String serviceName) {
         LOG.error("Renderer implementation failed !");
         Services service = serviceDataStoreOperations.getService(input.getServiceName()).get();
-        sendNbiNotification(new PublishNotificationServiceBuilder()
+        sendNbiNotification(new PublishNotificationProcessServiceBuilder()
                 .setServiceName(service.getServiceName())
                 .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
                 .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
@@ -240,7 +240,7 @@ public class RendererListenerImpl implements TransportpceRendererListener {
                 .setResponseFailed("Renderer implementation failed !")
                 .setMessage("ServiceCreate request failed ...")
                 .setOperationalState(service.getOperationalState())
-                .setTopic(TOPIC)
+                .setPublisherName(PUBLISHER)
                 .build());
         OperationResult deleteServicePathOperationResult =
                 this.serviceDataStoreOperations.deleteServicePath(serviceName);
@@ -290,7 +290,7 @@ public class RendererListenerImpl implements TransportpceRendererListener {
      * Send notification to NBI notification in order to publish message.
      * @param service PublishNotificationService
      */
-    private void sendNbiNotification(PublishNotificationService service) {
+    private void sendNbiNotification(PublishNotificationProcessService service) {
         try {
             notificationPublishService.putNotification(service);
         } catch (InterruptedException e) {
index ee64141f011418dd47d065c6432f2233390029c1..736e6471be4e627b63ab905d6fb7de29c5fd0b7c 100644 (file)
@@ -15,15 +15,15 @@ import org.opendaylight.mdsal.binding.api.DataTreeModification;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ServiceListener implements DataTreeChangeListener<Services> {
 
     private static final Logger LOG = LoggerFactory.getLogger(ServiceListener.class);
-    private static final String TOPIC = "ServiceListener";
+    private static final String PUBLISHER = "ServiceListener";
     private final DataBroker dataBroker;
     private NotificationPublishService notificationPublishService;
 
@@ -54,7 +54,7 @@ public class ServiceListener implements DataTreeChangeListener<Services> {
                                 .setConnectionType(input.getConnectionType())
                                 .setMessage("The service is now outOfService")
                                 .setOperationalState(State.OutOfService)
-                                .setTopic(TOPIC)
+                                .setPublisherName(PUBLISHER)
                                 .build());
                     }
                     else if (rootService.getDataBefore().getOperationalState() == State.OutOfService
@@ -65,7 +65,7 @@ public class ServiceListener implements DataTreeChangeListener<Services> {
                                 .setConnectionType(input.getConnectionType())
                                 .setMessage("The service is now inService")
                                 .setOperationalState(State.InService)
-                                .setTopic(TOPIC)
+                                .setPublisherName(PUBLISHER)
                                 .build());
                     }
                     break;
index 8e2ba983b991f65cc95946dd59a754fd8950c54c..1900ea3059963fe544d7b01c40355b2b02a6f135 100644 (file)
@@ -68,7 +68,6 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
         <argument ref="rendererListener" />
         <argument ref="networkModelListener" />
         <argument ref="serviceDatastoreOperation" />
-        <argument value="ServiceHandler" />
     </bean>
 
     <bean id="provider"
index 641c107a341cddf1e2e9622f8443f2d2e14c0780..46289d95be7ea9ba040e5806952aa3edbfe6f6cb 100644 (file)
@@ -103,7 +103,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                serviceDataStoreOperations, "ServiceHandler");
+                serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result =
             servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
         result.addListener(new Runnable() {
@@ -129,7 +129,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                serviceDataStoreOperations, "ServiceHandler");
+                serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result =  servicehandlerImpl.serviceCreate(input);
         result.addListener(new Runnable() {
             @Override
@@ -151,7 +151,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                serviceDataStoreOperations, "ServiceHandler");
+                serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
             servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
                 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
@@ -176,7 +176,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                serviceDataStoreOperations, "ServiceHandler");
+                serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
         result.addListener(new Runnable() {
             @Override
@@ -200,7 +200,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
                 notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                serviceDataStoreOperations, "ServiceHandler");
+                serviceDataStoreOperations);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
         ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
@@ -226,7 +226,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
                 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
         result.addListener(new Runnable() {
@@ -252,7 +252,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
             servicehandlerImpl.serviceFeasibilityCheck(input);
         result.addListener(new Runnable() {
@@ -275,7 +275,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
                 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
         result.addListener(new Runnable() {
@@ -302,7 +302,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
 
         result.addListener(new Runnable() {
@@ -332,7 +332,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
 
@@ -360,7 +360,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
                 servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
         result.addListener(new Runnable() {
@@ -387,7 +387,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
 
         result.addListener(new Runnable() {
@@ -417,7 +417,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
 
@@ -445,7 +445,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
                 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
         result.addListener(new Runnable() {
@@ -471,7 +471,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
 
         result.addListener(new Runnable() {
@@ -501,7 +501,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
 
@@ -529,7 +529,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
                 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
                         .setCommonId("").build());
@@ -557,7 +557,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
         result.addListener(new Runnable() {
             @Override
@@ -583,7 +583,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
         serviceDataStoreOperations.createTempService(createInput);
 
@@ -610,7 +610,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
                 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
         result.addListener(new Runnable() {
@@ -638,7 +638,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations, "ServiceHandler");
+                        serviceDataStoreOperations);
 
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result =  servicehandlerImpl.tempServiceCreate(input);
         result.addListener(new Runnable() {
index f02dec19f433880189878ea8a470968c0238a55b..cf85247a5fcfe124b139c7c7a52f9560fb3eafa9 100755 (executable)
@@ -28,8 +28,14 @@ import org.opendaylight.mdsal.binding.api.DataTreeModification;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceZEndBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.LgxBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
@@ -37,8 +43,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.re
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210628.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 @RunWith(MockitoJUnitRunner.StrictStubs.class)
@@ -127,18 +133,15 @@ public class ServiceListenerTest {
     }
 
     private Services buildService(State state, AdminStates adminStates) {
-        org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.ServiceAEnd
-                serviceAEnd = getServiceAEndBuild()
-                .build();
-        org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
-                .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1
-                .http.org.openroadm.common.service.types.rev190531.service.ServiceZEndBuilder()
-                .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
-                .setNodeId(new NodeIdType("XPONDER-3-2"))
-                .setTxDirection(getTxDirection())
-                .setRxDirection(getRxDirection())
-                .build();
-
+        ServiceAEnd serviceAEnd = getServiceAEndBuild().build();
+        ServiceZEnd serviceZEnd = new ServiceZEndBuilder()
+                    .setClli("clli")
+                    .setServiceFormat(ServiceFormat.OC)
+                    .setServiceRate(Uint32.valueOf(1))
+                    .setNodeId(new NodeIdType("XPONDER-3-2"))
+                    .setTxDirection(getTxDirection())
+                    .setRxDirection(getRxDirection())
+                    .build();
         ServicesBuilder builtInput = new ServicesBuilder()
                 .setCommonId("commonId")
                 .setConnectionType(ConnectionType.Service)
@@ -152,35 +155,53 @@ public class ServiceListenerTest {
         return builtInput.build();
     }
 
-    private org.opendaylight.yang.gen.v1
-            .http.org.openroadm.common.service.types.rev190531.service.ServiceAEndBuilder getServiceAEndBuild() {
-        return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
-                .ServiceAEndBuilder()
-                .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
+    private ServiceAEndBuilder getServiceAEndBuild() {
+        return new ServiceAEndBuilder()
+                .setClli("clli")
+                .setServiceFormat(ServiceFormat.OC)
+                .setServiceRate(Uint32.valueOf(1))
                 .setNodeId(new NodeIdType("XPONDER-1-2"))
                 .setTxDirection(getTxDirection())
                 .setRxDirection(getRxDirection());
     }
 
     private TxDirection getTxDirection() {
-        return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
-                .endpoint.TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
-                .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
-                .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
-                .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
-                        .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
+        return new TxDirectionBuilder()
+                .setPort(new PortBuilder()
+                        .setPortDeviceName("device name")
+                        .setPortName("port name")
+                        .setPortRack("port rack")
+                        .setPortShelf("port shelf")
+                        .setPortSlot("port slot")
+                        .setPortSubSlot("port subslot")
+                        .setPortType("port type")
+                        .build())
+                .setLgx(new LgxBuilder()
+                        .setLgxDeviceName("lgx device name")
+                        .setLgxPortName("lgx port name")
+                        .setLgxPortRack("lgx port rack")
+                        .setLgxPortShelf("lgx port shelf")
+                        .build())
                 .build();
     }
 
     private RxDirection getRxDirection() {
-        return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
-                .endpoint.RxDirectionBuilder()
-                .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
-                        .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
-                        .setPortSubSlot("port subslot").setPortType("port type").build())
-                .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
-                        .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
-                        .setLgxPortShelf("lgx port shelf").build())
+        return new RxDirectionBuilder()
+                .setPort(new PortBuilder()
+                        .setPortDeviceName("device name")
+                        .setPortName("port name")
+                        .setPortRack("port rack")
+                        .setPortShelf("port shelf")
+                        .setPortSlot("port slot")
+                        .setPortSubSlot("port subslot")
+                        .setPortType("port type")
+                        .build())
+                .setLgx(new LgxBuilder()
+                        .setLgxDeviceName("lgx device name")
+                        .setLgxPortName("lgx port name")
+                        .setLgxPortRack("lgx port rack")
+                        .setLgxPortShelf("lgx port shelf")
+                        .build())
                 .build();
     }
 
@@ -190,7 +211,7 @@ public class ServiceListenerTest {
                 .setConnectionType(ConnectionType.Service)
                 .setMessage(message)
                 .setOperationalState(services.getOperationalState())
-                .setTopic("ServiceListener")
+                .setPublisherName("ServiceListener")
                 .build();
     }
 }
index 64fb893903a42db0a17bd3f9f4a32f91793f4258..b70a4eeb5dbedda055726bfe65b3fee3f8700179 100644 (file)
@@ -42,7 +42,7 @@ URL_CONFIG_CLLI_NET = "{}/config/ietf-network:networks/network/clli-network/"
 URL_CONFIG_ORDM_NET = "{}/config/ietf-network:networks/network/openroadm-network/"
 URL_PORTMAPPING = "{}/config/transportpce-portmapping:network/nodes/"
 URL_OPER_SERV_LIST = "{}/operational/org-openroadm-service:service-list/"
-URL_GET_NBINOTIFICATIONS_SERV = "{}/operations/nbi-notifications:get-notifications-service/"
+URL_GET_NBINOTIFICATIONS_PROCESS_SERV = "{}/operations/nbi-notifications:get-notifications-process-service/"
 URL_GET_NBINOTIFICATIONS_ALARM_SERV = "{}/operations/nbi-notifications:get-notifications-alarm-service/"
 URL_SERV_CREATE = "{}/operations/org-openroadm-service:service-create"
 URL_SERV_DELETE = "{}/operations/org-openroadm-service:service-delete"
@@ -353,8 +353,8 @@ def portmapping_request(suffix: str):
     return get_request(url)
 
 
-def get_notifications_service_request(attr):
-    return post_request(URL_GET_NBINOTIFICATIONS_SERV, attr)
+def get_notifications_process_service_request(attr):
+    return post_request(URL_GET_NBINOTIFICATIONS_PROCESS_SERV, attr)
 
 
 def get_notifications_alarm_service_request(attr):
index 27ff94b5947f6095c375b830052a7ec9694c4f37..14b8bd8882c394ef472549072befac2123ae0422 100644 (file)
@@ -207,7 +207,7 @@ class TransportNbiNotificationstesting(unittest.TestCase):
                 "group-id": "transportpceTest"
             }
         }
-        response = test_utils.get_notifications_service_request(data)
+        response = test_utils.get_notifications_process_service_request(data)
         self.assertEqual(response.status_code, requests.codes.no_content)
         time.sleep(2)
 
@@ -228,13 +228,14 @@ class TransportNbiNotificationstesting(unittest.TestCase):
                 "group-id": "transportpceTest"
             }
         }
-        response = test_utils.get_notifications_service_request(data)
+        response = test_utils.get_notifications_process_service_request(data)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertEqual(res['output']['notification-service'][-1]['service-name'], 'service1')
-        self.assertEqual(res['output']['notification-service'][-1]['connection-type'], 'service')
-        self.assertEqual(res['output']['notification-service'][-1]['message'], 'ServiceCreate request failed ...')
-        self.assertEqual(res['output']['notification-service'][-1]['response-failed'],
+        self.assertEqual(res['output']['notifications-process-service'][-1]['service-name'], 'service1')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['connection-type'], 'service')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['message'],
+                         'ServiceCreate request failed ...')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['response-failed'],
                          'PCE path computation failed !')
         time.sleep(2)
 
@@ -300,12 +301,12 @@ class TransportNbiNotificationstesting(unittest.TestCase):
                 "group-id": "transportpceTest"
             }
         }
-        response = test_utils.get_notifications_service_request(data)
+        response = test_utils.get_notifications_process_service_request(data)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertEqual(res['output']['notification-service'][-1]['service-name'], 'service1')
-        self.assertEqual(res['output']['notification-service'][-1]['connection-type'], 'service')
-        self.assertEqual(res['output']['notification-service'][-1]['message'], 'Service implemented !')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['service-name'], 'service1')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['connection-type'], 'service')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['message'], 'Service implemented !')
         time.sleep(2)
 
     def test_17_get_notifications_alarm_service1(self):
@@ -319,10 +320,10 @@ class TransportNbiNotificationstesting(unittest.TestCase):
         response = test_utils.get_notifications_alarm_service_request(data)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['service-name'], 'service1')
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['connection-type'], 'service')
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['operational-state'], 'inService')
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['message'], 'The service is now inService')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['service-name'], 'service1')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['connection-type'], 'service')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['operational-state'], 'inService')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['message'], 'The service is now inService')
         time.sleep(2)
 
     def test_18_change_status_port_roadma_srg(self):
@@ -351,10 +352,10 @@ class TransportNbiNotificationstesting(unittest.TestCase):
         response = test_utils.get_notifications_alarm_service_request(data)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['service-name'], 'service1')
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['connection-type'], 'service')
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['operational-state'], 'outOfService')
-        self.assertEqual(res['output']['notification-alarm-service'][-1]['message'], 'The service is now outOfService')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['service-name'], 'service1')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['connection-type'], 'service')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['operational-state'], 'outOfService')
+        self.assertEqual(res['output']['notifications-alarm-service'][-1]['message'], 'The service is now outOfService')
         time.sleep(2)
 
     def test_20_restore_status_port_roadma_srg(self):
@@ -391,12 +392,12 @@ class TransportNbiNotificationstesting(unittest.TestCase):
                 "group-id": "transportpceTest"
             }
         }
-        response = test_utils.get_notifications_service_request(data)
+        response = test_utils.get_notifications_process_service_request(data)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertEqual(res['output']['notification-service'][-1]['service-name'], 'service1')
-        self.assertEqual(res['output']['notification-service'][-1]['connection-type'], 'service')
-        self.assertEqual(res['output']['notification-service'][-1]['message'], 'Service deleted !')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['service-name'], 'service1')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['connection-type'], 'service')
+        self.assertEqual(res['output']['notifications-process-service'][-1]['message'], 'Service deleted !')
         time.sleep(2)
 
     def test_24_disconnect_XPDRA(self):