summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
authorhighstreetherbert <herbert.eiselt@highstreet-technologies.com>2021-02-17 16:32:31 +0100
committerhighstreetherbert <herbert.eiselt@highstreet-technologies.com>2021-02-17 16:43:41 +0100
commit5cf15b27796b68b3edbfc1e59f258dee1e10b2b9 (patch)
tree4645675dd73b142bd96748ee232419724a1b38a4 /sdnr/wt
parentf9486b50bbf6f92a4549203c1ede21ba912989c0 (diff)
Increase coverage of netconfnode-state-service
Add junit tests to provider Issue-ID: CCSDK-3171 Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com> Change-Id: I3c32859f1e30b9d715d74d9125f3603805ea7808 Signed-off-by: highstreetherbert <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorImpl.java8
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingNotificationsImpl.java36
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java168
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestCapabilites.java90
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestDom.java80
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGenericTransactionUtils.java58
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfAccessorImpl.java176
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java100
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/TestNetconfHelper.java78
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java37
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java93
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java54
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java44
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java34
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java44
15 files changed, 605 insertions, 495 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 5ff6caf56..189845831 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
@@ -80,10 +80,10 @@ public class NetconfAccessorImpl implements NetconfAccessor {
this(new NodeId(nodeId), netconfNode, netconfCommunicatorManager, domContext);
}
- protected NetconfAccessorImpl(NetconfAccessorImpl accessor) {
- this.nodeId = accessor.nodeId;
- this.netconfNode = accessor.netconfNode;
- this.capabilities = accessor.capabilities;
+ public NetconfAccessorImpl(NetconfAccessorImpl accessor) {
+ this.nodeId = accessor.getNodeId();
+ this.netconfNode = accessor.getNetconfNode();
+ this.capabilities = accessor.getCapabilites();
this.netconfCommunicatorManager = accessor.netconfCommunicatorManager;
this.domContext = accessor.domContext;
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingNotificationsImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingNotificationsImpl.java
index 6716581a2..46ff07b2c 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingNotificationsImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/binding/NetconfBindingNotificationsImpl.java
@@ -23,9 +23,11 @@ package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.bind
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.common.YangHelper;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNotifications;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.NetconfAccessorImpl;
@@ -57,12 +59,14 @@ public class NetconfBindingNotificationsImpl extends NetconfBindingAccessorImpl
}
@Override
- public ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream(@NonNull String streamName) {
+ public ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream(
+ @NonNull String streamName) {
String failMessage = "";
final Optional<RpcConsumerRegistry> optionalRpcConsumerService =
getMountpoint().getService(RpcConsumerRegistry.class);
if (optionalRpcConsumerService.isPresent()) {
- final NotificationsService rpcService = optionalRpcConsumerService.get().getRpcService(NotificationsService.class);
+ final NotificationsService rpcService =
+ optionalRpcConsumerService.get().getRpcService(NotificationsService.class);
final CreateSubscriptionInputBuilder createSubscriptionInputBuilder = new CreateSubscriptionInputBuilder();
createSubscriptionInputBuilder.setStream(new StreamNameType(streamName));
@@ -72,6 +76,7 @@ public class NetconfBindingNotificationsImpl extends NetconfBindingAccessorImpl
if (createSubscriptionInput == null) {
failMessage = "createSubscriptionInput is null for mountpoint " + getNodeId();
} else {
+ // Regular case, return value
return rpcService.createSubscription(createSubscriptionInput);
}
} catch (NullPointerException e) {
@@ -80,6 +85,7 @@ public class NetconfBindingNotificationsImpl extends NetconfBindingAccessorImpl
} else {
failMessage = "No RpcConsumerRegistry avaialble.";
}
+ //Be here only in case of problem and return failed indication
log.warn(failMessage);
RpcResultBuilder<CreateSubscriptionOutput> result = RpcResultBuilder.failed();
result.withError(ErrorType.APPLICATION, failMessage);
@@ -91,9 +97,17 @@ public class NetconfBindingNotificationsImpl extends NetconfBindingAccessorImpl
@Override
public void registerNotificationsStream(List<Stream> streamList) {
for (Stream stream : streamList) {
- log.info("Stream Name = {}, Stream Description = {}", stream.getName().getValue(), stream.getDescription());
- if (!(stream.getName().getValue().equals(NetconfNotifications.DefaultNotificationsStream))) // Since this stream is already registered
- registerNotificationsStream(stream.getName().getValue());
+ @Nullable
+ StreamNameType streamName = stream.getName();
+ if (streamName != null) {
+ String streamNameValue = stream.getName().getValue();
+ log.info("Stream Name = {}, Stream Description = {}", streamNameValue, stream.getDescription());
+ if (!(streamNameValue.equals(NetconfNotifications.DefaultNotificationsStream)))
+ // Register any not default stream. Default stream is already registered
+ registerNotificationsStream(streamNameValue);
+ } else {
+ log.warn("Ignore a stream without name");
+ }
}
}
@@ -116,10 +130,14 @@ public class NetconfBindingNotificationsImpl extends NetconfBindingAccessorImpl
final Class<Netconf> netconfClazz = Netconf.class;
InstanceIdentifier<Netconf> streamsIID = InstanceIdentifier.builder(netconfClazz).build();
- Netconf res = getTransactionUtils().readData(getDataBroker(),
- LogicalDatastoreType.OPERATIONAL, streamsIID);
- Streams streams = res.getStreams();
- return YangHelper.getList(streams.getStream());
+ Netconf res = getTransactionUtils().readData(getDataBroker(), LogicalDatastoreType.OPERATIONAL, streamsIID);
+ if (res != null) {
+ Streams streams = res.getStreams();
+ if (streams != null) {
+ return YangHelper.getList(streams.nonnullStream());
+ }
+ }
+ return Collections.emptyList();
}
@Override
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java
index a420b5e91..f7ec70a30 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestAkkaConfig.java
@@ -21,7 +21,6 @@
package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test;
import static org.junit.Assert.fail;
-
import java.io.File;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlAkka.AkkaConfig;
@@ -30,50 +29,147 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.conf.odlAkka
public class TestAkkaConfig {
+ // @formatter:off
private static String getAkkaConfigSingleNodeText() {
- return "\n" + "odl-cluster-data {\n" + " akka {\n" + " remote {\n" + " artery {\n"
- + " enabled = off\n" + " canonical.hostname = \"127.0.0.1\"\n"
- + " canonical.port = 2550\n" + " }\n" + " netty.tcp {\n"
- + " hostname = \"127.0.0.1\"\n" + " port = 2550\n" + " }\n"
+ return "odl-cluster-data {\n"
+ + " akka {\n"
+ + " remote {\n"
+ + " artery {\n"
+ + " enabled = off\n"
+ + " canonical.hostname = \"127.0.0.1\"\n"
+ + " canonical.port = 2550\n"
+ + " }\n"
+ + " netty.tcp {\n"
+ + " hostname = \"127.0.0.1\"\n"
+ + " port = 2550\n"
+ + " }\n"
+ " # when under load we might trip a false positive on the failure detector\n"
- + " # transport-failure-detector {\n" + " # heartbeat-interval = 4 s\n"
- + " # acceptable-heartbeat-pause = 16s\n" + " # }\n" + " }\n" + "\n" + " cluster {\n"
+ + " # transport-failure-detector {\n"
+ + " # heartbeat-interval = 4 s\n"
+ + " # acceptable-heartbeat-pause = 16s\n"
+ + " # }\n"
+ + " }\n"
+ + "\n"
+ + " cluster {\n"
+ " # Remove \".tcp\" when using artery.\n"
- + " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@127.0.0.1:2550\"]\n" + "\n"
- + " roles = [\n" + " \"member-1\"\n" + " ]\n" + "\n" + " }\n" + "\n"
+ + " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@127.0.0.1:2550\"]\n"
+ + "\n"
+ + " roles = [\n"
+ + " \"member-1\"\n"
+ + " ]\n"
+ + "\n"
+ + " }\n"
+ + "\n"
+ " persistence {\n"
- + " # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by\n"
- + " # modifying the following two properties. The directory location specified may be a relative or absolute path. \n"
- + " # The relative path is always relative to KARAF_HOME.\n" + "\n"
+ + " # By default the snapshots/journal directories live in KARAF_HOME."
+ + " You can choose to put it somewhere else by\n"
+ + " # modifying the following two properties. The directory location specified may be a"
+ + " relative or absolute path. \n"
+ + " # The relative path is always relative to KARAF_HOME.\n"
+ + "\n"
+ " # snapshot-store.local.dir = \"target/snapshots\"\n"
- + " # journal.leveldb.dir = \"target/journal\"\n" + "\n" + " journal {\n"
- + " leveldb {\n" + " # Set native = off to use a Java-only implementation of leveldb.\n"
- + " # Note that the Java-only version is not currently considered by Akka to be production quality.\n"
- + "\n" + " # native = off\n" + " }\n" + " }\n" + " }\n" + " }\n" + "}";
+ + " # journal.leveldb.dir = \"target/journal\"\n"
+ + "\n"
+ + " journal {\n"
+ + " leveldb {\n"
+ + " # Set native = off to use a Java-only implementation of leveldb.\n"
+ + " # Note that the Java-only version is not currently considered by Akka"
+ + " to be production quality.\n"
+ + "\n"
+ + " # native = off\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + "}";
}
private static String getAkkaConfigClusterNodeText() {
- return "\n" + "odl-cluster-data {\n" + "\n" + " akka {\n" + " loglevel = \"\"\n" + " remote {\n"
- + " netty.tcp {\n" + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n"
- + " port = 2550\n" + " }\n" + " }\n" + " actor {\n" + " debug{\n"
- + " autoreceive = on\n" + " lifecycle = on\n" + " unhandled = on\n"
- + " fsm = on\n" + " event-stream = on\n" + " }\n" + " }\n" + " cluster {\n"
- + " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2550\"]\n"
- + " seed-node-timeout = 15s\n" + " roles = [\"member-1\"]\n" + "\n" + " }\n"
- + " persistence {\n" + " journal-plugin-fallback {\n" + " circuit-breaker {\n"
- + " max-failures = 10\n" + " call-timeout = 60s\n"
- + " reset-timeout = 30s\n" + " }\n" + " }\n" + " }\n" + " }\n" + "}\n" + "\n"
- + "odl-cluster-rpc {\n" + "\n" + " akka {\n" + " loglevel = \"\"\n" + " remote {\n"
- + " netty.tcp {\n" + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n"
- + " port = 2551\n" + " }\n" + " }\n" + " actor {\n" + " debug{\n"
- + " autoreceive = on\n" + " lifecycle = on\n" + " unhandled = on\n"
- + " fsm = on\n" + " event-stream = on\n" + " }\n" + " }\n" + " cluster {\n"
- + " seed-nodes = [\"akka.tcp://odl-cluster-rpc@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2551\"]\n"
- + " seed-node-timeout = 15s\n" + " }\n" + " persistence {\n"
- + " journal-plugin-fallback {\n" + " circuit-breaker {\n" + " max-failures = 10\n"
- + " call-timeout = 60s\n" + " reset-timeout = 30s\n" + " }\n" + " }\n"
- + " }\n" + " }\n" + "}\n" + "\n" + "";
+ return "odl-cluster-data {\n"
+ + "\n"
+ + " akka {\n"
+ + " loglevel = \"\"\n"
+ + " remote {\n"
+ + " netty.tcp {\n"
+ + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n"
+ + " port = 2550\n"
+ + " }\n"
+ + " }\n"
+ + " actor {\n"
+ + " debug{\n"
+ + " autoreceive = on\n"
+ + " lifecycle = on\n"
+ + " unhandled = on\n"
+ + " fsm = on\n"
+ + " event-stream = on\n"
+ + " }\n"
+ + " }\n"
+ + " cluster {\n"
+ + " seed-nodes = ["
+ + " \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2550\","
+ + " \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2550\","
+ + " \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2550\","
+ + " \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2550\","
+ + " \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2550\","
+ + " \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2550\"]\n"
+ + " seed-node-timeout = 15s\n"
+ + " roles = [\"member-1\"]\n"
+ + "\n"
+ + " }\n"
+ + " persistence {\n"
+ + " journal-plugin-fallback {\n"
+ + " circuit-breaker {\n"
+ + " max-failures = 10\n"
+ + " call-timeout = 60s\n"
+ + " reset-timeout = 30s\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "\n"
+ + "odl-cluster-rpc {\n"
+ + "\n"
+ + " akka {\n"
+ + " loglevel = \"\"\n"
+ + " remote {\n"
+ + " netty.tcp {\n"
+ + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n"
+ + " port = 2551\n"
+ + " }\n"
+ + " }\n"
+ + " actor {\n"
+ + " debug{\n"
+ + " autoreceive = on\n"
+ + " lifecycle = on\n"
+ + " unhandled = on\n"
+ + " fsm = on\n"
+ + " event-stream = on\n"
+ + " }\n"
+ + " }\n"
+ + " cluster {\n"
+ + " seed-nodes = [\"akka.tcp://odl-cluster-rpc@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2551\","
+ + " \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2551\","
+ + " \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2551\","
+ + " \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2551\","
+ + " \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2551\","
+ + " \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2551\"]\n"
+ + " seed-node-timeout = 15s\n"
+ + " }\n"
+ + " persistence {\n"
+ + " journal-plugin-fallback {\n"
+ + " circuit-breaker {\n"
+ + " max-failures = 10\n"
+ + " call-timeout = 60s\n"
+ + " reset-timeout = 30s\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "\n";
}
+ //@formatter:on
@Test
public void test1() {
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestCapabilites.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestCapabilites.java
new file mode 100644
index 000000000..97c1d20bd
--- /dev/null
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestCapabilites.java
@@ -0,0 +1,90 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 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
+ *
+ * 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.netconfnodestateservice.test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.example.TestNetconfHelper;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yangtools.yang.common.QName;
+
+public class TestCapabilites {
+
+ private static final String CAPABILITYSTRING = "network-element";
+
+ private static final QName QNAMECOREMODEL = QName.create("urn:onf:params:xml:ns:yang:core-model", "2017-03-20", "core-model").intern();
+ private static final QName QNAMENETWORKELEMENET = QName.create(QNAMECOREMODEL, CAPABILITYSTRING).intern();
+
+ private static Capabilities capabilites;
+ private static Capabilities uacapabilites;
+
+ @BeforeClass
+ public static void before() {
+ String nodeIdString = "Test";
+ NodeId nodeId = new NodeId(nodeIdString);
+ String capabilityString = "network-element";
+ Node node = TestNetconfHelper.getTestNode(nodeId,capabilityString);
+ NetconfNode netconfNode = node.augmentation(NetconfNode.class);
+ capabilites = Capabilities.getAvailableCapabilities(netconfNode);
+ uacapabilites = Capabilities.getUnavailableCapabilities(netconfNode);
+ }
+
+ @Test
+ public void testAvailableCapabilites() {
+ boolean result = capabilites.isSupportingNamespaceAndRevision("network-element", null);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testAvailableCapabilitesNotThere() {
+ boolean result = capabilites.isSupportingNamespaceAndRevision(CAPABILITYSTRING+"xy", null);
+ assertFalse(result);
+ }
+
+ @Test
+ public void testUnavailableCapabilites() {
+ assertTrue(uacapabilites.getCapabilities().isEmpty());
+ }
+
+ @Test
+ public void testAvailableCapabilitesQName() {
+ boolean result = capabilites.isSupportingNamespace(QNAMENETWORKELEMENET);
+ assertFalse(result);
+ }
+ @Test
+ public void testSupportsRevision() {
+ boolean result = capabilites.isSupportingNamespaceAndRevision(QNAMENETWORKELEMENET);
+ assertFalse(result);
+ }
+ @Test
+ public void testGetRevision() {
+ String revisionString = capabilites.getRevisionForNamespace(QNAMENETWORKELEMENET);
+ boolean result = Capabilities.isNamespaceSupported(revisionString);
+ assertFalse(result);
+
+ }
+}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestDom.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestDom.java
deleted file mode 100644
index f7aef6b6d..000000000
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestDom.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2020 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
- *
- * 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.netconfnodestateservice.test;
-
-import com.google.gson.stream.JsonWriter;
-import java.io.IOException;
-import java.io.StringWriter;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfnode.state.rev191011.FaultNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfnode.state.rev191011.FaultNotificationBuilder;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestDom {
-
- private static final Logger LOG = LoggerFactory.getLogger(TestDom.class);
-
- @Test
- public void test2() {
- FaultNotification faultNotification =
- new FaultNotificationBuilder().setCounter(1).setNodeId("Node1").setSeverity(SeverityType.Major).build();
-
-// final NormalizedNode<?, ?> data = DomContext.getBINDING_CONTEXT()
-// .toNormalizedNode(InstanceIdentifier.create(FaultNotification.class), faultNotification).getValue();
-
-// LOG.info("Normalized node: {}", data);
-// final String json = toJson(data, schemaContext);
-// LOG.info(json);
-
- }
- /**
- * Serialization of {@link NormalizedNode} into {@link String}.
- *
- * @param node to be serialized data
- * @param schemaContext schema context
- * @return serialized data
- */
- private static String toJson(final NormalizedNode<?, ?> node, final EffectiveModelContext schemaContext) {
- final JSONCodecFactory codecFactory = JSONCodecFactorySupplier.RFC7951.createSimple(schemaContext);
- try (StringWriter stringWriter = new StringWriter();
- JsonWriter jsonWriter = new JsonWriter(stringWriter);
- NormalizedNodeWriter nodeStreamer = NormalizedNodeWriter.forStreamWriter(
- JSONNormalizedNodeStreamWriter.createNestedWriter(codecFactory, SchemaPath.ROOT,
- schemaContext.getQName().getNamespace(), jsonWriter))) {
- jsonWriter.beginObject();
- nodeStreamer.write(node);
- jsonWriter.endObject();
- return stringWriter.toString();
- } catch (IOException e) {
- throw new IllegalStateException("Failed to convert input node to JSON: " + node, e);
- }
- }
-}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGenericTransactionUtils.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGenericTransactionUtils.java
new file mode 100644
index 000000000..a9ddf1ace
--- /dev/null
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestGenericTransactionUtils.java
@@ -0,0 +1,58 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 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
+ *
+ * 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.netconfnodestateservice.test;
+
+import com.google.common.util.concurrent.FluentFuture;
+import java.util.Optional;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.binding.GenericTransactionUtils;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.Netconf;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.NetconfBuilder;
+import org.opendaylight.yangtools.util.concurrent.FluentFutures;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class TestGenericTransactionUtils extends Mockito {
+
+ @Test
+ public void testRead() {
+ GenericTransactionUtils transactionUtils = new GenericTransactionUtils();
+
+ final Class<Netconf> netconfClazz = Netconf.class;
+ InstanceIdentifier<Netconf> streamsIID = InstanceIdentifier.builder(netconfClazz).build();
+
+ Netconf netconf = new NetconfBuilder().build();
+ FluentFuture<Optional<Netconf>> readResult = FluentFutures.immediateFluentFuture(Optional.of(netconf));
+
+ ReadTransaction readTransaction = mock(ReadTransaction.class);
+ when(readTransaction.read(LogicalDatastoreType.OPERATIONAL, streamsIID)).thenReturn(readResult);
+
+ DataBroker dataBroker = mock(DataBroker.class);
+ when(dataBroker.newReadOnlyTransaction()).thenReturn(readTransaction);
+
+ Netconf res = transactionUtils.readData(dataBroker, LogicalDatastoreType.OPERATIONAL, streamsIID);
+ System.out.println("Res:"+res);
+ }
+}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfAccessorImpl.java
new file mode 100644
index 000000000..1ec9cde2c
--- /dev/null
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfAccessorImpl.java
@@ -0,0 +1,176 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 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
+ *
+ * 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.netconfnodestateservice.test;
+
+import static org.junit.Assert.assertEquals;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Optional;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfNotifications;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.NetconfAccessorImpl;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.NetconfCommunicatorManager;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.binding.NetconfBindingNotificationsImpl;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.dom.DomContext;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.dom.NetconfDomAccessorImpl;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.example.TestNetconfHelper;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.MountPoint;
+import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMMountPoint;
+import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.NotificationsService;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+
+public class TestNetconfAccessorImpl extends Mockito {
+
+ @Test
+ public void testConstruct() {
+ NetconfCommunicatorManager netconfCommunicatorManager = mock(NetconfCommunicatorManager.class);
+ DomContext domContext = mock(DomContext.class);
+ String nodeIdString = "Test";
+ String capabilityStringForNetworkElement = "network-element";
+ NodeId nodeId = new NodeId(nodeIdString);
+ NetconfNode testNode = TestNetconfHelper.getTestNode(nodeId, capabilityStringForNetworkElement)
+ .augmentation(NetconfNode.class);
+
+ NetconfAccessorImpl netconfAccessor =
+ new NetconfAccessorImpl(nodeId, testNode, netconfCommunicatorManager, domContext);
+
+ Assert.assertNotNull(netconfAccessor);
+
+ NetconfAccessorImpl netconfAcessor2 = new NetconfAccessorImpl(netconfAccessor);
+
+ Assert.assertNotNull(netconfAcessor2);
+ }
+
+ @Test
+ public void testBindingNotifications() {
+ NetconfAccessorImpl netconfAccessor = TestNetconfHelper.getNetconfAcessorImpl();
+
+ DataBroker dataBroker = mock(DataBroker.class);
+
+ NotificationsService notificationService = mock(NotificationsService.class);
+
+ RpcConsumerRegistry rpcComerRegistry = mock(RpcConsumerRegistry.class);
+ when(rpcComerRegistry.getRpcService(NotificationsService.class)).thenReturn(notificationService);
+
+ MountPoint mountPoint = mock(MountPoint.class);
+ when(mountPoint.getService(RpcConsumerRegistry.class)).thenReturn(Optional.of(rpcComerRegistry));
+
+ //Start here
+ NetconfBindingNotificationsImpl test =
+ new NetconfBindingNotificationsImpl(netconfAccessor, dataBroker, mountPoint);
+
+ String streamName = "NETCONF";
+ test.registerNotificationsStream(streamName);
+
+ //Capture parameters and assert them
+ ArgumentCaptor<CreateSubscriptionInput> captor = ArgumentCaptor.forClass(CreateSubscriptionInput.class);
+ verify(notificationService).createSubscription(captor.capture());
+
+ assertEquals("StreamName", streamName, captor.getValue().getStream().getValue());
+ }
+
+ @Test
+ public void testNotificationList() {
+
+ NetconfAccessorImpl netconfAccessor = TestNetconfHelper.getNetconfAcessorImpl();
+
+ DataBroker dataBroker = mock(DataBroker.class);
+
+ NotificationsService notificationService = mock(NotificationsService.class);
+
+ RpcConsumerRegistry rpcComerRegistry = mock(RpcConsumerRegistry.class);
+ when(rpcComerRegistry.getRpcService(NotificationsService.class)).thenReturn(notificationService);
+
+ MountPoint mountPoint = mock(MountPoint.class);
+ when(mountPoint.getService(RpcConsumerRegistry.class)).thenReturn(Optional.of(rpcComerRegistry));
+
+
+ //Start here
+ NetconfBindingNotificationsImpl test =
+ new NetconfBindingNotificationsImpl(netconfAccessor, dataBroker, mountPoint);
+
+ String streamName = NetconfNotifications.DefaultNotificationsStream+"ChangeIt";
+ StreamNameType streamNameType = new StreamNameType(streamName);
+ Stream stream = new StreamBuilder().setName(streamNameType).build();
+ test.registerNotificationsStream(Arrays.asList(stream));
+
+ //Capture parameters and assert them
+ ArgumentCaptor<CreateSubscriptionInput> captor = ArgumentCaptor.forClass(CreateSubscriptionInput.class);
+ verify(notificationService).createSubscription(captor.capture());
+
+ assertEquals("StreamName", streamName, captor.getValue().getStream().getValue());
+
+ }
+
+ @Test
+ public void testNetconfDomNotification() {
+
+ NetconfAccessorImpl netconfAccessor = TestNetconfHelper.getNetconfAcessorImpl();
+ DOMDataBroker domDataBroker = mock(DOMDataBroker.class);
+ DOMMountPoint domMountPoint = mock(DOMMountPoint.class);
+ DOMNotificationService domNotificationService = mock(DOMNotificationService.class);
+
+ YangInstanceIdentifier mountpointPath = YangInstanceIdentifier.builder()
+ .node(NetworkTopology.QNAME)
+ .build();
+ when(domMountPoint.getIdentifier()).thenReturn(mountpointPath);
+ when(domMountPoint.getService(DOMNotificationService.class)).thenReturn(Optional.of(domNotificationService));
+
+ DomContext domContext = mock(DomContext.class);
+
+ NetconfDomAccessorImpl netconfDomAccessor =
+ new NetconfDomAccessorImpl(netconfAccessor, domDataBroker, domMountPoint, domContext);
+
+ Collection<SchemaPath> types = Arrays.asList(SchemaPath.create(false, NetworkTopology.QNAME));
+
+ DOMNotificationListener listener = (notification) -> System.out.println("Notification: "+notification);
+ ListenerRegistration<DOMNotificationListener> res =
+ netconfDomAccessor.doRegisterNotificationListener(listener, types);
+
+ //Capture parameters and assert them
+ ArgumentCaptor<DOMNotificationListener> captor1 = ArgumentCaptor.forClass(DOMNotificationListener.class);
+ @SuppressWarnings("unchecked")
+ ArgumentCaptor<Collection<SchemaPath>> captor2 = ArgumentCaptor.forClass(Collection.class);
+ verify(domNotificationService).registerNotificationListener(captor1.capture(), captor2.capture());
+
+ assertEquals("Listener", listener, captor1.getValue());
+ assertEquals("SchemaPath", types, captor2.getValue());
+ }
+
+}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
index 5de8b7075..f03ab90e2 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java
@@ -47,11 +47,7 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.VesNotificationLi
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.NetconfNodeStateServiceImpl;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.rpc.NetconfnodeStateServiceRpcApiImpl;
import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.example.ExampleConfig;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock.ClusterSingletonServiceProviderMock;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock.MountPointMock;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock.MountPointServiceMock;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock.NotificationPublishServiceMock;
-import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.mock.RpcProviderRegistryMock;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.test.example.TestNetconfHelper;
import org.opendaylight.binding.runtime.spi.BindingRuntimeHelpers;
import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -68,8 +64,6 @@ import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvid
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapabilityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfnode.state.rev191011.AttributeChangeNotification;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfnode.state.rev191011.AttributeChangeNotificationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconfnode.state.rev191011.FaultNotification;
@@ -98,20 +92,18 @@ public class TestNetconfNodeStateService extends Mockito {
private static Path KARAF_ETC = Paths.get("etc");
private static NetconfNodeStateServiceImpl netconfStateService;
- private static MountPointMock mountPoint;
//private static DataBrokerNetconfMock dataBrokerNetconf;
private static DataBroker dataBrokerNetconf;
- private @NonNull
- static DataTreeChangeListener<Node> listener;
- private @NonNull
- static ClusteredDataTreeChangeListener<Node> listenerClustered;
+ private @NonNull static DataTreeChangeListener<Node> listener;
+ private @NonNull static ClusteredDataTreeChangeListener<Node> listenerClustered;
private static final Logger LOG = LoggerFactory.getLogger(TestNetconfNodeStateService.class);
@SuppressWarnings("unchecked")
@BeforeClass
- public static <T extends DataObject, L extends DataTreeChangeListener<T>> void before() throws InterruptedException, IOException {
+ public static <T extends DataObject, L extends DataTreeChangeListener<T>> void before()
+ throws InterruptedException, IOException {
System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName());
// Call System property to get the classpath value
@@ -125,39 +117,35 @@ public class TestNetconfNodeStateService extends Mockito {
//dataBrokerNetconf = new DataBrokerNetconfMock();
//dataBrokerNetconf.newReadWriteTransaction();
dataBrokerNetconf = mock(DataBroker.class);
- when(dataBrokerNetconf.registerDataTreeChangeListener(any(), any())).thenAnswer(
- invocation -> {
- Object pListener = invocation.getArguments()[1];
- System.out.println("Register " + pListener.getClass().getName());
- if (pListener instanceof ClusteredDataTreeChangeListener) {
- System.out.println("Clustered listener");
- listenerClustered = (ClusteredDataTreeChangeListener<Node>) pListener;
- } else if (pListener instanceof DataTreeChangeListener) {
- System.out.println("Listener");
- listener = (DataTreeChangeListener<Node>) pListener;
- }
- return new ListenerRegistration<L>() {
- @Override
- public L getInstance() {
- return (L) pListener;
- }
-
- @Override
- public void close() {
- }
- };
-
+ when(dataBrokerNetconf.registerDataTreeChangeListener(any(), any())).thenAnswer(invocation -> {
+ Object pListener = invocation.getArguments()[1];
+ System.out.println("Register " + pListener.getClass().getName());
+ if (pListener instanceof ClusteredDataTreeChangeListener) {
+ System.out.println("Clustered listener");
+ listenerClustered = (ClusteredDataTreeChangeListener<Node>) pListener;
+ } else if (pListener instanceof DataTreeChangeListener) {
+ System.out.println("Listener");
+ listener = (DataTreeChangeListener<Node>) pListener;
+ }
+ return new ListenerRegistration<L>() {
+ @Override
+ public L getInstance() {
+ return (L) pListener;
}
-);
- mountPoint = new MountPointMock();
- ClusterSingletonServiceProvider clusterSingletonService = new ClusterSingletonServiceProviderMock();
- MountPointService mountPointService = new MountPointServiceMock(mountPoint);
- NotificationPublishService notificationPublishService = new NotificationPublishServiceMock();
- RpcProviderService rpcProviderRegistry = new RpcProviderRegistryMock();
+ @Override
+ public void close() {}
+ };
+
+ });
+ ClusterSingletonServiceProvider clusterSingletonService = mock(ClusterSingletonServiceProvider.class);
+ MountPointService mountPointService = mock(MountPointService.class);
+ NotificationPublishService notificationPublishService = mock(NotificationPublishService.class);
+ RpcProviderService rpcProviderRegistry = mock(RpcProviderService.class);
IEntityDataProvider entityProviderMock = mock(IEntityDataProvider.class);
YangParserFactory yangParserFactory = new YangParserFactoryImpl();
- BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer = new BindingCodecContext(BindingRuntimeHelpers.createRuntimeContext());
+ BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer =
+ new BindingCodecContext(BindingRuntimeHelpers.createRuntimeContext());
// start using blueprint interface
netconfStateService = new NetconfNodeStateServiceImpl();
@@ -227,22 +215,10 @@ public class TestNetconfNodeStateService extends Mockito {
@Test
public void test5OnConnect() throws InterruptedException {
System.out.println("Test5: On Connect");
- NetconfNodeBuilder netconfNodeBuilder = new NetconfNodeBuilder();
- netconfNodeBuilder.setConnectionStatus(ConnectionStatus.Connected);
- AvailableCapabilityBuilder availableCapabilityBuilder = new AvailableCapabilityBuilder();
- availableCapabilityBuilder.setCapability("network-element");
- AvailableCapabilitiesBuilder availableCapabilitesBuilder = new AvailableCapabilitiesBuilder();
- availableCapabilitesBuilder.setAvailableCapability(Arrays.asList(availableCapabilityBuilder.build()));
- netconfNodeBuilder.setAvailableCapabilities(availableCapabilitesBuilder.build());
- NetconfNode rootNodeNetconf = netconfNodeBuilder.build();
-
String nodeIdString = "Test";
+ String capabilityStringForNetworkElement = "network-element";
NodeId nodeId = new NodeId(nodeIdString);
- NodeBuilder nodeBuilder = new NodeBuilder();
-
- nodeBuilder.addAugmentation(rootNodeNetconf);
- nodeBuilder.setNodeId(nodeId);
- Node rootNode = nodeBuilder.build();
+ Node rootNode = TestNetconfHelper.getTestNode(nodeId, capabilityStringForNetworkElement);
DataObjectModification<Node> dom = mock(DataObjectModification.class);
when(dom.getDataAfter()).thenReturn(rootNode);
@@ -253,7 +229,6 @@ public class TestNetconfNodeStateService extends Mockito {
NetconfNodeConnectListener nCL = mock(NetconfNodeConnectListener.class);
netconfStateService.registerNetconfNodeConnectListener(nCL);
- mountPoint.setDatabrokerAbsent(false);
Collection<DataTreeModification<Node>> changes = Arrays.asList(ntn);
sendClusteredChanges(changes);
@@ -262,9 +237,9 @@ public class TestNetconfNodeStateService extends Mockito {
//verify that it was called one time and nodeId is the expected
ArgumentCaptor<NetconfAccessor> varArgs = ArgumentCaptor.forClass(NetconfAccessor.class);
verify(nCL).onEnterConnected(varArgs.capture());
- System.out.println("Accessor " + varArgs.getValue().getNodeId());
- assertEquals(nodeIdString, varArgs.getValue().getNodeId().getValue());
-
+ NetconfAccessor accessor = varArgs.getValue();
+ System.out.println("Accessor " + accessor.getNodeId());
+ assertEquals(nodeIdString, accessor.getNodeId().getValue());
}
@SuppressWarnings("unchecked")
@@ -361,6 +336,11 @@ public class TestNetconfNodeStateService extends Mockito {
ExampleConfig.exampleConfig(netconfStateService.getDomContext());
}
+ @Test
+ public void test10NetconfAccessorClone() {
+
+ }
+
// ------- private section
private static void delete(Path etc) throws IOException {
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/TestNetconfHelper.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/TestNetconfHelper.java
new file mode 100644
index 000000000..ac466579f
--- /dev/null
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/TestNetconfHelper.java
@@ -0,0 +1,78 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 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
+ *
+ * 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.netconfnodestateservice.test.example;
+
+import java.util.Arrays;
+import org.mockito.Mockito;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.NetconfAccessorImpl;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.NetconfCommunicatorManager;
+import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.dom.DomContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
+
+public class TestNetconfHelper extends Mockito {
+
+ /**
+ * Provide a test node.
+ * @param nodeIdString
+ */
+ public static Node getTestNode(NodeId nodeId, String capabilityString) {
+ NetconfNodeBuilder netconfNodeBuilder = new NetconfNodeBuilder();
+ netconfNodeBuilder.setConnectionStatus(ConnectionStatus.Connected);
+ AvailableCapabilityBuilder availableCapabilityBuilder = new AvailableCapabilityBuilder();
+ availableCapabilityBuilder.setCapability(capabilityString);
+ AvailableCapabilitiesBuilder availableCapabilitesBuilder = new AvailableCapabilitiesBuilder();
+ availableCapabilitesBuilder.setAvailableCapability(Arrays.asList(availableCapabilityBuilder.build()));
+ netconfNodeBuilder.setAvailableCapabilities(availableCapabilitesBuilder.build());
+ NetconfNode rootNodeNetconf = netconfNodeBuilder.build();
+
+ NodeBuilder nodeBuilder = new NodeBuilder();
+
+ nodeBuilder.addAugmentation(rootNodeNetconf);
+ nodeBuilder.setNodeId(nodeId);
+ return nodeBuilder.build();
+ }
+
+ /**
+ * Provide a test NetconfAccessorImpl
+ * @return object NetconfAccessorImpl
+ */
+ public static NetconfAccessorImpl getNetconfAcessorImpl() {
+ NetconfCommunicatorManager netconfCommunicatorManager = mock(NetconfCommunicatorManager.class);
+ DomContext domContext = mock(DomContext.class);
+ String nodeIdString = "Test";
+ String capabilityStringForNetworkElement = "network-element";
+ NodeId nodeId = new NodeId(nodeIdString);
+ NetconfNode testNode = TestNetconfHelper.getTestNode(nodeId, capabilityStringForNetworkElement)
+ .augmentation(NetconfNode.class);
+
+ NetconfAccessorImpl netconfAccessor =
+ new NetconfAccessorImpl(nodeId, testNode, netconfCommunicatorManager, domContext);
+ return netconfAccessor;
+ }
+}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java
deleted file mode 100644
index cc502b4aa..000000000
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/ClusterSingletonServiceProviderMock.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * ============LICENSE_START========================================================================
- * ONAP : ccsdk feature sdnr wt
- * =================================================================================================
- * Copyright (C) 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
- *
- * 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.netconfnodestateservice.test.mock;
-
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
-
-public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider {
-
- @Override
- public void close() throws Exception {
-
- }
-
- @Override
- public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) {
- return null;
- }
-
-}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java
deleted file mode 100644
index 98a8eeaef..000000000
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointMock.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider
- * ================================================================================
- * Copyright (C) 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
- *
- * 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.netconfnodestateservice.test.mock;
-
-import java.util.Optional;
-import org.mockito.Mockito;
-import org.opendaylight.mdsal.binding.api.BindingService;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * @author herbert
- *
- */
-public class MountPointMock extends Mockito implements MountPoint {
-
- private boolean databrokerAbsent = true;
- private final RpcConsumerRegistryMock rpcConsumerRegistry = new RpcConsumerRegistryMock();
- private NotificationService setReadTransaction;
- private DataBroker dataBroker;
-
- private static final InstanceIdentifier<Topology> NETCONF_TOPO_IID =
- InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
- new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())));
-
- public MountPointMock() {
- this.dataBroker = mock(DataBroker.class);
- }
-
- @Override
- public InstanceIdentifier<?> getIdentifier() {
- return NETCONF_TOPO_IID;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends BindingService> Optional<T> getService(Class<T> service) {
-
- System.out.println("Requested mountpoint service: " + service.getSimpleName() + " databrokerAbsent state: "
- + databrokerAbsent);
-
- Optional<? extends BindingService> res;
- if (service.isInstance(dataBroker)) {
- System.out.println("Delivering databroker");
- res = databrokerAbsent ? Optional.empty() : Optional.of(dataBroker);
- } else if (service.isInstance(rpcConsumerRegistry)) {
- System.out.println("Delivering RpcConsumerRegistryMock");
- res = Optional.of(rpcConsumerRegistry);
- } else if (service.isInstance(setReadTransaction)) {
- System.out.println("Delivering notificationService");
- res = Optional.of(setReadTransaction);
- } else {
- System.out.println("Delivering no service");
- res = Optional.empty();
- }
- return (Optional<T>) res;
- }
-
- public void setDatabrokerAbsent(boolean state) {
- this.databrokerAbsent = state;
- }
-
- public DataBroker getDataBroker() {
- return dataBroker;
- }
-
-}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java
deleted file mode 100644
index 996549e3d..000000000
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/MountPointServiceMock.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk feature sdnr wt
- * ================================================================================
- * Copyright (C) 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
- *
- * 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.netconfnodestateservice.test.mock;
-
-import java.util.Optional;
-import org.opendaylight.mdsal.binding.api.MountPoint;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * @author herbert
- *
- */
-public class MountPointServiceMock implements MountPointService {
-
- private final MountPointMock mountpoint;
-
- public MountPointServiceMock(MountPointMock mountpoint) {
- this.mountpoint = mountpoint;
- }
-
- @Override
- public Optional<MountPoint> getMountPoint(InstanceIdentifier<?> mountPoint) {
-
- Optional<MountPoint> optional = Optional.of(mountpoint);
- return optional;
- }
-
- @Override
- public <T extends MountPointListener> ListenerRegistration<T> registerListener(InstanceIdentifier<?> path,
- T listener) {
- return null;
- }
-
-}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java
deleted file mode 100644
index 2b3e00f5c..000000000
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/NotificationPublishServiceMock.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk feature sdnr wt
- * ================================================================================
- * Copyright (C) 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
- *
- * 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.netconfnodestateservice.test.mock;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.concurrent.TimeUnit;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.yangtools.yang.binding.Notification;
-
-public class NotificationPublishServiceMock implements NotificationPublishService {
-
- @Override
- public ListenableFuture<?> offerNotification(Notification notification) {
- return null;
- }
-
- @Override
- public ListenableFuture<?> offerNotification(Notification notification, int timeout, TimeUnit unit)
- throws InterruptedException {
- return null;
- }
-
- @Override
- public void putNotification(Notification notification) throws InterruptedException {}
-
-}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java
deleted file mode 100644
index 8eea79abc..000000000
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcConsumerRegistryMock.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider
- * ================================================================================
- * Copyright (C) 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
- *
- * 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.netconfnodestateservice.test.mock;
-
-import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-
-public class RpcConsumerRegistryMock implements RpcConsumerRegistry {
-
- @Override
- public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
- return null;
- }
-
-}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java
deleted file mode 100644
index f2f6c0e68..000000000
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/mock/RpcProviderRegistryMock.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk feature sdnr wt
- * ================================================================================
- * Copyright (C) 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
- *
- * 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.netconfnodestateservice.test.mock;
-
-import java.util.Set;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-
-public class RpcProviderRegistryMock implements RpcProviderService {
-
- @Override
- public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
- T implementation) {
- return null;
- }
-
- @Override
- public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
- T implementation, Set<InstanceIdentifier<?>> paths) {
- return null;
- }
-
-
-}