diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-02-18 09:55:09 +0100 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2020-02-18 11:51:56 +0100 |
commit | 3b5d372ed15ccd9af58756b6d4dcaf30377ddd3e (patch) | |
tree | ab07797bc67f90405e0709170c12201f98600727 | |
parent | 635d0ff476db287c1d9ffe50e44e02d8326c2995 (diff) |
Fix code smells
Fix code smells based on SonarCloud report
Issue-ID: SDNC-1075
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I98be47a2c75f80aa5593aab2ed63e7abf1dcccc9
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
23 files changed, 616 insertions, 959 deletions
diff --git a/sdnr/wt/devicemanager-gran/provider/pom.xml b/sdnr/wt/devicemanager-gran/provider/pom.xml index b8ef8637f..6cd317f01 100644 --- a/sdnr/wt/devicemanager-gran/provider/pom.xml +++ b/sdnr/wt/devicemanager-gran/provider/pom.xml @@ -131,29 +131,6 @@ </excludes> </configuration> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <executions> - <execution> - <id>generateDTOs</id> - <phase>generate-sources</phase> - <goals> - <goal>exec</goal> - </goals> - <configuration> - <executable>bash</executable> - <arguments> - <argument>${basedir}/../../data-provider/provider/src/main/resources/es-init.sh - </argument> - <argument>initfile</argument> - <argument>-f</argument> - <argument>${project.build.directory}/EsInit.script</argument> - </arguments> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> </project> diff --git a/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/GRanNetworkElement.java b/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/GRanNetworkElement.java index d4932b93e..0f7266061 100644 --- a/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/GRanNetworkElement.java +++ b/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/GRanNetworkElement.java @@ -52,10 +52,12 @@ public class GRanNetworkElement implements NetworkElement { @Override public void deregister() { + log.info("deRegister actions should be here"); } @Override public void warmstart() { + log.info("Warmstart actions should be here"); } @Override diff --git a/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/impl/DeviceManagerGRanImpl.java b/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/impl/DeviceManagerGRanImpl.java index d85515bb4..961a9b7ff 100644 --- a/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/impl/DeviceManagerGRanImpl.java +++ b/sdnr/wt/devicemanager-gran/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/impl/DeviceManagerGRanImpl.java @@ -17,7 +17,6 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.devicemanager.gran.impl; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.gran.GRanNetworkElementFactory; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistration; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; @@ -28,12 +27,10 @@ public class DeviceManagerGRanImpl implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerGRanImpl.class); private static final String APPLICATION_NAME = "DeviceManagerGRan"; - private static final String CONFIGURATIONFILE = "etc/devicemanager-gran.properties"; - + private NetconfNetworkElementService netconfNetworkElementService; private Boolean devicemanagerInitializationOk; - private DataProvider dataProvider; private FactoryRegistration<GRanNetworkElementFactory> factoryRegistration; // Blueprint 1 @@ -43,7 +40,7 @@ public class DeviceManagerGRanImpl implements AutoCloseable { netconfNetworkElementService = null; factoryRegistration = null; - dataProvider = null; + } public void setNetconfNetworkElementService(NetconfNetworkElementService netconfNetworkElementService) { this.netconfNetworkElementService = netconfNetworkElementService; @@ -54,8 +51,6 @@ public class DeviceManagerGRanImpl implements AutoCloseable { LOG.info("Session Initiated start {}", APPLICATION_NAME); // Intialization factoryRegistration = netconfNetworkElementService.registerNetworkElementFactory(new GRanNetworkElementFactory()); - dataProvider = netconfNetworkElementService.getServiceProvider().getDataProvider(); - netconfNetworkElementService.writeToEventLog(APPLICATION_NAME, "startup", "done"); this.devicemanagerInitializationOk = true; diff --git a/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestDeviceManagerGRanImpl.java b/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestDeviceManagerGRanImpl.java index bf0a098d8..c008986e0 100644 --- a/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestDeviceManagerGRanImpl.java +++ b/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestDeviceManagerGRanImpl.java @@ -17,24 +17,14 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.devicemanager.gran.test; -import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.eclipse.jdt.annotation.NonNull; import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.gran.GRanNetworkElementFactory; import org.onap.ccsdk.features.sdnr.wt.devicemanager.gran.impl.DeviceManagerGRanImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.AaiService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EventHandlingService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.MaintenanceService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager; public class TestDeviceManagerGRanImpl { GRanNetworkElementFactory factory = new GRanNetworkElementFactory(); diff --git a/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestGRanNetworkElement.java b/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestGRanNetworkElement.java index 1b381ee00..ac232a008 100644 --- a/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestGRanNetworkElement.java +++ b/sdnr/wt/devicemanager-gran/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/gran/test/TestGRanNetworkElement.java @@ -39,9 +39,9 @@ public class TestGRanNetworkElement { when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); GRanNetworkElement gRanNe = new GRanNetworkElement(netconfAccessor, databaseService); - assertEquals(gRanNe.getDeviceType().getIntValue(), 3); - assertEquals(gRanNe.getDeviceType().getName(), "RAN3GPP"); - assertEquals(gRanNe.getNodeId().getValue(), NODEID); + assertEquals(3, gRanNe.getDeviceType().getIntValue()); + assertEquals("RAN3GPP", gRanNe.getDeviceType().getName()); + assertEquals(NODEID, gRanNe.getNodeId().getValue()); gRanNe.register(); gRanNe.deregister(); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java index 18e3c0b10..4993b5e4a 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ExtendedEquipment.java @@ -82,13 +82,13 @@ public class ExtendedEquipment { // General inventoryBuilder.setNodeId(getNodeId()); inventoryBuilder.setParentUuid(getParentUuid()); - inventoryBuilder.setTreeLevel(new Long(getTreeLevel())); + inventoryBuilder.setTreeLevel(Long.valueOf(getTreeLevel())); - if (equipment != null) { - inventoryBuilder.setUuid(equipment.getUuid().getValue()); + if (getEquipment() != null) { + inventoryBuilder.setUuid(getEquipment().getUuid().getValue()); // -- String list with ids of holders List<String> containerHolderKeyList = new ArrayList<>(); - List<ContainedHolder> containerHolderList = equipment.getContainedHolder(); + List<ContainedHolder> containerHolderList = getEquipment().getContainedHolder(); if (containerHolderList != null) { for (ContainedHolder containerHolder : containerHolderList) { containerHolderKeyList.add(containerHolder.getUuid().getValue()); @@ -97,7 +97,7 @@ public class ExtendedEquipment { inventoryBuilder.setContainedHolder(containerHolderKeyList); // -- Manufacturer related things - ManufacturedThing mThing = equipment.getManufacturedThing(); + ManufacturedThing mThing = getEquipment().getManufacturedThing(); if (mThing != null) { ManufacturerProperties mProperties = mThing.getManufacturerProperties(); if (mProperties != null) { @@ -117,7 +117,7 @@ public class ExtendedEquipment { String manufacturedDateString = mInstance.getManufactureDate(); if (manufacturedDateString != null && !manufacturedDateString.isEmpty()) { try { - inventoryBuilder.setDate(mInstance.getManufactureDate()); + inventoryBuilder.setDate(manufacturedDateString); } catch (IllegalArgumentException e) { LOG.debug("Format problem", e); } 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 b2d4404c8..c67efe3df 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 @@ -63,11 +63,11 @@ public class ONFCoreNetworkElement12Equipment { private final @NonNull List<ExtendedEquipment> globalEquipmentList; public ONFCoreNetworkElement12Equipment(NetconfAccessor acessor, NetworkElementCoreData coreData, Capabilities capabilities) { - LOG.debug("Initialize " + ONFCoreNetworkElement12Equipment.class.getName()); + LOG.debug("Initialize class: {} " + ONFCoreNetworkElement12Equipment.class.getName()); this.acessor = acessor; this.coreData = coreData; if (capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)) { - this.equipmentPac = new WrapperEquipmentPacRev170402(acessor, coreData); + this.equipmentPac = new WrapperEquipmentPacRev170402(acessor); LOG.debug("Equipement pac supported {}", WrapperEquipmentPacRev170402.QNAME); } else { this.equipmentPac = null; @@ -264,10 +264,9 @@ public class ONFCoreNetworkElement12Equipment { InstanceIdentifier<Equipment> equipmentIID = InstanceIdentifier.builder(Equipment.class, new EquipmentKey(interfacePacUuid)).build(); - Equipment res = getGenericTransactionUtils().readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + return getGenericTransactionUtils().readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, equipmentIID); - return res; } /** @@ -285,10 +284,9 @@ public class ONFCoreNetworkElement12Equipment { InstanceIdentifier<Equipment> equipmentIID = InstanceIdentifier.builder(Equipment.class).build(); - Equipment res = getGenericTransactionUtils().readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + return getGenericTransactionUtils().readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, equipmentIID); - return res; } /** diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java index 6da673766..229f88cfa 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java @@ -45,7 +45,7 @@ public class WrapperEquipmentPacRev170402 implements OnfInterfacePac { private final NetconfAccessor acessor; - public WrapperEquipmentPacRev170402(NetconfAccessor acessor, NetworkElementCoreData coreData) { + public WrapperEquipmentPacRev170402(NetconfAccessor acessor) { this.acessor = acessor; } @@ -67,9 +67,7 @@ public class WrapperEquipmentPacRev170402 implements OnfInterfacePac { final Class<EquipmentPac> clazzPac = EquipmentPac.class; final Class<EquipmentPacKey> clazzPacKey = EquipmentPacKey.class; final Class<EquipmentCurrentProblems> clazzProblems = EquipmentCurrentProblems.class; - // final Class<ContainerCurrentProblemTypeG> clazzProblem = - // ContainerCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), acessor.getNodeId(), interfacePacUuid.getValue()); @@ -83,7 +81,7 @@ public class WrapperEquipmentPacRev170402 implements OnfInterfacePac { EquipmentCurrentProblems problems = getGenericTransactionUtils().readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, interfaceIID); if (problems == null) { - LOG.debug("DBRead Id {} no {}", interfacePacUuid, clazzProblems, clazzProblems.getName()); + LOG.debug("DBRead Id {} no {} name {}", interfacePacUuid, clazzProblems, clazzProblems.getName()); } else { // -- Specific part 3 for (CurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java index fc321a5e1..d200530fc 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java @@ -29,10 +29,10 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.r */ public class Helper { - private static @NonNull UniversalId DEFAULT_UniversalId = new UniversalId("Default"); - private static @NonNull LayerProtocolName DEFAULT_LayerProtocolName = new LayerProtocolName("default"); - private static @NonNull GranularityPeriodType DEFAULT_GranularityPeriodType = GranularityPeriodType.Unknown; - private static @NonNull String DEFAULT_String = ""; + private static final @NonNull UniversalId DEFAULT_UniversalId = new UniversalId("Default"); + private static final @NonNull LayerProtocolName DEFAULT_LayerProtocolName = new LayerProtocolName("default"); + private static final @NonNull GranularityPeriodType DEFAULT_GranularityPeriodType = GranularityPeriodType.Unknown; + private static final @NonNull String DEFAULT_String = ""; public static @NonNull UniversalId nnGetUniversalId(@Nullable UniversalId x) { return x == null ? DEFAULT_UniversalId : x; diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java index 79124969c..08783ecef 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java @@ -86,7 +86,6 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw public static final QName QNAME = MwAirInterfacePac.QNAME; - //private NetworkElementCoreData coreData; private final NotificationService microwaveModelListener; private final NetconfAccessor acessor; private final TransactionUtils genericTransactionUtils; @@ -129,19 +128,19 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw FaultData resultList) { switch (lpName) { - case MWAirInterface: + case MWAIRINTERFACE: readTheFaultsOfMwAirInterfacePac(uuid, resultList); break; - case EthernetContainer12: + case ETHERNETCONTAINER12: readTheFaultsOfMwEthernetContainerPac(uuid, resultList); break; - case TDMContainer: + case TDMCONTAINER: readTheFaultsOfMwTdmContainerPac(uuid, resultList); break; - case Structure: + case STRUCTURE: if (lpClass == MwHybridMwStructurePac.class) { readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); @@ -155,10 +154,10 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); } break; - case Ethernet: + case ETHERNET: // No alarms supported break; - case EthernetContainer10: + case ETHERNETCONTAINER10: default: LOG.warn("Unassigned or not expected lp in model {}", lpName); } @@ -167,31 +166,12 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw @Override public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { PerformanceDataLtp res = new PerformanceDataLtp(); - res = readAirInterfacePerformanceData(lp, res); - res = readEthernetContainerPerformanceData(lp, res); + readAirInterfacePerformanceData(lp, res); + readEthernetContainerPerformanceData(lp, res); return res; } -// @Override -// public @NonNull List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { -// switch (lpName) { -// case MWAirInterface: -// return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp); -// -// case EthernetContainer12: -// return readTheHistoricalPerformanceDataOfEthernetContainer(lp); -// -// case EthernetContainer10: -// case EthernetPhysical: -// case Ethernet: -// case TDMContainer: -// case Structure: -// case Unknown: -// LOG.debug("Do not read HistoricalPM data for {} {}", lpName, getUuid(lp)); -// break; -// } -// return new ArrayList<>(); -// } + @Override public Class<?> getClassForLtpExtension(QName qName) { Class<?> res = null; @@ -266,12 +246,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class; - // final Class<AirInterfaceCurrentProblems> clazzProblems = - // AirInterfaceCurrentProblems.class; - // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem = - // AirInterfaceCurrentProblemTypeG.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -306,13 +281,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - // final Class<MwEthernetContainerPacKey> clazzPacKey = - // MwEthernetContainerPacKey.class; - // final Class<EthernetContainerCurrentProblems> clazzProblems = - // EthernetContainerCurrentProblems.class; - // final Class<ContainerCurrentProblemTypeG> clazzProblem = - // ContainerCurrentProblemTypeG.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -344,12 +313,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; - // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey = - // MwAirInterfaceDiversityPacKey.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem = - // AirInterfaceDiversityCurrentProblemTypeG.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -380,12 +345,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; - // final Class<MwPureEthernetStructurePacKey> clazzPacKey = - // MwPureEthernetStructurePacKey.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - // final Class<StructureCurrentProblemTypeG> clazzProblem = - // StructureCurrentProblemTypeG.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -415,12 +376,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; - // final Class<MwHybridMwStructurePacKey> clazzPacKey = - // MwHybridMwStructurePacKey.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - // final Class<HybridMwStructureCurrentProblemsG> clazzProblem = - // HybridMwStructureCurrentProblemsG.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -460,9 +417,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - // final Class<ContainerCurrentProblemTypeG> clazzProblem = - // ContainerCurrentProblemTypeG.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -492,63 +447,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw return resultList; } - /*----------------------------------------------------------------------------- - * Performance related data - */ - -// /** -// * PM MwAirInterfacePac -// * -// * @param lp -// * @return -// */ -// private @NonNull List<ExtendedAirInterfaceHistoricalPerformanceType12> readTheHistoricalPerformanceDataOfMwAirInterfacePac( -// Lp lp) { -// -// List<ExtendedAirInterfaceHistoricalPerformanceType12> resultList = new ArrayList<>(); -// LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), lp.getUuid()); -// // ---- -// UniversalId mwAirInterfacePacuuId = lp.getUuid(); -// // Step 2.1: construct data and the relative iid -// InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier -// .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) -// .child(AirInterfaceConfiguration.class).build(); -// AirInterfaceConfiguration airConfiguration = genericTransactionUtils.readData(coreData.getDataBroker(), -// LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID); -// -// if (airConfiguration == null) { -// LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId); -// -// } else { -// // Step 2.2: construct data and the relative iid -// InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier -// .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) -// .child(AirInterfaceHistoricalPerformances.class).build(); -// -// // Step 2.3: read to the config data store -// AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtils.readData( -// coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID); -// -// if (airHistoricalPerformanceData == null) { -// LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances", -// mwAirInterfacePacuuId); -// } else { -// // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.air._interface.historical.performances.g.HistoricalPerformanceDataList -// List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData -// .nonnullHistoricalPerformanceDataList(); -// LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId, -// airHistPMList.size()); -// for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData -// .nonnullHistoricalPerformanceDataList()) { -// resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType12(pmRecord, airConfiguration)); -// } -// } -// } -// LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size()); -// return resultList; -// } - - /** + /** * Read and add performance data * @param lp to read from * @param result Object to be filled with data @@ -598,39 +497,6 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw return result; } -// private @NonNull List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) { -// -// final String myName = "MWEthernetContainerPac"; -// -// List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>(); -// LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, lp.getUuid()); -// // ---- -// UniversalId ethContainerPacuuId = lp.getUuid(); -// // Step 2.2: construct data and the relative iid -// InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier -// .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId)) -// .child(EthernetContainerHistoricalPerformances.class).build(); -// -// // Step 2.3: read to the config data store -// EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = genericTransactionUtils -// .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID); -// -// if (ethContainerHistoricalPerformanceData == null) { -// LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId); -// } else { -// // import -// // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList -// // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList -// List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData -// .nonnullHistoricalPerformanceDataList(); -// LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size()); -// for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) { -// resultList.add(pmRecord); -// } -// } -// LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size()); -// return resultList; -// } private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) { final String myName = "MWEthernetContainerPac"; @@ -663,11 +529,6 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw return result; } -// private static String getUuid(Lp lp) { -// UniversalId uuid = lp.getUuid(); -// return uuid != null ? uuid.getValue() : null; -// } - private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) { Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType> res = @@ -675,7 +536,4 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed); } - - - } diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java index ed3019cec..bee11b6be 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java @@ -133,19 +133,19 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw FaultData resultList) { switch (lpName) { - case MWAirInterface: + case MWAIRINTERFACE: readTheFaultsOfMwAirInterfacePac(uuid, resultList); break; - case EthernetContainer12: + case ETHERNETCONTAINER12: readTheFaultsOfMwEthernetContainerPac(uuid, resultList); break; - case TDMContainer: + case TDMCONTAINER: readTheFaultsOfMwTdmContainerPac(uuid, resultList); break; - case Structure: + case STRUCTURE: if (lpClass == MwHybridMwStructurePac.class) { readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); @@ -159,10 +159,10 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); } break; - case Ethernet: + case ETHERNET: // No alarms supported break; - case EthernetContainer10: + case ETHERNETCONTAINER10: default: LOG.warn("Unassigned or not expected lp in model {}", lpName); } @@ -172,47 +172,26 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { - case MWAirInterface: - res = readAirInterfacePerformanceData(lp, res); + case MWAIRINTERFACE: + readAirInterfacePerformanceData(lp, res); break; - case EthernetContainer12: - res = readEthernetContainerPerformanceData(lp, res); + case ETHERNETCONTAINER12: + readEthernetContainerPerformanceData(lp, res); break; - case EthernetContainer10: - case EthernetPhysical: - case Ethernet: - case TDMContainer: - case Structure: - case Unknown: + case ETHERNETCONTAINER10: + case ETHERNETPHYSICAL: + case ETHERNET: + case TDMCONTAINER: + case STRUCTURE: + case UNKNOWN: LOG.debug("Do not read HistoricalPM data for {} {}", lpName, Helper.nnGetUniversalId(lp.getUuid()).getValue()); break; } return res; } -// @Override -// public @NonNull List<? extends OtnHistoryDataG> readTheHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { -// switch (lpName) { -// case MWAirInterface: -// return readTheHistoricalPerformanceDataOfMwAirInterfacePac(lp); -// -// case EthernetContainer12: -// return readTheHistoricalPerformanceDataOfEthernetContainer(lp); -// -// case EthernetContainer10: -// case EthernetPhysical: -// case Ethernet: -// case TDMContainer: -// case Structure: -// case Unknown: -// LOG.debug("Do not read HistoricalPM data for {} {}", lpName, Helper.nnGetUniversalId(lp.getUuid()).getValue()); -// break; -// } -// return new ArrayList<>(); -// } - @Override public Class<?> getClassForLtpExtension(QName qName) { Class<?> res = null; @@ -288,12 +267,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class; - // final Class<AirInterfaceCurrentProblems> clazzProblems = - // AirInterfaceCurrentProblems.class; - // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem = - // AirInterfaceCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -327,13 +301,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - // final Class<MwEthernetContainerPacKey> clazzPacKey = - // MwEthernetContainerPacKey.class; - // final Class<EthernetContainerCurrentProblems> clazzProblems = - // EthernetContainerCurrentProblems.class; - // final Class<ContainerCurrentProblemTypeG> clazzProblem = - // ContainerCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -364,12 +332,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; - // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey = - // MwAirInterfaceDiversityPacKey.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem = - // AirInterfaceDiversityCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -399,12 +363,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; - // final Class<MwPureEthernetStructurePacKey> clazzPacKey = - // MwPureEthernetStructurePacKey.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - // final Class<StructureCurrentProblemTypeG> clazzProblem = - // StructureCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -434,12 +394,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; - // final Class<MwHybridMwStructurePacKey> clazzPacKey = - // MwHybridMwStructurePacKey.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - // final Class<HybridMwStructureCurrentProblemsG> clazzProblem = - // HybridMwStructureCurrentProblemsG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -479,9 +435,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - // final Class<ContainerCurrentProblemTypeG> clazzProblem = - // ContainerCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -510,96 +464,6 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw return resultList; } - /*----------------------------------------------------------------------------- - * Performance related data - */ - -// /** -// * PM MwAirInterfacePac -// * -// * @param lp -// * @return -// */ -// private @NonNull List<ExtendedAirInterfaceHistoricalPerformanceType1211> readTheHistoricalPerformanceDataOfMwAirInterfacePac( -// Lp lp) { -// -// String uuId = Helper.nnGetUniversalId(lp.getUuid()).getValue(); -// -// List<ExtendedAirInterfaceHistoricalPerformanceType1211> resultList = new ArrayList<>(); -// LOG.debug("DBRead Get {} MWAirInterfacePac: {}", coreData.getMountpoint(), uuId); -// // ---- -// UniversalId mwAirInterfacePacuuId = new UniversalId(uuId); -// // Step 2.1: construct data and the relative iid -// InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier -// .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) -// .child(AirInterfaceConfiguration.class).build(); -// AirInterfaceConfiguration airConfiguration = genericTransactionUtil.readData(coreData.getDataBroker(), -// LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID); -// -// if (airConfiguration == null) { -// LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceConfiguration", mwAirInterfacePacuuId); -// -// } else { -// // Step 2.2: construct data and the relative iid -// InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier -// .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) -// .child(AirInterfaceHistoricalPerformances.class).build(); -// -// // Step 2.3: read to the config data store -// AirInterfaceHistoricalPerformances airHistoricalPerformanceData = genericTransactionUtil.readData( -// coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID); -// -// if (airHistoricalPerformanceData == null) { -// LOG.debug("DBRead MWAirInterfacePac Id {} no AirInterfaceHistoricalPerformances", -// mwAirInterfacePacuuId); -// } else { -// List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData -// .nonnullHistoricalPerformanceDataList(); -// LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId, -// airHistPMList.size()); -// for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistPMList) { -// resultList.add(new ExtendedAirInterfaceHistoricalPerformanceType1211(pmRecord, airConfiguration)); -// } -// } -// } -// LOG.debug("DBRead MWAirInterfacePac Id {} Records result: {}", mwAirInterfacePacuuId, resultList.size()); -// return resultList; -// } - -// private @NonNull List<ContainerHistoricalPerformanceTypeG> readTheHistoricalPerformanceDataOfEthernetContainer(Lp lp) { -// -// final String myName = "MWEthernetContainerPac"; -// String uuId = Helper.nnGetUniversalId(lp.getUuid()).getValue(); -// -// List<ContainerHistoricalPerformanceTypeG> resultList = new ArrayList<>(); -// LOG.debug("DBRead Get {} : {}", coreData.getMountpoint(), myName, uuId); -// // ---- -// UniversalId ethContainerPacuuId = new UniversalId(uuId); -// // Step 2.2: construct data and the relative iid -// InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier -// .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(ethContainerPacuuId)) -// .child(EthernetContainerHistoricalPerformances.class).build(); -// -// // Step 2.3: read to the config data store -// EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = genericTransactionUtil -// .readData(coreData.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID); -// -// if (ethContainerHistoricalPerformanceData == null) { -// LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId); -// } else { -// // import -// // org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170320.ethernet.container.historical.performances.g.HistoricalPerformanceDataList -// List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData -// .nonnullHistoricalPerformanceDataList(); -// LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size()); -// for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) { -// resultList.add(pmRecord); -// } -// } -// LOG.debug("DBRead {} Id {} Records result: {}", myName, ethContainerPacuuId, resultList.size()); -// return resultList; -// } - /** * Read and add performance data * @param lp to read from diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java index dc2c4e995..633f24d96 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java @@ -132,19 +132,19 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw FaultData resultList) { switch (lpName) { - case MWAirInterface: + case MWAIRINTERFACE: readTheFaultsOfMwAirInterfacePac(uuid, resultList); break; - case EthernetContainer12: + case ETHERNETCONTAINER12: readTheFaultsOfMwEthernetContainerPac(uuid, resultList); break; - case TDMContainer: + case TDMCONTAINER: readTheFaultsOfMwTdmContainerPac(uuid, resultList); break; - case Structure: + case STRUCTURE: if (lpClass == MwHybridMwStructurePac.class) { readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); @@ -158,10 +158,10 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); } break; - case Ethernet: + case ETHERNET: // No alarms supported break; - case EthernetContainer10: + case ETHERNETCONTAINER10: default: LOG.warn("Unassigned or not expected lp in model {}", lpName); } @@ -171,18 +171,18 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { - case MWAirInterface: + case MWAIRINTERFACE: return readAirInterfacePerformanceData(lp, res); - case EthernetContainer12: + case ETHERNETCONTAINER12: return readEthernetContainerPerformanceData(lp, res); - case EthernetContainer10: - case EthernetPhysical: - case Ethernet: - case TDMContainer: - case Structure: - case Unknown: + case ETHERNETCONTAINER10: + case ETHERNETPHYSICAL: + case ETHERNET: + case TDMCONTAINER: + case STRUCTURE: + case UNKNOWN: LOG.debug("Do not read HistoricalPM data for {} {}", lpName, Helper.nnGetUniversalId(lp.getUuid()).getValue()); } return res; @@ -263,12 +263,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - // final Class<MwAirInterfacePacKey> clazzPacKey = MwAirInterfacePacKey.class; - // final Class<AirInterfaceCurrentProblems> clazzProblems = - // AirInterfaceCurrentProblems.class; - // final Class<AirInterfaceCurrentProblemTypeG> clazzProblem = - // AirInterfaceCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -304,13 +299,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - // final Class<MwEthernetContainerPacKey> clazzPacKey = - // MwEthernetContainerPacKey.class; - // final Class<EthernetContainerCurrentProblems> clazzProblems = - // EthernetContainerCurrentProblems.class; - // final Class<ContainerCurrentProblemTypeG> clazzProblem = - // ContainerCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -343,12 +332,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; - // final Class<MwAirInterfaceDiversityPacKey> clazzPacKey = - // MwAirInterfaceDiversityPacKey.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - // final Class<AirInterfaceDiversityCurrentProblemTypeG> clazzProblem = - // AirInterfaceDiversityCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -380,12 +365,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; - // final Class<MwPureEthernetStructurePacKey> clazzPacKey = - // MwPureEthernetStructurePacKey.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - // final Class<StructureCurrentProblemTypeG> clazzProblem = - // StructureCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -417,12 +398,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw FaultData resultList) { final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; - // final Class<MwHybridMwStructurePacKey> clazzPacKey = - // MwHybridMwStructurePacKey.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - // final Class<HybridMwStructureCurrentProblemsG> clazzProblem = - // HybridMwStructureCurrentProblemsG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -464,9 +441,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - // final Class<ContainerCurrentProblemTypeG> clazzProblem = - // ContainerCurrentProblemTypeG.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java new file mode 100644 index 000000000..04c3bc57b --- /dev/null +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/DeviceManagerOnfImpl.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * ============LICENSE_END========================================================================== + ******************************************************************************/ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.impl; + +import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistration; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DeviceManagerOnfImpl implements AutoCloseable { + + private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerOnfImpl.class); + private static final String APPLICATIONNAME = "DeviceManagerOnf"; + + private NetconfNetworkElementService netconfNetworkElementService; + + private HtDatabaseClient htDatabaseClient; + private Boolean devicemanagerInitializationOk = false; + private FactoryRegistration<ONFCoreNetworkElementFactory> resOnf; + + // Blueprint begin + public DeviceManagerOnfImpl() { + LOG.info("Creating provider for {}", APPLICATIONNAME); + resOnf = null; + } + + public void setNetconfNetworkElementService(NetconfNetworkElementService netconfNetworkElementService) { + this.netconfNetworkElementService = netconfNetworkElementService; + } + + public void init() throws Exception { + + LOG.info("Session Initiated start {}", APPLICATIONNAME); + + resOnf = netconfNetworkElementService.registerNetworkElementFactory(new ONFCoreNetworkElementFactory()); + + + netconfNetworkElementService.writeToEventLog(APPLICATIONNAME, "startup", "done"); + this.devicemanagerInitializationOk = true; + + LOG.info("Session Initiated end. Initialization done {}", devicemanagerInitializationOk); + } + // Blueprint end + + @Override + public void close() throws Exception { + LOG.info("closing ..."); + close(htDatabaseClient); + close(resOnf); + LOG.info("closing done"); + } + + /** + * Used to close all Services, that should support AutoCloseable Pattern + * + * @param toClose + * @throws Exception + */ + private void close(AutoCloseable... toCloseList) { + for (AutoCloseable element : toCloseList) { + if (element != null) { + try { + element.close(); + } catch (Exception e) { + LOG.warn("Fail during close: ", e); + } + } + } + } +} 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 48f1ebba6..9fc0c9599 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 @@ -57,380 +57,378 @@ import org.slf4j.LoggerFactory; */ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementBase implements NetworkElementCoreData { - private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12Base.class); - - protected static final @NonNull List<Extension> EMPTYLTPEXTENSIONLIST = new ArrayList<>(); - // private static final List<Ltp> EMPTYLTPLIST = new ArrayList<>(); - - protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier - .builder(NetworkElement.class).build(); - - - /*----------------------------------------------------------------------------- - * Class members - */ - - // Non specific part. Used by all functions. - /** interfaceList is used by PM task and should be synchronized */ - @SuppressWarnings("null") - private final @NonNull List<Lp> interfaceList = Collections.synchronizedList(new CopyOnWriteArrayList<>()); - private Optional<NetworkElement> optionalNe; - - // Performance monitoring specific part - /** Lock for the PM access specific elements that could be null */ - private final @NonNull Object pmLock = new Object(); - protected @Nullable Iterator<Lp> interfaceListIterator = null; - /** Actual pmLp used during iteration over interfaces */ - protected @Nullable Lp pmLp = null; - - // Device monitoring specific part - /** Lock for the DM access specific elements that could be null */ - protected final @NonNull Object dmLock = new Object(); - - protected final boolean isNetworkElementCurrentProblemsSupporting12; - - protected final ONFCoreNetworkElement12Equipment equipment; - - protected final NodeId nodeId; - - /*--------------------------------------------------------------- - * Constructor - */ - - protected ONFCoreNetworkElement12Base(@NonNull NetconfAccessor acessor) { - super(acessor); - this.optionalNe = Optional.empty(); - this.nodeId = getAcessor().get().getNodeId(); - this.isNetworkElementCurrentProblemsSupporting12 = acessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME); - this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this, acessor.getCapabilites()); - WrapperPTPModelRev170208.initSynchronizationExtension(acessor); - LOG.debug("support necurrent-problem-list={}", this.isNetworkElementCurrentProblemsSupporting12); - } - - /*--------------------------------------------------------------- - * Getter/ Setter - */ - - @Override - public Optional<NetworkElement> getOptionalNetworkElement() { - return optionalNe; - } - - List<Lp> getInterfaceList() { - return interfaceList; - } - - public Object getPmLock() { - return pmLock; - } - - /*--------------------------------------------------------------- - * Core model related function - */ - - /** - * Get uuid of Optional NE. - * - * @return Uuid or EMPTY String if optionNE is not available - */ - protected String getUuId() { - String uuid = optionalNe.isPresent() ? Helper.nnGetUniversalId(optionalNe.get().getUuid()).getValue() : EMPTY; - return uuid; - } - - /** - * 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() { - - LOG.debug("Update mountpoint if changed {}", getMountPointNodeName()); - - optionalNe = Optional.ofNullable(getGenericTransactionUtils().readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL, - NETWORKELEMENT_IID)); - synchronized (pmLock) { - boolean change = false; - - if (!optionalNe.isPresent()) { - LOG.debug("Unable to read NE data for mountpoint {}", getMountPointNodeName()); - if (!interfaceList.isEmpty()) { - interfaceList.clear(); - interfaceListIterator = null; - change = true; - } - - } else { - NetworkElement ne = optionalNe.get(); - LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountPointNodeName(), ne.getName()); - List<Lp> actualInterfaceList = getLtpList(ne); - if (!interfaceList.equals(actualInterfaceList)) { - LOG.debug("Mountpoint '{}' Update LTP List. Elements {}", getMountPointNodeName(), - actualInterfaceList.size()); - interfaceList.clear(); - interfaceList.addAll(actualInterfaceList); - interfaceListIterator = null; - change = true; - } - } - return change; - } - } - - /** - * Get List of UUIDs for conditional packages from Networkelement<br> - * Possible interfaces are:<br> - * MWPS, LTP(MWPS-TTP), MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface<br> - * ETH-CTP,LTP(Client), MW_EthernetContainer_Pac<br> - * MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac, - * MicrowaveModel-ObjectClasses-AirInterfaceDiversity<br> - * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-HybridMwStructure<br> - * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-PureEthernetStructure<br> - * - * @param ne NetworkElement - * @return Id List, never null. - */ - - private static List<Lp> getLtpList(@Nullable NetworkElement ne) { - - List<Lp> res = Collections.synchronizedList(new ArrayList<Lp>()); - - if (ne != null) { - List<Ltp> ltpRefList = ne.getLtp(); - if (ltpRefList == null) { - LOG.debug("DBRead NE-Interfaces: null"); - } else { - for (Ltp ltRefListE : ltpRefList) { - List<Lp> lpList = ltRefListE.getLp(); - if (lpList == null) { - LOG.debug("DBRead NE-Interfaces Reference List: null"); - } else { - for (Lp ltp : lpList) { - res.add(ltp); - } - } - } - } - } else { - LOG.debug("DBRead NE: null"); - } - - // ---- Debug - if (LOG.isDebugEnabled()) { - StringBuffer strBuf = new StringBuffer(); - for (Lp ltp : res) { - if (strBuf.length() > 0) { - strBuf.append(", "); - } - strBuf.append(Helper.nnGetLayerProtocolName(ltp.getLayerProtocolName()).getValue()); - strBuf.append(':'); - strBuf.append(Helper.nnGetUniversalId(ltp.getUuid()).getValue()); - } - LOG.debug("DBRead NE-Interfaces: {}", strBuf.toString()); - } - // ---- Debug end - - return res; - } - - /** - * Read current problems of AirInterfaces and EthernetContainer according to NE status into DB - * - * @return List with all problems - */ - protected FaultData readAllCurrentProblemsOfNode() { - - // Step 2.3: read the existing faults and add to DB - FaultData resultList = new FaultData(); - int idxStart; // Start index for debug messages - UniversalId uuid; - - synchronized (pmLock) { - for (Lp lp : interfaceList) { - - idxStart = resultList.size(); - uuid = lp.getUuid(); - FaultData.debugResultList(LOG, uuid.getValue(), resultList, idxStart); - - } - } - - // Step 2.4: Read other problems from mountpoint - if (isNetworkElementCurrentProblemsSupporting12) { - idxStart = resultList.size(); - readNetworkElementCurrentProblems12(resultList); - FaultData.debugResultList(LOG, "CurrentProblems12", resultList, idxStart); - } - - return resultList; - - } - - /** - * Reading problems for the networkElement V1.2 - * @param resultList to collect the problems - * @return resultList with additonal problems - */ - protected FaultData readNetworkElementCurrentProblems12(FaultData resultList) { - - LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountPointNodeName()); - - InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID = - InstanceIdentifier.builder( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac.class) - .build(); - - // Step 2.3: read to the config data store - NetworkElementPac problemPac; - NetworkElementCurrentProblems problems = null; - try { - problemPac = getGenericTransactionUtils().readData(getNetconfNodeDataBroker(), LogicalDatastoreType.OPERATIONAL, - networkElementCurrentProblemsIID); - if (problemPac != null) { - problems = problemPac.getNetworkElementCurrentProblems(); - } - if (problems == null) { - LOG.debug("DBRead no NetworkElementCurrentProblems12"); - } else { - for (org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.current.problems.g.CurrentProblemList problem : problems - .nonnullCurrentProblemList()) { - resultList.add(nodeId, problem.getSequenceNumber(), problem.getTimeStamp(), - problem.getObjectReference(), problem.getProblemName(), - WrapperMicrowaveModelRev181010.mapSeverity(problem.getProblemSeverity())); - } - } - } catch (Exception e) { - LOG.warn("DBRead {} NetworkElementCurrentProblems12 not supported. Message '{}' ", getMountPointNodeName(), - e.getMessage()); - } - return resultList; - } - - /*--------------------------------------------------------------- - * Device Monitor - */ - - @Override - public boolean checkIfConnectionToMediatorIsOk() { - synchronized (dmLock) { - return optionalNe != null; - } - } - - /* - * New implementation to interpret status with empty LTP List as notConnected => return false - * 30.10.2018 Since this behavior is very specific and implicit for specific NE Types - * it needs to be activated by extension or configuration. Change to be disabled at the moment - */ - @Override - public boolean checkIfConnectionToNeIsOk() { - return true; - } - - /*--------------------------------------------------------------- - * Synchronization - */ - - - /*--------------------------------------------------------------- - * Equipment related functions - */ - - @Override - public @NonNull InventoryInformationDcae getInventoryInformation(String layerProtocolFilter) { - LOG.debug("request inventory information. filter:" + layerProtocolFilter); - return this.equipment.getInventoryInformation(getFilteredInterfaceUuidsAsStringList(layerProtocolFilter)); - } - - @Override - public InventoryInformationDcae getInventoryInformation() { - return getInventoryInformation(null); - } - - protected List<String> getFilteredInterfaceUuidsAsStringList(String layerProtocolFilter) { - List<String> uuids = new ArrayList<>(); - - LOG.debug("request inventory information. filter:" + layerProtocolFilter); - if (optionalNe != null) { - // uuids - for (Lp lp : this.interfaceList) { - if (layerProtocolFilter == null || layerProtocolFilter.isEmpty()) { - uuids.add(Helper.nnGetUniversalId(lp.getUuid()).getValue()); - } else if (layerProtocolFilter.equals(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue())) { - uuids.add(Helper.nnGetUniversalId(lp.getUuid()).getValue()); - } - } - } - LOG.debug("uuids found: {}", uuids); - return uuids; - } - - - /*--------------------------------------------------------------- - * Performancemanagement specific interface - */ - - @Override - public void resetPMIterator() { - synchronized (pmLock) { - interfaceListIterator = interfaceList.iterator(); - } - LOG.debug("PM reset iterator"); - } - - @SuppressWarnings("null") - @Override - public boolean hasNext() { - boolean res; - synchronized (pmLock) { - res = interfaceListIterator != null ? interfaceListIterator.hasNext() : false; - } - LOG.debug("PM hasNext LTP {}", res); - return res; - } - - @SuppressWarnings("null") - @Override - public void next() { - synchronized (pmLock) { - if (interfaceListIterator == null) { - pmLp = null; - LOG.debug("PM next LTP null"); - } else { - pmLp = interfaceListIterator.next(); - LOG.debug("PM next LTP {}", Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); - } - } - } - - @SuppressWarnings("null") - @Override - public String pmStatusToString() { - StringBuffer res = new StringBuffer(); - synchronized (pmLock) { - res.append(pmLp == null ? "no interface" : Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); - for (Lp lp : getInterfaceList()) { - res.append("IF:"); - res.append(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); - res.append(" "); - } - } - return res.toString(); - } - - @Override - public void doRegisterEventListener(MountPoint mountPoint) { - //Do nothing - } - - @SuppressWarnings("unchecked") - @Override - public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) { - return clazz.isInstance(this) ? Optional.of((L)this) : Optional.empty(); - } - - @Override - public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() { - return Optional.empty(); - } + private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElement12Base.class); + + protected static final @NonNull List<Extension> EMPTYLTPEXTENSIONLIST = new ArrayList<>(); + + protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier + .builder(NetworkElement.class).build(); + + + /*----------------------------------------------------------------------------- + * Class members + */ + + // Non specific part. Used by all functions. + /** interfaceList is used by PM task and should be synchronized */ + @SuppressWarnings("null") + private final @NonNull List<Lp> interfaceList = Collections.synchronizedList(new CopyOnWriteArrayList<>()); + private Optional<NetworkElement> optionalNe; + + // Performance monitoring specific part + /** Lock for the PM access specific elements that could be null */ + private final @NonNull Object pmLock = new Object(); + protected @Nullable Iterator<Lp> interfaceListIterator = null; + /** Actual pmLp used during iteration over interfaces */ + protected @Nullable Lp pmLp = null; + + // Device monitoring specific part + /** Lock for the DM access specific elements that could be null */ + protected final @NonNull Object dmLock = new Object(); + + protected final boolean isNetworkElementCurrentProblemsSupporting12; + + protected final ONFCoreNetworkElement12Equipment equipment; + + protected final NodeId nodeId; + + /*--------------------------------------------------------------- + * Constructor + */ + + protected ONFCoreNetworkElement12Base(@NonNull NetconfAccessor acessor) { + super(acessor); + this.optionalNe = Optional.empty(); + this.nodeId = getAcessor().get().getNodeId(); + this.isNetworkElementCurrentProblemsSupporting12 = acessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME); + this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this, acessor.getCapabilites()); + WrapperPTPModelRev170208.initSynchronizationExtension(acessor); + LOG.debug("support necurrent-problem-list={}", this.isNetworkElementCurrentProblemsSupporting12); + } + + /*--------------------------------------------------------------- + * Getter/ Setter + */ + + @Override + public Optional<NetworkElement> getOptionalNetworkElement() { + return optionalNe; + } + + List<Lp> getInterfaceList() { + return interfaceList; + } + + public Object getPmLock() { + return pmLock; + } + + /*--------------------------------------------------------------- + * Core model related function + */ + + /** + * Get uuid of Optional NE. + * + * @return Uuid or EMPTY String if optionNE is not available + */ + protected String getUuId() { + return optionalNe.isPresent() ? Helper.nnGetUniversalId(optionalNe.get().getUuid()).getValue() : EMPTY; + } + + /** + * 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() { + + LOG.debug("Update mountpoint if changed {}", getMountpoint()); + + optionalNe = Optional.ofNullable(getGenericTransactionUtils().readData(getDataBroker(), LogicalDatastoreType.OPERATIONAL, + NETWORKELEMENT_IID)); + synchronized (pmLock) { + boolean change = false; + + if (!optionalNe.isPresent()) { + LOG.debug("Unable to read NE data for mountpoint {}", getMountpoint()); + if (!interfaceList.isEmpty()) { + interfaceList.clear(); + interfaceListIterator = null; + change = true; + } + + } else { + NetworkElement ne = optionalNe.get(); + LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountpoint(), ne.getName()); + List<Lp> actualInterfaceList = getLtpList(ne); + if (!interfaceList.equals(actualInterfaceList)) { + LOG.debug("Mountpoint '{}' Update LTP List. Elements {}", getMountpoint(), + actualInterfaceList.size()); + interfaceList.clear(); + interfaceList.addAll(actualInterfaceList); + interfaceListIterator = null; + change = true; + } + } + return change; + } + } + + /** + * Get List of UUIDs for conditional packages from Networkelement<br> + * Possible interfaces are:<br> + * MWPS, LTP(MWPS-TTP), MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface<br> + * ETH-CTP,LTP(Client), MW_EthernetContainer_Pac<br> + * MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac, + * MicrowaveModel-ObjectClasses-AirInterfaceDiversity<br> + * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-HybridMwStructure<br> + * MWS, LTP(MWS-TTP), ,MicrowaveModel-ObjectClasses-PureEthernetStructure<br> + * + * @param ne NetworkElement + * @return Id List, never null. + */ + + private static List<Lp> getLtpList(@Nullable NetworkElement ne) { + + List<Lp> res = Collections.synchronizedList(new ArrayList<Lp>()); + + if (ne != null) { + List<Ltp> ltpRefList = ne.getLtp(); + if (ltpRefList == null) { + LOG.debug("DBRead NE-Interfaces: null"); + } else { + for (Ltp ltRefListE : ltpRefList) { + List<Lp> lpList = ltRefListE.getLp(); + if (lpList == null) { + LOG.debug("DBRead NE-Interfaces Reference List: null"); + } else { + for (Lp ltp : lpList) { + res.add(ltp); + } + } + } + } + } else { + LOG.debug("DBRead NE: null"); + } + + // ---- Debug + if (LOG.isDebugEnabled()) { + StringBuilder strBuild = new StringBuilder(); + for (Lp ltp : res) { + if (strBuild.length() > 0) { + strBuild.append(", "); + } + strBuild.append(Helper.nnGetLayerProtocolName(ltp.getLayerProtocolName()).getValue()); + strBuild.append(':'); + strBuild.append(Helper.nnGetUniversalId(ltp.getUuid()).getValue()); + } + LOG.debug("DBRead NE-Interfaces: {}", strBuild.toString()); + } + // ---- Debug end + + return res; + } + + /** + * Read current problems of AirInterfaces and EthernetContainer according to NE status into DB + * + * @return List with all problems + */ + protected FaultData readAllCurrentProblemsOfNode() { + + // Step 2.3: read the existing faults and add to DB + FaultData resultList = new FaultData(); + int idxStart; // Start index for debug messages + UniversalId uuid; + + synchronized (pmLock) { + for (Lp lp : interfaceList) { + + idxStart = resultList.size(); + uuid = lp.getUuid(); + FaultData.debugResultList(LOG, uuid.getValue(), resultList, idxStart); + + } + } + + // Step 2.4: Read other problems from mountpoint + if (isNetworkElementCurrentProblemsSupporting12) { + idxStart = resultList.size(); + readNetworkElementCurrentProblems12(resultList); + FaultData.debugResultList(LOG, "CurrentProblems12", resultList, idxStart); + } + + return resultList; + + } + + /** + * Reading problems for the networkElement V1.2 + * @param resultList to collect the problems + * @return resultList with additonal problems + */ + protected FaultData readNetworkElementCurrentProblems12(FaultData resultList) { + + LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountpoint()); + + InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID = + InstanceIdentifier.builder( + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac.class) + .build(); + + // Step 2.3: read to the config data store + NetworkElementPac problemPac; + NetworkElementCurrentProblems problems = null; + try { + problemPac = getGenericTransactionUtils().readData(getDataBroker(), LogicalDatastoreType.OPERATIONAL, + networkElementCurrentProblemsIID); + if (problemPac != null) { + problems = problemPac.getNetworkElementCurrentProblems(); + } + if (problems == null) { + LOG.debug("DBRead no NetworkElementCurrentProblems12"); + } else { + for (org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.network.element.current.problems.g.CurrentProblemList problem : problems + .nonnullCurrentProblemList()) { + resultList.add(nodeId, problem.getSequenceNumber(), problem.getTimeStamp(), + problem.getObjectReference(), problem.getProblemName(), + WrapperMicrowaveModelRev181010.mapSeverity(problem.getProblemSeverity())); + } + } + } catch (Exception e) { + LOG.warn("DBRead {} NetworkElementCurrentProblems12 not supported. Message '{}' ", getMountpoint(), + e.getMessage()); + } + return resultList; + } + + /*--------------------------------------------------------------- + * Device Monitor + */ + + @Override + public boolean checkIfConnectionToMediatorIsOk() { + synchronized (dmLock) { + return optionalNe != null; + } + } + + /* + * New implementation to interpret status with empty LTP List as notConnected => return false + * 30.10.2018 Since this behavior is very specific and implicit for specific NE Types + * it needs to be activated by extension or configuration. Change to be disabled at the moment + */ + @Override + public boolean checkIfConnectionToNeIsOk() { + return true; + } + + /*--------------------------------------------------------------- + * Synchronization + */ + + + /*--------------------------------------------------------------- + * Equipment related functions + */ + + @Override + public @NonNull InventoryInformationDcae getInventoryInformation(String layerProtocolFilter) { + LOG.debug("request inventory information. filter: {}" + layerProtocolFilter); + return this.equipment.getInventoryInformation(getFilteredInterfaceUuidsAsStringList(layerProtocolFilter)); + } + + @Override + public InventoryInformationDcae getInventoryInformation() { + return getInventoryInformation(null); + } + + protected List<String> getFilteredInterfaceUuidsAsStringList(String layerProtocolFilter) { + List<String> uuids = new ArrayList<>(); + + LOG.debug("request inventory information. filter: {}" + layerProtocolFilter); + if (optionalNe != null) { + // uuids + for (Lp lp : this.interfaceList) { + if (layerProtocolFilter == null || + layerProtocolFilter.isEmpty() || + layerProtocolFilter.equals(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue())) { + uuids.add(Helper.nnGetUniversalId(lp.getUuid()).getValue()); + } + } + } + LOG.debug("uuids found: {}", uuids); + return uuids; + } + + + /*--------------------------------------------------------------- + * Performancemanagement specific interface + */ + + @Override + public void resetPMIterator() { + synchronized (pmLock) { + interfaceListIterator = interfaceList.iterator(); + } + LOG.debug("PM reset iterator"); + } + + @SuppressWarnings("null") + @Override + public boolean hasNext() { + boolean res; + synchronized (pmLock) { + res = interfaceListIterator != null ? interfaceListIterator.hasNext() : false; + } + LOG.debug("PM hasNext LTP {}", res); + return res; + } + + @SuppressWarnings("null") + @Override + public void next() { + synchronized (pmLock) { + if (interfaceListIterator == null) { + pmLp = null; + LOG.debug("PM next LTP null"); + } else { + pmLp = interfaceListIterator.next(); + LOG.debug("PM next LTP {}", Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); + } + } + } + + @SuppressWarnings("null") + @Override + public String pmStatusToString() { + StringBuilder res = new StringBuilder(); + synchronized (pmLock) { + res.append(pmLp == null ? "no interface" : Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); + for (Lp lp : getInterfaceList()) { + res.append("IF:"); + res.append(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); + res.append(" "); + } + } + return res.toString(); + } + + @Override + public void doRegisterEventListener(MountPoint mountPoint) { + //Do nothing + } + + @SuppressWarnings("unchecked") + @Override + public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) { + return clazz.isInstance(this) ? Optional.of((L)this) : Optional.empty(); + } + + @Override + public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() { + return Optional.empty(); + } } 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 fb73b823e..b152824ee 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 @@ -104,7 +104,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { int problems = faultService.removeAllCurrentProblemsOfNode(nodeId); FaultData resultList = readAllCurrentProblemsOfNode(); faultService.initCurrentProblemStatus(nodeId, resultList); - LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountPointNodeName(), + LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountpoint(), getUuId(), problems, resultList.size()); } } @@ -130,8 +130,8 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { */ @Override public synchronized void initialReadFromNetworkElement() { - // optionalNe.getLtp().get(0).getLp(); - LOG.debug("Get info about {}", getMountPointNodeName()); + + LOG.debug("Get info about {}", getMountpoint()); int problems = faultService.removeAllCurrentProblemsOfNode(nodeId); LOG.debug("Removed all {} problems from database at registration", problems); @@ -150,7 +150,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { faultService.initCurrentProblemStatus(nodeId, resultList); equipmentService.writeEquipment(equipment.getEquipmentData()); - LOG.info("Found info at {} for device {} number of problems: {}", getMountPointNodeName(), getUuId(), + LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), resultList.size()); } @@ -166,9 +166,6 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { public void register() { // Setup microwaveEventListener for notification service - // MicrowaveEventListener microwaveEventListener = new - // MicrowaveEventListener(mountPointNodeName, websocketmanagerService, - // xmlMapper, databaseClientEvents); doRegisterEventListener(acessor.getMountpoint()); // Register netconf stream @@ -201,6 +198,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { @Override public void close() throws Exception { + // Close to be implemented } 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 c90e76efc..505e0ca12 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 @@ -110,7 +110,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas int problems = microwaveEventListener.removeAllCurrentProblemsOfNode(nodeId); FaultData resultList = readAllCurrentProblemsOfNode(); microwaveEventListener.initCurrentProblemStatus(nodeId, resultList); - LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountPointNodeName(), + LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountpoint(), getUuId(), problems, resultList.size()); } } @@ -187,8 +187,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas */ @Override public synchronized void initialReadFromNetworkElement() { - // optionalNe.getLtp().get(0).getLp(); - LOG.debug("Get info about {}", getMountPointNodeName()); + LOG.debug("Get info about {}", getMountpoint()); int problems = microwaveEventListener.removeAllCurrentProblemsOfNode(nodeId); LOG.debug("Removed all {} problems from database at registration", problems); @@ -207,7 +206,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas microwaveEventListener.initCurrentProblemStatus(nodeId, resultList); equipmentService.writeEquipment(equipment.getEquipmentData()); - LOG.info("Found info at {} for device {} number of problems: {}", getMountPointNodeName(), getUuId(), + LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), resultList.size()); } @@ -220,7 +219,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas */ private void debugResultList(String uuid, FaultData resultList, int idxStart) { if (LOG.isDebugEnabled()) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); int idx = 0; for (int t = idxStart; t < resultList.size(); t++) { sb.append(idx++); @@ -228,7 +227,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas sb.append(resultList.get(t)); sb.append('}'); } - LOG.debug("Found problems {} {}", uuid, sb.toString()); + LOG.debug("Found problems {} {}", uuid, sb); } } @@ -290,7 +289,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas if (valueName.contentEquals("capability")) { capability = e.getValue(); if (capability != null) { - int idx = capability.indexOf("?"); + int idx = capability.indexOf('?'); if (idx != -1) { capability = capability.substring(0, idx); } @@ -310,7 +309,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas // "2017-03-24", "mw-air-interface-pac").intern(); LOG.info("LpExtension capability={} revision={} conditionalPackage={}", capability, revision, conditionalPackage); - if (!capability.isEmpty() && !revision.isEmpty() && !conditionalPackage.isEmpty()) { + if (capability != null && !capability.isEmpty() && !revision.isEmpty() && !conditionalPackage.isEmpty()) { try { QName qName = QName.create(capability, revision, conditionalPackage); res = this.microwaveModel.getClassForLtpExtension(qName); 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 80df3ce5f..5bbeb74ef 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 @@ -57,7 +57,6 @@ public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCor private final String mountPointNodeName; private final NodeId nodeId; private final DataBroker netconfNodeDataBroker; - private final Capabilities capabilities; private final NetconfAccessor acessor; protected ONFCoreNetworkElementBase(NetconfAccessor acessor) { @@ -65,7 +64,6 @@ public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCor this.mountPointNodeName = acessor.getNodeId().getValue(); this.nodeId = acessor.getNodeId(); this.netconfNodeDataBroker = acessor.getDataBroker(); - this.capabilities = acessor.getCapabilites(); this.acessor = acessor; } @@ -79,73 +77,14 @@ public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCor public String getMountPointNodeName() { return mountPointNodeName; } - + /** * @return the netconfNodeDataBroker */ public DataBroker getNetconfNodeDataBroker() { return netconfNodeDataBroker; } - - /** - * @return the capabilities - */ - /* - * public Capabilities getCapabilities() { return capabilities; } - */ - - /** - * Update devicetype and let all other field empty - * @param deviceType that should be updated - * @return NetworkElementConnectionEntity with related parameter - */ - /* - * public static NetworkElementConnectionEntity - * getNetworkConnectionDeviceTpe(NetworkElementDeviceType deviceType) { - * NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder(); - * eb.setDeviceType(deviceType); return eb.build(); } - */ - - /** - * Provide device specific data - * @param nodeId mountpoint id - * @param nNode data - * @return NetworkElementConnectionEntity specific information - */ - /* - * public static NetworkElementConnectionEntity getNetworkConnection(String - * nodeId, @Nonnull NetconfNode nNode) { - * - * NetworkElementConnectionBuilder eb = new NetworkElementConnectionBuilder(); - * // -- basics - * eb.setId(nodeId).setNodeId(nodeId).setDeviceType(NetworkElementDeviceType. - * Unknown).setIsRequired(false); - * - * // -- connection status ConnectionLogStatus status = - * InternalConnectionStatus.statusFromNodeStatus(nNode.getConnectionStatus()); - * eb.setStatus(status); - * - * // -- capabilites Capabilities availableCapabilities = - * Capabilities.getAvailableCapabilities(nNode); Capabilities - * unAvailableCapabilities = Capabilities.getUnavailableCapabilities(nNode); - * eb.setCoreModelCapability(availableCapabilities.getRevisionForNamespace( - * NetworkElement.QNAME)); - * - * NodeDetailsBuilder nodeDetails = new NodeDetailsBuilder() - * .setAvailableCapabilities(availableCapabilities.getCapabilities()) - * .setUnavailableCapabilities(unAvailableCapabilities.getCapabilities()); - * eb.setNodeDetails(nodeDetails.build()); // -- host information Host host = - * nNode.getHost(); PortNumber portNumber = nNode.getPort(); if (host != null && - * portNumber != null) { - * eb.setHost(host.stringValue()).setPort(portNumber.getValue().longValue()); } - * - * Credentials credentials = nNode.getCredentials(); if (credentials instanceof - * LoginPassword) { LoginPassword loginPassword = (LoginPassword) credentials; - * eb.setUsername(loginPassword.getUsername()).setPassword(loginPassword. - * getPassword()); } return eb.build(); } - */ - - + @Override public void warmstart() { int problems = removeAllCurrentProblemsOfNode(); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/notifications/NotificationWorker.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/notifications/NotificationWorker.java index 44fad1b3a..5de65642b 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/notifications/NotificationWorker.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/notifications/NotificationWorker.java @@ -54,7 +54,7 @@ public class NotificationWorker<T> implements AutoCloseable { @Override public void close() throws Exception { - // TODO Auto-generated method stub + // Auto-generated method stub } private static class Worker<T> implements Runnable { diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/ONFLayerProtocolName.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/ONFLayerProtocolName.java index 3fa52e110..f9e5ea688 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/ONFLayerProtocolName.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/util/ONFLayerProtocolName.java @@ -23,14 +23,14 @@ import org.slf4j.LoggerFactory; public enum ONFLayerProtocolName { - MWAirInterface("MWPS"), //V1.0 + V1.2 - EthernetContainer10("ETH-CTP"), //V1.0 - EthernetContainer12("ETC"), //V1.2 + V1.2.1.1 - EthernetPhysical("ETY"), //V1.2 - TDMContainer("TDM"), //V1.2 - Structure("MWS"), //V1.0 + V1.2 - Ethernet("ETH"), //V1.2 - Unknown(""); + MWAIRINTERFACE("MWPS"), //V1.0 + V1.2 + ETHERNETCONTAINER10("ETH-CTP"), //V1.0 + ETHERNETCONTAINER12("ETC"), //V1.2 + V1.2.1.1 + ETHERNETPHYSICAL("ETY"), //V1.2 + TDMCONTAINER("TDM"), //V1.2 + STRUCTURE("MWS"), //V1.0 + V1.2 + ETHERNET("ETH"), //V1.2 + UNKNOWN(""); private static final Logger LOG = LoggerFactory.getLogger(ONFLayerProtocolName.class); @@ -51,7 +51,7 @@ public enum ONFLayerProtocolName { } } LOG.info("Can not map {}. Use Unknown",onfName.getValue() ); - return Unknown; + return UNKNOWN; } public String getValue() { diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java index 7ac2944dd..99e426adc 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java @@ -136,7 +136,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAirInterface, null, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); } @Test @@ -145,7 +145,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(null); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAirInterface, null, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); } @Test @@ -154,7 +154,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.EthernetContainer12, null, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); } @Test @@ -163,7 +163,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(null); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.EthernetContainer12, null, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); } @Test @@ -183,7 +183,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMContainer, null, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, resultList); } @@ -202,7 +202,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwHybridMwStructurePac.class, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwHybridMwStructurePac.class, uid, resultList); } @@ -221,7 +221,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwAirInterfaceDiversityPac.class, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwAirInterfaceDiversityPac.class, uid, resultList); } @@ -240,7 +240,7 @@ public class TestWrapperMicrowaveModelRev170324 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwPureEthernetStructurePac.class, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwPureEthernetStructurePac.class, uid, resultList); } @@ -248,7 +248,7 @@ public class TestWrapperMicrowaveModelRev170324 { public void testNullStructureWithProblems() throws Exception { WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, null, uid, resultList); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, resultList); } @@ -288,6 +288,6 @@ public class TestWrapperMicrowaveModelRev170324 { Lp lp = new LpBuilder().setUuid(uid).build(); WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.getLtpHistoricalPerformanceData(ONFLayerProtocolName.Ethernet, lp); + wrapperMicrowaveModelRev170324.getLtpHistoricalPerformanceData(ONFLayerProtocolName.ETHERNET, lp); } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java index ee0f727dd..64c857173 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java @@ -133,7 +133,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAirInterface, null, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); } @Test @@ -142,7 +142,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(null); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAirInterface, null, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); } @Test @@ -151,7 +151,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.EthernetContainer12, null, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); } @Test @@ -160,7 +160,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(null); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.EthernetContainer12, null, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); } @Test @@ -180,7 +180,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMContainer, null, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, resultList); } @@ -199,7 +199,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwHybridMwStructurePac.class, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwHybridMwStructurePac.class, uid, resultList); } @@ -218,7 +218,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwAirInterfaceDiversityPac.class, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwAirInterfaceDiversityPac.class, uid, resultList); } @@ -237,7 +237,7 @@ public class TestWrapperMicrowaveModelRev180907 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwPureEthernetStructurePac.class, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwPureEthernetStructurePac.class, uid, resultList); } @@ -245,7 +245,7 @@ public class TestWrapperMicrowaveModelRev180907 { public void testNullStructureWithProblems() throws Exception { WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, null, uid, resultList); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, resultList); } @@ -285,6 +285,6 @@ public class TestWrapperMicrowaveModelRev180907 { Lp lp = new LpBuilder().setUuid(uid).build();; WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAirInterface, lp); + wrapperMicrowaveModelRev180907.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAIRINTERFACE, lp); } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java index 074948ba1..32d9849d8 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java @@ -138,7 +138,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAirInterface, null, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); } @Test @@ -147,7 +147,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(null); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAirInterface, null, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); } @Test @@ -156,7 +156,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.EthernetContainer12, null, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); } @Test @@ -165,7 +165,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(null); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.EthernetContainer12, null, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); } @Test @@ -185,7 +185,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMContainer, null, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, resultList); } @@ -204,7 +204,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwHybridMwStructurePac.class, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwHybridMwStructurePac.class, uid, resultList); } @@ -223,7 +223,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwAirInterfaceDiversityPac.class, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwAirInterfaceDiversityPac.class, uid, resultList); } @@ -242,7 +242,7 @@ public class TestWrapperMicrowaveModelRev181010 { LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, MwPureEthernetStructurePac.class, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwPureEthernetStructurePac.class, uid, resultList); } @@ -250,7 +250,7 @@ public class TestWrapperMicrowaveModelRev181010 { public void testNullStructureWithProblems() throws Exception { WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.Structure, null, uid, resultList); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, resultList); } @@ -290,6 +290,6 @@ public class TestWrapperMicrowaveModelRev181010 { Lp lp = new LpBuilder().setUuid(uid).build(); WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAirInterface, lp); + wrapperMicrowaveModelRev181010.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAIRINTERFACE, lp); } } diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java index ff15f7991..0a458d805 100644 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java @@ -46,16 +46,14 @@ public class TestDevMgrPropertiesFile { private static final Logger LOG = LoggerFactory.getLogger(ArchiveCleanService.class); - private static final File FILENAME = new File("test.properties"); - private static final File AAIPROP_FILE=new File("aaiclient.properties"); + private static final File FILENAME = new File("testdevmgrpropertiesfile.properties"); + private static final File AAIPROP_FILE=new File("testdevmgrpropertiesfileaaiclient.properties"); private int hasChanged; @Before public void init() { - //if (! LOG.isDebugEnabled()) { - delete(FILENAME); - delete(AAIPROP_FILE); - //} + delete(FILENAME); + delete(AAIPROP_FILE); } @After public void deinit() { @@ -63,14 +61,13 @@ public class TestDevMgrPropertiesFile { } @Test - public void test1() { + public void testBasicConfiguration() { writeFile(FILENAME, this.getContent1()); writeFile(AAIPROP_FILE, this.getAaiPropertiesConfig()); - System.out.println("Read and verify"); - ConfigurationFileRepresentation cfg = new ConfigurationFileRepresentation(FILENAME.getPath()); - ConfigurationFileRepresentation cfg2 = cfg; + LOG.info("Read and verify"); + ConfigurationFileRepresentation cfg2 = new ConfigurationFileRepresentation(FILENAME.getPath()); AaiConfig aaiConfig = new AaiConfig(cfg2); assertNotNull(aaiConfig); @@ -81,34 +78,24 @@ public class TestDevMgrPropertiesFile { ToggleAlarmConfig toggleAlarmConfig = new ToggleAlarmConfig(cfg2); assertNotNull(toggleAlarmConfig); - System.out.println("Verify\n"+aaiConfig+"\n"); - @SuppressWarnings("unused") - boolean res; - /* - res = cfg.getAai().equals(AaiConfig.getDefaultConfiguration()); - res = cfg.getDcae().equals(DcaeConfig.getDefaultConfiguration()); - res = cfg.getPm().equals(PmConfig.getDefaultConfiguration()); - res = cfg.getEs().equals(EsConfig.getDefaultConfiguration()); - res = cfg.getToggleAlarm().equals(ToggleAlarmConfig.getDefaultConfiguration()); - - res = cfg.getAai().hashCode() == AaiConfig.getDefaultConfiguration().hashCode(); - res = cfg.getDcae().hashCode() == DcaeConfig.getDefaultConfiguration().hashCode(); - res = cfg.getPm().hashCode() == PmConfig.getDefaultConfiguration().hashCode(); - res = cfg.getEs().hashCode() == EsConfig.getDefaultConfiguration().hashCode(); - res = cfg.getToggleAlarm().hashCode() == ToggleAlarmConfig.getDefaultConfiguration().hashCode(); - */ + LOG.info("Verify {} ", aaiConfig); } //-- Observer not working with all testcases, because config does not support different file types. @Test - public void test2() { + public void testChangeConfiguration() { + + LOG.info("Read and verify"); - hasChanged=0; writeFile(FILENAME, this.getContent1()); writeFile(AAIPROP_FILE, this.getAaiPropertiesConfig()); - System.out.println("Read and verify"); ConfigurationFileRepresentation cfg2 = new ConfigurationFileRepresentation(FILENAME.getPath()); + hasChanged = 0; + cfg2.registerConfigChangedListener(() -> { + hasChanged++; + LOG.info("file changed listener triggered: {}",hasChanged); + }); AaiConfig aaiConfig = new AaiConfig(cfg2); assertNotNull(aaiConfig); @@ -119,25 +106,18 @@ public class TestDevMgrPropertiesFile { ToggleAlarmConfig toggleAlarmConfig = new ToggleAlarmConfig(cfg2); assertNotNull(toggleAlarmConfig); - cfg2.registerConfigChangedListener(() -> { - hasChanged++; - System.out.println("file changed listener triggered: "+hasChanged); - }); - - sleep(1000); - System.out.println("Write new content. Changes "+hasChanged); + LOG.info("Write new content. Changes {}",hasChanged); writeFile(FILENAME, this.getContent2()); - sleep(1000); int i=10; while(hasChanged == 0 && i-- > 0) { - System.out.println("Wait for Change indication."); + LOG.info("Wait for Change indication."); sleep(1000); } - System.out.println("Changes "+hasChanged); + LOG.info("Changes {}",hasChanged); - assertTrue("fileChanged counter"+hasChanged, hasChanged > 0); - System.out.println("Test done"); + assertTrue("fileChanged counter "+hasChanged, hasChanged > 0); + LOG.info("Test done"); } |