aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/websocketmanager/model
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-05-25 18:57:29 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-06-14 10:22:54 +0530
commit17614362f2550c29dcd746ee2c1bc01d0df5de65 (patch)
tree97930a14a08c610efceb4aebb4f457e0cf42b2f8 /sdnr/wt/websocketmanager/model
parentdb9f267b3930a28054e967c75db228e27663aedc (diff)
Improve Websocket notification interface
Improve websocket notification interface Issue-ID: CCSDK-3315 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: I0ded865adddb546ade98df4760e0a32ec964295a Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/websocketmanager/model')
-rw-r--r--sdnr/wt/websocketmanager/model/pom.xml5
-rw-r--r--sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/WebsocketManagerService.java9
-rw-r--r--sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/data/SchemaInfo.java23
3 files changed, 27 insertions, 10 deletions
diff --git a/sdnr/wt/websocketmanager/model/pom.xml b/sdnr/wt/websocketmanager/model/pom.xml
index 7026b3329..ec384d7c6 100644
--- a/sdnr/wt/websocketmanager/model/pom.xml
+++ b/sdnr/wt/websocketmanager/model/pom.xml
@@ -56,6 +56,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-topology</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
diff --git a/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/WebsocketManagerService.java b/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/WebsocketManagerService.java
index bfceb373e..305d7453c 100644
--- a/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/WebsocketManagerService.java
+++ b/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/WebsocketManagerService.java
@@ -2,6 +2,7 @@ package org.onap.ccsdk.features.sdnr.wt.websocketmanager.model;
import org.opendaylight.mdsal.dom.api.DOMNotification;
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;
@@ -57,7 +58,7 @@ public interface WebsocketManagerService {
* @param nodeId
* @param eventType
*/
- void sendNotification(Notification notification, String nodeId, QName eventType);
+ void sendNotification(Notification notification, NodeId nodeId, QName eventType);
/**
* Send notification via Websocket to the connected clients.
* @param notification
@@ -65,7 +66,7 @@ public interface WebsocketManagerService {
* @param eventType
* @param eventTime
*/
- void sendNotification(Notification notification, String nodeId, QName eventType, DateAndTime eventTime);
+ void sendNotification(Notification notification, NodeId nodeId, QName eventType, DateAndTime eventTime);
/**
* Send notification via Websocket to the connected clients.
@@ -73,7 +74,7 @@ public interface WebsocketManagerService {
* @param nodeId
* @param eventType
*/
- void sendNotification(DOMNotification notification, String nodeId, QName eventType);
+ void sendNotification(DOMNotification notification, NodeId nodeId, QName eventType);
/**
* Send notification via Websocket to the connected clients.
* @param notification
@@ -81,7 +82,7 @@ public interface WebsocketManagerService {
* @param eventType
* @param eventTime
*/
- void sendNotification(DOMNotification notification, String nodeId, QName eventType, DateAndTime eventTime);
+ void sendNotification(DOMNotification notification, NodeId nodeId, QName eventType, DateAndTime eventTime);
diff --git a/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/data/SchemaInfo.java b/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/data/SchemaInfo.java
index c587a7997..4d3975379 100644
--- a/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/data/SchemaInfo.java
+++ b/sdnr/wt/websocketmanager/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/model/data/SchemaInfo.java
@@ -36,12 +36,17 @@ public class SchemaInfo {
public SchemaInfo(QName qname) {
- this.namespace = qname.getNamespace().toString();
- this.revision = qname.getRevision().isPresent() ? qname.getRevision().get().toString() : null;
- this.notification = new ArrayList<>();
+ this(qname.getNamespace().toString(),
+ qname.getRevision().isPresent() ? qname.getRevision().get().toString() : null, new ArrayList<>());
this.notification.add(qname.getLocalName());
}
+ public SchemaInfo(String namespace, String revision, List<String> notifications) {
+ this.namespace = namespace;
+ this.revision = revision;
+ this.notification = notifications;
+ }
+
public String getNamespace() {
return namespace;
}
@@ -66,6 +71,11 @@ public class SchemaInfo {
this.notification = notification;
}
+ /**
+ * SchemaInfo Validation restrictions: namespace!=null notification=null or if notification list set, then size>0
+ *
+ * @return
+ */
@JsonIgnore
public boolean isValid() {
return this.namespace != null
@@ -74,6 +84,7 @@ public class SchemaInfo {
/**
* Check if schema(qname based info of notification) matches into this scope
+ *
* @param schema
* @return
*/
@@ -87,8 +98,8 @@ public class SchemaInfo {
if (!this.namespace.equals(schema.getNamespace().toString())) {
return false;
}
- //if revision of scope is set and it does not match => false
- if (this.revision != null && !this.revision.equals(schema.getRevision())){
+ //if revision of scope is set and it does not match and is not '*' => false
+ if (this.revision != null && (!this.revision.equals(schema.getRevision()) && !this.revision.equals("*"))) {
return false;
}
//if notification of scope is set and is current notification is not in the list
@@ -117,7 +128,7 @@ public class SchemaInfo {
@JsonIgnore
public void addNotification(String notification) {
- if(this.notification ==null) {
+ if (this.notification == null) {
this.notification = new ArrayList<>();
}
this.notification.add(notification);