diff options
author | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2022-03-10 10:39:16 +0100 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2022-03-23 15:08:48 -0400 |
commit | eb2a7c97c0007b013bd1784ac17d57be02b63d03 (patch) | |
tree | b0861438532727219216cfd426e21ae053abb31a /sdnr/wt/netconfnode-state-service/provider/src/main | |
parent | 3c74361514bb920ed441d105f66ca978bd074ced (diff) |
migrate sdnr features to phosphorus
fix mapper and switch to dom api
Updated to use phosphorus version of parent poms
Issue-ID: CCSDK-3566
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Change-Id: I98c5bef9286622e0d66b53db687557d798cd53f5
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/provider/src/main')
7 files changed, 27 insertions, 26 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"/> |