summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
authorMichael Dürre <michael.duerre@highstreet-technologies.com>2020-07-29 07:54:34 +0200
committerMichael Dürre <michael.duerre@highstreet-technologies.com>2020-07-29 07:54:50 +0200
commit30420c45f8db8d95951f9ea782489a57a76fb97b (patch)
tree1b5d782ef73d46961eaef6d3be27da2c1f1c9b66 /sdnr/wt
parente68cf13d6a550df5c9f7b4f4ddcdea594a08dc5f (diff)
update websocketmanager
yang completion and smaller code cleanups Issue-ID: CCSDK-2580 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com> Change-Id: I4f6d425dbe000a9156ae3d5c6280d83d73dbd1f5
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/websocketmanager2/feature/pom.xml11
-rw-r--r--sdnr/wt/websocketmanager2/model/src/main/yang/websocketmanager.yang96
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManager.java10
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerSocket.java10
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/AkkaConfig.java11
-rw-r--r--sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/UserScopes.java2
6 files changed, 84 insertions, 56 deletions
diff --git a/sdnr/wt/websocketmanager2/feature/pom.xml b/sdnr/wt/websocketmanager2/feature/pom.xml
index b1d1a9ed7..0306499c6 100644
--- a/sdnr/wt/websocketmanager2/feature/pom.xml
+++ b/sdnr/wt/websocketmanager2/feature/pom.xml
@@ -40,17 +40,6 @@
<name>ccsdk-features :: ${project.artifactId}</name>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>${odl.controller.mdsal.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
diff --git a/sdnr/wt/websocketmanager2/model/src/main/yang/websocketmanager.yang b/sdnr/wt/websocketmanager2/model/src/main/yang/websocketmanager.yang
index dd0297830..81eaaf602 100644
--- a/sdnr/wt/websocketmanager2/model/src/main/yang/websocketmanager.yang
+++ b/sdnr/wt/websocketmanager2/model/src/main/yang/websocketmanager.yang
@@ -1,38 +1,76 @@
module websocketmanager {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:websocketmanager";
- prefix "websocketmanager";
- revision "2015-01-05" {
- description "Initial revision of websocketmanager model";
- }
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:websocketmanager";
+ prefix websocketmanager;
- rpc websocket-event {
- input {
- leaf nodeName {
- type string;
- }
-
- leaf eventType {
- type string;
- }
-
- leaf xmlEvent {
- type string;
- }
- }
- output {
- leaf response {
- type string;
- }
- }
- }
+ organization
+ "highstreet technologies GmbH";
+ contact
+ "Web: <https://highstreet-technologies.com>
+ ONAP: <https://wiki.onap.org/display/DW/ODLUX+DB+API>";
+
+ description
+ "This module defines the API for the websocket manager component.
+
+ Copyright 2019 highstreet technologies GmbH Intellectual Property.
+ All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the 'License');
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
- notification messagePushed {
- leaf message {
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an 'AS IS' BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.";
+
+ revision 2015-01-05 {
+ description
+ "Initial revision of websocketmanager model";
+ reference
+ "https://jira.onap.org/browse/SDNC-879";
+ }
+
+ rpc websocket-event {
+ description
+ "The remote procedure call tor regirster for websocket.";
+ input {
+ leaf nodeName {
type string;
+ description
+ "The node name, also called mointpoint name, device id,...";
}
+ leaf eventType {
+ type string;
+ description
+ "The event type.";
+ }
+ leaf xmlEvent {
+ type string;
+ description
+ "The event in xml format.";
+ }
+ }
+ output {
+ leaf response {
+ type string;
+ description
+ "The response message.";
+ }
+ }
+ }
+ notification messagePushed {
+ leaf message {
+ type string;
+ description
+ "The text pushed in the message.";
}
+ description
+ "The definition of the notification syntax to push a message.";
+ }
}
-
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManager.java b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManager.java
index 1c4d924cb..00e776a74 100644
--- a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManager.java
+++ b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManager.java
@@ -14,7 +14,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- */
+ */
package org.onap.ccsdk.features.sdnr.wt.websocketmanager2;
import com.google.common.util.concurrent.ListenableFuture;
@@ -37,9 +37,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocke
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,7 +54,7 @@ public class WebSocketManager extends WebSocketServlet implements Websocketmanag
private final AkkaConfig akkaConfig;
/**
* timeout for websocket with no messages in ms
- */
+ */
//private static final long IDLE_TIMEOUT = 5 * 60 * 1000L;
private static final long IDLE_TIMEOUT = 0L;
@@ -142,12 +142,12 @@ public class WebSocketManager extends WebSocketServlet implements Websocketmanag
/**********************************************************
* Private functions
- */
+ */
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (req.getHeader("Upgrade") != null) {
- /* Accept upgrade request */
+ /* Accept upgrade request */
resp.setStatus(101);
resp.setHeader("Upgrade", "XYZP");
resp.setHeader("Connection", "Upgrade");
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerSocket.java b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerSocket.java
index 70810a7ac..c2c67be2e 100644
--- a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerSocket.java
+++ b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerSocket.java
@@ -50,15 +50,15 @@ public class WebSocketManagerSocket extends WebSocketAdapter {
/**
* list of all sessionids
- */
+ */
private static final List<String> sessionIds = new ArrayList<>();
/**
* map of sessionid <=> UserScopes
- */
+ */
private static final HashMap<String, UserScopes> userScopesList = new HashMap<>();
/**
* map of class.hashCode <=> class
- */
+ */
private static final HashMap<String, WebSocketManagerSocket> clientList = new HashMap<>();
private final String myUniqueSessionId;
@@ -132,7 +132,7 @@ public class WebSocketManagerSocket extends WebSocketAdapter {
*
* @param request is a json object {"data":"scopes","scopes":["scope1","scope2",...]}
* @return if handled
- */
+ */
private boolean manageClientRequest(String request) {
boolean ret = false;
try {
@@ -159,7 +159,7 @@ public class WebSocketManagerSocket extends WebSocketAdapter {
/*
* broadcast message to all your clients
- */
+ */
private void manageClientRequest2(String request) {
try {
JSONObject o = new JSONObject(request);
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/AkkaConfig.java b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/AkkaConfig.java
index 93a941d20..b61462b49 100644
--- a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/AkkaConfig.java
+++ b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/AkkaConfig.java
@@ -6,19 +6,17 @@
* =================================================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- */
+ */
package org.onap.ccsdk.features.sdnr.wt.websocketmanager2.utils;
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -28,6 +26,9 @@ import org.onap.ccsdk.features.sdnr.wt.websocketmanager2.WebSocketManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+
public class AkkaConfig {
private static final Logger LOG = LoggerFactory.getLogger(WebSocketManager.class.getName());
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/UserScopes.java b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/UserScopes.java
index c7772d8cb..affa27e45 100644
--- a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/UserScopes.java
+++ b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/utils/UserScopes.java
@@ -26,7 +26,7 @@ public class UserScopes {
/**
*
* @param jsonArray array of Strings
- */
+ */
public void setScopes(JSONArray jsonArray) {
this.scopes = jsonArray;
}