aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/netconfnode-state-service/provider/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider/src/main/java')
-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
6 files changed, 30 insertions, 24 deletions
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()) {