From 17614362f2550c29dcd746ee2c1bc01d0df5de65 Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Tue, 25 May 2021 18:57:29 +0530 Subject: Improve Websocket notification interface Improve websocket notification interface Issue-ID: CCSDK-3315 Signed-off-by: Ravi Pendurty Change-Id: I0ded865adddb546ade98df4760e0a32ec964295a Signed-off-by: Ravi Pendurty --- sdnr/wt/devicemanager-core/provider/pom.xml | 14 ++++++++++++-- .../DeviceManagerDatabaseNotificationService.java | 11 ++++++----- .../eventdatahandler/ODLEventListenerHandler.java | 11 ++++++----- .../eventdatahandler/RpcPushNotificationsHandler.java | 5 +++-- .../devicemanager/impl/xml/WebSocketServiceClientImpl.java | 5 +++-- .../impl/xml/WebSocketServiceClientInternal.java | 3 ++- 6 files changed, 32 insertions(+), 17 deletions(-) (limited to 'sdnr/wt/devicemanager-core/provider') diff --git a/sdnr/wt/devicemanager-core/provider/pom.xml b/sdnr/wt/devicemanager-core/provider/pom.xml index 575987d41..d37a4a9ed 100644 --- a/sdnr/wt/devicemanager-core/provider/pom.xml +++ b/sdnr/wt/devicemanager-core/provider/pom.xml @@ -118,8 +118,13 @@ provided - com.typesafe - config + com.typesafe.akka + akka-actor_2.13 + provided + + + com.typesafe.akka + akka-cluster_2.13 provided @@ -151,6 +156,11 @@ javax.xml.bind jaxb-api provided + + + jakarta.activation + jakarta.activation-api + provided org.glassfish.jaxb diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java index 830969a10..dc57626ff 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/DeviceManagerDatabaseNotificationService.java @@ -99,7 +99,7 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer .setAttributeName(eventNotification.getAttributeName()).setCounter(eventNotification.getCounter()) .setNewValue(eventNotification.getNewValue()).setObjectIdRef(eventNotification.getObjectId()) .setTimeStamp(eventNotification.getTimestamp()).build(); - this.webSocketService.sendViaWebsockets(nodeId, notification, AttributeValueChangedNotification.QNAME, + this.webSocketService.sendViaWebsockets(new NodeId(nodeId), notification, AttributeValueChangedNotification.QNAME, eventNotification.getTimestamp()); } @@ -119,7 +119,7 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer databaseService.writeEventLog(eventlogEntity); ObjectCreationNotification notification = new ObjectCreationNotificationBuilder().setCounter(counter) .setObjectIdRef(objectId).setTimeStamp(eventlogEntity.getTimestamp()).build(); - this.webSocketService.sendViaWebsockets(nodeId.getValue(), notification, ObjectCreationNotification.QNAME, + this.webSocketService.sendViaWebsockets(nodeId, notification, ObjectCreationNotification.QNAME, eventlogEntity.getTimestamp()); } @@ -132,7 +132,7 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer databaseService.writeEventLog(eventlogEntity); ObjectDeletionNotification notification = new ObjectDeletionNotificationBuilder().setCounter(counter) .setObjectIdRef(objectId).setTimeStamp(eventlogEntity.getTimestamp()).build(); - this.webSocketService.sendViaWebsockets(nodeId.getValue(), notification, ObjectDeletionNotification.QNAME, + this.webSocketService.sendViaWebsockets(nodeId, notification, ObjectDeletionNotification.QNAME, eventlogEntity.getTimestamp()); } @@ -161,12 +161,13 @@ public class DeviceManagerDatabaseNotificationService implements NotificationSer } else { this.pushAlarmIfNotInMaintenance(nodeName, notificationXml); } + // Send ProblemNotification notification = new ProblemNotificationBuilder().setCounter(faultNotification.getCounter()) .setObjectIdRef(faultNotification.getObjectId()).setTimeStamp(faultNotification.getTimestamp()) .setProblem(faultNotification.getProblem()) .setSeverity(InternalSeverity.toYang(faultNotification.getSeverity())).build(); - this.webSocketService.sendViaWebsockets(faultNotification.getNodeId(), notification, - ObjectDeletionNotification.QNAME, faultNotification.getTimestamp()); + this.webSocketService.sendViaWebsockets(new NodeId(faultNotification.getNodeId()), notification, + ProblemNotification.QNAME, faultNotification.getTimestamp()); } private void pushAlarmIfNotInMaintenance(String nodeName, ProblemNotificationXml notificationXml) { diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java index d031d25b6..66fcc05c3 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/ODLEventListenerHandler.java @@ -48,6 +48,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicema import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ObjectDeletionNotificationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotification; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotificationBuilder; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -131,7 +132,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea // Write first to prevent missing entries databaseService.updateNetworkConnection22(e, registrationName); databaseService.writeConnectionLog(log); - webSocketService.sendViaWebsockets(ownKeyName, notification, ObjectCreationNotification.QNAME, + webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, ObjectCreationNotification.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp()); } @@ -156,7 +157,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea AttributeValueChangedNotification notification = new AttributeValueChangedNotificationBuilder() .setCounter(popEvntNumber()).setTimeStamp(ts).setObjectIdRef(mountpointNodeName) .setAttributeName("deviceType").setNewValue(deviceType.name()).build(); - webSocketService.sendViaWebsockets(ownKeyName, notification, AttributeValueChangedNotification.QNAME, ts); + webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, AttributeValueChangedNotification.QNAME, ts); } /** @@ -190,7 +191,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea // Write first to prevent missing entries databaseService.removeNetworkConnection(registrationName); databaseService.writeConnectionLog(log); - webSocketService.sendViaWebsockets(registrationName, notification, ObjectDeletionNotification.QNAME, ts); + webSocketService.sendViaWebsockets(new NodeId(registrationName), notification, ObjectDeletionNotification.QNAME, ts); } @@ -217,7 +218,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea this.updateNeConnectionRetryWithDelay(nNode, registrationName); } databaseService.writeConnectionLog(log); - webSocketService.sendViaWebsockets(ownKeyName, notification, AttributeValueChangedNotification.QNAME, ts); + webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, AttributeValueChangedNotification.QNAME, ts); } @@ -272,7 +273,7 @@ public class ODLEventListenerHandler implements EventHandlingService, AutoClosea aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(ownKeyName, notificationXml); - webSocketService.sendViaWebsockets(ownKeyName, notification, ProblemNotification.QNAME, ts); + webSocketService.sendViaWebsockets(new NodeId(ownKeyName), notification, ProblemNotification.QNAME, ts); } @Override diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java index 57f258b3b..273231a9b 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/eventdatahandler/RpcPushNotificationsHandler.java @@ -42,6 +42,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicema import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.ProblemNotificationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushAttributeChangeNotificationInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInput; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,7 +77,7 @@ public class RpcPushNotificationsHandler implements PushNotifications { new AttributeValueChangedNotificationBuilder().setAttributeName(input.getAttributeName()) .setCounter(input.getCounter()).setNewValue(input.getNewValue()) .setObjectIdRef(input.getObjectId()).setTimeStamp(input.getTimestamp()).build(); - webSocketService.sendViaWebsockets(OWNKEYNAME, notification, AttributeValueChangedNotification.QNAME, + webSocketService.sendViaWebsockets(new NodeId(input.getNodeId()!=null?input.getNodeId():OWNKEYNAME), notification, AttributeValueChangedNotification.QNAME, input.getTimestamp()); } @@ -102,7 +103,7 @@ public class RpcPushNotificationsHandler implements PushNotifications { .setCounter(input.getCounter()).setObjectIdRef(input.getObjectId()) .setSeverity(InternalSeverity.toYang(input.getSeverity())).setTimeStamp(input.getTimestamp()).build(); aotsDcaeForwarder.sendProblemNotificationUsingMaintenanceFilter(OWNKEYNAME, notificationXml); - webSocketService.sendViaWebsockets(OWNKEYNAME, notification, ProblemNotification.QNAME, input.getTimestamp()); + webSocketService.sendViaWebsockets(new NodeId(input.getNodeId()!=null?input.getNodeId():OWNKEYNAME), notification, ProblemNotification.QNAME, input.getTimestamp()); } } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java index 6cf984b11..30df8a966 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientImpl.java @@ -20,6 +20,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml; import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.yang.binding.Notification; import org.opendaylight.yangtools.yang.common.QName; @@ -50,9 +51,9 @@ public class WebSocketServiceClientImpl implements WebSocketServiceClientInterna @Override - public void sendViaWebsockets(@NonNull String nodeName, Notification notification, QName qname, + public void sendViaWebsockets(@NonNull NodeId nodeId, Notification notification, QName qname, DateAndTime timestamp) { - this.websocketmanagerService.sendNotification(notification, nodeName, qname, timestamp); + this.websocketmanagerService.sendNotification(notification, nodeId, qname, timestamp); } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java index 83fbd5c7d..53be1dc7a 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/xml/WebSocketServiceClientInternal.java @@ -22,6 +22,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.yang.binding.Notification; import org.opendaylight.yangtools.yang.common.QName; @@ -32,6 +33,6 @@ import org.opendaylight.yangtools.yang.common.QName; */ public interface WebSocketServiceClientInternal extends AutoCloseable { - public void sendViaWebsockets(@NonNull String nodeName,Notification notification, QName qname, DateAndTime timestamp); + public void sendViaWebsockets(@NonNull NodeId nodeId,Notification notification, QName qname, DateAndTime timestamp); } -- cgit 1.2.3-korg