2  * ONAP : ccsdk feature sdnr wt
 
   3  * =================================================================================================
 
   4  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
 
   5  * =================================================================================================
 
   6  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 
   7  * in compliance with the License. You may obtain a copy of the License at
 
   9  * http://www.apache.org/licenses/LICENSE-2.0
 
  11  * Unless required by applicable law or agreed to in writing, software distributed under the License
 
  12  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 
  13  * or implied. See the License for the specific language governing permissions and limitations under
 
  15  * ============LICENSE_END==========================================================================
 
  17 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm;
 
  19 import java.util.Optional;
 
  21 import org.eclipse.jdt.annotation.NonNull;
 
  22 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper;
 
  23 import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException;
 
  24 import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil;
 
  25 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
 
  26 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
 
  27 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
 
  28 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
 
  29 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData;
 
  30 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
 
  31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType;
 
  32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntityBuilder;
 
  33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.entity.PerformanceDataBuilder;
 
  34 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 
  36 public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilder {
 
  38         private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) {
 
  40                 Optional<GranularityPeriodType> gp = GranularityPeriodType
 
  41                                 .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName());
 
  42                 this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown));
 
  43                 this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue());
 
  44                 this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue());
 
  45                 this.setNodeName(nodeId.getValue());
 
  46                 this.setScannerId(pmRecord.getHistoryDataId());
 
  47                 this.setTimeStamp(pmRecord.getPeriodEndTime());
 
  48                 this.setSuspectIntervalFlag(pmRecord.requireSuspectIntervalFlag());
 
  52          * Move data to generic type
 
  54          * @param nodeId           of node
 
  55          * @param lp               to get data from
 
  56          * @param pmRecord         data itself
 
  57          * @param airConfiguration configuration for additional parameter
 
  58          * @throws InconsistentPMDataException
 
  60         public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp,
 
  61                         AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration)
 
  62                         throws InconsistentPMDataException {
 
  63                 this(nodeId, lp, pmRecord);
 
  65                 this.setRadioSignalId(airConfiguration.getRadioSignalId());
 
  67                 PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(),
 
  68                                 getUuidInterface(), getLayerProtocolName());
 
  70                 PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder();
 
  71                 bPerformanceData.setTimePeriod(pmr.getTimePeriod());
 
  72                 bPerformanceData.setEs(pmr.getEs());
 
  73                 bPerformanceData.setSes(pmr.getSes());
 
  74                 bPerformanceData.setCses(pmr.getCses());
 
  75                 bPerformanceData.setUnavailability(pmr.getUnavailability());
 
  76                 bPerformanceData.setTxLevelMin(pmr.getTxLevelMin());
 
  77                 bPerformanceData.setTxLevelMax(pmr.getTxLevelMax());
 
  78                 bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg());
 
  79                 bPerformanceData.setRxLevelMin(pmr.getRxLevelMin());
 
  80                 bPerformanceData.setRxLevelMax(pmr.getRxLevelMax());
 
  81                 bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg());
 
  82                 bPerformanceData.setTime2States(pmr.getTime2States());
 
  83                 bPerformanceData.setTime4StatesS(pmr.getTime4StatesS());
 
  84                 bPerformanceData.setTime4States(pmr.getTime4States());
 
  85                 bPerformanceData.setTime8States(pmr.getTime8States());
 
  86                 bPerformanceData.setTime16StatesS(pmr.getTime16StatesS());
 
  87                 bPerformanceData.setTime16States(pmr.getTime16States());
 
  88                 bPerformanceData.setTime32States(pmr.getTime32States());
 
  89                 bPerformanceData.setTime64States(pmr.getTime64States());
 
  90                 bPerformanceData.setTime128States(pmr.getTime128States());
 
  91                 bPerformanceData.setTime256States(pmr.getTime256States());
 
  92                 bPerformanceData.setTime512States(pmr.getTime512States());
 
  93                 bPerformanceData.setTime512StatesL(pmr.getTime512StatesL());
 
  94                 bPerformanceData.setTime1024States(pmr.getTime1024States());
 
  95                 bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL());
 
  96                 bPerformanceData.setTime2048States(pmr.getTime2048States());
 
  97                 bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL());
 
  98                 bPerformanceData.setTime4096States(pmr.getTime4096States());
 
  99                 bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL());
 
 100                 bPerformanceData.setTime8192States(pmr.getTime8192States());
 
 101                 bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL());
 
 102                 bPerformanceData.setSnirMin(pmr.getSnirMin());
 
 103                 bPerformanceData.setSnirMax(pmr.getSnirMax());
 
 104                 bPerformanceData.setSnirAvg(pmr.getSnirAvg());
 
 105                 bPerformanceData.setXpdMin(pmr.getXpdMin());
 
 106                 bPerformanceData.setXpdMax(pmr.getXpdMax());
 
 107                 bPerformanceData.setXpdAvg(pmr.getXpdAvg());
 
 108                 bPerformanceData.setRfTempMin(pmr.getRfTempMin());
 
 109                 bPerformanceData.setRfTempMax(pmr.getRfTempMax());
 
 110                 bPerformanceData.setRfTempAvg(pmr.getRfTempAvg());
 
 111                 bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum());
 
 112                 this.setPerformanceData(bPerformanceData.build());
 
 116          * Move data to generic type
 
 118          * @param nodeId   of node
 
 119          * @param lp       to get data from
 
 120          * @param pmRecord data itself
 
 121          * @throws InconsistentPMDataException
 
 123         public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord)
 
 124                         throws InconsistentPMDataException {
 
 125                 this(nodeId, lp, (OtnHistoryDataG) pmRecord);
 
 126                 org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper
 
 127                                 .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), getLayerProtocolName());
 
 129                 PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder();
 
 130                 bPerformanceData.setTimePeriod(pmr.getTimePeriod());
 
 131                 bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM());
 
 132                 bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS());
 
 133                 bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum());
 
 134                 this.setPerformanceData(bPerformanceData.build());