From 461cc15c741776837b59b8779e0f5bb683657a10 Mon Sep 17 00:00:00 2001 From: Michael Dürre Date: Wed, 29 Jul 2020 08:35:29 +0200 Subject: update devicemanager onf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sodium fixes and some small other changes Issue-ID: CCSDK-2576 Signed-off-by: Michael Dürre Change-Id: I58670cbfbd10c90bd6ade65a0e59d2e7d543cebe --- .../ONFCoreNetworkElement12Equipment.java | 30 ++-- .../onf/ne/ONFCoreNetworkElement12Base.java | 4 +- .../onf/ne/ONFCoreNetworkElement12Basic.java | 9 +- .../onf/ne/ONFCoreNetworkElement12Microwave.java | 11 +- .../onf/ne/ONFCoreNetworkElementBase.java | 15 -- .../test/TestONFCoreNetworkElement12Equipment.java | 6 +- .../ne/test/TestONFCoreNetworkElement12Basic.java | 189 +------------------ .../test/TestONFCoreNetworkElement12Microwave.java | 199 +-------------------- 8 files changed, 49 insertions(+), 414 deletions(-) (limited to 'sdnr/wt/devicemanager-onf') diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java index 5641f2873..fdaaf4f76 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java @@ -27,7 +27,6 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.OnfInterfacePac; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.EquipmentData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; -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.TransactionUtils; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; @@ -54,32 +53,41 @@ public class ONFCoreNetworkElement12Equipment { private static final int EQUIPMENTROOTLEVEL = 0; private final NetworkElementCoreData coreData; - private final OnfInterfacePac equipmentPac; + private final @Nullable OnfInterfacePac equipmentPac; private final NetconfAccessor acessor; private final ValueNameList extensionList; - private final List topLevelEqUuidList; + private final @NonNull List topLevelEqUuidList; private final @NonNull FaultData globalProblemList; private final @NonNull List globalEquipmentList; + public ONFCoreNetworkElement12Equipment(NetconfAccessor acessor, NetworkElementCoreData coreData) { + this(acessor, coreData, false); + } + public ONFCoreNetworkElement12Equipment(NetconfAccessor acessor, NetworkElementCoreData coreData, - Capabilities capabilities) { + Boolean disabled) { LOG.debug("Initialize class: {} " + ONFCoreNetworkElement12Equipment.class.getName()); this.acessor = acessor; this.coreData = coreData; - if (capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)) { + String reason; + if (disabled) { + this.equipmentPac = null; + reason = "disabled"; + } else if (acessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)) { this.equipmentPac = new WrapperEquipmentPacRev170402(acessor); - LOG.debug("Equipement pac supported {}", WrapperEquipmentPacRev170402.QNAME); + reason = "WrapperEquipmentPacRev170402.QNAME"; } else { this.equipmentPac = null; - LOG.debug("Equipement pac not supported {}", WrapperEquipmentPacRev170402.QNAME); + reason = "unsupported"; } + LOG.debug("Equipement pac initialization '{}'", reason); + + globalEquipmentList = new ArrayList<>(); extensionList = new ValueNameList(); topLevelEqUuidList = new ArrayList<>(); - globalEquipmentList = new ArrayList<>(); globalProblemList = new FaultData(); - initClassVars(); } @@ -192,8 +200,8 @@ public class ONFCoreNetworkElement12Equipment { equipmentList.add( new ExtendedEquipment(this.getMountpoint(), parentUuid.getValue(), equipment, path, treeLevel)); - if (this.equipmentPac != null) { - this.equipmentPac.readTheFaults(uuid, problemList); + if (equipmentPac != null) { + equipmentPac.readTheFaults(uuid, problemList); List containedHolderListe = equipment.getContainedHolder(); if (containedHolderListe != null) { diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java index 698a39ab6..6ffdd0ce9 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java @@ -102,7 +102,7 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB this.nodeId = getAcessor().get().getNodeId(); this.isNetworkElementCurrentProblemsSupporting12 = acessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME); - this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this, acessor.getCapabilites()); + this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this); WrapperPTPModelRev170208.initSynchronizationExtension(acessor); LOG.debug("support necurrent-problem-list={}", this.isNetworkElementCurrentProblemsSupporting12); } @@ -141,7 +141,7 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB * Read from NetworkElement and verify LTPs have changed. If the NE has changed, update to the new structure. From * initial state it changes also. */ - protected synchronized boolean readNetworkElementAndInterfaces() { + protected boolean readNetworkElementAndInterfaces() { LOG.debug("Update mountpoint if changed {}", getMountpoint()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java index 05402f895..19be0281a 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java @@ -131,7 +131,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { * Read during startup all relevant structure and status parameters from device */ @Override - public synchronized void initialReadFromNetworkElement() { + public void initialReadFromNetworkElement() { LOG.debug("Get info about {}", getMountpoint()); @@ -143,13 +143,18 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { // Step 2.2: read ne from data store readNetworkElementAndInterfaces(); + LOG.debug("NETCONF read network element and interfaces completed"); equipment.readNetworkElementEquipment(); + LOG.debug("NETCONF read equipment completed"); // Step 2.3: read the existing faults and add to DB FaultData resultList = readAllCurrentProblemsOfNode(); + LOG.debug("NETCONF read current problems completed"); equipment.addProblemsofNode(resultList); faultService.initCurrentProblemStatus(nodeId, resultList); + LOG.debug("DB write current problems completed"); + equipmentService.writeEquipment(equipment.getEquipmentData()); LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), @@ -184,7 +189,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { // -- Register NE to performance manager performanceManager.registration(mountPointNodeName, this); - //events will be already pushed by base devmgr (needs more clarification SDNC-1123) + //events will be already pushed by base devmgr (needs more clarification SDNC-1123) //eventListenerHandler.registration(mountPointNodeName, acessor.getNetconfNode()); //LOG.debug("refresh necon entry for {} with type {} not",mountPointNodeName,this.getDeviceType()); //eventListenerHandler.connectIndication(mountPointNodeName, getDeviceType()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java index a8384ea61..0fc5b15f4 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java @@ -172,7 +172,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas * * @param uuidString of the equipment-pac */ - private synchronized void syncEquipmentPac(String uuidString) { + private void syncEquipmentPac(String uuidString) { int problems = microwaveEventListener.removeObjectsCurrentProblemsOfNode(nodeId, uuidString); LOG.debug("Removed {} problems for uuid {}", problems, uuidString); @@ -192,7 +192,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas * Read during startup all relevant structure and status parameters from device */ @Override - public synchronized void initialReadFromNetworkElement() { + public void initialReadFromNetworkElement() { LOG.debug("Get info about {}", getMountpoint()); int problems = microwaveEventListener.removeAllCurrentProblemsOfNode(nodeId); @@ -203,13 +203,17 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas // Step 2.2: read ne from data store readNetworkElementAndInterfaces(); + LOG.debug("NETCONF read network element and interfaces completed"); equipment.readNetworkElementEquipment(); + LOG.debug("NETCONF read equipment completed"); // Step 2.3: read the existing faults and add to DB FaultData resultList = readAllCurrentProblemsOfNode(); + LOG.debug("NETCONF read current problems completed"); equipment.addProblemsofNode(resultList); microwaveEventListener.initCurrentProblemStatus(nodeId, resultList); + LOG.debug("DB write current problems completed"); equipmentService.writeEquipment(equipment.getEquipmentData()); LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), @@ -256,6 +260,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas idxStart = resultList.size(); uuid = Helper.nnGetUniversalId(lp.getUuid()); + @Nullable Class lpClass = getLpExtension(lp); ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName()); @@ -321,7 +326,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas QName qName = QName.create(capability, revision, conditionalPackage); res = this.microwaveModel.getClassForLtpExtension(qName); } catch (IllegalArgumentException e) { - LOG.debug("Can not create QName from ({}{}{}): {}", capability, revision, conditionalPackage, + LOG.warn("Can not create QName from ({}{}{}): {}", capability, revision, conditionalPackage, e.getMessage()); } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java index 40a6d323b..deacab8f2 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java @@ -21,24 +21,10 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne; import java.util.Optional; -import javax.annotation.Nonnull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ONFCoreNetworkElementRepresentation; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InternalConnectionStatus; -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.TransactionUtils; import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -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.netconf.node.credentials.Credentials; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ConnectionLogStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementConnectionEntity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.NetworkElementDeviceType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.network.element.connection.entity.NodeDetailsBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +33,6 @@ import org.slf4j.LoggerFactory; * @author herbert * */ -@SuppressWarnings("deprecation") public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation { private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class); diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java index 403451799..095446f0b 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java @@ -81,8 +81,7 @@ public class TestONFCoreNetworkElement12Equipment { @Test public void test() { when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(true); - ONFCoreNetworkElement12Equipment onfCoreEqpt = - new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); + ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData); onfCoreEqpt.addProblemsofNode(faultData); onfCoreEqpt.addProblemsofNodeObject("ABCD"); onfCoreEqpt.getInventoryInformation(Arrays.asList("TESTINV")); @@ -96,8 +95,7 @@ public class TestONFCoreNetworkElement12Equipment { @Test public void test1() { when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(false); - ONFCoreNetworkElement12Equipment onfCoreEqpt = - new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); + ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData); } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java index 242014fc0..cfdc5988e 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java @@ -93,134 +93,6 @@ public class TestONFCoreNetworkElement12Basic { } - @Test - public void test() { - optionalNe = new NetworkElement() { - - @Override - public @Nullable List