diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-04-05 11:04:55 +0200 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2021-04-06 07:16:24 +0200 |
commit | 6188c03a3fd1b73da7184c26fdb81f02c8aa8825 (patch) | |
tree | 6e5c8c71a0d57ac0f2ec60cf7a60acfab7e83bb4 /sdnr/wt/netconfnode-state-service/provider | |
parent | 9fb395380431345b7da7a765651185815a9ac91d (diff) |
Callhome to VES PNF Registration
Callhome to VES PNF Registration
Issue-ID: CCSDK-3160
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: Ic5503ff7bb5bb77af3d5b4ad3ba6b09ccd10d87e
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider')
5 files changed, 28 insertions, 63 deletions
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java index 92ce34b16..d3752cdc4 100644 --- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java +++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java @@ -221,7 +221,7 @@ public class NetconfNodeStateServiceImpl LOG.info("Session Initiated start {}", APPLICATION_NAME); this.domContext = new DomContext(this.yangParserFactory, this.bindingNormalizedNodeSerializer); this.netconfCommunicatorManager = new NetconfCommunicatorManager(mountPointService, domMountPointService, domContext); - this.accessorManager = new NetconfAccessorManager(netconfCommunicatorManager, domContext); + this.accessorManager = new NetconfAccessorManager(netconfCommunicatorManager, domContext, this); // Start RPC Service this.rpcApiService = new NetconfnodeStateServiceRpcApiImpl(rpcProviderRegistry, vesNotificationListenerList); // Get configuration @@ -266,6 +266,10 @@ public class NetconfNodeStateServiceImpl return Objects.requireNonNull(domContext, "Initialization not completed for domContext" ); } + public DataBroker getDataBroker() { + return dataBroker; + } + public NetconfnodeStateServiceRpcApiImpl getNetconfnodeStateServiceRpcApiImpl() { return Objects.requireNonNull(rpcApiService, "Initialization not completed for rpcApiService" ); } 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 189845831..8eba4e7ef 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 @@ -23,7 +23,9 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.NetconfNodeStateServiceImpl; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.dom.DomContext; +import org.opendaylight.mdsal.binding.api.DataBroker; 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.NetconfNodeConnectionStatus.ConnectionStatus; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; @@ -40,7 +42,7 @@ public class NetconfAccessorImpl implements NetconfAccessor { private final Capabilities capabilities; private final NetconfCommunicatorManager netconfCommunicatorManager; private final DomContext domContext; - + private final NetconfNodeStateServiceImpl netconfNodeStateService; /** * Contains all data to access and manage netconf device * @@ -52,13 +54,14 @@ public class NetconfAccessorImpl implements NetconfAccessor { * @param dataBroker to access node * @param mountpoint of netconfNode */ - public NetconfAccessorImpl(NodeId nodeId, NetconfNode netconfNode, - NetconfCommunicatorManager netconfCommunicatorManager, DomContext domContext) { + public NetconfAccessorImpl(NodeId nodeId, NetconfNode netconfNode, + NetconfCommunicatorManager netconfCommunicatorManager, DomContext domContext, NetconfNodeStateServiceImpl netconfNodeStateService) { super(); this.nodeId = Objects.requireNonNull(nodeId); this.netconfNode = Objects.requireNonNull(netconfNode); this.netconfCommunicatorManager = Objects.requireNonNull(netconfCommunicatorManager); this.domContext = Objects.requireNonNull(domContext); + this.netconfNodeStateService = Objects.requireNonNull(netconfNodeStateService); ConnectionStatus csts = netconfNode != null ? netconfNode.getConnectionStatus() : null; if (csts == null) { @@ -71,21 +74,13 @@ public class NetconfAccessorImpl implements NetconfAccessor { this.capabilities = tmp; } - /** - * @param nodeId with uuid of managed netconf node - * @param dataBroker to access node - */ - public NetconfAccessorImpl(String nodeId, NetconfNode netconfNode, - NetconfCommunicatorManager netconfCommunicatorManager, DomContext domContext) { - this(new NodeId(nodeId), netconfNode, netconfCommunicatorManager, domContext); - } - public NetconfAccessorImpl(NetconfAccessorImpl accessor) { this.nodeId = accessor.getNodeId(); this.netconfNode = accessor.getNetconfNode(); this.capabilities = accessor.getCapabilites(); this.netconfCommunicatorManager = accessor.netconfCommunicatorManager; this.domContext = accessor.domContext; + this.netconfNodeStateService = accessor.netconfNodeStateService; } @Override @@ -113,4 +108,9 @@ public class NetconfAccessorImpl implements NetconfAccessor { return netconfCommunicatorManager.getNetconfDomAccessor(this); } + @Override + public DataBroker getControllerBindingDataBroker() { + return netconfNodeStateService.getDataBroker(); + } + } diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorManager.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorManager.java index 280193402..6c3704421 100644 --- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorManager.java +++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorManager.java @@ -45,15 +45,17 @@ public class NetconfAccessorManager { private final ConcurrentHashMap<NodeId, NetconfAccessor> accessorList; private final NetconfCommunicatorManager netconfCommunicatorManager; private final DomContext domContext; + private final NetconfNodeStateServiceImpl netconfNodeStateService; - public NetconfAccessorManager(NetconfCommunicatorManager netconfCommunicatorManager, DomContext domContext) { + public NetconfAccessorManager(NetconfCommunicatorManager netconfCommunicatorManager, DomContext domContext, NetconfNodeStateServiceImpl netconfNodeStateService) { this.netconfCommunicatorManager = Objects.requireNonNull(netconfCommunicatorManager); this.domContext = Objects.requireNonNull(domContext); this.accessorList = new ConcurrentHashMap<>(); + this.netconfNodeStateService = Objects.requireNonNull(netconfNodeStateService); } public NetconfAccessor getAccessor(NodeId nNodeId, NetconfNode netconfNode) { - NetconfAccessor res = new NetconfAccessorImpl(nNodeId, netconfNode, netconfCommunicatorManager, domContext); + NetconfAccessor res = new NetconfAccessorImpl(nNodeId, netconfNode, netconfCommunicatorManager, domContext, netconfNodeStateService); NetconfAccessor previouse = accessorList.put(nNodeId, res); if (Objects.nonNull(previouse)) { LOG.warn("Accessor with name already available. Replaced with new one."); 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 index 1ec9cde2c..dd61db0d1 100644 --- 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 @@ -23,37 +23,28 @@ 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.NetconfNodeStateServiceImpl; 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 { @@ -67,8 +58,9 @@ public class TestNetconfAccessorImpl extends Mockito { NetconfNode testNode = TestNetconfHelper.getTestNode(nodeId, capabilityStringForNetworkElement) .augmentation(NetconfNode.class); - NetconfAccessorImpl netconfAccessor = - new NetconfAccessorImpl(nodeId, testNode, netconfCommunicatorManager, domContext); + NetconfNodeStateServiceImpl netconfNodeStateService = mock(NetconfNodeStateServiceImpl.class); + NetconfAccessorImpl netconfAccessor = new NetconfAccessorImpl(nodeId, testNode, netconfCommunicatorManager, + domContext, netconfNodeStateService); Assert.assertNotNull(netconfAccessor); @@ -138,39 +130,4 @@ public class TestNetconfAccessorImpl extends Mockito { } - @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/example/TestNetconfHelper.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/TestNetconfHelper.java index ac466579f..2b6c77ce0 100644 --- 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 @@ -23,6 +23,7 @@ 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.NetconfNodeStateServiceImpl; 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; @@ -71,8 +72,9 @@ public class TestNetconfHelper extends Mockito { NetconfNode testNode = TestNetconfHelper.getTestNode(nodeId, capabilityStringForNetworkElement) .augmentation(NetconfNode.class); + NetconfNodeStateServiceImpl netconfNodeStateService = mock(NetconfNodeStateServiceImpl.class); NetconfAccessorImpl netconfAccessor = - new NetconfAccessorImpl(nodeId, testNode, netconfCommunicatorManager, domContext); + new NetconfAccessorImpl(nodeId, testNode, netconfCommunicatorManager, domContext, netconfNodeStateService); return netconfAccessor; } } |