Initial tapi notification implementation 38/97438/40
authorJavier Errea <errea@eurecom.fr>
Wed, 11 Aug 2021 13:06:54 +0000 (15:06 +0200)
committerGilles Thouenon <gilles.thouenon@orange.com>
Fri, 8 Jul 2022 13:09:05 +0000 (15:09 +0200)
- Tapi notification to nbi module
- Create notification subscription service rpc
- Create tapi topic in kafka server and send tapi notifications
- Service state change use case
- Extension of nbi module to support tapi notification service
- Update nbinotification revision date
- TapiRendererListener sends a notification when TAPI service
  is implemented

JIRA: TRNSPRTPCE-387
Change-Id: I32ebbf62570474b5f18787ad0c1c422f3e5e8d68
Signed-off-by: errea <errea@eurecom.fr>
44 files changed:
api/src/main/yang/nbi-notifications@2021-10-13.yang [moved from api/src/main/yang/nbi-notifications@2021-08-13.yang with 67% 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/PublishNotificationProcessServiceModule.java
dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceSerializer.java
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/pom.xml
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/serialization/TapiNotificationSerializer.java [new file with mode: 0644]
nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/utils/TopicManager.java [new file with mode: 0644]
nbinotifications/src/main/resources/OSGI-INF/blueprint/nobinotifications-blueprint.xml
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/impl/NbiNotificationsProviderTest.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/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/test/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListenerTest.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiNetworkModelListenerImpl.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiRendererListenerImpl.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java
tapi/src/main/resources/OSGI-INF/blueprint/tapi-blueprint.xml

similarity index 67%
rename from api/src/main/yang/nbi-notifications@2021-08-13.yang
rename to api/src/main/yang/nbi-notifications@2021-10-13.yang
index b90e196a3219b9334d725d9d1de9fa0c3e453932..e55b7816b9135a512fda8c58fd4903bf9417ec44 100644 (file)
@@ -12,6 +12,14 @@ module nbi-notifications {
   import org-openroadm-common-state-types {
     prefix org-openroadm-common-state-types;
   }
+  import tapi-common {
+    prefix tapi-common;
+    revision-date 2018-12-10;
+   }
+  import tapi-notification {
+    prefix tapi-notification;
+    revision-date 2018-12-10;
+  }
 
   organization
     "transportPCE";
@@ -21,6 +29,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-10-13 {
+    description
+      "Implement new models, RPC for TAPI service notification";
+  }
+
   revision 2021-08-13 {
     description
       "Rename the groupings, containers and RPCs";
@@ -105,6 +118,69 @@ module nbi-notifications {
     }
   }
 
+  grouping notification-tapi-service {
+      leaf notification-type {
+        type tapi-notification:notification-type;
+        description "none";
+      }
+      leaf target-object-type {
+        type tapi-notification:object-type;
+        description "none";
+      }
+      leaf target-object-identifier {
+        type tapi-common:uuid;
+        description "none";
+      }
+      list target-object-name {
+        key 'value-name';
+        min-elements 1;
+        uses tapi-common:name-and-value;
+        description "none";
+      }
+      leaf event-time-stamp {
+        type tapi-common:date-and-time;
+        description "none";
+      }
+      leaf sequence-number {
+        type uint64;
+        config false;
+        description "A monotonous increasing sequence number associated with the notification.
+            The exact semantics of how this sequence number is assigned (per channel or subscription or source or system) is left undefined.";
+      }
+      leaf source-indicator {
+        type tapi-notification:source-indicator;
+        description "none";
+      }
+      leaf layer-protocol-name {
+        type tapi-common:layer-protocol-name;
+        description "none";
+      }
+      list changed-attributes {
+        key 'value-name';
+        uses tapi-notification:name-and-value-change;
+        description "none";
+      }
+      list additional-info {
+        key 'value-name';
+        uses tapi-common:name-and-value;
+        description "none";
+      }
+      leaf additional-text {
+        type string;
+        description "none";
+      }
+      container tca-info {
+        uses tapi-notification:tca-info;
+        description "none";
+      }
+      container alarm-info {
+        uses tapi-notification:alarm-info;
+        description "none";
+      }
+      uses tapi-common:resource-spec;
+      description "none";
+    }
+
   container notification-process-service {
     description
       "Model used to send a notification from a service request";
@@ -117,6 +193,12 @@ module nbi-notifications {
     uses notification-alarm-service;
     }
 
+  container notification-tapi-service {
+      description
+        "Model used to send a tapi notification";
+      uses notification-tapi-service;
+    }
+
   rpc get-notifications-process-service {
     description "Get the notifications service sent by ServiceHandler through filtering connection type";
     input {
@@ -196,4 +278,15 @@ module nbi-notifications {
      }
      uses notification-alarm-service;
   }
+
+  notification publish-tapi-notification-service {
+    description "Publish the TAPI notifications service for topic";
+    leaf topic {
+      type string;
+      mandatory true;
+      description
+        "Topic where to send the notification service";
+    }
+    uses tapi-notification:notification;
+  }
 }
index 63bee535759a193a9fbd5a6ee41b3654db684f94..482a46b782716ca3c826f92349ba48f43e6972bb 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.rev210813.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 4a91e6a4cf1d80cb2c9572797af898cc57a3d442..fcf0b000dd8c80e88ab4c782e025cc2b4af76c93 100644 (file)
@@ -17,9 +17,10 @@ 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.rev210813.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,7 +56,9 @@ public class NbiNotificationsListenerImpl implements NbiNotificationsListener {
 
     @Override
     public void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) {
-
     }
 
+    @Override
+    public void onPublishTapiNotificationService(PublishTapiNotificationService notification) {
+    }
 }
index e6f167824b5fe5be45a55bec1e35c6e6384bd72f..4284f8656dcd40659e7f17f77ea8be230a86a3e1 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.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
 
 @Path("/events")
 public interface EventsApi {
index 9fcbf9f2a398c2854428640d7b550f2bd1477a2f..5ae404b156b91ddf10d5944c7af8d8abb208ba31 100644 (file)
@@ -13,9 +13,9 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirection;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.lgx.Lgx;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.port.Port;
-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;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.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 b9b650ce0573324cf069bacf26528c588e5db6e1..5361e3fa00fec5b16588ca83c2d5792cadbc0fa3 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.rev210813.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
 
 // This class is a temporary workaround while waiting jackson
 // support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
index e05e0fcbb6f91ab923d4b6cee91a51e509a15444..3d48bf57e2466fac24d5ece0c4c1c3789d112189 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.rev210813.notification.process.service.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.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 2e1ae283596e3da6a2eb9e5c96bd326333d01425..b31bf5db62fbfd03e71351212828093f078a3c65 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.rev210813.notification.process.service.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.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 363653b2a908ea240b4e11ebec119cbdcc5ba637..f3df78362adfc1cf0e69b74e388c0e72256b52eb 100644 (file)
@@ -28,11 +28,11 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirectionKey;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
-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.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.LoggerFactory;
index fb3a8f828100277b2932919a53d8751062bbe377..b85554ee234e50da13d8d957e3763de4c0efba08 100644 (file)
@@ -215,7 +215,7 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
             R2RTapiLinkDiscovery tapilinkDiscoveryImpl = new R2RTapiLinkDiscovery(networkTransaction,
                     deviceTransactionManager, tapiLink);
             TapiRendererListenerImpl tapiRendererListenerImpl = new TapiRendererListenerImpl(lightyServices
-                    .getBindingDataBroker());
+                    .getBindingDataBroker(), lightyServices.getBindingNotificationPublishService());
             TapiPceListenerImpl tapiPceListenerImpl = new TapiPceListenerImpl(lightyServices.getBindingDataBroker());
             TapiServiceHandlerListenerImpl tapiServiceHandlerListener = new TapiServiceHandlerListenerImpl(
                     lightyServices.getBindingDataBroker());
@@ -230,7 +230,8 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
             TapiPortMappingListener tapiPortMappingListener =
                     new TapiPortMappingListener(tapiNetworkModelService);
             TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl =
-                    new TapiNetworkModelListenerImpl(networkTransaction);
+                    new TapiNetworkModelListenerImpl(networkTransaction,
+                            lightyServices.getBindingNotificationPublishService());
 
             tapiProvider = initTapi(lightyServices, servicehandler, networkTransaction, serviceDataStoreOperations,
                     tapiNetConfTopologyListener, tapiPortMappingListener, tapiNetworkutilsServiceImpl,
@@ -240,8 +241,9 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
         if (activateNbiNotification) {
             LOG.info("Creating nbi-notifications beans ...");
             nbiNotificationsProvider = new NbiNotificationsProvider(
-                publisherServiceList, publisherAlarmList, null, null, lightyServices.getRpcProviderService(),
-                lightyServices.getNotificationService(), lightyServices.getAdapterContext().currentSerializer());
+                    publisherServiceList, publisherAlarmList, null, null, lightyServices.getRpcProviderService(),
+                    lightyServices.getNotificationService(), lightyServices.getAdapterContext().currentSerializer(),
+                    networkTransaction);
         }
     }
 
index ab28ae2d88648eb0bf3203fc78c7a835134c5f82..f8cc331967f818e0a7fe4015040b0cb123c922c7 100644 (file)
@@ -365,7 +365,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.rev210813.$YangModuleInfoImpl
+            org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.$YangModuleInfoImpl
                     .getInstance());
 
     private static final Set<YangModuleInfo> TPCE_YANG_MODEL = Stream.concat(
index 96ff011b67a401c537422e5ff2a43631ab004616..552c3c2b0e61e2701ae9d223ae3a0b7f1348c91b 100644 (file)
       <artifactId>transportpce-api</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>transportpce-tapimodels</artifactId>
+      <version>${project.version}</version>
+    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>transportpce-common</artifactId>
index 77f6f8552c3cf590a60f2d82cb0fb98a30f0de07..ea5715f7d16ec0f768b24ab60efc38af9719862a 100644 (file)
@@ -8,38 +8,85 @@
 package org.opendaylight.transportpce.nbinotifications.impl;
 
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 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.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.transportpce.nbinotifications.utils.TopicManager;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceInput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.DeleteNotificationSubscriptionServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.DeleteNotificationSubscriptionServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationListInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationListOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceDetailsOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceListInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceListOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetSupportedNotificationTypesInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetSupportedNotificationTypesOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.UpdateNotificationSubscriptionServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.UpdateNotificationSubscriptionServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.context.NotificationContext;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.context.NotificationContextBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.create.notification.subscription.service.output.SubscriptionService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.create.notification.subscription.service.output.SubscriptionServiceBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.context.NotifSubscription;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.context.NotifSubscriptionBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.context.NotifSubscriptionKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.subscription.service.SubscriptionFilter;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.subscription.service.SubscriptionFilterBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NbiNotificationsImpl implements NbiNotificationsService {
+public class NbiNotificationsImpl implements NbiNotificationsService, TapiNotificationService {
     private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsImpl.class);
     private final JsonStringConverter<NotificationProcessService> converterService;
     private final JsonStringConverter<NotificationAlarmService> converterAlarmService;
     private final String server;
+    private final NetworkTransactionService networkTransactionService;
+    private final TopicManager topicManager;
 
     public NbiNotificationsImpl(JsonStringConverter<NotificationProcessService> converterService,
-                                JsonStringConverter<NotificationAlarmService> converterAlarmService, String server) {
+                                JsonStringConverter<NotificationAlarmService> converterAlarmService, String server,
+                                NetworkTransactionService networkTransactionService, TopicManager topicManager) {
         this.converterService = converterService;
         this.converterAlarmService = converterAlarmService;
         this.server = server;
+        this.networkTransactionService = networkTransactionService;
+        this.topicManager = topicManager;
     }
 
     @Override
@@ -75,4 +122,114 @@ public class NbiNotificationsImpl implements NbiNotificationsService {
         return RpcResultBuilder.success(new GetNotificationsAlarmServiceOutputBuilder()
                 .setNotificationsAlarmService(notificationAlarmServiceList).build()).buildFuture();
     }
+
+    @Override
+    public ListenableFuture<RpcResult<GetSupportedNotificationTypesOutput>>
+        getSupportedNotificationTypes(GetSupportedNotificationTypesInput input) {
+        return null;
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<CreateNotificationSubscriptionServiceOutput>>
+            createNotificationSubscriptionService(CreateNotificationSubscriptionServiceInput input) {
+        try {
+            for (Uuid uuid:input.getSubscriptionFilter().getRequestedObjectIdentifier()) {
+                LOG.info("Adding T-API topic: {} to Kafka server", uuid.getValue());
+                this.topicManager.addTapiTopic(uuid.getValue());
+            }
+
+            InstanceIdentifier<NotificationContext> notificationcontextIID =
+                InstanceIdentifier.builder(Context.class).augmentation(Context1.class)
+                    .child(org.opendaylight.yang.gen.v1.urn
+                        .onf.otcc.yang.tapi.notification.rev181210.context.NotificationContext.class)
+                    .build();
+            Optional<NotificationContext> notificationContextOptional
+                = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, notificationcontextIID).get();
+            if (notificationContextOptional.isEmpty()) {
+                LOG.error("Could not create TAPI notification subscription service");
+                return RpcResultBuilder.<CreateNotificationSubscriptionServiceOutput>failed()
+                    .withError(ErrorType.RPC, "Could not read notification context")
+                    .buildFuture();
+            }
+            SubscriptionFilter subscriptionFilter = new SubscriptionFilterBuilder()
+                .setName(input.getSubscriptionFilter().getName())
+                .setLocalId(input.getSubscriptionFilter().getLocalId())
+                .setIncludeContent(input.getSubscriptionFilter().getIncludeContent())
+                .setRequestedNotificationTypes(input.getSubscriptionFilter().getRequestedNotificationTypes())
+                .setRequestedLayerProtocols(input.getSubscriptionFilter().getRequestedLayerProtocols())
+                .setRequestedObjectIdentifier(input.getSubscriptionFilter().getRequestedObjectIdentifier())
+                .setRequestedObjectTypes(input.getSubscriptionFilter().getRequestedObjectTypes())
+                .build();
+            SubscriptionService subscriptionService = new SubscriptionServiceBuilder()
+                .setSubscriptionFilter(subscriptionFilter)
+                .setSubscriptionState(input.getSubscriptionState()).build();
+            Uuid notifSubscriptionUuid = new Uuid(UUID.randomUUID().toString());
+            NotifSubscriptionKey notifSubscriptionKey = new NotifSubscriptionKey(notifSubscriptionUuid);
+            Set<NotificationType> notificationTypes = (subscriptionFilter.getRequestedNotificationTypes() != null)
+                ? subscriptionFilter.getRequestedNotificationTypes()
+                : new HashSet<>(List.of(NotificationType.ALARMEVENT));
+            Set<ObjectType> objectTypes = (subscriptionFilter.getRequestedObjectTypes() != null)
+                ? subscriptionFilter.getRequestedObjectTypes()
+                : new HashSet<>(List.of(ObjectType.CONNECTIVITYSERVICE));
+            NotifSubscription notifSubscription = new NotifSubscriptionBuilder()
+                .setSubscriptionState(subscriptionService.getSubscriptionState())
+                .setSubscriptionFilter(subscriptionService.getSubscriptionFilter())
+                .setUuid(notifSubscriptionUuid)
+                .setSupportedNotificationTypes(notificationTypes)
+                .setSupportedObjectTypes(objectTypes)
+                .setName(subscriptionService.getName())
+                .build();
+            NotificationContext notificationContext = notificationContextOptional.get();
+            Map<NotifSubscriptionKey, NotifSubscription> notifSubscriptions = new HashMap<>();
+            if (notificationContext.getNotifSubscription() != null) {
+                notifSubscriptions.putAll(notificationContext.getNotifSubscription());
+            }
+            notifSubscriptions.put(notifSubscriptionKey, notifSubscription);
+            NotificationContext notificationContext1 = new NotificationContextBuilder()
+                .setNotification(notificationContext.getNotification())
+                .setNotifSubscription(notifSubscriptions)
+                .build();
+            this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, notificationcontextIID,
+                notificationContext1);
+            this.networkTransactionService.commit().get();
+            CreateNotificationSubscriptionServiceOutput serviceOutput =
+                new CreateNotificationSubscriptionServiceOutputBuilder()
+                    .setSubscriptionService(subscriptionService)
+                    .build();
+            return RpcResultBuilder.success(serviceOutput).buildFuture();
+        } catch (InterruptedException | ExecutionException e) {
+            LOG.error("Could not create TAPI notification subscription service");
+            return RpcResultBuilder.<CreateNotificationSubscriptionServiceOutput>failed()
+                .withError(ErrorType.RPC, "Could not read notification context").buildFuture();
+        }
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<UpdateNotificationSubscriptionServiceOutput>>
+        updateNotificationSubscriptionService(UpdateNotificationSubscriptionServiceInput input) {
+        return null;
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<DeleteNotificationSubscriptionServiceOutput>>
+        deleteNotificationSubscriptionService(DeleteNotificationSubscriptionServiceInput input) {
+        return null;
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<GetNotificationSubscriptionServiceDetailsOutput>>
+        getNotificationSubscriptionServiceDetails(GetNotificationSubscriptionServiceDetailsInput input) {
+        return null;
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<GetNotificationSubscriptionServiceListOutput>>
+            getNotificationSubscriptionServiceList(GetNotificationSubscriptionServiceListInput input) {
+        return null;
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<GetNotificationListOutput>> getNotificationList(GetNotificationListInput input) {
+        return null;
+    }
 }
index 24c0383e4dbfb516383666a734612d217a8b5089..7940b1bde8b8ea0deb1201cd7949c2366ec09f15 100644 (file)
@@ -14,14 +14,16 @@ import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
 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.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.transportpce.nbinotifications.utils.TopicManager;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.slf4j.Logger;
@@ -36,30 +38,39 @@ public class NbiNotificationsProvider {
     private final NotificationService notificationService;
     private final JsonStringConverter<NotificationProcessService> converterService;
     private final JsonStringConverter<NotificationAlarmService> converterAlarmService;
+    private final JsonStringConverter<NotificationTapiService> converterTapiService;
     private final String subscriberServer;
     private ObjectRegistration<NbiNotificationsService> rpcRegistration;
     private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
+    private TopicManager topicManager = TopicManager.getInstance();
+    private final NetworkTransactionService networkTransactionService;
 
 
     public NbiNotificationsProvider(List<String> publishersService, List<String> publishersAlarm,
-            String subscriberServer, String publisherServer,
-            RpcProviderService rpcProviderService, NotificationService notificationService,
-            BindingDOMCodecServices bindingDOMCodecServices) {
+                                    String subscriberServer, String publisherServer,
+                                    RpcProviderService rpcProviderService, NotificationService notificationService,
+                                    BindingDOMCodecServices bindingDOMCodecServices,
+                                    NetworkTransactionService networkTransactionService) {
         this.rpcService = rpcProviderService;
         this.notificationService = notificationService;
+        this.topicManager.setPublisherServer(publisherServer);
         converterService =  new JsonStringConverter<>(bindingDOMCodecServices);
+        this.topicManager.setProcessConverter(converterService);
         for (String publisherService: publishersService) {
             LOG.info("Creating publisher for the following class {}", publisherService);
-            publishersServiceMap.put(publisherService, new Publisher<>(publisherService, publisherServer,
-                    converterService, NotificationServiceSerializer.class));
+            this.topicManager.addProcessTopic(publisherService);
         }
         converterAlarmService = new JsonStringConverter<>(bindingDOMCodecServices);
+        this.topicManager.setAlarmConverter(converterAlarmService);
         for (String publisherAlarm: publishersAlarm) {
             LOG.info("Creating publisher for the following class {}", publisherAlarm);
-            publishersAlarmMap.put(publisherAlarm, new Publisher<>(publisherAlarm, publisherServer,
-                    converterAlarmService, NotificationAlarmServiceSerializer.class));
+            this.topicManager.addAlarmTopic(publisherAlarm);
         }
         this.subscriberServer = subscriberServer;
+        converterTapiService = new JsonStringConverter<>(bindingDOMCodecServices);
+        LOG.info("baozhi tapi converter: {}", converterTapiService);
+        this.topicManager.setTapiConverter(converterTapiService);
+        this.networkTransactionService = networkTransactionService;
     }
 
     /**
@@ -67,10 +78,15 @@ public class NbiNotificationsProvider {
      */
     public void init() {
         LOG.info("NbiNotificationsProvider Session Initiated");
-        rpcRegistration = rpcService.registerRpcImplementation(NbiNotificationsService.class,
-                new NbiNotificationsImpl(converterService, converterAlarmService, subscriberServer));
-        listenerRegistration = notificationService.registerNotificationListener(
-                new NbiNotificationsListenerImpl(publishersServiceMap, publishersAlarmMap));
+        NbiNotificationsImpl nbiImpl = new NbiNotificationsImpl(converterService, converterAlarmService,
+            subscriberServer, this.networkTransactionService, this.topicManager);
+        rpcRegistration = rpcService.registerRpcImplementation(NbiNotificationsService.class, nbiImpl);
+        rpcService.registerRpcImplementation(TapiNotificationService.class, nbiImpl);
+        NbiNotificationsListenerImpl nbiNotificationsListener =
+                new NbiNotificationsListenerImpl(this.topicManager.getProcessTopicMap(),
+                        this.topicManager.getAlarmTopicMap(), this.topicManager.getTapiTopicMap());
+        listenerRegistration = notificationService.registerNotificationListener(nbiNotificationsListener);
+        this.topicManager.setNbiNotificationsListener(nbiNotificationsListener);
     }
 
     /**
index 37b4c0181618044108e0d79435ca70ad5a7fa102..797fca71966b61d8a654fd07b591a7127982022c 100644 (file)
@@ -7,27 +7,48 @@
  */
 package org.opendaylight.transportpce.nbinotifications.listener;
 
+import java.util.HashMap;
 import java.util.Map;
 import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
-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.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfo;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfoBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfoKey;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AlarmInfoBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributes;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributesBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributesKey;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectName;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectNameBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectNameKey;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TcaInfoBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
 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<NotificationProcessService>> publishersServiceMap;
-    private final Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap;
+    private Map<String, Publisher<NotificationProcessService>> publishersServiceMap;
+    private Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap;
+    private Map<String, Publisher<NotificationTapiService>> tapiPublisherMap;
 
     public NbiNotificationsListenerImpl(Map<String, Publisher<NotificationProcessService>> publishersServiceMap,
-                                        Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap) {
+                                        Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap,
+                                        Map<String, Publisher<NotificationTapiService>> tapiPublisherMap) {
         this.publishersServiceMap = publishersServiceMap;
         this.publishersAlarmMap = publishersAlarmMap;
+        this.tapiPublisherMap = tapiPublisherMap;
     }
 
     @Override
@@ -67,4 +88,85 @@ public class NbiNotificationsListenerImpl implements NbiNotificationsListener {
                 .setServiceName(notification.getServiceName())
                         .build(), "alarm" + notification.getConnectionType().getName());
     }
+
+    @Override
+    public void onPublishTapiNotificationService(PublishTapiNotificationService notification) {
+        LOG.info("Receiving request for publishing TAPI notification");
+        String topic = notification.getTopic();
+        if (!tapiPublisherMap.containsKey(topic)) {
+            LOG.error("Unknown topic {}", topic);
+            return;
+        }
+        Publisher<NotificationTapiService> publisher = tapiPublisherMap.get(topic);
+        publisher.sendEvent(new NotificationTapiServiceBuilder(transformTapiNotification(notification))
+                .build(), topic);
+    }
+
+    private NotificationTapiService transformTapiNotification(PublishTapiNotificationService notification) {
+        Map<AdditionalInfoKey, AdditionalInfo> addInfoMap = new HashMap<>();
+        if (notification.getAdditionalInfo() != null) {
+            for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.AdditionalInfo
+                addInfo:notification.getAdditionalInfo().values()) {
+                AdditionalInfo transAddInfo = new AdditionalInfoBuilder(addInfo).build();
+                addInfoMap.put(transAddInfo.key(), transAddInfo);
+            }
+        }
+        Map<ChangedAttributesKey, ChangedAttributes> changedAttMap = new HashMap<>();
+        if (notification.getChangedAttributes() != null) {
+            for (org.opendaylight.yang.gen.v1
+                .urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes
+                    changedAtt:notification.getChangedAttributes().values()) {
+                ChangedAttributes transChangedAtt = new ChangedAttributesBuilder(changedAtt).build();
+                changedAttMap.put(transChangedAtt.key(), transChangedAtt);
+            }
+        }
+        Map<NameKey, Name> nameMap = new HashMap<>();
+        if (notification.getName() != null) {
+            for (Name name:notification.getName().values()) {
+                Name transName = new NameBuilder(name).build();
+                nameMap.put(transName.key(), transName);
+            }
+        }
+        Map<TargetObjectNameKey, TargetObjectName> targetObjNameMap = new HashMap<>();
+        if (notification.getTargetObjectName() != null) {
+            for (org.opendaylight.yang.gen.v1
+                .urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectName
+                    targetObjectName:notification.getTargetObjectName().values()) {
+                TargetObjectName transTargetObjName = new TargetObjectNameBuilder(targetObjectName).build();
+                targetObjNameMap.put(transTargetObjName.key(), transTargetObjName);
+            }
+        }
+        LOG.info("Notification uuid = {}", notification.getUuid());
+        return new NotificationTapiServiceBuilder()
+            .setAlarmInfo(notification.getAlarmInfo() == null ? null
+                : new AlarmInfoBuilder(notification.getAlarmInfo()).build())
+            .setAdditionalText(notification.getAdditionalText())
+            .setAdditionalInfo(addInfoMap)
+            .setNotificationType(notification.getNotificationType())
+            .setChangedAttributes(changedAttMap)
+            .setEventTimeStamp(notification.getEventTimeStamp())
+            .setLayerProtocolName(notification.getLayerProtocolName())
+            .setName(nameMap)
+            .setSequenceNumber(notification.getSequenceNumber())
+            .setSourceIndicator(notification.getSourceIndicator())
+            .setTargetObjectIdentifier(notification.getTargetObjectIdentifier())
+            .setTargetObjectName(targetObjNameMap)
+            .setTargetObjectType(notification.getTargetObjectType())
+            .setTcaInfo(notification.getTcaInfo() == null ? null
+                : new TcaInfoBuilder(notification.getTcaInfo()).build())
+            .setUuid(notification.getUuid())
+            .build();
+    }
+
+    public void setPublishersServiceMap(Map<String, Publisher<NotificationProcessService>> publishersServiceMap) {
+        this.publishersServiceMap = publishersServiceMap;
+    }
+
+    public void setPublishersAlarmMap(Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap) {
+        this.publishersAlarmMap = publishersAlarmMap;
+    }
+
+    public void setTapiPublishersMap(Map<String, Publisher<NotificationTapiService>> tapiPublishersMap) {
+        this.tapiPublisherMap = tapiPublishersMap;
+    }
 }
index c08dbfb2fa9ceda56cd4a45569f65738437271a1..4f0d19fcaae2ffea7cc785c1139382d871cba006 100644 (file)
@@ -11,9 +11,9 @@ 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.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.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.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;
index 9d0371a125cab43fab04588c34d0267a470c83d4..9816d9f6ff7cd70f4463210463bd575a15c30f16 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.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.slf4j.Logger;
index eab7f3618f9eb031e94a0c789a850f8d2b8d62fc..73e979310683355c0eb86d17e5dd4eaf5cb21d55 100644 (file)
@@ -11,9 +11,9 @@ 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.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.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.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;
index dc2c3d775737d8a290baf77416d4f4726a90224b..8090ccd268f8538027a56aec5999465d5520f321 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.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.slf4j.Logger;
diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationSerializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationSerializer.java
new file mode 100644 (file)
index 0000000..7525fcf
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright Â© 2021 Nokia, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.nbinotifications.serialization;
+
+import java.io.IOException;
+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.rev211013.NotificationTapiService;
+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 TapiNotificationSerializer implements Serializer<NotificationTapiService> {
+    private static final Logger LOG = LoggerFactory.getLogger(TapiNotificationSerializer.class);
+    private JsonStringConverter<NotificationTapiService> converter;
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public void configure(Map<String, ?> configs, boolean isKey) {
+        LOG.info("Deserializer configuration {}", configs);
+        if (configs.containsKey(ConfigConstants.CONVERTER)
+                && configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter<?>) {
+            converter = (JsonStringConverter<NotificationTapiService>) configs.get(ConfigConstants.CONVERTER);
+        }
+    }
+
+    @Override
+    public byte[] serialize(String topic, NotificationTapiService data) {
+        if (converter == null) {
+            throw new IllegalArgumentException(
+                    "Converter should be configured through configure method of serializer");
+        }
+        if (data == null) {
+            LOG.error("Notification data is empty");
+            return new byte[0];
+        }
+        try {
+            InstanceIdentifier<NotificationTapiService> iid = InstanceIdentifier.builder(NotificationTapiService.class)
+                .build();
+            String serialized = converter.createJsonStringFromDataObject(iid, data, JSONCodecFactorySupplier.RFC7951);
+            LOG.info("Serialized event {}", serialized);
+            return serialized.getBytes(StandardCharsets.UTF_8);
+        } catch (IOException e) {
+            LOG.error("Event couldnt be serialized", e);
+            return new byte[0];
+        }
+    }
+}
diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/utils/TopicManager.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/utils/TopicManager.java
new file mode 100644 (file)
index 0000000..6960ab5
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright Â© 2021 Nokia, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.nbinotifications.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.opendaylight.transportpce.common.converter.JsonStringConverter;
+import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
+import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
+import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer;
+import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer;
+import org.opendaylight.transportpce.nbinotifications.serialization.TapiNotificationSerializer;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class TopicManager {
+
+    private static final Logger LOG = LoggerFactory.getLogger(TopicManager.class);
+    private static TopicManager instance = new TopicManager();
+
+    private Map<String, Publisher<NotificationTapiService>> tapiPublisherMap = new HashMap<>();
+    private String publisherServer;
+    private JsonStringConverter<NotificationTapiService> tapiConverter;
+    private NbiNotificationsListenerImpl nbiNotificationsListener;
+    private Map<String, Publisher<NotificationAlarmService>> alarmPublisherMap = new HashMap<>();
+    private Map<String, Publisher<NotificationProcessService>> processPublisherMap = new HashMap<>();
+    private JsonStringConverter<NotificationProcessService> processConverter;
+    private JsonStringConverter<NotificationAlarmService> alarmConverter;
+    private int calledSetConverter = 0;
+
+    private TopicManager() {
+    }
+
+    public static TopicManager getInstance() {
+        return instance;
+    }
+
+    public void setNbiNotificationsListener(NbiNotificationsListenerImpl nbiNotificationsListener) {
+        this.nbiNotificationsListener = nbiNotificationsListener;
+    }
+
+    public void setProcessConverter(JsonStringConverter<NotificationProcessService> processConverter) {
+        this.processConverter = processConverter;
+    }
+
+    public void setAlarmConverter(JsonStringConverter<NotificationAlarmService> alarmConverter) {
+        this.alarmConverter = alarmConverter;
+    }
+
+    public void setTapiConverter(JsonStringConverter<NotificationTapiService> tapiConverter) {
+        this.tapiConverter = tapiConverter;
+        this.calledSetConverter++;
+    }
+
+    public void setPublisherServer(String publisherServer) {
+        this.publisherServer = publisherServer;
+    }
+
+    public void addProcessTopic(String topic) {
+        LOG.info("Adding process topic: {}", topic);
+        processPublisherMap.put(topic, new Publisher<>(topic, publisherServer, processConverter,
+            NotificationServiceSerializer.class));
+        if (this.nbiNotificationsListener != null) {
+            this.nbiNotificationsListener.setPublishersServiceMap(processPublisherMap);
+        }
+    }
+
+    public void addAlarmTopic(String topic) {
+        LOG.info("Adding alarm topic: {}", topic);
+        alarmPublisherMap.put(topic, new Publisher<>(topic, publisherServer, alarmConverter,
+                NotificationAlarmServiceSerializer.class));
+        if (this.nbiNotificationsListener != null) {
+            this.nbiNotificationsListener.setPublishersAlarmMap(alarmPublisherMap);
+        }
+    }
+
+    public void addTapiTopic(String topic) {
+        if (tapiPublisherMap.containsKey(topic)) {
+            LOG.info("Tapi topic: {} already exists", topic);
+            return;
+        }
+        LOG.info("Adding new tapi topic: {}", topic);
+        tapiPublisherMap.put(topic, new Publisher<>(topic, publisherServer, tapiConverter,
+            TapiNotificationSerializer.class));
+        if (this.nbiNotificationsListener != null) {
+            this.nbiNotificationsListener.setTapiPublishersMap(tapiPublisherMap);
+        }
+    }
+
+    public Map<String, Publisher<NotificationTapiService>> getTapiTopicMap() {
+        return this.tapiPublisherMap;
+    }
+
+    public Map<String, Publisher<NotificationAlarmService>> getAlarmTopicMap() {
+        return this.alarmPublisherMap;
+    }
+
+    public Map<String, Publisher<NotificationProcessService>> getProcessTopicMap() {
+        return this.processPublisherMap;
+    }
+}
index d938b9d28d1608a29e35effd823a46fe8deff714..39bb0c041418fec801173e0a71a78bd7b2cedb18 100644 (file)
@@ -15,6 +15,8 @@ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
     <reference id="rpcService" interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/>
     <reference id="notificationService" interface="org.opendaylight.mdsal.binding.api.NotificationService"/>
     <reference id="bindingDOMCodecServices" interface="org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices" />
+    <reference id="networkTransactionImpl"
+               interface="org.opendaylight.transportpce.common.network.NetworkTransactionService" />
     <bean id="provider"
         class="org.opendaylight.transportpce.nbinotifications.impl.NbiNotificationsProvider"
         init-method="init" destroy-method="close">
@@ -36,5 +38,6 @@ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
         <argument ref="rpcService" />
         <argument ref="notificationService" />
         <argument ref="bindingDOMCodecServices" />
+        <argument ref="networkTransactionImpl" />
     </bean>
 </blueprint>
index 7e5fcf615a00f5bbb55194a2df6fe253b3fe44f5..c32142f23b57e047cca5707190ddbb77b0927351 100644 (file)
@@ -22,10 +22,10 @@ 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.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.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
 
 public class SubscriberTest extends AbstractTest {
     private static final String TOPIC = "topic";
index 825193f01fdc95c221dd0d0d144321cdda322474..3ba5258240f1c09ce1f325d2985dbf9ccbc7b19d 100644 (file)
@@ -13,27 +13,39 @@ import com.google.common.util.concurrent.ListenableFuture;
 import java.util.concurrent.ExecutionException;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Mock;
 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
+import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.transportpce.common.network.RequestProcessor;
+import org.opendaylight.transportpce.nbinotifications.utils.TopicManager;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
-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.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutput;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public class NbiNotificationsImplTest extends AbstractTest {
     private NbiNotificationsImpl nbiNotificationsImpl;
+    public static NetworkTransactionService networkTransactionService;
+
+    @Mock
+    private TopicManager topicManager;
 
     @Before
     public void setUp() {
+        networkTransactionService = new NetworkTransactionImpl(
+            new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
         JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
                 getDataStoreContextUtil().getBindingDOMCodecServices());
         JsonStringConverter<NotificationAlarmService> converterAlarm = new JsonStringConverter<>(
                 getDataStoreContextUtil().getBindingDOMCodecServices());
-        nbiNotificationsImpl = new NbiNotificationsImpl(converter, converterAlarm,"localhost:8080");
+        nbiNotificationsImpl = new NbiNotificationsImpl(converter, converterAlarm,"localhost:8080",
+            networkTransactionService, topicManager);
     }
 
     @Test
index 2b917aab040360084fd2006133e0f0421b1b6414..93827286f55d8cf73e5011f3158b12fb2a5dd172 100644 (file)
@@ -18,10 +18,14 @@ import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.transportpce.common.network.RequestProcessor;
 import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
 import org.opendaylight.transportpce.test.AbstractTest;
 
 public class NbiNotificationsProviderTest  extends AbstractTest {
+    public static NetworkTransactionService networkTransactionService;
 
     @Mock
     RpcProviderService rpcProviderRegistry;
@@ -37,12 +41,14 @@ public class NbiNotificationsProviderTest  extends AbstractTest {
 
     @Test
     public void initTest() {
+        networkTransactionService = new NetworkTransactionImpl(
+            new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
         NbiNotificationsProvider provider = new NbiNotificationsProvider(
                 Arrays.asList("topic1", "topic2"), Arrays.asList("topic1", "topic2"), "localhost:8080",
                 "localhost:8080", rpcProviderRegistry, notificationService,
-                getDataStoreContextUtil().getBindingDOMCodecServices());
+                getDataStoreContextUtil().getBindingDOMCodecServices(), networkTransactionService);
         provider.init();
-        verify(rpcProviderRegistry, times(1))
+        verify(rpcProviderRegistry, times(2))
                 .registerRpcImplementation(any(), any(NbiNotificationsImpl.class));
         verify(notificationService, times(1))
                 .registerNotificationListener(any(NbiNotificationsListenerImpl.class));
index c0fa4d1ba39f7b4fe10437c04dcc229a8fb23c13..1743723e6883853be8d9a3563d6fad0199953e23 100644 (file)
@@ -12,6 +12,7 @@ import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
+import java.util.HashMap;
 import java.util.Map;
 import org.junit.Before;
 import org.junit.Test;
@@ -21,12 +22,12 @@ 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.rev211210.ConnectionType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
-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;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
 
 public class NbiNotificationsListenerImplTest extends AbstractTest {
     @Mock
@@ -42,7 +43,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest {
     @Test
     public void onPublishNotificationServiceTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
-                Map.of("test", publisherAlarm));
+                Map.of("test", publisherAlarm), new HashMap<>());
         PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
                 .setPublisherName("test")
                 .setCommonId("commonId")
@@ -58,7 +59,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest {
     @Test
     public void onPublishNotificationServiceWrongPublisherTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
-                Map.of("test", publisherAlarm));
+                Map.of("test", publisherAlarm), new HashMap<>());
         PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
                 .setPublisherName("wrongPublisher")
                 .setCommonId("commonId")
@@ -74,7 +75,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest {
     @Test
     public void onPublishNotificationAlarmServiceTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
-                Map.of("test", publisherAlarm));
+                Map.of("test", publisherAlarm), new HashMap<>());
         PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
                 .setPublisherName("test")
                 .setConnectionType(ConnectionType.Service)
@@ -89,7 +90,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest {
     @Test
     public void onPublishNotificationAlarmServiceWrongPublisherTest() {
         NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
-                Map.of("test", publisherAlarm));
+                Map.of("test", publisherAlarm), new HashMap<>());
         PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
                 .setPublisherName("wrongPublisher")
                 .setConnectionType(ConnectionType.Service)
index 4b9e160f585428727d90592833295b15055f8f62..1d988fc0ce2700b4bd6ca9d43fc7cb168879f181 100644 (file)
@@ -22,8 +22,8 @@ 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.rev210813.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 
index b0d156a2a66af52ad617f562c0fc76bbc85f5604..d1c5c39a4bc94bec2c9d6e38fecde84efe343943 100755 (executable)
@@ -16,8 +16,8 @@ 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.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.rev211013.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
 
 public class NotificationAlarmServiceDeserializerTest extends AbstractTest {
 
index 605c85158d6b34c1ea11fea8c8e60bb23f1cb4ea..b850f5b7956a8bc6a7526929ff42c65fd536cd45 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.rev210813.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 
index 12f7a80f33c2bdf19a2f1d0709878833f711ab8e..0c47b49bcdf1362a565d521670dd632f1ff6939e 100644 (file)
@@ -16,8 +16,8 @@ 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.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.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
 
 public class NotificationServiceDeserializerTest extends AbstractTest {
 
index 4a4868bbd29d36a66f69bcd44da38b910de70372..51d83fa14af08548b0a3118f5663df5882e3627e 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.rev210813.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 
index de4cb5f01565d5d2c90a9a7d4829688e38cf5532..ea8c5496a548b8c22b0fdff46b7795578bb71b04 100644 (file)
@@ -20,14 +20,14 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.port.PortBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
-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.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint8;
 
index 47209dd7dc7b96c60378e63a8ec22c97cd4034f5..4e277d8a5171859faefbd8018330ffe8f2fc7648 100644 (file)
 {
   "nbi-notifications:notification-process-service": {
-    "common-id": "commond-id",
-    "message": "message",
-    "operational-state": "inService",
+    "connection-type": "service",
     "service-z-end": {
-      "node-id": "XPONDER-1-2",
-      "service-rate": 1,
-      "clli": "clli",
-      "is-split-lambda": false,
-      "service-format": "OC",
       "tx-direction": [
         {
           "index": 0,
+          "lgx": {
+            "lgx-port-rack": "lgx port rack",
+            "lgx-device-name": "lgx device name",
+            "lgx-port-shelf": "lgx port shelf",
+            "lgx-port-name": "lgx port name"
+          },
           "port": {
-            "port-name": "port name",
-            "port-slot": "port slot",
+            "port-type": "port type",
             "port-sub-slot": "port subslot",
+            "port-name": "port name",
+            "port-rack": "port rack",
             "port-device-name": "device name",
-            "port-shelf": "port shelf",
-            "port-type": "port type",
-            "port-rack": "port rack"
-          },
-          "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"
+            "port-slot": "port slot",
+            "port-shelf": "port shelf"
           }
         }
       ],
+      "node-id": "XPONDER-1-2",
+      "service-format": "OC",
+      "service-rate": 1,
       "rx-direction": [
         {
           "index": 0,
+          "lgx": {
+            "lgx-port-rack": "lgx port rack",
+            "lgx-device-name": "lgx device name",
+            "lgx-port-shelf": "lgx port shelf",
+            "lgx-port-name": "lgx port name"
+          },
           "port": {
-            "port-name": "port name",
-            "port-slot": "port slot",
+            "port-type": "port type",
             "port-sub-slot": "port subslot",
+            "port-name": "port name",
+            "port-rack": "port rack",
             "port-device-name": "device name",
-            "port-shelf": "port shelf",
-            "port-type": "port type",
-            "port-rack": "port rack"
-          },
-          "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"
+            "port-slot": "port slot",
+            "port-shelf": "port shelf"
           }
         }
-      ]
+      ],
+      "is-split-lambda": false,
+      "clli": "clli"
     },
-    "service-name": "service1",
-    "connection-type": "service",
+    "message": "message",
     "service-a-end": {
-      "node-id": "XPONDER-1-2",
-      "service-rate": 1,
-      "clli": "clli",
-      "is-split-lambda": false,
-      "service-format": "OC",
       "tx-direction": [
         {
           "index": 0,
+          "lgx": {
+            "lgx-port-rack": "lgx port rack",
+            "lgx-device-name": "lgx device name",
+            "lgx-port-shelf": "lgx port shelf",
+            "lgx-port-name": "lgx port name"
+          },
           "port": {
-            "port-name": "port name",
-            "port-slot": "port slot",
+            "port-type": "port type",
             "port-sub-slot": "port subslot",
+            "port-name": "port name",
+            "port-rack": "port rack",
             "port-device-name": "device name",
-            "port-shelf": "port shelf",
-            "port-type": "port type",
-            "port-rack": "port rack"
-          },
-          "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"
+            "port-slot": "port slot",
+            "port-shelf": "port shelf"
           }
         }
       ],
+      "node-id": "XPONDER-1-2",
+      "service-format": "OC",
+      "service-rate": 1,
       "rx-direction": [
         {
           "index": 0,
+          "lgx": {
+            "lgx-port-rack": "lgx port rack",
+            "lgx-device-name": "lgx device name",
+            "lgx-port-shelf": "lgx port shelf",
+            "lgx-port-name": "lgx port name"
+          },
           "port": {
-            "port-name": "port name",
-            "port-slot": "port slot",
+            "port-type": "port type",
             "port-sub-slot": "port subslot",
+            "port-name": "port name",
+            "port-rack": "port rack",
             "port-device-name": "device name",
-            "port-shelf": "port shelf",
-            "port-type": "port type",
-            "port-rack": "port rack"
-          },
-          "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"
+            "port-slot": "port slot",
+            "port-shelf": "port shelf"
           }
         }
-      ]
+      ],
+      "is-split-lambda": false,
+      "clli": "clli"
     },
-    "response-failed": ""
+    "operational-state": "inService",
+    "common-id": "commond-id",
+    "response-failed": "",
+    "service-name": "service1"
   }
-}
+}
\ No newline at end of file
index 68480455ff4ab4654738d55fecdc428ffb52b17c..4b71fd0d8352615e80a9869cdecfb9453bb07ac5 100755 (executable)
@@ -1,8 +1,8 @@
 {
   "nbi-notifications:notification-alarm-service": {
+    "connection-type": "service",
     "message": "The service is now inService",
-    "operational-state": "inService",
     "service-name": "service1",
-    "connection-type": "service"
+    "operational-state": "inService"
   }
 }
\ No newline at end of file
index 109531e342c5670c17ff96b665bf3d38720b072b..37e7c1a223a14507f7f7a0accc7c51b903bcfd2a 100644 (file)
@@ -105,10 +105,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempSer
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo.TailRetention;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
-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.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.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;
index 74d659a24ec44479b73bb7341223f2aa669d915a..1fd4cbb39dff1ecbe6008a74c5220124d2ece430 100644 (file)
@@ -26,10 +26,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder;
-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.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index a30c7d2378cffc7656ea27af9c952b044cbecdea..9eb124cad5d1dc1325e38762bb82431b6ec3085a 100644 (file)
@@ -29,10 +29,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.rev211210.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType;
-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.nbi.notifications.rev211013.PublishNotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index 73702010884f06c062614745e51950879bf21547..64d46b4cf7f33bbf4431f5c0f1078d52d147dc32 100644 (file)
@@ -39,8 +39,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
-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.rev211013.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 368009f6daf1538c5ad81bc294b32124431dc5f1..b8d5290f08784e55871349b216fb007ae3dd4d06 100755 (executable)
@@ -57,8 +57,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.Service
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesBuilder;
-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.rev211013.PublishNotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint8;
index b68f43ccf5c26fb0c0c6a23b9248a211f4558ae1..0f87998752fc82b895f5338895f6c4de0bd69478 100644 (file)
@@ -99,13 +99,13 @@ public class TapiProvider {
     private TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl;
 
     public TapiProvider(DataBroker dataBroker, RpcProviderService rpcProviderService,
-            OrgOpenroadmServiceService serviceHandler, ServiceDataStoreOperations serviceDataStoreOperations,
+            OrgOpenroadmServiceService serviceHandler,ServiceDataStoreOperations serviceDataStoreOperations,
             TapiListener tapiListener, NetworkTransactionService networkTransactionService,
             TapiNetconfTopologyListener topologyListener, TapiPortMappingListener tapiPortMappingListener,
             TransportpceTapinetworkutilsService tapiNetworkUtils, TapiPceListenerImpl pceListenerImpl,
             TapiRendererListenerImpl rendererListenerImpl, TapiServiceHandlerListenerImpl serviceHandlerListenerImpl,
             NotificationService notificationService, TapiOrLinkListener orLinkListener,
-                        TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl) {
+            TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl) {
         this.dataBroker = dataBroker;
         this.rpcProviderService = rpcProviderService;
         this.serviceHandler = serviceHandler;
@@ -121,6 +121,7 @@ public class TapiProvider {
         this.notificationService = notificationService;
         this.orLinkListener = orLinkListener;
         this.tapiNetworkModelListenerImpl = tapiNetworkModelListenerImpl;
+        //this.notificationPublishService = notificationPublishService;
     }
 
     /**
@@ -142,6 +143,7 @@ public class TapiProvider {
         TapiConnectivityImpl tapi = new TapiConnectivityImpl(this.serviceHandler, tapiContext, connectivityUtils,
                 pceListenerImpl, rendererListenerImpl);
         TapiTopologyImpl topo = new TapiTopologyImpl(this.dataBroker, tapiContext, topologyUtils, tapiLink);
+
         rpcRegistration = rpcProviderService.registerRpcImplementation(TapiConnectivityService.class, tapi);
         rpcProviderService.registerRpcImplementation(TapiTopologyService.class, topo);
         rpcProviderService.registerRpcImplementation(TapiCommonService.class, topo);
index 995fee80c11afa355cb40defe5b0a8073e17552a..2d92919b9f6d884d8f024e4e50eceab0be71194e 100644 (file)
@@ -8,6 +8,9 @@
 package org.opendaylight.transportpce.tapi.listeners;
 
 import java.nio.charset.StandardCharsets;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -19,15 +22,21 @@ import java.util.Optional;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
 import java.util.stream.Collectors;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.tapi.TapiStringConstants;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationServiceBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.DateAndTime;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.OwnedNodeEdgePoint1;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connection.LowerConnection;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.Connection;
@@ -42,6 +51,12 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev18121
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationListener;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectName;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.NodeEdgePointRef;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext;
@@ -64,12 +79,14 @@ public class TapiNetworkModelListenerImpl implements TapiNotificationListener {
     private final Uuid tapiTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
             .getBytes(StandardCharsets.UTF_8)).toString());
     private final List<LayerProtocolName> orderedServiceLayerList;
+    private final NotificationPublishService notificationPublishService;
 
-
-    public TapiNetworkModelListenerImpl(NetworkTransactionService networkTransactionService) {
+    public TapiNetworkModelListenerImpl(NetworkTransactionService networkTransactionService,
+                                        NotificationPublishService notificationPublishService) {
         this.networkTransactionService = networkTransactionService;
         this.orderedServiceLayerList = List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
             LayerProtocolName.DSR, LayerProtocolName.ETH);
+        this.notificationPublishService = notificationPublishService;
     }
 
     @Override
@@ -88,7 +105,64 @@ public class TapiNetworkModelListenerImpl implements TapiNotificationListener {
                     .map(NameAndValueChange::getNewValue)
                     .collect(Collectors.toList()));
             updateConnectivityServices();
-            // todo  create NotificationPublishSerivce (Tapi) object + send Notification
+            // todo set attributes
+            for (ConnectivityService connService : this.connectivityServiceChanges) {
+                sendNbiNotification(createNbiNotification(connService));
+            }
+        }
+    }
+
+    private PublishTapiNotificationService createNbiNotification(ConnectivityService connService) {
+        if (connService == null) {
+            LOG.error("ConnService is null");
+            return null;
+        }
+        Map<ChangedAttributesKey, ChangedAttributes> changedStates = new HashMap<>();
+        changedStates.put(new ChangedAttributesKey("administrativeState"),
+            new ChangedAttributesBuilder()
+                .setNewValue(connService.getAdministrativeState().getName())
+                .setOldValue(connService.getAdministrativeState().equals(AdministrativeState.UNLOCKED)
+                    ? AdministrativeState.LOCKED.getName() : AdministrativeState.UNLOCKED.getName())
+                .setValueName("administrativeState").build());
+        changedStates.put(new ChangedAttributesKey("operationalState"),
+            new ChangedAttributesBuilder()
+                .setNewValue(connService.getOperationalState().getName())
+                .setOldValue(connService.getOperationalState().equals(OperationalState.ENABLED)
+                    ? OperationalState.DISABLED.getName() : OperationalState.ENABLED.getName())
+                .setValueName("operationalState").build());
+        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
+        OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
+        DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
+        Map<TargetObjectNameKey, TargetObjectName> targetObjectNames = new HashMap<>();
+        if (connService.getName() != null) {
+            for (Map.Entry<NameKey, Name> entry : connService.getName().entrySet()) {
+                targetObjectNames.put(new TargetObjectNameKey(entry.getKey().getValueName()),
+                    new TargetObjectNameBuilder()
+                        .setValueName(entry.getValue().getValueName())
+                        .setValue(entry.getValue().getValue())
+                        .build());
+            }
+        }
+
+        return new PublishTapiNotificationServiceBuilder()
+            .setUuid(new Uuid(UUID.randomUUID().toString()))
+            .setTopic(connService.getUuid().getValue())
+            .setTargetObjectIdentifier(connService.getUuid())
+            .setNotificationType(NotificationType.ATTRIBUTEVALUECHANGE)
+            .setChangedAttributes(changedStates)
+            .setEventTimeStamp(datetime)
+            .setTargetObjectName(targetObjectNames)
+            .setTargetObjectType(ObjectType.CONNECTIVITYSERVICE)
+            .setLayerProtocolName(connService.getServiceLayer())
+            .build();
+    }
+
+    private void sendNbiNotification(PublishTapiNotificationService service) {
+        try {
+            this.notificationPublishService.putNotification(service);
+        } catch (InterruptedException e) {
+            LOG.warn("Cannot send notification to nbi", e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -119,8 +193,8 @@ public class TapiNetworkModelListenerImpl implements TapiNotificationListener {
                 OperationalState operState = (OperationalState) states.get(connService.getUuid())[1];
 
                 InstanceIdentifier<ConnectivityService> connServIID = InstanceIdentifier
-                    .builder(Context.class).augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi
-                        .connectivity.rev181210.Context1.class)
+                    .builder(Context.class).augmentation(org.opendaylight.yang.gen.v1
+                                .urn.onf.otcc.yang.tapi.connectivity.rev181210.Context1.class)
                     .child(ConnectivityContext.class)
                     .child(ConnectivityService.class, new ConnectivityServiceKey(connService.getUuid()))
                     .build();
index 24d5e30975a166e9a45e1c3492b8ffe4a879e26d..0080c77c1e8e44b778cc2f074bfe32a87f147d8a 100644 (file)
@@ -8,22 +8,33 @@
 package org.opendaylight.transportpce.tapi.listeners;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Optional;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.common.network.RequestProcessor;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSp;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererListener;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationServiceBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.DateAndTime;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.Context1;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionKey;
@@ -31,6 +42,14 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18121
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityServiceBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityServiceKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.Connection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectName;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,10 +61,12 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener {
     private Uuid serviceUuid;
     private RendererRpcResultSp serviceRpcResultSp;
     private final NetworkTransactionService networkTransactionService;
+    private final NotificationPublishService notificationPublishService;
 
-    public TapiRendererListenerImpl(DataBroker dataBroker) {
+    public TapiRendererListenerImpl(DataBroker dataBroker, NotificationPublishService notificationPublishService) {
         this.dataBroker = dataBroker;
         this.networkTransactionService = new NetworkTransactionImpl(new RequestProcessor(this.dataBroker));
+        this.notificationPublishService = notificationPublishService;
     }
 
     @Override
@@ -98,7 +119,7 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener {
             LOG.error("Couldnt retrieve service from datastore");
             return;
         }
-        LOG.info("Connectivity service = {}", connectivityService.toString());
+        LOG.info("Connectivity service = {}", connectivityService);
         // TODO --> this throws error because the renderer goes really fast. Is this normal??
         ConnectivityService updtConnServ = new ConnectivityServiceBuilder(connectivityService)
             .setAdministrativeState(AdministrativeState.UNLOCKED)
@@ -109,6 +130,8 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener {
             updateConnectionState(connection.getConnectionUuid());
         }
         updateConnectivityService(updtConnServ);
+        // TODO: need to send notification to kafka in case the topic exists!!
+        sendNbiNotification(createNbiNotification(updtConnServ));
     }
 
     /**
@@ -118,7 +141,7 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener {
     private void onFailedServiceImplementation(String serviceName) {
         LOG.error("Renderer implementation failed !");
         LOG.info("PCE cancel resource done OK !");
-        Uuid suuid = new Uuid(UUID.nameUUIDFromBytes(serviceName.getBytes(Charset.forName("UTF-8")))
+        Uuid suuid = new Uuid(UUID.nameUUIDFromBytes(serviceName.getBytes(StandardCharsets.UTF_8))
                 .toString());
         // get connections of connectivity service and remove them from tapi context and then remove
         //  service from context. The CEPs are maintained as they could be reused by another service
@@ -278,6 +301,66 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener {
         }
     }
 
+    private void sendNbiNotification(PublishTapiNotificationService service) {
+        try {
+            this.notificationPublishService.putNotification(service);
+        } catch (InterruptedException e) {
+            LOG.warn("Cannot send notification to nbi", e);
+            Thread.currentThread().interrupt();
+        }
+    }
+
+    private PublishTapiNotificationService createNbiNotification(ConnectivityService connService) {
+        if (connService == null) {
+            LOG.error("ConnService is null");
+            return null;
+        }
+        /*
+        Map<ChangedAttributesKey, ChangedAttributes> changedStates = changedAttributesMap.entrySet()
+                .stream()
+                .filter(e -> e.getKey().getValueName().equals("administrative")
+                        || e.getKey().getValueName().equals("operational"))
+                .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
+
+         */
+        Map<ChangedAttributesKey, ChangedAttributes> changedStates = new HashMap<>();
+        changedStates.put(new ChangedAttributesKey("administrativeState"),
+            new ChangedAttributesBuilder()
+                .setNewValue(connService.getAdministrativeState().getName())
+                .setOldValue(AdministrativeState.LOCKED.getName())
+                .setValueName("administrativeState").build());
+        changedStates.put(new ChangedAttributesKey("operationalState"),
+            new ChangedAttributesBuilder()
+                .setNewValue(connService.getOperationalState().getName())
+                .setOldValue(OperationalState.DISABLED.getName())
+                .setValueName("operationalState").build());
+        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
+        OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
+        DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
+        Map<TargetObjectNameKey, TargetObjectName> targetObjectNames = new HashMap<>();
+        if (connService.getName() != null) {
+            for (Map.Entry<NameKey, Name> entry : connService.getName().entrySet()) {
+                targetObjectNames.put(new TargetObjectNameKey(entry.getKey().getValueName()),
+                    new TargetObjectNameBuilder()
+                        .setValueName(entry.getValue().getValueName())
+                        .setValue(entry.getValue().getValue())
+                        .build());
+            }
+        }
+
+        return new PublishTapiNotificationServiceBuilder()
+            .setUuid(new Uuid(UUID.randomUUID().toString()))
+            .setTopic(connService.getUuid().getValue())
+            .setTargetObjectIdentifier(connService.getUuid())
+            .setNotificationType(NotificationType.ATTRIBUTEVALUECHANGE)
+            .setChangedAttributes(changedStates)
+            .setEventTimeStamp(datetime)
+            .setTargetObjectName(targetObjectNames)
+            .setTargetObjectType(ObjectType.CONNECTIVITYSERVICE)
+            .setLayerProtocolName(connService.getServiceLayer())
+            .build();
+    }
+
     public void setServiceUuid(Uuid serviceUuid) {
         this.serviceUuid = serviceUuid;
     }
index 12f86017532d5590df78c032c001bd151f973563..a44e508104b4d07b2bc8316b4420037f9d28f86f 100644 (file)
@@ -38,6 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18121
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContextBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepList;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.context.NotificationContextBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContextBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
@@ -102,13 +103,22 @@ public class TapiContext {
                         .build())
                     .build();
 
+            org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1 notificationContext
+                = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1Builder()
+                    .setNotificationContext(new NotificationContextBuilder()
+                        .setNotification(new HashMap<>())
+                        .setNotifSubscription(new HashMap<>())
+                        .build())
+                    .build();
+
             ContextBuilder contextBuilder = new ContextBuilder()
                     .setName(Map.of(contextName.key(), contextName))
                     .setUuid(
                         new Uuid(UUID.nameUUIDFromBytes(TAPI_CONTEXT.getBytes(Charset.forName("UTF-8"))).toString()))
                     .setServiceInterfacePoint(new HashMap<>())
                     .addAugmentation(connectivityContext)
-                    .addAugmentation(topologyContext);
+                    .addAugmentation(topologyContext)
+                    .addAugmentation(notificationContext);
 
             // todo: add notification context
             InstanceIdentifier<Context> contextIID = InstanceIdentifier.builder(Context.class).build();
index 62a1d9633fb08fdfd6b876dd24e3e870ae8bf948..419993e791bc2d26152023cf308e8b63af672076 100644 (file)
@@ -52,6 +52,7 @@ Author: Gilles Thouenon <gilles.thouenon@orange.com>
 
     <bean id="tapiRendererListener" class="org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl">
         <argument ref="dataBroker" />
+        <argument ref="notificationPublishService" />
     </bean>
 
     <bean id="tapiServiceHandlerListener" class="org.opendaylight.transportpce.tapi.listeners.TapiServiceHandlerListenerImpl">
@@ -60,6 +61,7 @@ Author: Gilles Thouenon <gilles.thouenon@orange.com>
 
     <bean id="tapiNetworkModelListenerImpl" class="org.opendaylight.transportpce.tapi.listeners.TapiNetworkModelListenerImpl">
         <argument ref="networkTransactionImpl" />
+        <argument ref="notificationPublishService" />
     </bean>
 
     <bean id="tapiNetworkModelService" class="org.opendaylight.transportpce.tapi.topology.TapiNetworkModelServiceImpl">