summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/netconfnode-state-service/provider/src
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider/src')
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/NetconfNodeStateServiceImpl.java5
-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/DomContext.java2
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomParser.java4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/NetconfDomAccessorImpl.java34
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml4
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/TestNetconfNodeStateService.java12
-rw-r--r--sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java11
9 files changed, 40 insertions, 36 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 f759971fb..8605274db 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
@@ -76,8 +76,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.api.YangParserException;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -685,4 +685,5 @@ public class NetconfNodeStateServiceImpl
this.handleDataTreeAsync = this.config.handleAsync();
}
+
}
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 3b68004bc..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
@@ -70,4 +70,7 @@ 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 f1cf906be..30afb4a20 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,7 +65,6 @@ 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/DomContext.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomContext.java
index 35eaa9fc8..602b2987f 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomContext.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomContext.java
@@ -23,7 +23,7 @@ package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.impl.access.dom;
import java.util.Objects;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomParser.java b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomParser.java
index 9bfa826bf..f19103646 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomParser.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/impl/access/dom/DomParser.java
@@ -43,11 +43,11 @@ public class DomParser {
* @param schemaContext schema context
* @return created {@link NormalizedNode}
*/
- public static NormalizedNode<?, ?> parseJsonFile(final String path, final EffectiveModelContext schemaContext) {
+ public static NormalizedNode parseJsonFile(final String path, final EffectiveModelContext schemaContext) {
final JSONCodecFactory codecFactory = JSONCodecFactorySupplier.RFC7951.createSimple(schemaContext);
final NormalizedNodeResult resultHolder = new NormalizedNodeResult();
try (NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder);
- JsonParserStream jsonParser = JsonParserStream.create(writer, codecFactory, schemaContext);
+ JsonParserStream jsonParser = JsonParserStream.create(writer, codecFactory);
InputStream inputStream = NetconfDomAccessorImpl.class.getResourceAsStream(path);
JsonReader reader = new JsonReader(new InputStreamReader(inputStream))) {
jsonParser.parse(reader);
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 54ca395f4..1b263115f 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
@@ -123,7 +123,7 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
}
@Override
- public Optional<NormalizedNode<?, ?>> readDataNode(LogicalDatastoreType dataStoreType,
+ public Optional<NormalizedNode> readDataNode(LogicalDatastoreType dataStoreType,
YangInstanceIdentifier path) {
LOG.debug("Read to node datastore:{} path:{}", dataStoreType, path);
@@ -131,9 +131,9 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
// correctly by underlying opendaylight NETCONF service
DOMDataTreeReadTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction();
try {
- FluentFuture<Optional<NormalizedNode<?, ?>>> foData = readOnlyTransaction.read(dataStoreType, path);
+ FluentFuture<Optional<NormalizedNode>> foData = readOnlyTransaction.read(dataStoreType, path);
- Optional<NormalizedNode<?, ?>> data = foData.get(120, TimeUnit.SECONDS);
+ Optional<NormalizedNode> data = foData.get(120, TimeUnit.SECONDS);
LOG.trace("read is done - {} ", foData.isDone());
return data;
} catch (InterruptedException e) {
@@ -147,15 +147,15 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
}
@Override
- public Optional<NormalizedNode<?, ?>> readControllerDataNode(LogicalDatastoreType dataStoreType,
+ 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);
+ FluentFuture<Optional<NormalizedNode>> foData = readOnlyTransaction.read(dataStoreType, path);
- Optional<NormalizedNode<?, ?>> data = foData.get(120, TimeUnit.SECONDS);
+ Optional<NormalizedNode> data = foData.get(120, TimeUnit.SECONDS);
LOG.trace("read is done - {} ", foData.isDone());
return data;
} catch (InterruptedException e) {
@@ -170,12 +170,12 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
@SuppressWarnings("unchecked")
private static <T extends DataObject> Optional<T> convertNormalizedNode(BindingNormalizedNodeSerializer serializer,
- Optional<NormalizedNode<?, ?>> oData, YangInstanceIdentifier path, Class<T> clazz)
+ Optional<NormalizedNode> oData, YangInstanceIdentifier path, Class<T> clazz)
throws CanNotConvertException {
if (oData.isPresent()) {
- NormalizedNode<?, ?> data = oData.get();
+ NormalizedNode data = oData.get();
LOG.debug("convertNormalizedNode data identifier: {} data nodetype: {}", data.getIdentifier(),
- data.getNodeType());
+ data.getIdentifier().getNodeType());
@Nullable
Entry<InstanceIdentifier<?>, DataObject> entry = serializer.fromNormalizedNode(path, data);
if (entry != null) {
@@ -185,11 +185,11 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
return Optional.of((T) value);
} else {
throw new CanNotConvertException("Unexpected class. Expected:" + clazz.getName() + " provided:"
- + value.getClass().getName() + " Nodetype:" + data.getNodeType());
+ + value.getClass().getName() + " Nodetype:" + data.getIdentifier().getNodeType());
}
} else {
throw new CanNotConvertException(
- "No object created for path:" + path + " Nodetype:" + data.getNodeType());
+ "No object created for path:" + path + " Nodetype:" + data.getIdentifier().getNodeType());
}
} else {
throw new CanNotConvertException("No data received for path:" + path);
@@ -241,7 +241,7 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
if (stream.getName() != null) {
inputBuilder.setStream(stream.getName());
}
- replayIsSupported = Boolean.TRUE.equals(stream.isReplaySupport());
+ replayIsSupported = Boolean.TRUE.equals(stream.requireReplaySupport());
}
filter.ifPresent(inputBuilder::setFilter);
@@ -297,14 +297,12 @@ public class NetconfDomAccessorImpl extends NetconfAccessorImpl implements Netco
return oStreams.map(Streams::nonnullStream).orElse(Collections.emptyMap());
}
- @Override
- public BindingNormalizedNodeSerializer getBindingNormalizedNodeSerializer() {
- return serializer;
- }
-
+ /*
+ * @Override public BindingNormalizedNodeSerializer
+ * getBindingNormalizedNodeSerializer() { return serializer; }
+ */
private DateAndTime getDateAndTime(Instant dateTime) {
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 ec4c64e67..6a4fd8fb2 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,7 +28,7 @@
<reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker"/>
- <reference id="domDataBroker" interface="org.opendaylight.mdsal.dom.api.DOMDataBroker"/>
+ <reference id="domDataBroker" interface="org.opendaylight.mdsal.dom.api.DOMDataBroker"/>
<reference id="notificationPublishService"
interface="org.opendaylight.mdsal.binding.api.NotificationPublishService"/>
@@ -49,7 +49,7 @@
interface="org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEntityDataProvider"/>
<reference id="yangParserFactory"
- interface="org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory"/>
+ interface="org.opendaylight.yangtools.yang.parser.api.YangParserFactory"/>
<reference id="bindingNormalizedNodeSerializer"
interface="org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer"/>
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 b6d731418..70480d5bb 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
@@ -81,9 +81,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl;
+import org.opendaylight.yangtools.yang.parser.api.YangParserException;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -143,7 +143,7 @@ public class TestNetconfNodeStateService extends Mockito {
NotificationPublishService notificationPublishService = mock(NotificationPublishService.class);
RpcProviderService rpcProviderRegistry = mock(RpcProviderService.class);
IEntityDataProvider entityProviderMock = mock(IEntityDataProvider.class);
- YangParserFactory yangParserFactory = new YangParserFactoryImpl();
+ YangParserFactory yangParserFactory = new DefaultYangParserFactory();
BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer =
new BindingCodecContext(BindingRuntimeHelpers.createRuntimeContext());
// start using blueprint interface
@@ -165,7 +165,9 @@ public class TestNetconfNodeStateService extends Mockito {
public static void after() throws InterruptedException, IOException {
System.out.println("Start shutdown");
// close using blueprint interface
- netconfStateService.close();
+ if(netconfStateService!=null) {
+ netconfStateService.close();
+ }
delete(KARAF_ETC);
}
diff --git a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java
index f17453803..9630897fb 100644
--- a/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java
+++ b/sdnr/wt/netconfnode-state-service/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/test/example/ExampleConfig.java
@@ -30,11 +30,12 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.config.rev201208
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParser;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
+import org.opendaylight.yangtools.yang.parser.api.YangParser;
+import org.opendaylight.yangtools.yang.parser.api.YangParserException;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +46,7 @@ public class ExampleConfig {
// specification of YANG module
private static final QNameModule CONFIG_MODULE = QNameModule.create(
- URI.create("urn:ietf:params:xml:ns:yang:config"), Revision.of("2020-12-08"));
+ XMLNamespace.of("urn:ietf:params:xml:ns:yang:config"), Revision.of("2020-12-08"));
// path to 'configuration' container (it is a root container)
private static final YangInstanceIdentifier CONFIGURATION_PATH = YangInstanceIdentifier.builder()
.node(QName.create(CONFIG_MODULE, "configuration"))
@@ -61,7 +62,7 @@ public class ExampleConfig {
final EffectiveModelContext schemaContext = parser.buildEffectiveModel();
// (2) parsing of configuration into binding-independent format
- final NormalizedNode<?, ?> data = DomParser.parseJsonFile("/example.json", schemaContext);
+ final NormalizedNode data = DomParser.parseJsonFile("/example.json", schemaContext);
// (3) conversion into binding-aware format (md-sal codec needs to know about path on which data is placed)
final Configuration config = (Configuration) domContext.getBindingNormalizedNodeSerializer().fromNormalizedNode(CONFIGURATION_PATH, data)
@@ -69,7 +70,7 @@ public class ExampleConfig {
// (4) printing some useful information
LOG.info("Value of 'config1': {}", config.getConfig1());
- LOG.info("Value of 'config2': {}", config.isConfig2());
+ LOG.info("Value of 'config2': {}", config.requireConfig2());
Objects.requireNonNull(config.getEntry()).forEach((entryKey, entry) ->
LOG.info("Value of '{}' setting: {}", entry.getSetting(), entry.getValue()));
}