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