diff options
author | KAPIL SINGAL <ks220y@att.com> | 2020-07-10 17:22:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-07-10 17:22:20 +0000 |
commit | 1e98209f55b36e6601095172f7f92f291c3ac0ee (patch) | |
tree | a9cafba6655c01a838a8ea2b866f328291862cd4 | |
parent | ac230fbc678587f50afb84f04a1f5b55794e14e4 (diff) | |
parent | c845f3a65190c74815818cf78fde9f59cb7cba80 (diff) |
Merge "Reformat sdnr devicemanager-onf to ONAP code style"
33 files changed, 1837 insertions, 1634 deletions
diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/NetworkElementCoreData.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/NetworkElementCoreData.java index 0537ec828..c349ad3ba 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/NetworkElementCoreData.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/NetworkElementCoreData.java @@ -25,8 +25,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro public interface NetworkElementCoreData { public String getMountpoint(); + public DataBroker getDataBroker(); + public Optional<NetworkElement> getOptionalNetworkElement(); + public NetworkElementDeviceType getDeviceType(); } diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ONFCoreNetworkElementRepresentation.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ONFCoreNetworkElementRepresentation.java index 4122a7190..a460853c6 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ONFCoreNetworkElementRepresentation.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ONFCoreNetworkElementRepresentation.java @@ -27,9 +27,8 @@ public interface ONFCoreNetworkElementRepresentation extends DeviceMonitoredNe, PerformanceDataProvider, NetworkElementCoreData, InventoryProvider, NetworkElement { /** - * Read during startup all relevant structure and status parameters from device. - * Remove all currentAlarms, read structure from networkElement with all - * interfacePacs, read current alarm status + * Read during startup all relevant structure and status parameters from device. Remove all currentAlarms, read + * structure from networkElement with all interfacePacs, read current alarm status */ public void initialReadFromNetworkElement(); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/OnfInterfacePac.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/OnfInterfacePac.java index 4d9c8b14d..7b0409a1f 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/OnfInterfacePac.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/OnfInterfacePac.java @@ -24,14 +24,13 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170 public interface OnfInterfacePac { /** - * Read problems of specific interfaces. TODO Goal for future implementation - * without usage of explicit new. Key is generated by newInstance() function - * here to verify this approach. + * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is + * generated by newInstance() function here to verify this approach. * * @param interfacePacUuid Universal index of Interfacepac * @param resultList List to add fault. If null new list is created. * @return list of alarms */ - public FaultData readTheFaults(@NonNull UniversalId interfacePacUuid, @NonNull FaultData resultList); + public FaultData readTheFaults(@NonNull UniversalId interfacePacUuid, @NonNull FaultData resultList); } diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/WrapperPTPModelRev170208.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/WrapperPTPModelRev170208.java index 1d25b4be0..4359401c6 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/WrapperPTPModelRev170208.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/WrapperPTPModelRev170208.java @@ -39,8 +39,8 @@ public class WrapperPTPModelRev170208 { private static final Logger LOG = LoggerFactory.getLogger(WrapperPTPModelRev170208.class); - protected static final InstanceIdentifier<InstanceList> PTPINSTANCES_IID = InstanceIdentifier - .builder(InstanceList.class, new InstanceListKey(1)).build(); + protected static final InstanceIdentifier<InstanceList> PTPINSTANCES_IID = + InstanceIdentifier.builder(InstanceList.class, new InstanceListKey(1)).build(); /** * Query synchronization information out of NE 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 56e616e9b..2ca2a9d63 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 @@ -44,6 +44,7 @@ public class ExtendedEquipment { private final Equipment equipment; private final String nodeId; private final String path; + /** * Equipment with additional information beside NETCONF equipment * @@ -71,6 +72,7 @@ public class ExtendedEquipment { public int getTreeLevel() { return treeLevel; } + public String getNodeId() { return nodeId; } 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 aa88d98ad..5641f2873 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 @@ -62,7 +62,8 @@ public class ONFCoreNetworkElement12Equipment { private final @NonNull FaultData globalProblemList; private final @NonNull List<ExtendedEquipment> globalEquipmentList; - public ONFCoreNetworkElement12Equipment(NetconfAccessor acessor, NetworkElementCoreData coreData, Capabilities capabilities) { + public ONFCoreNetworkElement12Equipment(NetconfAccessor acessor, NetworkElementCoreData coreData, + Capabilities capabilities) { LOG.debug("Initialize class: {} " + ONFCoreNetworkElement12Equipment.class.getName()); this.acessor = acessor; this.coreData = coreData; @@ -188,7 +189,8 @@ public class ONFCoreNetworkElement12Equipment { Equipment equipment = this.readEquipment(uuid); if (equipment != null) { - equipmentList.add(new ExtendedEquipment(this.getMountpoint(),parentUuid.getValue(), equipment, path, treeLevel)); + equipmentList.add( + new ExtendedEquipment(this.getMountpoint(), parentUuid.getValue(), equipment, path, treeLevel)); if (this.equipmentPac != null) { this.equipmentPac.readTheFaults(uuid, problemList); @@ -196,8 +198,8 @@ public class ONFCoreNetworkElement12Equipment { List<ContainedHolder> containedHolderListe = equipment.getContainedHolder(); if (containedHolderListe != null) { for (ContainedHolder containedHolder : containedHolderListe) { - recurseReadEquipmentProblems(containedHolder.getOccupyingFru(), uuid, path+"/"+uuid.getValue(), treeLevel + 1, - problemList, equipmentList); + recurseReadEquipmentProblems(containedHolder.getOccupyingFru(), uuid, + path + "/" + uuid.getValue(), treeLevel + 1, problemList, equipmentList); } } } @@ -205,7 +207,8 @@ public class ONFCoreNetworkElement12Equipment { } } - private @NonNull InventoryInformationDcae getInventoryInformationDcae(ValueNameList extensions, List<String> uuids) { + private @NonNull InventoryInformationDcae getInventoryInformationDcae(ValueNameList extensions, + List<String> uuids) { InventoryInformationDcae inventoryInformation = new InventoryInformationDcae(); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ValueNameList.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ValueNameList.java index 1deb4fa1e..b79d0aa2b 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ValueNameList.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ValueNameList.java @@ -25,8 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension; /** - * ValueNameList is an access Wrapper to NETCONF Extension lists - * Class is a specialized HashMap. + * ValueNameList is an access Wrapper to NETCONF Extension lists Class is a specialized HashMap. */ public class ValueNameList extends HashMap<String, String> { @@ -34,6 +33,7 @@ public class ValueNameList extends HashMap<String, String> { /** * Create ValueNameList for NETCONF extensions + * * @param extensionList Parameters as received from device. Could be null. */ public void put(@Nullable List<Extension> extensionList) { @@ -54,6 +54,7 @@ public class ValueNameList extends HashMap<String, String> { /** * Return value or null + * * @param name key for element * @return value if key exists; if not nul */ @@ -63,11 +64,12 @@ public class ValueNameList extends HashMap<String, String> { /** * Get element as id list + * * @param name key of element * @param topLevelEqUuidList as input to add elements * @return List<UniversalId> */ - public @NonNull List<UniversalId> getAsUniversalIdList(String name, List<UniversalId> topLevelEqUuidList) { + public @NonNull List<UniversalId> getAsUniversalIdList(String name, List<UniversalId> topLevelEqUuidList) { if (containsKey(name)) { String[] result = get(name).split(",\\s*"); if (result.length > 0) { 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 28042668c..840d8bf12 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 @@ -54,8 +54,8 @@ public class WrapperEquipmentPacRev170402 implements OnfInterfacePac { } /** - * Read problems of specific interfaces. TODO Goal for future implementation without usage of - * explicit new. Key is generated by newInstance() function here to verify this approach. + * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is + * generated by newInstance() function here to verify this approach. * * @param interfacePacUuid Universal index of onf interface-pac * @param resultList list to add, or null for new list. @@ -67,7 +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; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), acessor.getNodeId(), interfacePacUuid.getValue()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java index 79e95cc59..406884475 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java @@ -39,16 +39,18 @@ public interface OnfMicrowaveModel { // -- Frankfurt below - /** Get performancedata from LTP - * - * @param lpName filter for layerprotocol - * @param lp to get pm from - * @return the pm data object - */ - @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp); - - /** Set notificationqueue worker for specific notification that needs to be forwarded **/ - void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue); + /** + * Get performancedata from LTP + * + * @param lpName filter for layerprotocol + * @param lp to get pm from + * @return the pm data object + */ + @NonNull + PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp); + + /** Set notificationqueue worker for specific notification that needs to be forwarded **/ + void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue); } 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 8aad824b0..891aa3d6d 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 @@ -96,7 +96,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw /** * @param acessor to access device */ - public WrapperMicrowaveModelRev170324(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) { + public WrapperMicrowaveModelRev170324(@NonNull NetconfAccessor acessor, + @NonNull DeviceManagerServiceProvider serviceProvider) { this.acessor = acessor; this.genericTransactionUtils = acessor.getTransactionUtils(); this.microwaveModelListener = serviceProvider.getNotificationService(); @@ -111,7 +112,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw @SuppressWarnings("unchecked") @Override public <T extends NotificationListener> T getNotificationListener() { - return (T)this; + return (T) this; } @Override @@ -128,43 +129,44 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw FaultData resultList) { switch (lpName) { - case MWAIRINTERFACE: - readTheFaultsOfMwAirInterfacePac(uuid, resultList); - break; + case MWAIRINTERFACE: + readTheFaultsOfMwAirInterfacePac(uuid, resultList); + break; - case ETHERNETCONTAINER12: - readTheFaultsOfMwEthernetContainerPac(uuid, resultList); - break; + case ETHERNETCONTAINER12: + readTheFaultsOfMwEthernetContainerPac(uuid, resultList); + break; - case TDMCONTAINER: - readTheFaultsOfMwTdmContainerPac(uuid, resultList); - break; + case TDMCONTAINER: + readTheFaultsOfMwTdmContainerPac(uuid, resultList); + break; - case STRUCTURE: - if (lpClass == MwHybridMwStructurePac.class) { - readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); + case STRUCTURE: + if (lpClass == MwHybridMwStructurePac.class) { + readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); - } else if (lpClass == MwAirInterfaceDiversityPac.class) { - readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList); + } else if (lpClass == MwAirInterfaceDiversityPac.class) { + readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList); - } else if (lpClass == MwPureEthernetStructurePac.class) { - readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList); + } else if (lpClass == MwPureEthernetStructurePac.class) { + readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList); - } else { - LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); - } - break; - case ETHERNET: - // No alarms supported - break; - case ETHERNETCONTAINER10: - default: - LOG.warn("Unassigned or not expected lp in model {}", lpName); + } else { + LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); + } + break; + case ETHERNET: + // No alarms supported + break; + case ETHERNETCONTAINER10: + default: + LOG.warn("Unassigned or not expected lp in model {}", lpName); } } @Override - public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { + public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, + @NonNull Lp lp) { PerformanceDataLtp res = new PerformanceDataLtp(); readAirInterfacePerformanceData(lp, res); readEthernetContainerPerformanceData(lp, res); @@ -202,7 +204,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } @Override - public void onObjectDeletionNotification( ObjectDeletionNotification notification) { + public void onObjectDeletionNotification(ObjectDeletionNotification notification) { LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName()); if (notification != null) { microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(), @@ -228,9 +230,9 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); - faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), - notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), - notification.getProblem(), mapSeverity(notification.getSeverity())); + faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), + Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(), + mapSeverity(notification.getSeverity())); } /*----------------------------------------------------------------------------- @@ -246,15 +248,15 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); // Step 2.2: construct data and the relative iid - InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid)) - .child(AirInterfaceCurrentProblems.class).build(); + InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid)) + .child(AirInterfaceCurrentProblems.class).build(); // Step 2.3: read to the config data store AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(), @@ -265,7 +267,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } else { for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -281,7 +284,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -297,7 +300,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } else { for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -309,12 +313,11 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -329,7 +332,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } else { for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -341,12 +345,11 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -361,7 +364,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } else { for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -377,7 +381,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -392,16 +396,16 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } else { for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; } /** - * Read problems of specific interfaces. TODO Goal for future implementation - * without usage of explicit new. Key is generated by newInstance() function - * here to verify this approach. + * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is + * generated by newInstance() function here to verify this approach. * * @param uuId Universal index of Interfacepac * @return number of alarms @@ -417,7 +421,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; - + String mountpointId = acessor.getNodeId().getValue(); LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -437,7 +441,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw // -- Specific part 3 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException @@ -447,8 +452,9 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw return resultList; } - /** + /** * Read and add performance data + * * @param lp to read from * @param result Object to be filled with data * @return result @@ -459,9 +465,9 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw // ---- 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(); + InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) + .child(AirInterfaceConfiguration.class).build(); AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID); @@ -470,9 +476,9 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } else { // Step 2.2: construct data and the relative iid - InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) - .child(AirInterfaceHistoricalPerformances.class).build(); + 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( @@ -483,13 +489,14 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw 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(); + 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()) { - result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord, airConfiguration)); + result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord, + airConfiguration)); } } } @@ -518,8 +525,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw if (ethContainerHistoricalPerformanceData == null) { LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId); } else { - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData - .nonnullHistoricalPerformanceDataList(); + 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) { result.add(new PerformanceDataAirInterface170324Builder(acessor.getNodeId(), lp, pmRecord)); @@ -529,11 +536,14 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw return result; } - private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) { + 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 = - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.forName(severity.name()); - return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType + .forName(severity.name()); + 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 0f200e91c..10abc8e7a 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 @@ -97,10 +97,12 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw /** * Handle specific version of microwave model + * * @param acessor to access device * @param serviceProvider for devicemanager services */ - public WrapperMicrowaveModelRev180907(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) { + public WrapperMicrowaveModelRev180907(@NonNull NetconfAccessor acessor, + @NonNull DeviceManagerServiceProvider serviceProvider) { this.acessor = acessor; this.mountpointId = acessor.getNodeId().getValue(); this.genericTransactionUtil = acessor.getTransactionUtils(); @@ -133,61 +135,63 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw FaultData resultList) { switch (lpName) { - case MWAIRINTERFACE: - readTheFaultsOfMwAirInterfacePac(uuid, resultList); - break; + case MWAIRINTERFACE: + readTheFaultsOfMwAirInterfacePac(uuid, resultList); + break; - case ETHERNETCONTAINER12: - readTheFaultsOfMwEthernetContainerPac(uuid, resultList); - break; + case ETHERNETCONTAINER12: + readTheFaultsOfMwEthernetContainerPac(uuid, resultList); + break; - case TDMCONTAINER: - readTheFaultsOfMwTdmContainerPac(uuid, resultList); - break; + case TDMCONTAINER: + readTheFaultsOfMwTdmContainerPac(uuid, resultList); + break; - case STRUCTURE: - if (lpClass == MwHybridMwStructurePac.class) { - readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); + case STRUCTURE: + if (lpClass == MwHybridMwStructurePac.class) { + readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); - } else if (lpClass == MwAirInterfaceDiversityPac.class) { - readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList); + } else if (lpClass == MwAirInterfaceDiversityPac.class) { + readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList); - } else if (lpClass == MwPureEthernetStructurePac.class) { - readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList); + } else if (lpClass == MwPureEthernetStructurePac.class) { + readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList); - } else { - LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); - } - break; - case ETHERNET: - // No alarms supported - break; - case ETHERNETCONTAINER10: - default: - LOG.warn("Unassigned or not expected lp in model {}", lpName); + } else { + LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); + } + break; + case ETHERNET: + // No alarms supported + break; + case ETHERNETCONTAINER10: + default: + LOG.warn("Unassigned or not expected lp in model {}", lpName); } } @Override - public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { + public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, + @NonNull Lp lp) { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { - case MWAIRINTERFACE: - readAirInterfacePerformanceData(lp, res); - break; - - case ETHERNETCONTAINER12: - readEthernetContainerPerformanceData(lp, res); - break; - - 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; + case MWAIRINTERFACE: + readAirInterfacePerformanceData(lp, res); + break; + + case ETHERNETCONTAINER12: + readEthernetContainerPerformanceData(lp, res); + break; + + 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; } @@ -222,7 +226,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } @Override - public void onObjectDeletionNotification( ObjectDeletionNotification notification) { + public void onObjectDeletionNotification(ObjectDeletionNotification notification) { LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName()); if (notification != null) { microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(), @@ -248,9 +252,9 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); - faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), - notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), - notification.getProblem(), mapSeverity(notification.getSeverity())); + faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), + Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(), + mapSeverity(notification.getSeverity())); } /*----------------------------------------------------------------------------- @@ -263,18 +267,17 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @param uuId Universal Id String of the interface * @return number of alarms */ - private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); // Step 2.2: construct data and the relative iid - InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid)) - .child(AirInterfaceCurrentProblems.class).build(); + InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid)) + .child(AirInterfaceCurrentProblems.class).build(); // Step 2.3: read to the config data store AirInterfaceCurrentProblems problems = genericTransactionUtil.readData(acessor.getDataBroker(), @@ -285,7 +288,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } else { for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -297,11 +301,10 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -316,7 +319,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } else { for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -328,12 +332,11 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -347,7 +350,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } else { for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -359,12 +363,11 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -378,7 +381,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } else { for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -390,12 +394,11 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -409,16 +412,16 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } else { for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; } /** - * Read problems of specific interfaces. TODO Goal for future implementation - * without usage of explicit new. Key is generated by newInstance() function - * here to verify this approach. + * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is + * generated by newInstance() function here to verify this approach. * * @param uuId Universal index of Interfacepac * @return number of alarms @@ -429,13 +432,12 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @throws IllegalAccessException * @throws InstantiationException */ - private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -454,7 +456,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw // -- Specific part 3 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException @@ -466,6 +469,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw /** * Read and add performance data + * * @param lp to read from * @param result Object to be filled with data * @return result @@ -476,9 +480,9 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw // ---- 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(); + InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) + .child(AirInterfaceConfiguration.class).build(); AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID); @@ -487,9 +491,9 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } else { // Step 2.2: construct data and the relative iid - InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) - .child(AirInterfaceHistoricalPerformances.class).build(); + 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 = acessor.getTransactionUtils().readData( @@ -500,13 +504,14 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw 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.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData - .nonnullHistoricalPerformanceDataList(); + 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 : airHistoricalPerformanceData .nonnullHistoricalPerformanceDataList()) { - result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord, airConfiguration)); + result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord, + airConfiguration)); } } } @@ -532,8 +537,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw if (ethContainerHistoricalPerformanceData == null) { LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId); } else { - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData - .nonnullHistoricalPerformanceDataList(); + 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) { result.add(new PerformanceDataAirInterface180907Builder(acessor.getNodeId(), lp, pmRecord)); @@ -543,11 +548,14 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw return result; } - private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) { + 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 = - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.forName(severity.name()); - return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType + .forName(severity.name()); + 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/WrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java index 2531baaac..f0f5bf117 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 @@ -96,10 +96,12 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw /** * Handle specific version of microwave model + * * @param acessor to access device * @param serviceProvider for devicemanager services */ - public WrapperMicrowaveModelRev181010(@NonNull NetconfAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) { + public WrapperMicrowaveModelRev181010(@NonNull NetconfAccessor acessor, + @NonNull DeviceManagerServiceProvider serviceProvider) { this.acessor = acessor; this.genericTransactionUtils = acessor.getTransactionUtils(); this.mountpointId = acessor.getNodeId().getValue(); @@ -132,58 +134,60 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw FaultData resultList) { switch (lpName) { - case MWAIRINTERFACE: - readTheFaultsOfMwAirInterfacePac(uuid, resultList); - break; + case MWAIRINTERFACE: + readTheFaultsOfMwAirInterfacePac(uuid, resultList); + break; - case ETHERNETCONTAINER12: - readTheFaultsOfMwEthernetContainerPac(uuid, resultList); - break; + case ETHERNETCONTAINER12: + readTheFaultsOfMwEthernetContainerPac(uuid, resultList); + break; - case TDMCONTAINER: - readTheFaultsOfMwTdmContainerPac(uuid, resultList); - break; + case TDMCONTAINER: + readTheFaultsOfMwTdmContainerPac(uuid, resultList); + break; - case STRUCTURE: - if (lpClass == MwHybridMwStructurePac.class) { - readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); + case STRUCTURE: + if (lpClass == MwHybridMwStructurePac.class) { + readTheFaultsOfMwHybridMwStructurePac(uuid, resultList); - } else if (lpClass == MwAirInterfaceDiversityPac.class) { - readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList); + } else if (lpClass == MwAirInterfaceDiversityPac.class) { + readTheFaultsOfMwAirInterfaceDiversityPac(uuid, resultList); - } else if (lpClass == MwPureEthernetStructurePac.class) { - readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList); + } else if (lpClass == MwPureEthernetStructurePac.class) { + readTheFaultsOfMwPureEthernetStructurePac(uuid, resultList); - } else { - LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); - } - break; - case ETHERNET: - // No alarms supported - break; - case ETHERNETCONTAINER10: - default: - LOG.warn("Unassigned or not expected lp in model {}", lpName); + } else { + LOG.warn("Unassigned lp model {} class {}", lpName, lpClass); + } + break; + case ETHERNET: + // No alarms supported + break; + case ETHERNETCONTAINER10: + default: + LOG.warn("Unassigned or not expected lp in model {}", lpName); } } @Override - public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) { + public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, + @NonNull Lp lp) { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { - case MWAIRINTERFACE: - return readAirInterfacePerformanceData(lp, res); - - case ETHERNETCONTAINER12: - return readEthernetContainerPerformanceData(lp, res); - - 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()); + case MWAIRINTERFACE: + return readAirInterfacePerformanceData(lp, res); + + case ETHERNETCONTAINER12: + return readEthernetContainerPerformanceData(lp, res); + + 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; } @@ -218,7 +222,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } @Override - public void onObjectDeletionNotification( ObjectDeletionNotification notification) { + public void onObjectDeletionNotification(ObjectDeletionNotification notification) { LOG.debug("Got event of type :: {}", ObjectDeletionNotification.class.getSimpleName()); if (notification != null) { microwaveModelListener.deletionNotification(acessor.getNodeId(), notification.getCounter(), @@ -244,9 +248,9 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); - faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), - notification.getTimeStamp(), Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), - notification.getProblem(), mapSeverity(notification.getSeverity())); + faultService.faultNotification(acessor.getNodeId(), notification.getCounter(), notification.getTimeStamp(), + Helper.nnGetUniversalId(notification.getObjectIdRef()).getValue(), notification.getProblem(), + mapSeverity(notification.getSeverity())); } /*----------------------------------------------------------------------------- @@ -259,18 +263,17 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @param uuId Universal Id String of the interface * @return number of alarms */ - private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwAirInterfacePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); // Step 2.2: construct data and the relative iid - InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid)) - .child(AirInterfaceCurrentProblems.class).build(); + InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(interfacePacUuid)) + .child(AirInterfaceCurrentProblems.class).build(); // Step 2.3: read to the config data store AirInterfaceCurrentProblems problems = genericTransactionUtils.readData(acessor.getDataBroker(), @@ -283,7 +286,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else { for (AirInterfaceCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -295,11 +299,10 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwEthernetContainerPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -316,7 +319,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else { for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -328,12 +332,11 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwAirInterfaceDiversityPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -349,7 +352,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else { for (AirInterfaceDiversityCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -361,12 +365,11 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwPureEthernetStructurePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -382,7 +385,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else { for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; @@ -394,12 +398,11 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @param uuId Universal index of Interfacepac * @return number of alarms */ - private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwHybridMwStructurePac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -415,16 +418,16 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else { for (StructureCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } return resultList; } /** - * Read problems of specific interfaces. TODO Goal for future implementation - * without usage of explicit new. Key is generated by newInstance() function - * here to verify this approach. + * Read problems of specific interfaces. TODO Goal for future implementation without usage of explicit new. Key is + * generated by newInstance() function here to verify this approach. * * @param uuId Universal index of Interfacepac * @return number of alarms @@ -435,13 +438,12 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @throws IllegalAccessException * @throws InstantiationException */ - private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, - FaultData resultList) { + private FaultData readTheFaultsOfMwTdmContainerPac(UniversalId interfacePacUuid, FaultData resultList) { final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - + LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); @@ -460,7 +462,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw // -- Specific part 3 for (ContainerCurrentProblemTypeG problem : problems.nonnullCurrentProblemList()) { resultList.add(acessor.getNodeId(), problem.getSequenceNumber(), problem.getTimeStamp(), - interfacePacUuid.getValue(), problem.getProblemName(), mapSeverity(problem.getProblemSeverity())); + interfacePacUuid.getValue(), problem.getProblemName(), + mapSeverity(problem.getProblemSeverity())); } } } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException @@ -476,6 +479,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw /** * Read and add performance data + * * @param lp to read from * @param result Object to be filled with data * @return result @@ -486,9 +490,9 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw // ---- 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(); + InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) + .child(AirInterfaceConfiguration.class).build(); AirInterfaceConfiguration airConfiguration = acessor.getTransactionUtils().readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID); @@ -497,9 +501,9 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else { // Step 2.2: construct data and the relative iid - InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(mwAirInterfacePacuuId)) - .child(AirInterfaceHistoricalPerformances.class).build(); + 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( @@ -510,13 +514,14 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw 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.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = airHistoricalPerformanceData - .nonnullHistoricalPerformanceDataList(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = + airHistoricalPerformanceData.nonnullHistoricalPerformanceDataList(); LOG.debug("DBRead MWAirInterfacePac Id {} Records intermediate: {}", mwAirInterfacePacuuId, airHistPMList.size()); for (AirInterfaceHistoricalPerformanceTypeG pmRecord : airHistoricalPerformanceData .nonnullHistoricalPerformanceDataList()) { - result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord, airConfiguration)); + result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord, + airConfiguration)); } } } @@ -542,8 +547,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw if (ethContainerHistoricalPerformanceData == null) { LOG.debug("DBRead {} Id {} no HistoricalPerformances", myName, ethContainerPacuuId); } else { - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = ethContainerHistoricalPerformanceData - .nonnullHistoricalPerformanceDataList(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = + ethContainerHistoricalPerformanceData.nonnullHistoricalPerformanceDataList(); LOG.debug("DBRead {} Id {} Records intermediate: {}", myName, ethContainerPacuuId, airHistPMList.size()); for (ContainerHistoricalPerformanceTypeG pmRecord : airHistPMList) { result.add(new PerformanceDataAirInterface181010Builder(acessor.getNodeId(), lp, pmRecord)); @@ -553,11 +558,14 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw return result; } - public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType mapSeverity( SeverityType severity) { + public static 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 = - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.forName(severity.name()); - return res.orElse(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType.NonAlarmed); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType + .forName(severity.name()); + 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/pm/PerformanceDataAirInterface170324Builder.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java index 6f9fd63c4..792f62011 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java @@ -34,7 +34,8 @@ public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilde private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType.forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + Optional<GranularityPeriodType> gp = GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); @@ -46,13 +47,14 @@ public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilde /** * Move data to generic type + * * @param nodeId of node * @param lp to get data from - * @param pmRecord data itself + * @param pmRecord data itself * @param airConfiguration configuration for additional parameter */ - public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, AirInterfaceHistoricalPerformanceTypeG pmRecord, - AirInterfaceConfiguration airConfiguration) { + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { this(nodeId, lp, pmRecord); this.setRadioSignalId(airConfiguration.getRadioSignalId()); @@ -106,14 +108,16 @@ public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilde /** * Move data to generic type + * * @param nodeId of node * @param lp to get data from - * @param pmRecord data itself + * @param pmRecord data itself */ - public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) { + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, + ContainerHistoricalPerformanceTypeG pmRecord) { this(nodeId, lp, (OtnHistoryDataG) pmRecord); - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceData pmr = pmRecord - .getPerformanceData(); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceData pmr = + pmRecord.getPerformanceData(); if (pmr != null) { PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); bPerformanceData.setTimePeriod(pmr.getTimePeriod()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java index 022f3f160..7aeddc963 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java @@ -34,7 +34,8 @@ public class PerformanceDataAirInterface180907Builder extends PmdataEntityBuilde private PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType.forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + Optional<GranularityPeriodType> gp = GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); @@ -46,13 +47,14 @@ public class PerformanceDataAirInterface180907Builder extends PmdataEntityBuilde /** * Move data to generic type + * * @param nodeId of node * @param lp to get data from - * @param pmRecord data itself + * @param pmRecord data itself * @param airConfiguration configuration for additional parameter */ - public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, AirInterfaceHistoricalPerformanceTypeG pmRecord, - AirInterfaceConfiguration airConfiguration) { + public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { this(nodeId, lp, pmRecord); this.setRadioSignalId(airConfiguration.getRadioSignalId()); @@ -106,14 +108,16 @@ public class PerformanceDataAirInterface180907Builder extends PmdataEntityBuilde /** * Move data to generic type + * * @param nodeId of node * @param lp to get data from - * @param pmRecord data itself + * @param pmRecord data itself */ - public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) { + public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, + ContainerHistoricalPerformanceTypeG pmRecord) { this(nodeId, lp, (OtnHistoryDataG) pmRecord); - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceData pmr = pmRecord - .getPerformanceData(); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceData pmr = + pmRecord.getPerformanceData(); if (pmr != null) { PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); bPerformanceData.setTimePeriod(pmr.getTimePeriod()); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java index 83e3e72fd..68fdb1812 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java @@ -34,7 +34,8 @@ public class PerformanceDataAirInterface181010Builder extends PmdataEntityBuilde private PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType.forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + Optional<GranularityPeriodType> gp = GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); @@ -46,13 +47,14 @@ public class PerformanceDataAirInterface181010Builder extends PmdataEntityBuilde /** * Move data to generic type + * * @param nodeId of node * @param lp to get data from - * @param pmRecord data itself + * @param pmRecord data itself * @param airConfiguration configuration for additional parameter */ - public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, AirInterfaceHistoricalPerformanceTypeG pmRecord, - AirInterfaceConfiguration airConfiguration) { + public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { this(nodeId, lp, pmRecord); this.setRadioSignalId(airConfiguration.getRadioSignalId()); @@ -106,14 +108,16 @@ public class PerformanceDataAirInterface181010Builder extends PmdataEntityBuilde /** * Move data to generic type + * * @param nodeId of node * @param lp to get data from - * @param pmRecord data itself + * @param pmRecord data itself */ - public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) { + public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, + ContainerHistoricalPerformanceTypeG pmRecord) { this(nodeId, lp, (OtnHistoryDataG) pmRecord); - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceData pmr = pmRecord - .getPerformanceData(); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceData pmr = + pmRecord.getPerformanceData(); if (pmr != null) { PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); bPerformanceData.setTimePeriod(pmr.getTimePeriod()); 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 index 3d7ff88c7..b4900b599 100644 --- 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 @@ -23,7 +23,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkEleme import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DeviceManagerOnfImpl implements AutoCloseable { +public class DeviceManagerOnfImpl implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerOnfImpl.class); private static final String APPLICATIONNAME = "DeviceManagerOnf"; @@ -49,8 +49,10 @@ public class DeviceManagerOnfImpl implements AutoCloseable { LOG.info("Session Initiated start {}", APPLICATIONNAME); - configuration = new DeviceManagerOnfConfiguration(netconfNetworkElementService.getServiceProvider().getConfigurationFileRepresentation()); - resOnf = netconfNetworkElementService.registerNetworkElementFactory(new ONFCoreNetworkElementFactory(configuration)); + configuration = new DeviceManagerOnfConfiguration( + netconfNetworkElementService.getServiceProvider().getConfigurationFileRepresentation()); + resOnf = netconfNetworkElementService + .registerNetworkElementFactory(new ONFCoreNetworkElementFactory(configuration)); netconfNetworkElementService.writeToEventLog(APPLICATIONNAME, "startup", "done"); diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java index 3d2e04e87..bcfc3e0e4 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/ONFCoreNetworkElementFactory.java @@ -34,9 +34,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Create a Network Element representation according to the capability - * information. The capabilities are more than an ODL-QName. After the ? other - * terms than "revision" are provided. + * Create a Network Element representation according to the capability information. The capabilities are more than an + * ODL-QName. After the ? other terms than "revision" are provided. * */ public class ONFCoreNetworkElementFactory implements NetworkElementFactory { @@ -70,7 +69,8 @@ public class ONFCoreNetworkElementFactory implements NetworkElementFactory { } if (onfMicrowaveModel != null) { - return Optional.of(new ONFCoreNetworkElement12Microwave(acessor, serviceProvider, configuration, onfMicrowaveModel)); + return Optional.of(new ONFCoreNetworkElement12Microwave(acessor, serviceProvider, configuration, + onfMicrowaveModel)); } else { return Optional.of(new ONFCoreNetworkElement12Basic(acessor, serviceProvider, configuration)); } 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 0b405d002..698a39ab6 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,378 +57,379 @@ 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<>(); - - 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(); - } + 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 86d28fe4e..05402f895 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 @@ -33,13 +33,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Get information over NETCONF device according to ONF Coremodel. Read networkelement and - * conditional packages. + * Get information over NETCONF device according to ONF Coremodel. Read networkelement and conditional packages. * - * Get conditional packages from Networkelement Possible interfaces are: MWPS, LTP(MWPS-TTP), - * MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface ETH-CTP,LTP(Client), - * MW_EthernetContainer_Pac MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac, - * MicrowaveModel-ObjectClasses-AirInterfaceDiversity MWS, LTP(MWS-TTP), + * Get conditional packages from Networkelement Possible interfaces are: MWPS, LTP(MWPS-TTP), MWAirInterfacePac, + * MicrowaveModel-ObjectClasses-AirInterface ETH-CTP,LTP(Client), MW_EthernetContainer_Pac MWS, LTP(MWS-CTP-xD), + * MWAirInterfaceDiversityPac, MicrowaveModel-ObjectClasses-AirInterfaceDiversity MWS, LTP(MWS-TTP), * ,MicrowaveModel-ObjectClasses-HybridMwStructure MWS, LTP(MWS-TTP), * ,MicrowaveModel-ObjectClasses-PureEthernetStructure * @@ -71,6 +69,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { /** * Basic element for netconf device with ONF Core model V1.2 + * * @param acessor to manage device connection * @param serviceProvider to get devicemanager services */ @@ -189,7 +188,8 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { //eventListenerHandler.registration(mountPointNodeName, acessor.getNetconfNode()); //LOG.debug("refresh necon entry for {} with type {} not",mountPointNodeName,this.getDeviceType()); //eventListenerHandler.connectIndication(mountPointNodeName, getDeviceType()); - LOG.info("Starting Event listener finished. Added Netconf device:{} type:{}", mountPointNodeName, getDeviceType()); + LOG.info("Starting Event listener finished. Added Netconf device:{} type:{}", mountPointNodeName, + getDeviceType()); } diff --git a/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java index ebdb8ccf1..a8384ea61 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 @@ -47,13 +47,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Get information over NETCONF device according to ONF Coremodel. Read networkelement and - * conditional packages. + * Get information over NETCONF device according to ONF Coremodel. Read networkelement and conditional packages. * - * Get conditional packages from Networkelement Possible interfaces are: MWPS, LTP(MWPS-TTP), - * MWAirInterfacePac, MicrowaveModel-ObjectClasses-AirInterface ETH-CTP,LTP(Client), - * MW_EthernetContainer_Pac MWS, LTP(MWS-CTP-xD), MWAirInterfaceDiversityPac, - * MicrowaveModel-ObjectClasses-AirInterfaceDiversity MWS, LTP(MWS-TTP), + * Get conditional packages from Networkelement Possible interfaces are: MWPS, LTP(MWPS-TTP), MWAirInterfacePac, + * MicrowaveModel-ObjectClasses-AirInterface ETH-CTP,LTP(Client), MW_EthernetContainer_Pac MWS, LTP(MWS-CTP-xD), + * MWAirInterfaceDiversityPac, MicrowaveModel-ObjectClasses-AirInterfaceDiversity MWS, LTP(MWS-TTP), * ,MicrowaveModel-ObjectClasses-HybridMwStructure MWS, LTP(MWS-TTP), * ,MicrowaveModel-ObjectClasses-PureEthernetStructure * @@ -78,16 +76,16 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas /** * Constructor + * * @param acessor for device * @param serviceProvider to get services * @param onfMicrowaveModel handling ofmicrosoft model data */ - public ONFCoreNetworkElement12Microwave(@NonNull NetconfAccessor acessor, - @NonNull DeviceManagerServiceProvider serviceProvider, - DeviceManagerOnfConfiguration configuration, - OnfMicrowaveModel onfMicrowaveModel) { + public ONFCoreNetworkElement12Microwave(@NonNull NetconfAccessor acessor, + @NonNull DeviceManagerServiceProvider serviceProvider, DeviceManagerOnfConfiguration configuration, + OnfMicrowaveModel onfMicrowaveModel) { - super(acessor, serviceProvider,configuration); + super(acessor, serviceProvider, configuration); this.microwaveModel = onfMicrowaveModel; this.microwaveEventListener = serviceProvider.getFaultService(); @@ -103,12 +101,12 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas */ /** - * @param acessor - * @param serviceProvider - * @param configuration - * @param onfMicrowaveModel - */ - /** + * @param acessor + * @param serviceProvider + * @param configuration + * @param onfMicrowaveModel + */ + /** * DeviceMonitor Prepare check by updating NE state and reading all interfaces. */ @Override @@ -144,8 +142,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas * * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model"> * <attribute-name>/equipment-pac/equipment-current-problems</attribute-name> - * <object-id-ref>CARD-1.1.1.0</object-id-ref> <new-value></new-value> - * </attribute-value-changed-notification> + * <object-id-ref>CARD-1.1.1.0</object-id-ref> <new-value></new-value> </attribute-value-changed-notification> * <attribute-value-changed-notification xmlns="urn:onf:params:xml:ns:yang:microwave-model"> * <attribute-name>/network-element/extension[value-name="top-level-equipment"]/value</attribute-name> * <object-id-ref>Hybrid-Z</object-id-ref> @@ -251,7 +248,8 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas // Step 2.3: read the existing faults and add to DB FaultData resultList = new FaultData(); int idxStart; // Start index for debug messages - @NonNull UniversalId uuid; + @NonNull + UniversalId uuid; synchronized (getPmLock()) { for (Lp lp : getInterfaceList()) { @@ -380,7 +378,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas // notificationService.registerNotificationListener(microwaveEventListener); listenerRegistrationresult = notificationService.registerNotificationListener(microwaveModel.getNotificationListener()); - LOG.info("End registration listener for Mountpoint Result: {}",listenerRegistrationresult); + LOG.info("End registration listener for Mountpoint Result: {}", listenerRegistrationresult); } /*------------------------------------------------------------ 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 1b03f8acb..40a6d323b 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 @@ -77,14 +77,14 @@ public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCor public String getMountPointNodeName() { return mountPointNodeName; } - + /** * @return the netconfNodeDataBroker */ public DataBroker getNetconfNodeDataBroker() { return netconfNodeDataBroker; } - + @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 ed6497c0f..e46383599 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 @@ -24,8 +24,8 @@ import java.util.concurrent.LinkedBlockingQueue; /** * Provide a thread that is receiving and process notifications. - * @param <T> represents the object that is provided with a notification and - * forwarded to the NotificationActor<T>. + * + * @param <T> represents the object that is provided with a notification and forwarded to the NotificationActor<T>. */ public class NotificationWorker<T> implements AutoCloseable { @@ -39,7 +39,7 @@ public class NotificationWorker<T> implements AutoCloseable { service = Executors.newFixedThreadPool(numWorkers); actor = actorObject; - for (int i=0; i < numWorkers; i++) { + for (int i = 0; i < numWorkers; i++) { service.submit(new Worker<>(workQueue, actor)); } } 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 a768da078..f9770d9fa 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,34 +23,36 @@ 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 + 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); private final String myLayerProtocolName; - ONFLayerProtocolName( String myLayerProtocolName ) { + ONFLayerProtocolName(String myLayerProtocolName) { this.myLayerProtocolName = myLayerProtocolName; } - public boolean is( org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName onfName ) { + public boolean is( + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName onfName) { return myLayerProtocolName.equals(onfName.getValue()); } - public static @NonNull ONFLayerProtocolName valueOf( org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName onfName ) { + public static @NonNull ONFLayerProtocolName valueOf( + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName onfName) { for (ONFLayerProtocolName protocol : ONFLayerProtocolName.values()) { if (protocol.is(onfName)) { return protocol; } } - LOG.info("Can not map {}. Use Unknown",onfName.getValue() ); + LOG.info("Can not map {}. Use Unknown", onfName.getValue()); return UNKNOWN; } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java index cda0f5366..20d479efa 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestExtendedEquipment.java @@ -44,44 +44,38 @@ import org.slf4j.LoggerFactory; public class TestExtendedEquipment { - UniversalId id = new UniversalId("1234567"); - private static final String NODEID = "NODE1"; - private static final Logger LOG = LoggerFactory.getLogger(TestExtendedEquipment.class); - - @Test - public void test() { - final @NonNull List<ContainedHolder> holder = Arrays.asList(new ContainedHolderBuilder().setUuid(id).build()); - final @NonNull ManufacturerProperties manufacturerProps = new ManufacturerPropertiesBuilder() - .setManufacturerIdentifier("NOK") - .setManufacturerName("Nokia").build(); - - final @NonNull EquipmentType eqptType = new EquipmentTypeBuilder() - .setDescription("5G RAN Equipment") - .setModelIdentifier("NOK-987-1T") - .setPartTypeIdentifier("ABCDEF") - .setTypeName("12345") - .setVersion("5T9V4567") - .build(); - - final @NonNull EquipmentInstance eqptInstance = new EquipmentInstanceBuilder() - .setAssetInstanceIdentifier("NOK1234-ABCD") - .setManufactureDate("2020-02-11") - .setSerialNumber("123456ABCD").build(); - - final @NonNull ManufacturedThing manufacturedThing = new ManufacturedThingBuilder() - .setManufacturerProperties(manufacturerProps) - .setEquipmentType(eqptType) - .setEquipmentInstance(eqptInstance).build(); - - Equipment equipment = new EquipmentBuilder().setUuid(id).setContainedHolder(holder).setManufacturedThing(manufacturedThing).build(); - - ExtendedEquipment extEqpt = new ExtendedEquipment(NODEID, "1234567890", equipment, "/var/opt", 3); - assertEquals(extEqpt.getNodeId(), NODEID); - assertEquals(extEqpt.getParentUuid(), "1234567890"); - assertEquals(extEqpt.getEquipment(), equipment); - LOG.info(extEqpt.toString()); - extEqpt.getCreateInventoryInput(); - - } + UniversalId id = new UniversalId("1234567"); + private static final String NODEID = "NODE1"; + private static final Logger LOG = LoggerFactory.getLogger(TestExtendedEquipment.class); + + @Test + public void test() { + final @NonNull List<ContainedHolder> holder = Arrays.asList(new ContainedHolderBuilder().setUuid(id).build()); + final @NonNull ManufacturerProperties manufacturerProps = new ManufacturerPropertiesBuilder() + .setManufacturerIdentifier("NOK").setManufacturerName("Nokia").build(); + + final @NonNull EquipmentType eqptType = + new EquipmentTypeBuilder().setDescription("5G RAN Equipment").setModelIdentifier("NOK-987-1T") + .setPartTypeIdentifier("ABCDEF").setTypeName("12345").setVersion("5T9V4567").build(); + + final @NonNull EquipmentInstance eqptInstance = + new EquipmentInstanceBuilder().setAssetInstanceIdentifier("NOK1234-ABCD") + .setManufactureDate("2020-02-11").setSerialNumber("123456ABCD").build(); + + final @NonNull ManufacturedThing manufacturedThing = + new ManufacturedThingBuilder().setManufacturerProperties(manufacturerProps).setEquipmentType(eqptType) + .setEquipmentInstance(eqptInstance).build(); + + Equipment equipment = new EquipmentBuilder().setUuid(id).setContainedHolder(holder) + .setManufacturedThing(manufacturedThing).build(); + + ExtendedEquipment extEqpt = new ExtendedEquipment(NODEID, "1234567890", equipment, "/var/opt", 3); + assertEquals(extEqpt.getNodeId(), NODEID); + assertEquals(extEqpt.getParentUuid(), "1234567890"); + assertEquals(extEqpt.getEquipment(), equipment); + LOG.info(extEqpt.toString()); + extEqpt.getCreateInventoryInput(); + + } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java index ff2969eac..403451799 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/test/TestONFCoreNetworkElement12Equipment.java @@ -45,56 +45,59 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class TestONFCoreNetworkElement12Equipment { - NetconfAccessor netconfAccessor; - Capabilities capabilities; - NetworkElementCoreData coreData; - FaultData faultData; - TransactionUtils transactionUtils; - EquipmentCurrentProblems eqptCurrProblems; - DataBroker dataBroker; - UniversalId uid = new UniversalId("ID"); - - - @Before - public void init() throws Exception { - netconfAccessor = mock(NetconfAccessor.class); - capabilities = mock(Capabilities.class); - coreData = mock(NetworkElementCoreData.class); - faultData = mock(FaultData.class); - eqptCurrProblems = mock(EquipmentCurrentProblems.class); - dataBroker = mock(DataBroker.class); - transactionUtils = mock(TransactionUtils.class); - - final Class<EquipmentPac> clazzPac = EquipmentPac.class; + NetconfAccessor netconfAccessor; + Capabilities capabilities; + NetworkElementCoreData coreData; + FaultData faultData; + TransactionUtils transactionUtils; + EquipmentCurrentProblems eqptCurrProblems; + DataBroker dataBroker; + UniversalId uid = new UniversalId("ID"); + + + @Before + public void init() throws Exception { + netconfAccessor = mock(NetconfAccessor.class); + capabilities = mock(Capabilities.class); + coreData = mock(NetworkElementCoreData.class); + faultData = mock(FaultData.class); + eqptCurrProblems = mock(EquipmentCurrentProblems.class); + dataBroker = mock(DataBroker.class); + transactionUtils = mock(TransactionUtils.class); + + final Class<EquipmentPac> clazzPac = EquipmentPac.class; final Class<EquipmentPacKey> clazzPacKey = EquipmentPacKey.class; final Class<EquipmentCurrentProblems> clazzProblems = EquipmentCurrentProblems.class; Constructor<EquipmentPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); - InstanceIdentifier<EquipmentCurrentProblems> interfaceIID = InstanceIdentifier - .builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); - when(netconfAccessor.getCapabilites()).thenReturn(capabilities); - when(netconfAccessor.getTransactionUtils()).thenReturn(transactionUtils); - when(netconfAccessor.getDataBroker()).thenReturn(dataBroker); - when(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, interfaceIID)).thenReturn(eqptCurrProblems); - } - - @Test - public void test() { - when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(true); - ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); - onfCoreEqpt.addProblemsofNode(faultData); - onfCoreEqpt.addProblemsofNodeObject("ABCD"); - onfCoreEqpt.getInventoryInformation(Arrays.asList("TESTINV")); - onfCoreEqpt.getEquipmentAll(); - onfCoreEqpt.getEquipmentData(); - onfCoreEqpt.getEquipmentPac(); - onfCoreEqpt.readNetworkElementEquipment(); - - } - - @Test - public void test1() { - when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(false); - ONFCoreNetworkElement12Equipment onfCoreEqpt = new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); - } + InstanceIdentifier<EquipmentCurrentProblems> interfaceIID = + InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); + when(netconfAccessor.getCapabilites()).thenReturn(capabilities); + when(netconfAccessor.getTransactionUtils()).thenReturn(transactionUtils); + when(netconfAccessor.getDataBroker()).thenReturn(dataBroker); + when(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(), + LogicalDatastoreType.OPERATIONAL, interfaceIID)).thenReturn(eqptCurrProblems); + } + + @Test + public void test() { + when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(true); + ONFCoreNetworkElement12Equipment onfCoreEqpt = + new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); + onfCoreEqpt.addProblemsofNode(faultData); + onfCoreEqpt.addProblemsofNodeObject("ABCD"); + onfCoreEqpt.getInventoryInformation(Arrays.asList("TESTINV")); + onfCoreEqpt.getEquipmentAll(); + onfCoreEqpt.getEquipmentData(); + onfCoreEqpt.getEquipmentPac(); + onfCoreEqpt.readNetworkElementEquipment(); + + } + + @Test + public void test1() { + when(capabilities.isSupportingNamespaceAndRevision(WrapperEquipmentPacRev170402.QNAME)).thenReturn(false); + ONFCoreNetworkElement12Equipment onfCoreEqpt = + new ONFCoreNetworkElement12Equipment(netconfAccessor, coreData, capabilities); + } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java index cae28f4fe..337dc2644 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestHelper.java @@ -27,21 +27,23 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.r public class TestHelper { - @Test - public void test() { - - assertEquals(GranularityPeriodType.Period24Hours, Helper.nnGetGranularityPeriodType(GranularityPeriodType.Period24Hours)); - assertEquals(GranularityPeriodType.Unknown, Helper.nnGetGranularityPeriodType(null)); - - assertEquals(new LayerProtocolName("TDM"), Helper.nnGetLayerProtocolName(LayerProtocolName.getDefaultInstance("TDM"))); - assertEquals(new LayerProtocolName("default"), Helper.nnGetLayerProtocolName(null)); - - assertEquals("TEST", Helper.nnGetString("TEST")); - assertEquals("", Helper.nnGetString(null)); - - assertEquals(new UniversalId("ABC"), Helper.nnGetUniversalId(new UniversalId("ABC"))); - assertEquals(new UniversalId("Default"), Helper.nnGetUniversalId(null)); - - } + @Test + public void test() { + + assertEquals(GranularityPeriodType.Period24Hours, + Helper.nnGetGranularityPeriodType(GranularityPeriodType.Period24Hours)); + assertEquals(GranularityPeriodType.Unknown, Helper.nnGetGranularityPeriodType(null)); + + assertEquals(new LayerProtocolName("TDM"), + Helper.nnGetLayerProtocolName(LayerProtocolName.getDefaultInstance("TDM"))); + assertEquals(new LayerProtocolName("default"), Helper.nnGetLayerProtocolName(null)); + + assertEquals("TEST", Helper.nnGetString("TEST")); + assertEquals("", Helper.nnGetString(null)); + + assertEquals(new UniversalId("ABC"), Helper.nnGetUniversalId(new UniversalId("ABC"))); + assertEquals(new UniversalId("Default"), Helper.nnGetUniversalId(null)); + + } } 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 0140eaa59..96c3c757d 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 @@ -82,212 +82,261 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class TestWrapperMicrowaveModelRev170324 { - NetconfAccessor accessor; - DeviceManagerServiceProvider serviceProvider; - FaultData resultList; - UniversalId uid; - TransactionUtils transactionUtils; - DataBroker dataBroker; - - InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID; - @NonNull AirInterfaceCurrentProblems airInterfaceCurrentProblems; - - InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID; - @NonNull EthernetContainerCurrentProblems ethernetContainerCurrentProblems; - - @Before - public void init() { - accessor = mock(NetconfAccessor.class); - serviceProvider = mock(DeviceManagerServiceProvider.class); - resultList = mock(FaultData.class); - transactionUtils = mock(TransactionUtils.class); - dataBroker = mock(DataBroker.class); - - uid = new UniversalId("ABCD"); - - mwAirInterfaceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceCurrentProblems.class).build(); - List<CurrentProblemList> currentProblemList = Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal").setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build()); - airInterfaceCurrentProblems = new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - - mwEthInterfaceIID = InstanceIdentifier - .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) - .child(EthernetContainerCurrentProblems.class).build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList - = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemListBuilder() - .setProblemName("Link Negotiation Unsuccessful") - .setProblemSeverity(SeverityType.Critical) - .setSequenceNumber(1) - .setTimeStamp(null) - .build()); - ethernetContainerCurrentProblems = new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build(); - - NodeId nNodeId = new NodeId("nSky"); - when(accessor.getNodeId()).thenReturn(nNodeId); - when(accessor.getTransactionUtils()).thenReturn(transactionUtils); - when(accessor.getDataBroker()).thenReturn(dataBroker); - - } - - @Test - public void testMWAirInterfaceWithProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); - } - - @Test - public void testMWAirInterfaceWithoProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(null); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); - } - - @Test - public void testEthernetContainer12WithProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); - } - - @Test - public void testEthernetContainer12WithNoProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(null); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); - } - - @Test - public void testTdmContainer12WithProblems() throws Exception { - final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; - final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; - final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - - Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new() - InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - TdmContainerCurrentProblems tdmInterfaceCurrentProblems = new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, resultList); - - } - - @Test - public void testMwHybridMwStructureWithProblems() throws Exception { - final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; - final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - - InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems = new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwHybridMwStructurePac.class, uid, resultList); - - } - - @Test - public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception { - final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; - final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - - InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems = new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwAirInterfaceDiversityPac.class, uid, resultList); - - } - - @Test - public void testMwPureEthernetStructureWithProblems() throws Exception { - final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; - final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - - InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems = new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwPureEthernetStructurePac.class, uid, resultList); - - } - - @Test - public void testNullStructureWithProblems() throws Exception { - - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, resultList); - - } - - @Test - public void testgetLtpHistoricalPerformanceData() { - InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceConfiguration.class).build(); - - AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().setAirInterfaceName("TESTINTF").build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration); - - InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceHistoricalPerformances.class).build(); - - PerformanceData performanceData = new PerformanceDataBuilder().build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = - Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder().setGranularityPeriod(GranularityPeriodType.Period15Min).setPerformanceData(performanceData).build()); - AirInterfaceHistoricalPerformances airHistoricalPerformanceData = new AirInterfaceHistoricalPerformancesBuilder() - .setHistoricalPerformanceDataList(airHistPMList).build(); - when(accessor.getTransactionUtils().readData( - accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData); - - InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier - .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) - .child(EthernetContainerHistoricalPerformances.class).build(); - - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceData ethPerformanceData = new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceDataBuilder().build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList = - Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder().setGranularityPeriod(GranularityPeriodType.Period24Hours).setPerformanceData(ethPerformanceData).build()); - EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID)) - .thenReturn(ethContainerHistoricalPerformanceData); - - Lp lp = new LpBuilder().setUuid(uid).build(); - WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = new WrapperMicrowaveModelRev170324(accessor, serviceProvider); - - wrapperMicrowaveModelRev170324.getLtpHistoricalPerformanceData(ONFLayerProtocolName.ETHERNET, lp); - } + NetconfAccessor accessor; + DeviceManagerServiceProvider serviceProvider; + FaultData resultList; + UniversalId uid; + TransactionUtils transactionUtils; + DataBroker dataBroker; + + InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID; + @NonNull + AirInterfaceCurrentProblems airInterfaceCurrentProblems; + + InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID; + @NonNull + EthernetContainerCurrentProblems ethernetContainerCurrentProblems; + + @Before + public void init() { + accessor = mock(NetconfAccessor.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + resultList = mock(FaultData.class); + transactionUtils = mock(TransactionUtils.class); + dataBroker = mock(DataBroker.class); + + uid = new UniversalId("ABCD"); + + mwAirInterfaceIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceCurrentProblems.class).build(); + List<CurrentProblemList> currentProblemList = + Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal") + .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build()); + airInterfaceCurrentProblems = + new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + + mwEthInterfaceIID = InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) + .child(EthernetContainerCurrentProblems.class).build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Link Negotiation Unsuccessful") + .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null) + .build()); + ethernetContainerCurrentProblems = + new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build(); + + NodeId nNodeId = new NodeId("nSky"); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getTransactionUtils()).thenReturn(transactionUtils); + when(accessor.getDataBroker()).thenReturn(dataBroker); + + } + + @Test + public void testMWAirInterfaceWithProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, + resultList); + } + + @Test + public void testMWAirInterfaceWithoProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceIID)).thenReturn(null); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, + resultList); + } + + @Test + public void testEthernetContainer12WithProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, + uid, resultList); + } + + @Test + public void testEthernetContainer12WithNoProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(null); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, + uid, resultList); + } + + @Test + public void testTdmContainer12WithProblems() throws Exception { + final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; + final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; + final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; + + Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new() + InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = + InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + TdmContainerCurrentProblems tdmInterfaceCurrentProblems = + new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, + resultList); + + } + + @Test + public void testMwHybridMwStructureWithProblems() throws Exception { + final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; + final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; + + InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = + InstanceIdentifier.builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems = + new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwHybridMwStructurePac.class, uid, resultList); + + } + + @Test + public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception { + final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; + final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; + + InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier + .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems = + new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwAirInterfaceDiversityPac.class, uid, resultList); + + } + + @Test + public void testMwPureEthernetStructureWithProblems() throws Exception { + final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; + final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; + + InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier + .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems = + new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwPureEthernetStructurePac.class, uid, resultList); + + } + + @Test + public void testNullStructureWithProblems() throws Exception { + + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + wrapperMicrowaveModelRev170324.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, + resultList); + + } + + @Test + public void testgetLtpHistoricalPerformanceData() { + InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceConfiguration.class).build(); + + AirInterfaceConfiguration airConfiguration = + new AirInterfaceConfigurationBuilder().setAirInterfaceName("TESTINTF").build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration); + + InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceHistoricalPerformances.class).build(); + + PerformanceData performanceData = new PerformanceDataBuilder().build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder() + .setGranularityPeriod(GranularityPeriodType.Period15Min) + .setPerformanceData(performanceData).build()); + AirInterfaceHistoricalPerformances airHistoricalPerformanceData = + new AirInterfaceHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(airHistPMList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData); + + InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = + InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) + .child(EthernetContainerHistoricalPerformances.class).build(); + + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceData ethPerformanceData = + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceDataBuilder() + .build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder() + .setGranularityPeriod(GranularityPeriodType.Period24Hours) + .setPerformanceData(ethPerformanceData).build()); + EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = + new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList) + .build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + ethContainerIID)).thenReturn(ethContainerHistoricalPerformanceData); + + Lp lp = new LpBuilder().setUuid(uid).build(); + WrapperMicrowaveModelRev170324 wrapperMicrowaveModelRev170324 = + new WrapperMicrowaveModelRev170324(accessor, serviceProvider); + + 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 e4d89f28f..dec443519 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 @@ -82,209 +82,258 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class TestWrapperMicrowaveModelRev180907 { - NetconfAccessor accessor; - DeviceManagerServiceProvider serviceProvider; - FaultData resultList; - UniversalId uid; - TransactionUtils transactionUtils; - - InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID; - @NonNull AirInterfaceCurrentProblems airInterfaceCurrentProblems; - - InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID; - @NonNull EthernetContainerCurrentProblems ethernetContainerCurrentProblems; - - @Before - public void init() { - accessor = mock(NetconfAccessor.class); - serviceProvider = mock(DeviceManagerServiceProvider.class); - resultList = mock(FaultData.class); - transactionUtils = mock(TransactionUtils.class); - - uid = new UniversalId("ABCD"); - - mwAirInterfaceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceCurrentProblems.class).build(); - List<CurrentProblemList> currentProblemList = Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal").setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build()); - airInterfaceCurrentProblems = new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - - mwEthInterfaceIID = InstanceIdentifier - .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) - .child(EthernetContainerCurrentProblems.class).build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList - = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemListBuilder() - .setProblemName("Link Negotiation Unsuccessful") - .setProblemSeverity(SeverityType.Critical) - .setSequenceNumber(1) - .setTimeStamp(null) - .build()); - ethernetContainerCurrentProblems = new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build(); - - NodeId nNodeId = new NodeId("nSky"); - when(accessor.getNodeId()).thenReturn(nNodeId); - when(accessor.getTransactionUtils()).thenReturn(transactionUtils); - - } - - @Test - public void testMWAirInterfaceWithProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); - } - - @Test - public void testMWAirInterfaceWithoProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(null); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); - } - - @Test - public void testEthernetContainer12WithProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); - } - - @Test - public void testEthernetContainer12WithNoProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(null); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); - } - - @Test - public void testTdmContainer12WithProblems() throws Exception { - final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; - final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; - final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - - Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new() - InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - TdmContainerCurrentProblems tdmInterfaceCurrentProblems = new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, resultList); - - } - - @Test - public void testMwHybridMwStructureWithProblems() throws Exception { - final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; - final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - - InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems = new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwHybridMwStructurePac.class, uid, resultList); - - } - - @Test - public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception { - final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; + NetconfAccessor accessor; + DeviceManagerServiceProvider serviceProvider; + FaultData resultList; + UniversalId uid; + TransactionUtils transactionUtils; + + InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID; + @NonNull + AirInterfaceCurrentProblems airInterfaceCurrentProblems; + + InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID; + @NonNull + EthernetContainerCurrentProblems ethernetContainerCurrentProblems; + + @Before + public void init() { + accessor = mock(NetconfAccessor.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + resultList = mock(FaultData.class); + transactionUtils = mock(TransactionUtils.class); + + uid = new UniversalId("ABCD"); + + mwAirInterfaceIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceCurrentProblems.class).build(); + List<CurrentProblemList> currentProblemList = + Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal") + .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build()); + airInterfaceCurrentProblems = + new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + + mwEthInterfaceIID = InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) + .child(EthernetContainerCurrentProblems.class).build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Link Negotiation Unsuccessful") + .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null) + .build()); + ethernetContainerCurrentProblems = + new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build(); + + NodeId nNodeId = new NodeId("nSky"); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getTransactionUtils()).thenReturn(transactionUtils); + + } + + @Test + public void testMWAirInterfaceWithProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, + resultList); + } + + @Test + public void testMWAirInterfaceWithoProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceIID)).thenReturn(null); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, + resultList); + } + + @Test + public void testEthernetContainer12WithProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, + uid, resultList); + } + + @Test + public void testEthernetContainer12WithNoProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(null); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, + uid, resultList); + } + + @Test + public void testTdmContainer12WithProblems() throws Exception { + final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; + final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; + final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; + + Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new() + InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = + InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + TdmContainerCurrentProblems tdmInterfaceCurrentProblems = + new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, + resultList); + + } + + @Test + public void testMwHybridMwStructureWithProblems() throws Exception { + final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; + final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; + + InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = + InstanceIdentifier.builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems = + new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwHybridMwStructurePac.class, uid, resultList); + + } + + @Test + public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception { + final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - + InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems = new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwAirInterfaceDiversityPac.class, uid, resultList); - - } - - @Test - public void testMwPureEthernetStructureWithProblems() throws Exception { - final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems = + new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwAirInterfaceDiversityPac.class, uid, resultList); + + } + + @Test + public void testMwPureEthernetStructureWithProblems() throws Exception { + final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - + InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems = new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwPureEthernetStructurePac.class, uid, resultList); - - } - - @Test - public void testNullStructureWithProblems() throws Exception { - - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, resultList); - - } - - @Test - public void testgetLtpHistoricalPerformanceData() { - InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceConfiguration.class).build(); - - AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().setAirInterfaceName("TESTINTF").build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration); - - InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceHistoricalPerformances.class).build(); - - PerformanceData performanceData = new PerformanceDataBuilder().build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = - Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder().setGranularityPeriod(GranularityPeriodType.Period15Min).setPerformanceData(performanceData).build()); - AirInterfaceHistoricalPerformances airHistoricalPerformanceData = new AirInterfaceHistoricalPerformancesBuilder() - .setHistoricalPerformanceDataList(airHistPMList).build(); - when(accessor.getTransactionUtils().readData( - accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData); - - InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier - .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) - .child(EthernetContainerHistoricalPerformances.class).build(); - - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceData ethPerformanceData = new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceDataBuilder().build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList = - Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder().setGranularityPeriod(GranularityPeriodType.Period24Hours).setPerformanceData(ethPerformanceData).build()); - EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID)) - .thenReturn(ethContainerHistoricalPerformanceData); - - Lp lp = new LpBuilder().setUuid(uid).build();; - WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = new WrapperMicrowaveModelRev180907(accessor, serviceProvider); - - wrapperMicrowaveModelRev180907.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAIRINTERFACE, lp); - } + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems = + new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwPureEthernetStructurePac.class, uid, resultList); + + } + + @Test + public void testNullStructureWithProblems() throws Exception { + + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + wrapperMicrowaveModelRev180907.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, + resultList); + + } + + @Test + public void testgetLtpHistoricalPerformanceData() { + InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceConfiguration.class).build(); + + AirInterfaceConfiguration airConfiguration = + new AirInterfaceConfigurationBuilder().setAirInterfaceName("TESTINTF").build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration); + + InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceHistoricalPerformances.class).build(); + + PerformanceData performanceData = new PerformanceDataBuilder().build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder() + .setGranularityPeriod(GranularityPeriodType.Period15Min) + .setPerformanceData(performanceData).build()); + AirInterfaceHistoricalPerformances airHistoricalPerformanceData = + new AirInterfaceHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(airHistPMList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData); + + InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = + InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) + .child(EthernetContainerHistoricalPerformances.class).build(); + + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceData ethPerformanceData = + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceDataBuilder() + .build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder() + .setGranularityPeriod(GranularityPeriodType.Period24Hours) + .setPerformanceData(ethPerformanceData).build()); + EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = + new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList) + .build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + ethContainerIID)).thenReturn(ethContainerHistoricalPerformanceData); + + Lp lp = new LpBuilder().setUuid(uid).build();; + WrapperMicrowaveModelRev180907 wrapperMicrowaveModelRev180907 = + new WrapperMicrowaveModelRev180907(accessor, serviceProvider); + + 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 eac003dac..94f8e6c19 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 @@ -84,212 +84,260 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @SuppressWarnings("deprecation") public class TestWrapperMicrowaveModelRev181010 { - NetconfAccessor accessor; - DeviceManagerServiceProvider serviceProvider; - FaultData resultList; - UniversalId uid; - TransactionUtils transactionUtils; - DataBroker dataBroker; - - InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID; - @NonNull AirInterfaceCurrentProblems airInterfaceCurrentProblems; - - InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID; - @NonNull EthernetContainerCurrentProblems ethernetContainerCurrentProblems; - - @Before - public void init() { - accessor = mock(NetconfAccessor.class); - serviceProvider = mock(DeviceManagerServiceProvider.class); - resultList = mock(FaultData.class); - transactionUtils = mock(TransactionUtils.class); - dataBroker = mock(DataBroker.class); - - uid = new UniversalId("ABCD"); - - mwAirInterfaceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceCurrentProblems.class).build(); - List<CurrentProblemList> currentProblemList = Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal").setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build()); - airInterfaceCurrentProblems = new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - - mwEthInterfaceIID = InstanceIdentifier - .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) - .child(EthernetContainerCurrentProblems.class).build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList - = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemListBuilder() - .setProblemName("Link Negotiation Unsuccessful") - .setProblemSeverity(SeverityType.Critical) - .setSequenceNumber(1) - .setTimeStamp(null) - .build()); - ethernetContainerCurrentProblems = new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build(); - - NodeId nNodeId = new NodeId("nSky"); - when(accessor.getNodeId()).thenReturn(nNodeId); - when(accessor.getTransactionUtils()).thenReturn(transactionUtils); - when(accessor.getDataBroker()).thenReturn(dataBroker); - - } - - @Test - public void testMWAirInterfaceWithProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); - } - - @Test - public void testMWAirInterfaceWithoProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceIID)).thenReturn(null); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, resultList); - } - - @Test - public void testEthernetContainer12WithProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); - } - - @Test - public void testEthernetContainer12WithNoProblems() { - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(null); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, uid, resultList); - } - - @Test - public void testTdmContainer12WithProblems() throws Exception { - final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; - final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; - final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - - Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new() - InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - TdmContainerCurrentProblems tdmInterfaceCurrentProblems = new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, resultList); - - } - - @Test - public void testMwHybridMwStructureWithProblems() throws Exception { - final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; - final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - - InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems = new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwHybridMwStructurePac.class, uid, resultList); - - } - - @Test - public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception { - final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; - final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - - InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems = new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwAirInterfaceDiversityPac.class, uid, resultList); - - } - - @Test - public void testMwPureEthernetStructureWithProblems() throws Exception { - final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; - final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - - InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier - .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build(); - - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemList> - currentProblemList = Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder().setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major).setSequenceNumber(2).setTimeStamp(null).build()); - PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems = new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, MwPureEthernetStructurePac.class, uid, resultList); - - } - - @Test - public void testNullStructureWithProblems() throws Exception { - - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, resultList); - - } - - @Test - public void testgetLtpHistoricalPerformanceData() { - InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceConfiguration.class).build(); - - AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().build(); - when(accessor.getTransactionUtils().readData(dataBroker, - LogicalDatastoreType.OPERATIONAL, mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration); - - InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = InstanceIdentifier - .builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) - .child(AirInterfaceHistoricalPerformances.class).build(); - - PerformanceData performanceData = new PerformanceDataBuilder().build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = - Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder().setGranularityPeriod(GranularityPeriodType.Period15Min).setPerformanceData(performanceData).build()); - AirInterfaceHistoricalPerformances airHistoricalPerformanceData = new AirInterfaceHistoricalPerformancesBuilder() - .setHistoricalPerformanceDataList(airHistPMList).build(); - when(accessor.getTransactionUtils().readData( - accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData); - - InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = InstanceIdentifier - .builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) - .child(EthernetContainerHistoricalPerformances.class).build(); - - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceData ethPerformanceData = new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceDataBuilder().build(); - List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList = - Arrays.asList(new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder().setGranularityPeriod(GranularityPeriodType.Period24Hours).setPerformanceData(ethPerformanceData).build()); - EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList).build(); - when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, ethContainerIID)) - .thenReturn(ethContainerHistoricalPerformanceData); - - Lp lp = new LpBuilder().setUuid(uid).build(); - WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = new WrapperMicrowaveModelRev181010(accessor, serviceProvider); - - wrapperMicrowaveModelRev181010.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAIRINTERFACE, lp); - } + NetconfAccessor accessor; + DeviceManagerServiceProvider serviceProvider; + FaultData resultList; + UniversalId uid; + TransactionUtils transactionUtils; + DataBroker dataBroker; + + InstanceIdentifier<AirInterfaceCurrentProblems> mwAirInterfaceIID; + @NonNull + AirInterfaceCurrentProblems airInterfaceCurrentProblems; + + InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID; + @NonNull + EthernetContainerCurrentProblems ethernetContainerCurrentProblems; + + @Before + public void init() { + accessor = mock(NetconfAccessor.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + resultList = mock(FaultData.class); + transactionUtils = mock(TransactionUtils.class); + dataBroker = mock(DataBroker.class); + + uid = new UniversalId("ABCD"); + + mwAirInterfaceIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceCurrentProblems.class).build(); + List<CurrentProblemList> currentProblemList = + Arrays.asList(new CurrentProblemListBuilder().setProblemName("Loss of Signal") + .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null).build()); + airInterfaceCurrentProblems = + new AirInterfaceCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + + mwEthInterfaceIID = InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) + .child(EthernetContainerCurrentProblems.class).build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemList> ethCurrentProblemsList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Link Negotiation Unsuccessful") + .setProblemSeverity(SeverityType.Critical).setSequenceNumber(1).setTimeStamp(null) + .build()); + ethernetContainerCurrentProblems = + new EthernetContainerCurrentProblemsBuilder().setCurrentProblemList(ethCurrentProblemsList).build(); + + NodeId nNodeId = new NodeId("nSky"); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getTransactionUtils()).thenReturn(transactionUtils); + when(accessor.getDataBroker()).thenReturn(dataBroker); + + } + + @Test + public void testMWAirInterfaceWithProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceIID)).thenReturn(airInterfaceCurrentProblems); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, + resultList); + } + + @Test + public void testMWAirInterfaceWithoProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceIID)).thenReturn(null); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.MWAIRINTERFACE, null, uid, + resultList); + } + + @Test + public void testEthernetContainer12WithProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(ethernetContainerCurrentProblems); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, + uid, resultList); + } + + @Test + public void testEthernetContainer12WithNoProblems() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(null); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.ETHERNETCONTAINER12, null, + uid, resultList); + } + + @Test + public void testTdmContainer12WithProblems() throws Exception { + final Class<MwTdmContainerPac> clazzPac = MwTdmContainerPac.class; + final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; + final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; + + Constructor<MwTdmContainerPacKey> cons = clazzPacKey.getConstructor(UniversalId.class); // Avoid new() + InstanceIdentifier<TdmContainerCurrentProblems> mwEthInterfaceIID = + InstanceIdentifier.builder(clazzPac, cons.newInstance(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + TdmContainerCurrentProblems tdmInterfaceCurrentProblems = + new TdmContainerCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(tdmInterfaceCurrentProblems); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.TDMCONTAINER, null, uid, + resultList); + + } + + @Test + public void testMwHybridMwStructureWithProblems() throws Exception { + final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; + final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; + + InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = + InstanceIdentifier.builder(clazzPac, new MwHybridMwStructurePacKey(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + HybridMwStructureCurrentProblems hybridMwStructureCurrentProblems = + new HybridMwStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwHybridMwStructurePac.class, uid, resultList); + + } + + @Test + public void testMwAirInterfaceDiversityStructureWithProblems() throws Exception { + final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; + final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; + + InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier + .builder(clazzPac, new MwAirInterfaceDiversityPacKey(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + AirInterfaceDiversityCurrentProblems hybridMwStructureCurrentProblems = + new AirInterfaceDiversityCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwAirInterfaceDiversityPac.class, uid, resultList); + + } + + @Test + public void testMwPureEthernetStructureWithProblems() throws Exception { + final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; + final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; + + InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier + .builder(clazzPac, new MwPureEthernetStructurePacKey(uid)).child(clazzProblems).build(); + + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemList> currentProblemList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder() + .setProblemName("Loss of Payload").setProblemSeverity(SeverityType.Major) + .setSequenceNumber(2).setTimeStamp(null).build()); + PureEthernetStructureCurrentProblems hybridMwStructureCurrentProblems = + new PureEthernetStructureCurrentProblemsBuilder().setCurrentProblemList(currentProblemList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwEthInterfaceIID)).thenReturn(hybridMwStructureCurrentProblems); + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, + MwPureEthernetStructurePac.class, uid, resultList); + + } + + @Test + public void testNullStructureWithProblems() throws Exception { + + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + wrapperMicrowaveModelRev181010.readTheFaultsOfMicrowaveModel(ONFLayerProtocolName.STRUCTURE, null, uid, + resultList); + + } + + @Test + public void testgetLtpHistoricalPerformanceData() { + InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceConfiguration.class).build(); + + AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().build(); + when(accessor.getTransactionUtils().readData(dataBroker, LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceConfigurationIID)).thenReturn(airConfiguration); + + InstanceIdentifier<AirInterfaceHistoricalPerformances> mwAirInterfaceHistoricalPerformanceIID = + InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) + .child(AirInterfaceHistoricalPerformances.class).build(); + + PerformanceData performanceData = new PerformanceDataBuilder().build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataList> airHistPMList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder() + .setGranularityPeriod(GranularityPeriodType.Period15Min) + .setPerformanceData(performanceData).build()); + AirInterfaceHistoricalPerformances airHistoricalPerformanceData = + new AirInterfaceHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(airHistPMList).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + mwAirInterfaceHistoricalPerformanceIID)).thenReturn(airHistoricalPerformanceData); + + InstanceIdentifier<EthernetContainerHistoricalPerformances> ethContainerIID = + InstanceIdentifier.builder(MwEthernetContainerPac.class, new MwEthernetContainerPacKey(uid)) + .child(EthernetContainerHistoricalPerformances.class).build(); + + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceData ethPerformanceData = + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceDataBuilder() + .build(); + List<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataList> ethHistPMList = + Arrays.asList( + new org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder() + .setGranularityPeriod(GranularityPeriodType.Period24Hours) + .setPerformanceData(ethPerformanceData).build()); + EthernetContainerHistoricalPerformances ethContainerHistoricalPerformanceData = + new EthernetContainerHistoricalPerformancesBuilder().setHistoricalPerformanceDataList(ethHistPMList) + .build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + ethContainerIID)).thenReturn(ethContainerHistoricalPerformanceData); + + Lp lp = new LpBuilder().setUuid(uid).build(); + WrapperMicrowaveModelRev181010 wrapperMicrowaveModelRev181010 = + new WrapperMicrowaveModelRev181010(accessor, serviceProvider); + + wrapperMicrowaveModelRev181010.getLtpHistoricalPerformanceData(ONFLayerProtocolName.MWAIRINTERFACE, lp); + } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java index bf9337291..42f7de1d6 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/test/TestWrapperPTPModelRev170208.java @@ -47,47 +47,47 @@ import static org.mockito.Mockito.*; public class TestWrapperPTPModelRev170208 { - private static final String NODEID = "node1"; - NetconfAccessor netconfAccessor; - Capabilities capabilities; - TransactionUtils transactionUtils; - DataBroker dataBroker; - - @Before - public void init() { - netconfAccessor = mock(NetconfAccessor.class); - capabilities = mock(Capabilities.class); - dataBroker = mock(DataBroker.class); - transactionUtils = mock(TransactionUtils.class); - - when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); - when(netconfAccessor.getCapabilites()).thenReturn(capabilities); - when(netconfAccessor.getTransactionUtils()).thenReturn(transactionUtils); - when(netconfAccessor.getDataBroker()).thenReturn(dataBroker); - - PortIdentity portIdentity = new PortIdentityBuilder().setPortNumber(10).build(); - List<PortDsList> portDsList = Arrays.asList(new PortDsListBuilder().setPortIdentity(portIdentity).build()); - InstanceList instanceList = new InstanceListBuilder().setPortDsList(portDsList).build(); - InstanceIdentifier<InstanceList> PTPINSTANCES_IID = InstanceIdentifier - .builder(InstanceList.class, new InstanceListKey(1)).build(); - when(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, - PTPINSTANCES_IID)).thenReturn(instanceList); - } - - @Test - public void test() { - - when(capabilities.isSupportingNamespaceAndRevision(InstanceList.QNAME)).thenReturn(false); - - WrapperPTPModelRev170208.initSynchronizationExtension(netconfAccessor); - } - - @Test - public void test1() { - - when(capabilities.isSupportingNamespaceAndRevision(InstanceList.QNAME)).thenReturn(true); - - WrapperPTPModelRev170208.initSynchronizationExtension(netconfAccessor); - } + private static final String NODEID = "node1"; + NetconfAccessor netconfAccessor; + Capabilities capabilities; + TransactionUtils transactionUtils; + DataBroker dataBroker; + + @Before + public void init() { + netconfAccessor = mock(NetconfAccessor.class); + capabilities = mock(Capabilities.class); + dataBroker = mock(DataBroker.class); + transactionUtils = mock(TransactionUtils.class); + + when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); + when(netconfAccessor.getCapabilites()).thenReturn(capabilities); + when(netconfAccessor.getTransactionUtils()).thenReturn(transactionUtils); + when(netconfAccessor.getDataBroker()).thenReturn(dataBroker); + + PortIdentity portIdentity = new PortIdentityBuilder().setPortNumber(10).build(); + List<PortDsList> portDsList = Arrays.asList(new PortDsListBuilder().setPortIdentity(portIdentity).build()); + InstanceList instanceList = new InstanceListBuilder().setPortDsList(portDsList).build(); + InstanceIdentifier<InstanceList> PTPINSTANCES_IID = + InstanceIdentifier.builder(InstanceList.class, new InstanceListKey(1)).build(); + when(netconfAccessor.getTransactionUtils().readData(netconfAccessor.getDataBroker(), + LogicalDatastoreType.OPERATIONAL, PTPINSTANCES_IID)).thenReturn(instanceList); + } + + @Test + public void test() { + + when(capabilities.isSupportingNamespaceAndRevision(InstanceList.QNAME)).thenReturn(false); + + WrapperPTPModelRev170208.initSynchronizationExtension(netconfAccessor); + } + + @Test + public void test1() { + + when(capabilities.isSupportingNamespaceAndRevision(InstanceList.QNAME)).thenReturn(true); + + WrapperPTPModelRev170208.initSynchronizationExtension(netconfAccessor); + } } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java index 93e65c0b9..909a67edc 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/impl/test/TestONFCoreNetworkElementFactory.java @@ -83,9 +83,12 @@ public class TestONFCoreNetworkElementFactory { when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) + .thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) + .thenReturn(false); ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); assertTrue(factory.create(accessor, serviceProvider).isPresent()); } @@ -93,9 +96,12 @@ public class TestONFCoreNetworkElementFactory { @Test public void testCreateMWModelRev180907() throws Exception { when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) + .thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) + .thenReturn(false); ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); assertTrue(factory.create(accessor, serviceProvider).isPresent()); } @@ -103,9 +109,12 @@ public class TestONFCoreNetworkElementFactory { @Test public void testCreateMWModelRev181010() throws Exception { when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElement.QNAME)).thenReturn(true); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)).thenReturn(false); - when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev180907.QNAME)) + .thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev181010.QNAME)) + .thenReturn(true); ONFCoreNetworkElementFactory factory = new ONFCoreNetworkElementFactory(configuration); assertTrue(factory.create(accessor, serviceProvider).isPresent()); } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java index ba295f6ce..242014fc0 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Basic.java @@ -68,8 +68,8 @@ public class TestONFCoreNetworkElement12Basic { EquipmentService equipmentService; DeviceManagerOnfConfiguration configuration; - protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier - .builder(NetworkElement.class).build(); + protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = + InstanceIdentifier.builder(NetworkElement.class).build(); @Before public void init() { @@ -179,8 +179,8 @@ public class TestONFCoreNetworkElement12Basic { when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(optionalNe); - ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = new ONFCoreNetworkElement12Basic(accessor, - serviceProvider,configuration); + ONFCoreNetworkElement12Basic onfCoreNetworkElement12Basic = + new ONFCoreNetworkElement12Basic(accessor, serviceProvider, configuration); onfCoreNetworkElement12Basic.prepareCheck(); /* @@ -222,73 +222,72 @@ public class TestONFCoreNetworkElement12Basic { @Test - public void test1() - { - when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); + public void test1() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + NETWORKELEMENT_IID)).thenReturn(null); ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = - new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, - onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); - - EventlogEntity eventlogEntity = new EventlogEntity() { - - @Override - public @Nullable String getId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable DateAndTime getTimestamp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getObjectId() { - // TODO Auto-generated method stub - return "ABCD"; - } - - @Override - public @Nullable String getNodeId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable Integer getCounter() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable SourceType getSourceType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getNewValue() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getAttributeName() { - // TODO Auto-generated method stub - return "/equipment-pac/equipment-current-problems"; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - }; - - onfCoreNetworkElement12MW.notificationActor(eventlogEntity); + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, onfMicrowaveModel); + onfCoreNetworkElement12MW.prepareCheck(); + + EventlogEntity eventlogEntity = new EventlogEntity() { + + @Override + public @Nullable String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable DateAndTime getTimestamp() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getObjectId() { + // TODO Auto-generated method stub + return "ABCD"; + } + + @Override + public @Nullable String getNodeId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable Integer getCounter() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable SourceType getSourceType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getNewValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getAttributeName() { + // TODO Auto-generated method stub + return "/equipment-pac/equipment-current-problems"; + } + + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + }; + + onfCoreNetworkElement12MW.notificationActor(eventlogEntity); } diff --git a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java index a5462d6f1..dcef80916 100644 --- a/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onf/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/test/TestONFCoreNetworkElement12Microwave.java @@ -67,8 +67,8 @@ public class TestONFCoreNetworkElement12Microwave { EquipmentService equipmentService; DeviceManagerOnfConfiguration configuration; - protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = InstanceIdentifier - .builder(NetworkElement.class).build(); + protected static final InstanceIdentifier<NetworkElement> NETWORKELEMENT_IID = + InstanceIdentifier.builder(NetworkElement.class).build(); @Before public void init() { @@ -178,8 +178,8 @@ public class TestONFCoreNetworkElement12Microwave { when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(optionalNe); - ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = new ONFCoreNetworkElement12Microwave(accessor, - serviceProvider, configuration, onfMicrowaveModel); + ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); EventlogEntity eventlogEntity = new EventlogEntity() { @@ -245,73 +245,72 @@ public class TestONFCoreNetworkElement12Microwave { @Test - public void test1() - { - when (accessor.getTransactionUtils().readData(accessor.getDataBroker(), - LogicalDatastoreType.OPERATIONAL, NETWORKELEMENT_IID)).thenReturn(null); + public void test1() { + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + NETWORKELEMENT_IID)).thenReturn(null); ONFCoreNetworkElement12Microwave onfCoreNetworkElement12MW = - new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, - onfMicrowaveModel); onfCoreNetworkElement12MW.prepareCheck(); - - EventlogEntity eventlogEntity = new EventlogEntity() { - - @Override - public @Nullable String getId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable DateAndTime getTimestamp() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getObjectId() { - // TODO Auto-generated method stub - return "ABCD"; - } - - @Override - public @Nullable String getNodeId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable Integer getCounter() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable SourceType getSourceType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getNewValue() { - // TODO Auto-generated method stub - return null; - } - - @Override - public @Nullable String getAttributeName() { - // TODO Auto-generated method stub - return "/equipment-pac/equipment-current-problems"; - } - - @Override - public Class<? extends DataContainer> getImplementedInterface() { - // TODO Auto-generated method stub - return null; - } - }; - - onfCoreNetworkElement12MW.notificationActor(eventlogEntity); + new ONFCoreNetworkElement12Microwave(accessor, serviceProvider, configuration, onfMicrowaveModel); + onfCoreNetworkElement12MW.prepareCheck(); + + EventlogEntity eventlogEntity = new EventlogEntity() { + + @Override + public @Nullable String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable DateAndTime getTimestamp() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getObjectId() { + // TODO Auto-generated method stub + return "ABCD"; + } + + @Override + public @Nullable String getNodeId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable Integer getCounter() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable SourceType getSourceType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getNewValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public @Nullable String getAttributeName() { + // TODO Auto-generated method stub + return "/equipment-pac/equipment-current-problems"; + } + + @Override + public Class<? extends DataContainer> getImplementedInterface() { + // TODO Auto-generated method stub + return null; + } + }; + + onfCoreNetworkElement12MW.notificationActor(eventlogEntity); } |