diff options
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider/src/main')
3 files changed, 21 insertions, 15 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."); |