summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java24
-rw-r--r--sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java7
-rw-r--r--sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java11
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java11
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorImpl.java6
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfAccessorManager.java3
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfCommunicatorManager.java1
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java23
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml3
9 files changed, 84 insertions, 5 deletions
diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
index 133868fcf..82232b2d5 100644
--- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
+++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java
@@ -48,8 +48,9 @@ public class Capabilities {
private static final Logger LOG = LoggerFactory.getLogger(Capabilities.class);
private static final String UNSUPPORTED = "Unsupported";
+ private static final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+
private final List<String> capabilities = new ArrayList<>();
- private final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
private Capabilities() {}
@@ -151,6 +152,25 @@ public class Capabilities {
}
/**
+ * Provide namespace and its revision as String.
+ *
+ * @param qCapability capability from the model
+ * @return String
+ */
+ public static String getNamespaceAndRevisionAsString(QName qCapability) {
+ StringBuffer res = new StringBuffer();
+ res.append(qCapability.getNamespace().toString());
+
+ String revisionString = getRevisionString(qCapability);
+ if (revisionString != null) {
+ res.append("?");
+ res.append(revisionString);
+ }
+
+ return res.toString();
+ }
+
+ /**
*
* @param namespace requested
* @param revision request or null for any revision
@@ -178,7 +198,7 @@ public class Capabilities {
* @param qCapability that specifies the revision
* @return String with revisiondate or null
*/
- private String getRevisionString(QName qCapability) {
+ private static String getRevisionString(QName qCapability) {
Object revisionObject = qCapability.getRevision();
String revision = null;
if (revisionObject instanceof Optional) {
diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java
index a419b3ac3..46fbbacc0 100644
--- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java
+++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java
@@ -19,6 +19,7 @@ package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice;
import java.util.Optional;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
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;
@@ -35,6 +36,12 @@ public interface NetconfAccessor {
DataBroker getControllerBindingDataBroker();
/**
+ * @return the Controller DOMDataBroker
+ */
+ DOMDataBroker getControllerDOMDataBroker();
+
+
+ /**
* @return the nodeId
*/
NodeId getNodeId();
diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java
index e78579a47..1013e37c7 100644
--- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java
+++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java
@@ -76,6 +76,16 @@ public interface NetconfDomAccessor extends NetconfAccessor {
Optional<NormalizedNode<?, ?>> readDataNode(LogicalDatastoreType dataStoreType, YangInstanceIdentifier path);
/**
+ * Read data from Controller node - controller-config
+ *
+ * @param dataStoreType
+ * @param path
+ * @return NormalizedNode<?, ?> with data
+ */
+ Optional<NormalizedNode<?, ?>> readControllerDataNode(LogicalDatastoreType dataStoreType,
+ YangInstanceIdentifier path);
+
+ /**
* Register netconf notification listener for related mountpoint
*
* @param <T> specific child class of DOMNotificationListener
@@ -153,4 +163,5 @@ public interface NetconfDomAccessor extends NetconfAccessor {
* @return serialization object.
*/
BindingNormalizedNodeSerializer getBindingNormalizedNodeSerializer();
+
}
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 d3752cdc4..f759971fb 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
@@ -58,6 +58,7 @@ import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
import org.opendaylight.mdsal.dom.api.DOMMountPointService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
@@ -104,6 +105,7 @@ public class NetconfNodeStateServiceImpl
// -- OSGi services, provided
private DataBroker dataBroker;
+ private DOMDataBroker domDataBroker;
private MountPointService mountPointService;
private DOMMountPointService domMountPointService;
private RpcProviderService rpcProviderRegistry;
@@ -159,6 +161,7 @@ public class NetconfNodeStateServiceImpl
LOG.info("Creating provider for {}", APPLICATION_NAME);
this.dataBroker = null;
+ this.domDataBroker = null;
this.mountPointService = null;
this.domMountPointService = null;
this.rpcProviderRegistry = null;
@@ -182,6 +185,10 @@ public class NetconfNodeStateServiceImpl
this.dataBroker = dataBroker;
}
+ public void setDomDataBroker(DOMDataBroker domDataBroker) {
+ this.domDataBroker = domDataBroker;
+ }
+
public void setRpcProviderRegistry(RpcProviderService rpcProviderRegistry) {
this.rpcProviderRegistry = rpcProviderRegistry;
}
@@ -270,6 +277,10 @@ public class NetconfNodeStateServiceImpl
return dataBroker;
}
+ public DOMDataBroker getDOMDataBroker() {
+ return domDataBroker;
+ }
+
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 34073614e..8cdf33d1b 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
@@ -26,6 +26,7 @@ import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfDomAccesso
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.mdsal.dom.api.DOMDataBroker;
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;
@@ -113,6 +114,11 @@ public class NetconfAccessorImpl implements NetconfAccessor {
return netconfNodeStateService.getDataBroker();
}
+ @Override
+ public DOMDataBroker getControllerDOMDataBroker() {
+ return netconfNodeStateService.getDOMDataBroker();
+ }
+
/**
* check if nc-notifications.yang is supported by the device
*/
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 6c3704421..3b68004bc 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
@@ -70,7 +70,4 @@ public class NetconfAccessorManager {
public void removeAccessor(NodeId nNodeId) {
accessorList.remove(nNodeId);
}
-
-
-
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfCommunicatorManager.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfCommunicatorManager.java
index 30afb4a20..f1cf906be 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfCommunicatorManager.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/NetconfCommunicatorManager.java
@@ -65,6 +65,7 @@ public class NetconfCommunicatorManager {
private final DOMMountPointService domMountPointService;
private final DomContext domContext;
+
public NetconfCommunicatorManager(MountPointService mountPointService, DOMMountPointService domMountPointService,
DomContext domContext) {
super();
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
index 97d48d130..54ca395f4 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java
@@ -146,6 +146,28 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
}
}
+ @Override
+ public Optional<NormalizedNode<?, ?>> readControllerDataNode(LogicalDatastoreType dataStoreType,
+ YangInstanceIdentifier path) {
+ LOG.debug("Read to controller node datastore:{} path:{}", dataStoreType, path);
+
+ DOMDataTreeReadTransaction readOnlyTransaction = this.getControllerDOMDataBroker().newReadOnlyTransaction();
+ try {
+ FluentFuture<Optional<NormalizedNode<?, ?>>> foData = readOnlyTransaction.read(dataStoreType, path);
+
+ Optional<NormalizedNode<?, ?>> data = foData.get(120, TimeUnit.SECONDS);
+ LOG.trace("read is done - {} ", foData.isDone());
+ return data;
+ } catch (InterruptedException e) {
+ LOG.debug("Incomplete read to node transaction {} {}", dataStoreType, path, e);
+ Thread.currentThread().interrupt();
+ return Optional.empty();
+ } catch (ExecutionException | TimeoutException e) {
+ LOG.debug("Incomplete read to node transaction {} {}", dataStoreType, path, e);
+ return Optional.empty();
+ }
+ }
+
@SuppressWarnings("unchecked")
private static <T extends DataObject> Optional<T> convertNormalizedNode(BindingNormalizedNodeSerializer serializer,
Optional<NormalizedNode<?, ?>> oData, YangInstanceIdentifier path, Class<T> clazz)
@@ -284,4 +306,5 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
final String formattedDate = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(dateTime);
return new DateAndTime(formattedDate);
}
+
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/netconfnode-state-service/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
index fbf36e5a0..ec4c64e67 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -28,6 +28,8 @@
<reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker"/>
+ <reference id="domDataBroker" interface="org.opendaylight.mdsal.dom.api.DOMDataBroker"/>
+
<reference id="notificationPublishService"
interface="org.opendaylight.mdsal.binding.api.NotificationPublishService"/>
@@ -55,6 +57,7 @@
<bean id="netconfNodeStateService" class="org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.NetconfNodeStateServiceImpl" init-method="init" destroy-method="destroy" scope="singleton">
<property name="dataBroker" ref="dataBroker"/>
+ <property name="domDataBroker" ref="domDataBroker"/>
<property name="rpcProviderRegistry" ref="rpcProviderRegistry"/>
<property name="notificationPublishService" ref="notificationPublishService"/>
<property name="mountPointService" ref="mountPointService"/>