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.rev180907.AirInterfaceHistoricalPerformanceTypeG;
29 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ContainerHistoricalPerformanceTypeG;
30 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performance.type.g.PerformanceData;
31 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.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 PerformanceDataAirInterface180907Builder extends PmdataEntityBuilder {
39 private PerformanceDataAirInterface180907Builder(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 PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp,
62 AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration)
63 throws InconsistentPMDataException {
64 this(nodeId, lp, pmRecord);
66 this.setRadioSignalId(airConfiguration.getRadioSignalId());
68 PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(),
69 getUuidInterface(), getLayerProtocolName());
71 PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder();
72 bPerformanceData.setTimePeriod(pmr.getTimePeriod());
73 bPerformanceData.setEs(pmr.getEs());
74 bPerformanceData.setSes(pmr.getSes());
75 bPerformanceData.setCses(pmr.getCses());
76 bPerformanceData.setUnavailability(pmr.getUnavailability());
77 bPerformanceData.setTxLevelMin(pmr.getTxLevelMin());
78 bPerformanceData.setTxLevelMax(pmr.getTxLevelMax());
79 bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg());
80 bPerformanceData.setRxLevelMin(pmr.getRxLevelMin());
81 bPerformanceData.setRxLevelMax(pmr.getRxLevelMax());
82 bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg());
83 bPerformanceData.setTime2States(pmr.getTime2States());
84 bPerformanceData.setTime4StatesS(pmr.getTime4StatesS());
85 bPerformanceData.setTime4States(pmr.getTime4States());
86 bPerformanceData.setTime8States(pmr.getTime8States());
87 bPerformanceData.setTime16StatesS(pmr.getTime16StatesS());
88 bPerformanceData.setTime16States(pmr.getTime16States());
89 bPerformanceData.setTime32States(pmr.getTime32States());
90 bPerformanceData.setTime64States(pmr.getTime64States());
91 bPerformanceData.setTime128States(pmr.getTime128States());
92 bPerformanceData.setTime256States(pmr.getTime256States());
93 bPerformanceData.setTime512States(pmr.getTime512States());
94 bPerformanceData.setTime512StatesL(pmr.getTime512StatesL());
95 bPerformanceData.setTime1024States(pmr.getTime1024States());
96 bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL());
97 bPerformanceData.setTime2048States(pmr.getTime2048States());
98 bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL());
99 bPerformanceData.setTime4096States(pmr.getTime4096States());
100 bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL());
101 bPerformanceData.setTime8192States(pmr.getTime8192States());
102 bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL());
103 bPerformanceData.setSnirMin(pmr.getSnirMin());
104 bPerformanceData.setSnirMax(pmr.getSnirMax());
105 bPerformanceData.setSnirAvg(pmr.getSnirAvg());
106 bPerformanceData.setXpdMin(pmr.getXpdMin());
107 bPerformanceData.setXpdMax(pmr.getXpdMax());
108 bPerformanceData.setXpdAvg(pmr.getXpdAvg());
109 bPerformanceData.setRfTempMin(pmr.getRfTempMin());
110 bPerformanceData.setRfTempMax(pmr.getRfTempMax());
111 bPerformanceData.setRfTempAvg(pmr.getRfTempAvg());
112 bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum());
113 this.setPerformanceData(bPerformanceData.build());
117 * Move data to generic type
119 * @param nodeId of node
120 * @param lp to get data from
121 * @param pmRecord data itself
122 * @throws InconsistentPMDataException
124 public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord)
125 throws InconsistentPMDataException {
126 this(nodeId, lp, (OtnHistoryDataG) pmRecord);
127 org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper
128 .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(),
129 getLayerProtocolName());
131 PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder();
132 bPerformanceData.setTimePeriod(pmr.getTimePeriod());
133 bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM());
134 bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS());
135 bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum());
136 this.setPerformanceData(bPerformanceData.build());