From 7964e8aa9b9748678f6dadfe7b0c17c936679351 Mon Sep 17 00:00:00 2001 From: Michael Dürre Date: Thu, 15 Aug 2024 10:04:54 +0200 Subject: migrate sdnr features to potassium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adapt features and poms for potassium-sr2 Issue-ID: CCSDK-4046 Change-Id: I67e8fc442811eca40c19f1f3777f1a36812d3e35 Signed-off-by: Michael Dürre --- sdnr/wt/devicemanager-onap/onf14/provider/pom.xml | 143 ++++++++------------- .../onf14/dom/impl/Onf14DomNetworkElement.java | 14 +- .../impl/equipment/Onf14DomEquipmentManager.java | 1 + .../onf14/dom/impl/yangspecs/AirInterface20.java | 101 ++++++++------- .../onf14/dom/impl/yangspecs/Alarms10.java | 27 ++-- .../onf14/dom/impl/yangspecs/CoreModel14.java | 5 - .../dom/impl/yangspecs/EthernetContainer20.java | 27 ++-- .../onf14/dom/impl/yangspecs/WireInterface20.java | 29 ++--- .../onf14/dom/TestOnf14ToInternalDataModel2.java | 1 + .../onf14/util/Onf14DomTestUtils.java | 19 +-- .../onf14/util/TestYangParserUtil.java | 4 +- 11 files changed, 170 insertions(+), 201 deletions(-) (limited to 'sdnr/wt/devicemanager-onap/onf14') diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml b/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml index cf59fa044..ec5c8c63a 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml @@ -52,7 +52,7 @@ ${maven.build.timestamp} UTC 49400 - + ${project.groupId} @@ -64,7 +64,7 @@ sdnr-wt-devicemanager-core-model ${project.version} provided - + ${project.groupId} sdnr-wt-websocketmanager-model @@ -82,7 +82,7 @@ sdnr-wt-common ${project.version} provided - + org.opendaylight.mdsal mdsal-binding-dom-codec-api @@ -94,11 +94,6 @@ ${project.version} provided - - org.opendaylight.netconf - sal-netconf-connector - provided - org.opendaylight.mdsal mdsal-singleton-common-api @@ -109,12 +104,62 @@ rfc6991-ietf-yang-types provided + + org.opendaylight.mdsal.model + ietf-topology + + + org.opendaylight.mdsal + mdsal-common-api + + + org.opendaylight.mdsal + mdsal-dom-api + + + org.opendaylight.mdsal + mdsal-binding-api + + + org.opendaylight.netconf.model + rfc5277 + + + org.opendaylight.yangtools + yang-data-codec-binfmt + org.mockito mockito-core test - + + + org.opendaylight.yangtools + yang-model-util + test + + + org.opendaylight.yangtools + yang-parser-api + test + + + org.opendaylight.yangtools + yang-data-codec-gson + test + + + org.opendaylight.yangtools + yang-data-codec-xml + test + + + org.opendaylight.netconf + netconf-topology + test + + @@ -125,87 +170,7 @@ true - - - org.opendaylight.yangtools - yang-maven-plugin - 7.0.9 - - - binding - none - - generate-sources - - - true - - - - - - org.opendaylight.mdsal - mdsal-binding-java-api-generator - 8.0.6 - compile - - - - - - - org.jacoco - jacoco-maven-plugin - - - **/gen/** - **/generated-sources/** - **/yang-gen-sal/** - **/pax/** - - - - - maven-enforcer-plugin - 3.0.0 - - - enforce-maven - - enforce - - - - - 11 - - - [3.5.0,) - - - - - - enforce-banned-dependencies - - enforce - - - - - Please always use mockito-core instead of mockito-all (see https://bugs.opendaylight.org/show_bug.cgi?id=7662), and spotbugs:annotations instead of findbugs:annotations - - org.mockito:mockito-all - com.google.code.findbugs:annotations - - - - false - - - - diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java index 4431865e2..61381554b 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java @@ -30,7 +30,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.equipment.Onf14DomEquipmentManager; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.Onf14DomInterfacePacManager; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.TechnologySpecificPacKeys; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.qnames.Onf14DevicemanagerQNames; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.yangspecs.CoreModel14; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; @@ -131,6 +130,7 @@ public class Onf14DomNetworkElement implements NetworkElement, PerformanceDataPr @Override public void deregister() { + faultService.removeAllCurrentProblemsOfNode(netconfDomAccessor.getNodeId()); performanceManager.deRegistration(netconfDomAccessor.getNodeId()); } @@ -146,7 +146,17 @@ public class Onf14DomNetworkElement implements NetworkElement, PerformanceDataPr } @Override - public void warmstart() {} + public void warmstart() { + int problems = removeAllCurrentProblemsOfNode(); + log.debug("Removed all {} problems from database at deregistration for {}", problems, netconfDomAccessor.getNodeId().getValue()); + } + + /** + * Remove all entries from list + */ + public int removeAllCurrentProblemsOfNode() { + return faultService.removeAllCurrentProblemsOfNode(netconfDomAccessor.getNodeId()); + } @Override public Optional getAcessor() { diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java index 6f7b24a19..557ddbca7 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java @@ -85,6 +85,7 @@ public class Onf14DomEquipmentManager { List inventoryList = new ArrayList<>(); for (String uuid : getTopLevelEquipment(controlConstruct)) { Optional equipment = readEquipmentInstance(netconfDomAccessor, uuid); + log.info("Equipment Data is - {}", equipment.get().prettyTree()); MapEntryNode equipmentEntry = (MapEntryNode) equipment.get(); if (equipmentEntry != null) { collectEquipment(inventoryList, equipmentEntry, null, EQUIPMENTROOTLEVEL); diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/AirInterface20.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/AirInterface20.java index 19dab4be9..f6f2fac74 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/AirInterface20.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/AirInterface20.java @@ -21,12 +21,10 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.yangspecs; -import com.google.common.collect.Sets; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.TechnologySpecificPacKeys; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.pm.PerformanceDataAirInterface; @@ -43,10 +41,8 @@ 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.YangInstanceIdentifier.AugmentationIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; @@ -70,8 +66,7 @@ public class AirInterface20 extends YangModule { this.coreModel14 = coreModel14; } - public FaultData readAllCurrentProblems(FaultData resultList, - List airInterfaceList) { + public FaultData readAllCurrentProblems(FaultData resultList, List airInterfaceList) { int idxStart; // Start index for debug messages @@ -107,20 +102,24 @@ public class AirInterface20 extends YangModule { // model YangInstanceIdentifier layerProtocolIID = coreModel14.getLayerProtocolIId(ltpUuid, localId); - - @NonNull - AugmentationIdentifier airInterfacePacIID = - YangInstanceIdentifier.AugmentationIdentifier.create(Sets.newHashSet(getQName("air-interface-pac"))); - - InstanceIdentifierBuilder augmentedAirInterfacePacIID = - YangInstanceIdentifier.builder(layerProtocolIID).node(airInterfacePacIID); - + InstanceIdentifierBuilder airInterfacePacIID = + YangInstanceIdentifier.builder(layerProtocolIID).node(getQName("air-interface-pac")); + + // @NonNull + // AugmentationIdentifier airInterfacePacIID = + // YangInstanceIdentifier.AugmentationIdentifier.create(Sets.newHashSet(getQName("air-interface-pac"))); + // + // InstanceIdentifierBuilder augmentedAirInterfacePacIID = + // YangInstanceIdentifier.builder(layerProtocolIID).node(airInterfacePacIID); + // // reading all the current-problems list for this specific LTP and LP Optional airInterfacePacDataOpt = - netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedAirInterfacePacIID.build()); - + netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, airInterfacePacIID.build()); if (airInterfacePacDataOpt.isPresent()) { - AugmentationNode airInterfacePacData = (AugmentationNode) airInterfacePacDataOpt.get(); + LOG.info("Air Interface = {}", airInterfacePacDataOpt.get().prettyTree()); + } + if (airInterfacePacDataOpt.isPresent()) { + ContainerNode airInterfacePacData = (ContainerNode) airInterfacePacDataOpt.get(); MapNode airInterfaceCurrentProblemsList = (MapNode) airInterfacePacData.childByArg(new NodeIdentifier(getQName("current-problem-list"))); if (airInterfaceCurrentProblemsList != null) { @@ -151,42 +150,44 @@ public class AirInterface20 extends YangModule { // model YangInstanceIdentifier layerProtocolIID = coreModel14.getLayerProtocolIId(ltpUuid, localId); - - @NonNull - AugmentationIdentifier airInterfacePacIID = YangInstanceIdentifier.AugmentationIdentifier - .create(Sets.newHashSet(Onf14DevicemanagerQNames.AIR_INTERFACE_PAC)); - - InstanceIdentifierBuilder augmentedAirInterfacePacIID = - YangInstanceIdentifier.builder(layerProtocolIID).node(airInterfacePacIID); - - // reading historical performance list for this specific LTP and LP - Optional airInterfacePacDataOpt = - netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedAirInterfacePacIID.build()); - LOG.debug("Performance Data = {}", airInterfacePacDataOpt.get().body()); - if (airInterfacePacDataOpt.isPresent()) { - AugmentationNode airInterfacePacData = (AugmentationNode) airInterfacePacDataOpt.get(); - ContainerNode cn = (ContainerNode) airInterfacePacData - .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_PAC)); - if (cn != null) { - ContainerNode airIntfHistPerf = (ContainerNode) cn - .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES)); - if (airIntfHistPerf != null) { - MapNode airInterfaceHistoricalPerformanceList = (MapNode) airIntfHistPerf.childByArg( - new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST)); - if (airInterfaceHistoricalPerformanceList != null) { - Collection airInterfaceHistoricalPerfCollection = - airInterfaceHistoricalPerformanceList.body(); - for (MapEntryNode airInterfaceHistPerf : airInterfaceHistoricalPerfCollection) { - res.add(new PerformanceDataAirInterface(netconfDomAccessor.getNodeId(), ltpUuid, localId, - airInterfaceHistPerf)); + InstanceIdentifierBuilder airInterfacePacIID = + YangInstanceIdentifier.builder(layerProtocolIID).node(getQName("air-interface-pac")); + + // @NonNull + // AugmentationIdentifier airInterfacePacIID = YangInstanceIdentifier.AugmentationIdentifier + // .create(Sets.newHashSet(Onf14DevicemanagerQNames.AIR_INTERFACE_PAC)); + // + // InstanceIdentifierBuilder augmentedAirInterfacePacIID = + // YangInstanceIdentifier.builder(layerProtocolIID).node(airInterfacePacIID); + // + // // reading historical performance list for this specific LTP and LP + Optional airInterfacePacDataOpt = + netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, airInterfacePacIID.build()); + LOG.debug("Performance Data = {}", airInterfacePacDataOpt.get().body()); + if (airInterfacePacDataOpt.isPresent()) { + ContainerNode airInterfacePacData = (ContainerNode) airInterfacePacDataOpt.get(); + ContainerNode cn = (ContainerNode) airInterfacePacData + .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_PAC)); + if (cn != null) { + ContainerNode airIntfHistPerf = (ContainerNode) cn + .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES)); + if (airIntfHistPerf != null) { + MapNode airInterfaceHistoricalPerformanceList = (MapNode) airIntfHistPerf.childByArg( + new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST)); + if (airInterfaceHistoricalPerformanceList != null) { + Collection airInterfaceHistoricalPerfCollection = + airInterfaceHistoricalPerformanceList.body(); + for (MapEntryNode airInterfaceHistPerf : airInterfaceHistoricalPerfCollection) { + res.add(new PerformanceDataAirInterface(netconfDomAccessor.getNodeId(), ltpUuid, localId, + airInterfaceHistPerf)); + } + return res; + } else { + LOG.debug("DBRead Id {} empty CurrentProblemList", ltpUuid); + } } - return res; - } else { - LOG.debug("DBRead Id {} empty CurrentProblemList", ltpUuid); } } - } - } return null; } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/Alarms10.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/Alarms10.java index 3f92eb0ca..efbcab158 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/Alarms10.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/Alarms10.java @@ -21,7 +21,6 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.yangspecs; -import com.google.common.collect.Sets; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -44,10 +43,8 @@ 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.YangInstanceIdentifier.AugmentationIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; @@ -132,21 +129,22 @@ public class Alarms10 extends YangModule { YangInstanceIdentifier alarmsPacIID = YangInstanceIdentifier.builder().node(coreModel14.getControlConstructQName()).build(); - - @NonNull - AugmentationIdentifier alarmsContainerIID = - YangInstanceIdentifier.AugmentationIdentifier.create(Sets.newHashSet(ALARM_PAC)); - - InstanceIdentifierBuilder augmentedAlarmsIID = - YangInstanceIdentifier.builder(alarmsPacIID).node(alarmsContainerIID); - - // reading all the alarms + InstanceIdentifierBuilder alarmsContainerIID = YangInstanceIdentifier.builder(alarmsPacIID).node(ALARM_PAC); + + // @NonNull + // AugmentationIdentifier alarmsContainerIID = + // YangInstanceIdentifier.AugmentationIdentifier.create(Sets.newHashSet(ALARM_PAC)); + // + // InstanceIdentifierBuilder augmentedAlarmsIID = + // YangInstanceIdentifier.builder(alarmsPacIID).node(alarmsContainerIID); + // + // // reading all the alarms Optional alarms = - this.getNetconfDomAccessor().readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedAlarmsIID.build()); + this.getNetconfDomAccessor().readDataNode(LogicalDatastoreType.OPERATIONAL, alarmsContainerIID.build()); FaultData resultList = new FaultData(); if (alarms.isPresent()) { - AugmentationNode alarmsDataNode = (AugmentationNode) alarms.get(); + ContainerNode alarmsDataNode = (ContainerNode) alarms.get(); ContainerNode alarmsContainer = (ContainerNode) alarmsDataNode.childByArg(new NodeIdentifier(ALARM_PAC)); ContainerNode currentAlarmsContainer = (ContainerNode) alarmsContainer.childByArg(new NodeIdentifier(CURRENT_ALARMS)); @@ -167,6 +165,7 @@ public class Alarms10 extends YangModule { } } return resultList; + } public boolean isSupported(Capabilities capabilites) { diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/CoreModel14.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/CoreModel14.java index 5a2b5772b..f2990a07d 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/CoreModel14.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/CoreModel14.java @@ -68,11 +68,6 @@ public class CoreModel14 extends YangModule { return module.getRevision().get().toString(); } - @Override - public QName getQName(String localName) { - return QName.create(module, localName); - } - public QName getControlConstructQName() { return CONTROL_CONSTRUCT; } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/EthernetContainer20.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/EthernetContainer20.java index 81aec9dd0..cbc76bc7f 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/EthernetContainer20.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/EthernetContainer20.java @@ -21,12 +21,10 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.yangspecs; -import com.google.common.collect.Sets; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.TechnologySpecificPacKeys; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Debug; @@ -40,10 +38,9 @@ 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.YangInstanceIdentifier.AugmentationIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -74,20 +71,20 @@ public class EthernetContainer20 extends YangModule { // constructing the IID needs the augmentation exposed by the // ethernet-container-2-0 model YangInstanceIdentifier layerProtocolIID = coreModel14.getLayerProtocolIId(ltpUuid, localId); - - @NonNull - AugmentationIdentifier ethernetContainerIID = YangInstanceIdentifier.AugmentationIdentifier - .create(Sets.newHashSet(getQName("ethernet-container-pac"))); - - InstanceIdentifierBuilder augmentedEthernetContainerConfigurationIID = - YangInstanceIdentifier.builder(layerProtocolIID).node(ethernetContainerIID); - - // reading all the current-problems list for this specific LTP and LP + InstanceIdentifierBuilder ethernetContainerIID = YangInstanceIdentifier.builder(layerProtocolIID).node(getQName("ethernet-container-pac")); +// @NonNull +// AugmentationIdentifier ethernetContainerIID = YangInstanceIdentifier.AugmentationIdentifier +// .create(Sets.newHashSet(getQName("ethernet-container-pac"))); +// +// InstanceIdentifierBuilder augmentedEthernetContainerConfigurationIID = +// YangInstanceIdentifier.builder(layerProtocolIID).node(ethernetContainerIID); +// +// // reading all the current-problems list for this specific LTP and LP Optional etherntContainerConfigurationOpt = netconfDomAccessor - .readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedEthernetContainerConfigurationIID.build()); + .readDataNode(LogicalDatastoreType.OPERATIONAL, ethernetContainerIID.build()); if (etherntContainerConfigurationOpt.isPresent()) { - AugmentationNode etherntContainerConfiguration = (AugmentationNode) etherntContainerConfigurationOpt.get(); + ContainerNode etherntContainerConfiguration = (ContainerNode) etherntContainerConfigurationOpt.get(); MapNode ethernetContainerCurrentProblemsList = (MapNode) etherntContainerConfiguration .childByArg(new NodeIdentifier(getQName("current-problem-list"))); if (ethernetContainerCurrentProblemsList != null) { diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/WireInterface20.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/WireInterface20.java index c97449d69..977fdb19c 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/WireInterface20.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/yangspecs/WireInterface20.java @@ -21,12 +21,10 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.yangspecs; -import com.google.common.collect.Sets; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.TechnologySpecificPacKeys; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.qnames.Onf14DevicemanagerQNames; @@ -41,10 +39,9 @@ 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.YangInstanceIdentifier.AugmentationIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -74,20 +71,21 @@ public class WireInterface20 extends YangModule { // constructing the IID needs the augmentation exposed by the wire-interface-2-0 // model YangInstanceIdentifier layerProtocolIID = coreModel14.getLayerProtocolIId(ltpUuid, localId); - - @NonNull - AugmentationIdentifier wireInterfacePacIID = YangInstanceIdentifier.AugmentationIdentifier - .create(Sets.newHashSet(Onf14DevicemanagerQNames.WIRE_INTERFACE_PAC)); - - InstanceIdentifierBuilder augmentedWireInterfaceConfigurationIID = - YangInstanceIdentifier.builder(layerProtocolIID).node(wireInterfacePacIID); + InstanceIdentifierBuilder wireInterfacePacIID = + YangInstanceIdentifier.builder(layerProtocolIID).node(Onf14DevicemanagerQNames.WIRE_INTERFACE_PAC); + // @NonNull + // YangInstanceIdentifier wireInterfacePacIID = + // YangInstanceIdentifier.of(Onf14DevicemanagerQNames.WIRE_INTERFACE_PAC); + // + // InstanceIdentifierBuilder augmentedWireInterfaceConfigurationIID = + // YangInstanceIdentifier.builder(layerProtocolIID).node(wireInterfacePacIID.getLastPathArgument()); // reading all the current-problems list for this specific LTP and LP - Optional wireInterfaceConfigurationOpt = netconfDomAccessor - .readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedWireInterfaceConfigurationIID.build()); + Optional wireInterfaceConfigurationOpt = + netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, wireInterfacePacIID.build()); if (wireInterfaceConfigurationOpt.isPresent()) { - AugmentationNode wireInterfaceConfiguration = (AugmentationNode) wireInterfaceConfigurationOpt.get(); + ContainerNode wireInterfaceConfiguration = (ContainerNode) wireInterfaceConfigurationOpt.get(); MapNode wireInterfaceCurrentProblemsList = (MapNode) wireInterfaceConfiguration .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_LIST)); if (wireInterfaceCurrentProblemsList != null) { @@ -111,8 +109,7 @@ public class WireInterface20 extends YangModule { return resultList; } - public FaultData readAllCurrentProblems(FaultData resultList, - List wireInterfaceList) { + public FaultData readAllCurrentProblems(FaultData resultList, List wireInterfaceList) { int idxStart; // Start index for debug messages diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14ToInternalDataModel2.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14ToInternalDataModel2.java index b889f39c9..01809bbb7 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14ToInternalDataModel2.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14ToInternalDataModel2.java @@ -71,6 +71,7 @@ public class TestOnf14ToInternalDataModel2 extends Mockito { Onf14DomToInternalDataModel model = new Onf14DomToInternalDataModel(); ContainerNode cn = (ContainerNode) Onf14DomTestUtils.getNormalizedNodeFromJson(); + System.out.println("Container Node = "+cn); MapNode equipmentMap = (MapNode) cn.getChildByArg(new NodeIdentifier(QName.create(qnm, "equipment"))); List inventoryList = new ArrayList(); diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/Onf14DomTestUtils.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/Onf14DomTestUtils.java index ec0013cf4..a810373ea 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/Onf14DomTestUtils.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/Onf14DomTestUtils.java @@ -38,16 +38,19 @@ 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.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizationResult; import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter; + import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream; import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter; -import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult; +import org.opendaylight.yangtools.yang.data.impl.schema.NormalizationResultHolder; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; -import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference; + //import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference; //Yangtool 8.0 +import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack.Inference; import org.xml.sax.SAXException; public class Onf14DomTestUtils { @@ -88,7 +91,7 @@ public class Onf14DomTestUtils { loadTextFile(new File(Onf14DomTestUtils.class.getResource("/ControlConstruct-data-test.json").toURI())); final JsonReader reader = new JsonReader(new StringReader(streamAsString)); - NormalizedNodeResult result = new NormalizedNodeResult(); + NormalizationResultHolder result = new NormalizationResultHolder(); // StreamWriter which attaches NormalizedNode under parent final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); @@ -99,7 +102,7 @@ public class Onf14DomTestUtils { } // Finally build the node - transformedInput = result.getResult(); + transformedInput = result.getResult().data(); return transformedInput; } @@ -116,7 +119,7 @@ public class Onf14DomTestUtils { */ final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream); - final NormalizedNodeResult result = new NormalizedNodeResult(); + final NormalizationResultHolder result = new NormalizationResultHolder(); final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, hwContainerSchema); @@ -125,7 +128,7 @@ public class Onf14DomTestUtils { xmlParser.flush(); xmlParser.close(); - transformedInput = result.getResult(); + transformedInput = result.getResult().data(); return transformedInput; } @@ -142,7 +145,7 @@ public class Onf14DomTestUtils { */ final XMLStreamReader reader = UntrustedXML.createXMLStreamReader(resourceAsStream); - final NormalizedNodeResult result = new NormalizedNodeResult(); + final NormalizationResultHolder result = new NormalizationResultHolder(); final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); final XmlParserStream xmlParser = XmlParserStream.create(streamWriter, hwContainerSchema); @@ -151,7 +154,7 @@ public class Onf14DomTestUtils { xmlParser.flush(); xmlParser.close(); - transformedInput = result.getResult(); + transformedInput = result.getResult().data(); return transformedInput; } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/TestYangParserUtil.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/TestYangParserUtil.java index 004f08da3..514ea51f9 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/TestYangParserUtil.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/util/TestYangParserUtil.java @@ -33,11 +33,11 @@ import java.util.Iterator; import java.util.ServiceLoader; import java.util.Set; import java.util.stream.Collectors; - import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.YangConstants; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; +import org.opendaylight.yangtools.yang.model.api.stmt.FeatureSet; import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation; import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; import org.opendaylight.yangtools.yang.parser.api.YangParser; @@ -98,7 +98,7 @@ public final class TestYangParserUtil { final Set supportedFeatures, final Collection sources) { final YangParser parser = PARSER_FACTORY.createParser(config); if (supportedFeatures != null) { - parser.setSupportedFeatures(supportedFeatures); + parser.setSupportedFeatures(FeatureSet.of(supportedFeatures)); } try { -- cgit 1.2.3-korg