From ba8b9a7ff4bef265f1f9a802932a0796c60b9cca Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Tue, 1 Feb 2022 15:02:52 +0530 Subject: Update ONF12 devicemanager Performance data handling refactorization Issue-ID: CCSDK-3575 Change-Id: Iae95b3250c2f1d7ee9353b3833bcd4270ea63d12 Signed-off-by: Ravi Pendurty --- .../devicemanager/onf/ifpac/microwave/Helper.java | 44 +++-- .../onf/ifpac/microwave/OnfMicrowaveModel.java | 4 +- .../microwave/WrapperMicrowaveModelRev170324.java | 8 +- .../microwave/WrapperMicrowaveModelRev180907.java | 8 +- .../microwave/WrapperMicrowaveModelRev181010.java | 16 +- .../PerformanceDataAirInterface170324Builder.java | 191 ++++++++++---------- .../PerformanceDataAirInterface180907Builder.java | 192 ++++++++++---------- .../PerformanceDataAirInterface181010Builder.java | 193 +++++++++++---------- .../onf/ne/ONFCoreNetworkElement12Base.java | 53 +++--- .../onf/ne/ONFCoreNetworkElement12Microwave.java | 4 +- .../test/TestWrapperMicrowaveModelRev170324.java | 3 +- .../test/TestWrapperMicrowaveModelRev180907.java | 3 +- .../test/TestWrapperMicrowaveModelRev181010.java | 3 +- .../ifpac/microwave/test/TestWrapperNoPmData.java | 56 ++++++ 14 files changed, 445 insertions(+), 333 deletions(-) create mode 100644 sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperNoPmData.java diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java index 98b55b3ae..6e5c1d5a1 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java @@ -19,9 +19,13 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData; +import org.opendaylight.yangtools.yang.binding.DataObject; /** * @author herbert @@ -29,25 +33,33 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.r */ public class Helper { - private static final @NonNull UniversalId DEFAULT_UniversalId = new UniversalId("Default"); - private static final @NonNull LayerProtocolName DEFAULT_LayerProtocolName = new LayerProtocolName("default"); - private static final @NonNull GranularityPeriodType DEFAULT_GranularityPeriodType = GranularityPeriodType.Unknown; - private static final @NonNull String DEFAULT_String = ""; + private static final @NonNull UniversalId DEFAULT_UniversalId = new UniversalId("Default"); + private static final @NonNull LayerProtocolName DEFAULT_LayerProtocolName = new LayerProtocolName("default"); + private static final @NonNull GranularityPeriodType DEFAULT_GranularityPeriodType = GranularityPeriodType.Unknown; + private static final @NonNull String DEFAULT_String = ""; - public static @NonNull UniversalId nnGetUniversalId(@Nullable UniversalId x) { - return x == null ? DEFAULT_UniversalId : x; - } + public static @NonNull UniversalId nnGetUniversalId(@Nullable UniversalId x) { + return x == null ? DEFAULT_UniversalId : x; + } - public static @NonNull LayerProtocolName nnGetLayerProtocolName(@Nullable LayerProtocolName x) { - return x == null ? DEFAULT_LayerProtocolName : x; - } + public static @NonNull LayerProtocolName nnGetLayerProtocolName(@Nullable LayerProtocolName x) { + return x == null ? DEFAULT_LayerProtocolName : x; + } - public static @NonNull GranularityPeriodType nnGetGranularityPeriodType(@Nullable GranularityPeriodType x) { - return x == null ? DEFAULT_GranularityPeriodType : x; - } + public static @NonNull GranularityPeriodType nnGetGranularityPeriodType(@Nullable GranularityPeriodType x) { + return x == null ? DEFAULT_GranularityPeriodType : x; + } - public static @NonNull String nnGetString(@Nullable String x) { - return x == null ? DEFAULT_String : x; - } + public static @NonNull String nnGetString(@Nullable String x) { + return x == null ? DEFAULT_String : x; + } + + public static @NonNull T throwIfPerformanceDataNull(T pmRecord, String uuidInterface, + String lpName) throws InconsistentPMDataException { + + String msg = new StringBuffer().append("Ignore record without PerformanceData. Node/Lp: ").append(uuidInterface).append("/") + .append(lpName).toString(); + return PmUtil.throwIfDataObjectNull(pmRecord, msg); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java index 369dfd1d7..29eee1955 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java @@ -22,6 +22,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.notifications.Notificat import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity; @@ -47,7 +48,8 @@ public interface OnfMicrowaveModel { * @return the pm data object */ @NonNull - PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp); + PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) + throws InconsistentPMDataException; /** Set notificationqueue worker for specific notification that needs to be forwarded **/ void setNotificationQueue(NotificationWorker notificationQueue); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java index 9ed027658..553c0103b 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; @@ -174,7 +175,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw @Override public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, - @NonNull Lp lp) { + @NonNull Lp lp) throws InconsistentPMDataException { PerformanceDataLtp res = new PerformanceDataLtp(); readAirInterfacePerformanceData(lp, res); readEthernetContainerPerformanceData(lp, res); @@ -491,8 +492,9 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw * @param lp to read from * @param result Object to be filled with data * @return result + * @throws InconsistentPMDataException */ - private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid()); // ---- @@ -537,7 +539,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } - private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { final String myName = "MWEthernetContainerPac"; String mountpointId = acessor.getNodeId().getValue(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java index e564881c4..5ce91ed65 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; @@ -180,7 +181,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw @Override public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, - @NonNull Lp lp) { + @NonNull Lp lp) throws InconsistentPMDataException { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { case MWAIRINTERFACE: @@ -488,8 +489,9 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @param lp to read from * @param result Object to be filled with data * @return result + * @throws InconsistentPMDataException */ - private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid()); // ---- @@ -533,7 +535,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw return result; } - private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { final String myName = "MWEthernetContainerPac"; LOG.debug("DBRead Get {} : {}", myName, lp.getUuid()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java index 33349ef72..747ff96a9 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; @@ -178,7 +179,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw @Override public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, - @NonNull Lp lp) { + @NonNull Lp lp) throws InconsistentPMDataException { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { case MWAIRINTERFACE: @@ -256,10 +257,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue()) .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf) - .setTimestamp(notification.getTimeStamp()) - .setNodeId(this.acessor.getNodeId().getValue()) - .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()) - .build(); + .setTimestamp(notification.getTimeStamp()).setNodeId(this.acessor.getNodeId().getValue()) + .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()).build(); // Send devicemanager specific notification for database and ODLUX faultService.faultNotification(faultAlarm); // Send model specific notification to WebSocketManager @@ -503,8 +502,10 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @param lp to read from * @param result Object to be filled with data * @return result + * @throws InconsistentPMDataException */ - private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) + throws InconsistentPMDataException { LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid()); // ---- @@ -548,7 +549,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw return result; } - private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) + throws InconsistentPMDataException { final String myName = "MWEthernetContainerPac"; LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java index 27ec32c81..d5ca9c388 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java @@ -18,7 +18,11 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm; import java.util.Optional; + +import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG; @@ -32,100 +36,103 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilder { - private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { - super(); - Optional 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()); - this.setNodeName(nodeId.getValue()); - this.setScannerId(pmRecord.getHistoryDataId()); - this.setTimeStamp(pmRecord.getPeriodEndTime()); - this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); - } + private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { + super(); + Optional 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()); + this.setNodeName(nodeId.getValue()); + this.setScannerId(pmRecord.getHistoryDataId()); + this.setTimeStamp(pmRecord.getPeriodEndTime()); + this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); + } + + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @param airConfiguration configuration for additional parameter + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) + throws InconsistentPMDataException { + this(nodeId, lp, pmRecord); + + this.setRadioSignalId(airConfiguration.getRadioSignalId()); + @NonNull + PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), + getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @param airConfiguration configuration for additional parameter - */ - public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, - AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { - this(nodeId, lp, pmRecord); + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setEs(pmr.getEs()); + bPerformanceData.setSes(pmr.getSes()); + bPerformanceData.setCses(pmr.getCses()); + bPerformanceData.setUnavailability(pmr.getUnavailability()); + bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); + bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); + bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); + bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); + bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); + bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); + bPerformanceData.setTime2States(pmr.getTime2States()); + bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); + bPerformanceData.setTime4States(pmr.getTime4States()); + bPerformanceData.setTime8States(pmr.getTime8States()); + bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); + bPerformanceData.setTime16States(pmr.getTime16States()); + bPerformanceData.setTime32States(pmr.getTime32States()); + bPerformanceData.setTime64States(pmr.getTime64States()); + bPerformanceData.setTime128States(pmr.getTime128States()); + bPerformanceData.setTime256States(pmr.getTime256States()); + bPerformanceData.setTime512States(pmr.getTime512States()); + bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); + bPerformanceData.setTime1024States(pmr.getTime1024States()); + bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); + bPerformanceData.setTime2048States(pmr.getTime2048States()); + bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); + bPerformanceData.setTime4096States(pmr.getTime4096States()); + bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); + bPerformanceData.setTime8192States(pmr.getTime8192States()); + bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); + bPerformanceData.setSnirMin(pmr.getSnirMin()); + bPerformanceData.setSnirMax(pmr.getSnirMax()); + bPerformanceData.setSnirAvg(pmr.getSnirAvg()); + bPerformanceData.setXpdMin(pmr.getXpdMin()); + bPerformanceData.setXpdMax(pmr.getXpdMax()); + bPerformanceData.setXpdAvg(pmr.getXpdAvg()); + bPerformanceData.setRfTempMin(pmr.getRfTempMin()); + bPerformanceData.setRfTempMax(pmr.getRfTempMax()); + bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); + bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); + this.setPerformanceData(bPerformanceData.build()); + } - this.setRadioSignalId(airConfiguration.getRadioSignalId()); - PerformanceData pmr = pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setEs(pmr.getEs()); - bPerformanceData.setSes(pmr.getSes()); - bPerformanceData.setCses(pmr.getCses()); - bPerformanceData.setUnavailability(pmr.getUnavailability()); - bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); - bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); - bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); - bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); - bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); - bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); - bPerformanceData.setTime2States(pmr.getTime2States()); - bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); - bPerformanceData.setTime4States(pmr.getTime4States()); - bPerformanceData.setTime8States(pmr.getTime8States()); - bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); - bPerformanceData.setTime16States(pmr.getTime16States()); - bPerformanceData.setTime32States(pmr.getTime32States()); - bPerformanceData.setTime64States(pmr.getTime64States()); - bPerformanceData.setTime128States(pmr.getTime128States()); - bPerformanceData.setTime256States(pmr.getTime256States()); - bPerformanceData.setTime512States(pmr.getTime512States()); - bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); - bPerformanceData.setTime1024States(pmr.getTime1024States()); - bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); - bPerformanceData.setTime2048States(pmr.getTime2048States()); - bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); - bPerformanceData.setTime4096States(pmr.getTime4096States()); - bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); - bPerformanceData.setTime8192States(pmr.getTime8192States()); - bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); - bPerformanceData.setSnirMin(pmr.getSnirMin()); - bPerformanceData.setSnirMax(pmr.getSnirMax()); - bPerformanceData.setSnirAvg(pmr.getSnirAvg()); - bPerformanceData.setXpdMin(pmr.getXpdMin()); - bPerformanceData.setXpdMax(pmr.getXpdMax()); - bPerformanceData.setXpdAvg(pmr.getXpdAvg()); - bPerformanceData.setRfTempMin(pmr.getRfTempMin()); - bPerformanceData.setRfTempMax(pmr.getRfTempMax()); - bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); - bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) + throws InconsistentPMDataException { + this(nodeId, lp, (OtnHistoryDataG) pmRecord); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper + .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - */ - 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(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); - bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); - bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); + bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); + bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); + this.setPerformanceData(bPerformanceData.build()); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java index f4023f932..275252f4d 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java @@ -18,7 +18,11 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm; import java.util.Optional; + +import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG; @@ -32,100 +36,104 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public class PerformanceDataAirInterface180907Builder extends PmdataEntityBuilder { - private PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { - super(); - Optional 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()); - this.setNodeName(nodeId.getValue()); - this.setScannerId(pmRecord.getHistoryDataId()); - this.setTimeStamp(pmRecord.getPeriodEndTime()); - this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); - } + private PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { + super(); + Optional 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()); + this.setNodeName(nodeId.getValue()); + this.setScannerId(pmRecord.getHistoryDataId()); + this.setTimeStamp(pmRecord.getPeriodEndTime()); + this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); + } + + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @param airConfiguration configuration for additional parameter + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) + throws InconsistentPMDataException { + this(nodeId, lp, pmRecord); + + this.setRadioSignalId(airConfiguration.getRadioSignalId()); + @NonNull + PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), + getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @param airConfiguration configuration for additional parameter - */ - public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, - AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { - this(nodeId, lp, pmRecord); + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setEs(pmr.getEs()); + bPerformanceData.setSes(pmr.getSes()); + bPerformanceData.setCses(pmr.getCses()); + bPerformanceData.setUnavailability(pmr.getUnavailability()); + bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); + bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); + bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); + bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); + bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); + bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); + bPerformanceData.setTime2States(pmr.getTime2States()); + bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); + bPerformanceData.setTime4States(pmr.getTime4States()); + bPerformanceData.setTime8States(pmr.getTime8States()); + bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); + bPerformanceData.setTime16States(pmr.getTime16States()); + bPerformanceData.setTime32States(pmr.getTime32States()); + bPerformanceData.setTime64States(pmr.getTime64States()); + bPerformanceData.setTime128States(pmr.getTime128States()); + bPerformanceData.setTime256States(pmr.getTime256States()); + bPerformanceData.setTime512States(pmr.getTime512States()); + bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); + bPerformanceData.setTime1024States(pmr.getTime1024States()); + bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); + bPerformanceData.setTime2048States(pmr.getTime2048States()); + bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); + bPerformanceData.setTime4096States(pmr.getTime4096States()); + bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); + bPerformanceData.setTime8192States(pmr.getTime8192States()); + bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); + bPerformanceData.setSnirMin(pmr.getSnirMin()); + bPerformanceData.setSnirMax(pmr.getSnirMax()); + bPerformanceData.setSnirAvg(pmr.getSnirAvg()); + bPerformanceData.setXpdMin(pmr.getXpdMin()); + bPerformanceData.setXpdMax(pmr.getXpdMax()); + bPerformanceData.setXpdAvg(pmr.getXpdAvg()); + bPerformanceData.setRfTempMin(pmr.getRfTempMin()); + bPerformanceData.setRfTempMax(pmr.getRfTempMax()); + bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); + bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); + this.setPerformanceData(bPerformanceData.build()); + } - this.setRadioSignalId(airConfiguration.getRadioSignalId()); - PerformanceData pmr = pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setEs(pmr.getEs()); - bPerformanceData.setSes(pmr.getSes()); - bPerformanceData.setCses(pmr.getCses()); - bPerformanceData.setUnavailability(pmr.getUnavailability()); - bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); - bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); - bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); - bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); - bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); - bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); - bPerformanceData.setTime2States(pmr.getTime2States()); - bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); - bPerformanceData.setTime4States(pmr.getTime4States()); - bPerformanceData.setTime8States(pmr.getTime8States()); - bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); - bPerformanceData.setTime16States(pmr.getTime16States()); - bPerformanceData.setTime32States(pmr.getTime32States()); - bPerformanceData.setTime64States(pmr.getTime64States()); - bPerformanceData.setTime128States(pmr.getTime128States()); - bPerformanceData.setTime256States(pmr.getTime256States()); - bPerformanceData.setTime512States(pmr.getTime512States()); - bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); - bPerformanceData.setTime1024States(pmr.getTime1024States()); - bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); - bPerformanceData.setTime2048States(pmr.getTime2048States()); - bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); - bPerformanceData.setTime4096States(pmr.getTime4096States()); - bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); - bPerformanceData.setTime8192States(pmr.getTime8192States()); - bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); - bPerformanceData.setSnirMin(pmr.getSnirMin()); - bPerformanceData.setSnirMax(pmr.getSnirMax()); - bPerformanceData.setSnirAvg(pmr.getSnirAvg()); - bPerformanceData.setXpdMin(pmr.getXpdMin()); - bPerformanceData.setXpdMax(pmr.getXpdMax()); - bPerformanceData.setXpdAvg(pmr.getXpdAvg()); - bPerformanceData.setRfTempMin(pmr.getRfTempMin()); - bPerformanceData.setRfTempMax(pmr.getRfTempMax()); - bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); - bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) + throws InconsistentPMDataException { + this(nodeId, lp, (OtnHistoryDataG) pmRecord); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper + .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), + getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - */ - 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(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); - bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); - bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); + bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); + bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); + this.setPerformanceData(bPerformanceData.build()); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java index ccf4ed4c5..0c379b10e 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java @@ -18,7 +18,11 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm; import java.util.Optional; + +import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG; @@ -32,100 +36,105 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public class PerformanceDataAirInterface181010Builder extends PmdataEntityBuilder { - private PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { - super(); - Optional 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()); - this.setNodeName(nodeId.getValue()); - this.setScannerId(pmRecord.getHistoryDataId()); - this.setTimeStamp(pmRecord.getPeriodEndTime()); - this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); - } + private PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { + super(); + Optional 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()); + this.setNodeName(nodeId.getValue()); + this.setScannerId(pmRecord.getHistoryDataId()); + this.setTimeStamp(pmRecord.getPeriodEndTime()); + this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); + } + + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @param airConfiguration configuration for additional parameter + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) + throws InconsistentPMDataException { + + this(nodeId, lp, pmRecord); + + this.setRadioSignalId(airConfiguration.getRadioSignalId()); + @NonNull + PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), + getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @param airConfiguration configuration for additional parameter - */ - public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, - AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { - this(nodeId, lp, pmRecord); + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setEs(pmr.getEs()); + bPerformanceData.setSes(pmr.getSes()); + bPerformanceData.setCses(pmr.getCses()); + bPerformanceData.setUnavailability(pmr.getUnavailability()); + bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); + bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); + bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); + bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); + bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); + bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); + bPerformanceData.setTime2States(pmr.getTime2States()); + bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); + bPerformanceData.setTime4States(pmr.getTime4States()); + bPerformanceData.setTime8States(pmr.getTime8States()); + bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); + bPerformanceData.setTime16States(pmr.getTime16States()); + bPerformanceData.setTime32States(pmr.getTime32States()); + bPerformanceData.setTime64States(pmr.getTime64States()); + bPerformanceData.setTime128States(pmr.getTime128States()); + bPerformanceData.setTime256States(pmr.getTime256States()); + bPerformanceData.setTime512States(pmr.getTime512States()); + bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); + bPerformanceData.setTime1024States(pmr.getTime1024States()); + bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); + bPerformanceData.setTime2048States(pmr.getTime2048States()); + bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); + bPerformanceData.setTime4096States(pmr.getTime4096States()); + bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); + bPerformanceData.setTime8192States(pmr.getTime8192States()); + bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); + bPerformanceData.setSnirMin(pmr.getSnirMin()); + bPerformanceData.setSnirMax(pmr.getSnirMax()); + bPerformanceData.setSnirAvg(pmr.getSnirAvg()); + bPerformanceData.setXpdMin(pmr.getXpdMin()); + bPerformanceData.setXpdMax(pmr.getXpdMax()); + bPerformanceData.setXpdAvg(pmr.getXpdAvg()); + bPerformanceData.setRfTempMin(pmr.getRfTempMin()); + bPerformanceData.setRfTempMax(pmr.getRfTempMax()); + bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); + bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); + this.setPerformanceData(bPerformanceData.build()); + } - this.setRadioSignalId(airConfiguration.getRadioSignalId()); - PerformanceData pmr = pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setEs(pmr.getEs()); - bPerformanceData.setSes(pmr.getSes()); - bPerformanceData.setCses(pmr.getCses()); - bPerformanceData.setUnavailability(pmr.getUnavailability()); - bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); - bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); - bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); - bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); - bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); - bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); - bPerformanceData.setTime2States(pmr.getTime2States()); - bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); - bPerformanceData.setTime4States(pmr.getTime4States()); - bPerformanceData.setTime8States(pmr.getTime8States()); - bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); - bPerformanceData.setTime16States(pmr.getTime16States()); - bPerformanceData.setTime32States(pmr.getTime32States()); - bPerformanceData.setTime64States(pmr.getTime64States()); - bPerformanceData.setTime128States(pmr.getTime128States()); - bPerformanceData.setTime256States(pmr.getTime256States()); - bPerformanceData.setTime512States(pmr.getTime512States()); - bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); - bPerformanceData.setTime1024States(pmr.getTime1024States()); - bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); - bPerformanceData.setTime2048States(pmr.getTime2048States()); - bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); - bPerformanceData.setTime4096States(pmr.getTime4096States()); - bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); - bPerformanceData.setTime8192States(pmr.getTime8192States()); - bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); - bPerformanceData.setSnirMin(pmr.getSnirMin()); - bPerformanceData.setSnirMax(pmr.getSnirMax()); - bPerformanceData.setSnirAvg(pmr.getSnirAvg()); - bPerformanceData.setXpdMin(pmr.getXpdMin()); - bPerformanceData.setXpdMax(pmr.getXpdMax()); - bPerformanceData.setXpdAvg(pmr.getXpdAvg()); - bPerformanceData.setRfTempMin(pmr.getRfTempMin()); - bPerformanceData.setRfTempMax(pmr.getRfTempMax()); - bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); - bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) + throws InconsistentPMDataException { + this(nodeId, lp, (OtnHistoryDataG) pmRecord); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper + .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), + getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - */ - 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(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); - bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); - bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); + bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); + bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); + this.setPerformanceData(bPerformanceData.build()); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java index 0e1a448b5..8c593038b 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java @@ -38,6 +38,8 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; @@ -103,10 +105,11 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB * Constructor */ - protected ONFCoreNetworkElement12Base(@NonNull NetconfBindingAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) { + protected ONFCoreNetworkElement12Base(@NonNull NetconfBindingAccessor acessor, + @NonNull DeviceManagerServiceProvider serviceProvider) { super(acessor); this.optionalNe = Optional.empty(); - this.nodeId = getAcessor().get().getNodeId(); + this.nodeId = acessor.getNodeId(); this.isNetworkElementCurrentProblemsSupporting12 = acessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME); this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this); @@ -158,7 +161,7 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB synchronized (pmLock) { boolean change = false; - if (!optionalNe.isPresent()) { + if (optionalNe.isEmpty()) { LOG.debug("Unable to read NE data for mountpoint {}", getMountpoint()); if (!interfaceList.isEmpty()) { interfaceList.clear(); @@ -169,8 +172,10 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB } else { NetworkElement ne = optionalNe.get(); Optional oGuicutthrough = getGuicutthrough(ne); - if (oGuicutthrough.isPresent()) { - databaseService.writeGuiCutThroughData(oGuicutthrough.get(), getAcessor().get().getNodeId().getValue()); + Optional netconfAccessorOpt = getAcessor(); + if (oGuicutthrough.isPresent() && netconfAccessorOpt.isPresent()) { + databaseService.writeGuiCutThroughData(oGuicutthrough.get(), + netconfAccessorOpt.get().getNodeId().getValue()); } LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountpoint(), ne.getName()); List actualInterfaceList = getLtpList(ne); @@ -361,13 +366,11 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB List 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()); - } + // 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); @@ -387,7 +390,6 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB LOG.debug("PM reset iterator"); } - @SuppressWarnings("null") @Override public boolean hasNext() { boolean res; @@ -398,7 +400,6 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB return res; } - @SuppressWarnings("null") @Override public void next() { synchronized (pmLock) { @@ -412,15 +413,22 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB } } - @SuppressWarnings("null") @Override public String pmStatusToString() { StringBuilder res = new StringBuilder(); synchronized (pmLock) { - res.append(pmLp == null ? "no interface" - : Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); + if (pmLp == null) { + res.append("no interface"); + } else { + res.append("ActualLP="); + res.append(Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); + } + res.append(" IFList="); + int no=0; for (Lp lp : getInterfaceList()) { - res.append("IF:"); + res.append("["); + res.append(no++); + res.append("]="); res.append(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); res.append(" "); } @@ -440,16 +448,17 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB } @Override - public Optional getLtpHistoricalPerformanceData() { + public Optional getLtpHistoricalPerformanceData() throws InconsistentPMDataException { return Optional.empty(); } //Guicutthrough - public Optional getGuicutthrough(NetworkElement ne) { + private Optional getGuicutthrough(NetworkElement ne) { Extension extension = ne.nonnullExtension().get(new ExtensionKey("webUri")); - if (extension != null) { + Optional netconfAccessorOpt = getAcessor(); + if (extension != null && netconfAccessorOpt.isPresent()) { GuicutthroughBuilder gcBuilder = new GuicutthroughBuilder(); - gcBuilder.setName(getAcessor().get().getNodeId().getValue()); + gcBuilder.setName(netconfAccessorOpt.get().getNodeId().getValue()); gcBuilder.setWeburi(extension.getValue()); return Optional.of(gcBuilder.build()); } else { diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java index 736fd4742..766ebdd23 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.binding.api.NotificationService; @@ -350,11 +351,10 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas } @Override - public Optional getLtpHistoricalPerformanceData() { + public Optional getLtpHistoricalPerformanceData() throws InconsistentPMDataException { synchronized (getPmLock()) { if (pmLp != null) { LOG.debug("Enter query PM"); - @SuppressWarnings("null") @NonNull Lp lp = pmLp; ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java index 9135c38cb..4049a549d 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java @@ -29,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Wrapper import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.binding.api.DataBroker; @@ -285,7 +286,7 @@ public class TestWrapperMicrowaveModelRev170324 { } @Test - public void testgetLtpHistoricalPerformanceData() { + public void testgetLtpHistoricalPerformanceData() throws InconsistentPMDataException { InstanceIdentifier mwAirInterfaceConfigurationIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) .child(AirInterfaceConfiguration.class).build(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java index bc4434f26..078890fd2 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java @@ -29,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Wrapper import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; @@ -281,7 +282,7 @@ public class TestWrapperMicrowaveModelRev180907 { } @Test - public void testgetLtpHistoricalPerformanceData() { + public void testgetLtpHistoricalPerformanceData() throws InconsistentPMDataException { InstanceIdentifier mwAirInterfaceConfigurationIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) .child(AirInterfaceConfiguration.class).build(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java index 3dfbdd2e0..51e9dae72 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java @@ -29,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Wrapper import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.binding.api.DataBroker; @@ -286,7 +287,7 @@ public class TestWrapperMicrowaveModelRev181010 { } @Test - public void testgetLtpHistoricalPerformanceData() { + public void testgetLtpHistoricalPerformanceData() throws InconsistentPMDataException { InstanceIdentifier mwAirInterfaceConfigurationIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) .child(AirInterfaceConfiguration.class).build(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperNoPmData.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperNoPmData.java new file mode 100644 index 000000000..1cda8716d --- /dev/null +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperNoPmData.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * ============LICENSE_END========================================================================== + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface170324Builder; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceDataBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfigurationBuilder; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; + +public class TestWrapperNoPmData { + + @Test + public void test() { + NodeId nodeId = new NodeId("TestNode"); + Lp lp = new LpBuilder().setUuid(new UniversalId("NodeUUID")).build(); + //Build empty, without PerformanceData + HistoricalPerformanceDataList pmRecord = + new HistoricalPerformanceDataListBuilder().setHistoryDataId("1").build(); + AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().build(); + + @SuppressWarnings("unused") + Exception exception = assertThrows(InconsistentPMDataException.class, () -> { + PerformanceDataAirInterface170324Builder pmdata = + new PerformanceDataAirInterface170324Builder(nodeId, lp, pmRecord, airConfiguration); + }); + String expectedMessage = "Ignore record without PerformanceData. Node/Lp: NodeUUID/default"; + String actualMessage = exception.getMessage(); + assertEquals(actualMessage,expectedMessage); + } +} -- cgit 1.2.3-korg