aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java2
-rw-r--r--sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java8
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorImpl.java2
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/GenericTransactionUtils.java12
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java2
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java31
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java2
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java5
-rw-r--r--sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java3
-rw-r--r--sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java9
10 files changed, 45 insertions, 31 deletions
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java
index 310444fd6..6eae55f04 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java
@@ -184,7 +184,7 @@ public class AboutHttpServlet extends HttpServlet {
* collect dynamic data for about.md
*/
private void collectData(ContentType ctype) {
- LOG.info("collecting dynamic data");
+ LOG.info("collecting dynamic data with content-type {}", ctype);
try {
this.data.put(PLACEHOLDER_KARAF_INFO, SystemInfo.get());
this.data.put(PLACEHOLDER_DEVICEMANAGER_TABLE, this.getDevicemanagerBundles(ctype));
diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
index f12c53a4d..133868fcf 100644
--- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
+++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
@@ -34,6 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev15
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.unavailable.capabilities.UnavailableCapability;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Revision;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -210,7 +211,10 @@ public class Capabilities {
String namespace = qCapability.getNamespace().toString();
for (String capability : capabilities) {
if (capability.contains(namespace)) {
- return QName.create(capability).getRevision().get().toString();
+ Optional<Revision> revisionOpt = QName.create(capability).getRevision();
+ if (revisionOpt.isPresent()) {
+ return revisionOpt.get().toString();
+ }
}
}
return UNSUPPORTED;
@@ -223,7 +227,7 @@ public class Capabilities {
* @return true if namespace is supported.
*/
static public boolean isNamespaceSupported(String revision) {
- return revision != UNSUPPORTED;
+ return !UNSUPPORTED.equals(revision);
}
@Override
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorImpl.java
index a1a35401e..34073614e 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorImpl.java
@@ -63,7 +63,7 @@ public class NetconfAccessorImpl implements NetconfAccessor {
this.domContext = Objects.requireNonNull(domContext);
this.netconfNodeStateService = Objects.requireNonNull(netconfNodeStateService);
- ConnectionStatus csts = netconfNode != null ? netconfNode.getConnectionStatus() : null;
+ ConnectionStatus csts = netconfNode.getConnectionStatus();
if (csts == null) {
throw new IllegalStateException(String.format("connection status for %s is not connected", nodeId));
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/GenericTransactionUtils.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/GenericTransactionUtils.java
index 282048453..1aa3afe5c 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/GenericTransactionUtils.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/GenericTransactionUtils.java
@@ -115,14 +115,10 @@ public final class GenericTransactionUtils implements TransactionUtils {
if (od != null) {
statusIndicator.set("Unwrap checkFuture done");
Optional<T> optionalData = od.get();
- if (optionalData != null) {
- statusIndicator.set("Unwrap optional done");
- data = optionalData.orElse(null);
- statusIndicator.set("Read transaction done");
- noErrorIndication.set(true);
- } else {
- statusIndicator.set("optional Data is null");
- }
+ statusIndicator.set("Unwrap optional done");
+ data = optionalData.orElse(null);
+ statusIndicator.set("Read transaction done");
+ noErrorIndication.set(true);
} else {
statusIndicator.set("od feature is null");
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java
index 6f3a592c8..b36e47621 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingAccessorImpl.java
@@ -111,7 +111,7 @@ public class NetconfBindingAccessorImpl extends NetconfAccessorImpl implements N
@Override
public ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream(
- @NonNull String streamName) {
+ String streamName) {
final CreateSubscriptionInputBuilder createSubscriptionInputBuilder = new CreateSubscriptionInputBuilder();
if (streamName != null) {
createSubscriptionInputBuilder.setStream(new StreamNameType(streamName));
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
index b6843fb59..97d48d130 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
@@ -127,16 +127,21 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
YangInstanceIdentifier path) {
LOG.debug("Read to node datastore:{} path:{}", dataStoreType, path);
- try (DOMDataTreeReadTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction()) {
+ // Don't use try with resource because the implicit close of this construct is not handled
+ // correctly by underlying opendaylight NETCONF service
+ DOMDataTreeReadTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction();
+ try {
FluentFuture<Optional<NormalizedNode<?, ?>>> foData = readOnlyTransaction.read(dataStoreType, path);
- // RAVI - Add a few debug here, like what ? Speak to Micha....
Optional<NormalizedNode<?, ?>> data = foData.get(120, TimeUnit.SECONDS);
- LOG.info("read is done - {} ", foData.isDone());
+ LOG.trace("read is done - {} ", foData.isDone());
return data;
-
- } catch (InterruptedException | ExecutionException | TimeoutException e) {
- LOG.info("Incomplete read to node transaction {} {}", dataStoreType, path, e);
+ } catch (InterruptedException e) {
+ LOG.debug("Incomplete read to node transaction {} {}", dataStoreType, path, e);
+ Thread.currentThread().interrupt();
+ return Optional.empty();
+ } catch (ExecutionException | TimeoutException e) {
+ LOG.debug("Incomplete read to node transaction {} {}", dataStoreType, path, e);
return Optional.empty();
}
}
@@ -217,9 +222,7 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
replayIsSupported = Boolean.TRUE.equals(stream.isReplaySupport());
}
- if (filter.isPresent()) {
- inputBuilder.setFilter(filter.get());
- }
+ filter.ifPresent(inputBuilder::setFilter);
if (startTime.isPresent()) {
if (replayIsSupported) {
inputBuilder.setStartTime(getDateAndTime(startTime.get()));
@@ -253,8 +256,12 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
if (!res.get().getErrors().isEmpty()) {
return res;
}
- } catch (InterruptedException | ExecutionException e) {
- LOG.warn("Exception during rpc call", e);
+ } catch (InterruptedException e) {
+ LOG.warn("InterruptedException during rpc call", e);
+ Thread.currentThread().interrupt();
+ return res;
+ } catch (ExecutionException e) {
+ LOG.warn("ExecutionException during rpc call", e);
return res;
}
}
@@ -265,7 +272,7 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
@Override
public @NonNull Map<StreamKey, Stream> getNotificationStreamsAsMap() {
Optional<Streams> oStreams = readData(LogicalDatastoreType.OPERATIONAL, STREAMS_PATH, Streams.class);
- return oStreams.isPresent() ? oStreams.get().nonnullStream() : Collections.emptyMap();
+ return oStreams.map(Streams::nonnullStream).orElse(Collections.emptyMap());
}
@Override
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java
index b27a7bd5c..ccce583ad 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlAkka/ClusterNodeInfo.java
@@ -32,7 +32,7 @@ public class ClusterNodeInfo {
}
public ClusterNodeInfo(String s) throws Exception {
- final String regex = "([a-z.]*):\\/\\/([a-zA-Z0-9-]*)@([a-zA-Z0-9.-]*):([0-9]*)";
+ final String regex = "([a-z.]{0,10}):\\/\\/([a-zA-Z0-9-]{0,1024})@([a-zA-Z0-9.-]{0,1024}):([0-9]{0,10})";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java
index 8f4446bb4..f11ce4011 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/conf/odlGeo/ClusterRoleInfo.java
@@ -25,7 +25,10 @@ public class ClusterRoleInfo {
private final int Index;
public ClusterRoleInfo(String s) throws Exception {
- final String regex = "([a-zA-Z]*)-([0-9]*)";
+ // role with minimum 1 character
+ // index with minimum 1 character or Integer.parseInt raise an exception
+ // index with maximum 10 because it's an integer
+ final String regex = "([a-zA-Z]{1,1024})-([0-9]{1,10})";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
diff --git a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java
index 7cc6d7272..95715be39 100644
--- a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java
+++ b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/WebSocketManagerSocket.java
@@ -18,6 +18,7 @@
package org.onap.ccsdk.features.sdnr.wt.websocketmanager;
import com.fasterxml.jackson.core.JsonProcessingException;
+import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -59,7 +60,7 @@ public class WebSocketManagerSocket extends WebSocketAdapter {
private static final String REGEX_SCOPEREGISTRATION = "\"data\"[\\s]*:[\\s]*\"scopes\"";
private static final Pattern PATTERN_SCOPEREGISTRATION =
Pattern.compile(REGEX_SCOPEREGISTRATION, Pattern.MULTILINE);
- private static final Random RND = new Random();
+ private static final SecureRandom RND = new SecureRandom();
private static final long SEND_MESSAGE_TIMEOUT_MILLIS = 1500;
private static final int QUEUE_SIZE = 100;
diff --git a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java
index 794515bb2..7bbbfea6d 100644
--- a/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java
+++ b/sdnr/wt/websocketmanager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager/utils/AkkaConfig.java
@@ -49,7 +49,7 @@ public class AkkaConfig {
}
public ClusterNodeInfo(String s) throws Exception {
- final String regex = "([a-z.]*):\\/\\/([a-zA-Z0-9-]*)@([a-zA-Z0-9.-]*):([0-9]*)";
+ final String regex = "([a-z.]{0,10}):\\/\\/([a-zA-Z0-9-]{0,1024})@([a-zA-Z0-9.-]{0,1024}):([0-9]{0,10})";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
@@ -71,7 +71,10 @@ public class AkkaConfig {
private final int Index;
public ClusterRoleInfo(String s) throws Exception {
- final String regex = "([a-z]*)-([0-9]*)";
+ // role with minimum 1 character
+ // index with minimum 1 character or Integer.parseInt raise an exception
+ // index with maximum 10 because it's an integer
+ final String regex = "([a-z]{1,1024})-([0-9]{1,10})";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(s);
if (!matcher.find()) {
@@ -177,7 +180,7 @@ public class AkkaConfig {
}
public boolean isCluster() {
- return this.cluserConfig != null ? this.cluserConfig.isCluster() : false;
+ return this.cluserConfig != null && this.cluserConfig.isCluster();
}
public static AkkaConfig load() throws Exception {