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;
20 import org.eclipse.jdt.annotation.NonNull;
21 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper;
22 import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException;
23 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
24 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG;
25 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG;
26 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ContainerHistoricalPerformanceTypeG;
27 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData;
28 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntityBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.entity.PerformanceDataBuilder;
32 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
34 public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilder {
36 private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) {
38 Optional<GranularityPeriodType> gp = Optional.ofNullable(GranularityPeriodType
39 .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()));
40 this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown));
41 this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue());
42 this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue());
43 this.setNodeName(nodeId.getValue());
44 this.setScannerId(pmRecord.getHistoryDataId());
45 this.setTimeStamp(pmRecord.getPeriodEndTime());
46 this.setSuspectIntervalFlag(pmRecord.requireSuspectIntervalFlag());
50 * Move data to generic type
52 * @param nodeId of node
53 * @param lp to get data from
54 * @param pmRecord data itself
55 * @param airConfiguration configuration for additional parameter
56 * @throws InconsistentPMDataException
58 public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp,
59 AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration)
60 throws InconsistentPMDataException {
61 this(nodeId, lp, pmRecord);
63 this.setRadioSignalId(airConfiguration.getRadioSignalId());
65 PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(),
66 getLayerProtocolName());
68 PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder();
69 bPerformanceData.setTimePeriod(pmr.getTimePeriod());
70 bPerformanceData.setEs(pmr.getEs());
71 bPerformanceData.setSes(pmr.getSes());
72 bPerformanceData.setCses(pmr.getCses());
73 bPerformanceData.setUnavailability(pmr.getUnavailability());
74 bPerformanceData.setTxLevelMin(pmr.getTxLevelMin());
75 bPerformanceData.setTxLevelMax(pmr.getTxLevelMax());
76 bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg());
77 bPerformanceData.setRxLevelMin(pmr.getRxLevelMin());
78 bPerformanceData.setRxLevelMax(pmr.getRxLevelMax());
79 bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg());
80 bPerformanceData.setTime2States(pmr.getTime2States());
81 bPerformanceData.setTime4StatesS(pmr.getTime4StatesS());
82 bPerformanceData.setTime4States(pmr.getTime4States());
83 bPerformanceData.setTime8States(pmr.getTime8States());
84 bPerformanceData.setTime16StatesS(pmr.getTime16StatesS());
85 bPerformanceData.setTime16States(pmr.getTime16States());
86 bPerformanceData.setTime32States(pmr.getTime32States());
87 bPerformanceData.setTime64States(pmr.getTime64States());
88 bPerformanceData.setTime128States(pmr.getTime128States());
89 bPerformanceData.setTime256States(pmr.getTime256States());
90 bPerformanceData.setTime512States(pmr.getTime512States());
91 bPerformanceData.setTime512StatesL(pmr.getTime512StatesL());
92 bPerformanceData.setTime1024States(pmr.getTime1024States());
93 bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL());
94 bPerformanceData.setTime2048States(pmr.getTime2048States());
95 bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL());
96 bPerformanceData.setTime4096States(pmr.getTime4096States());
97 bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL());
98 bPerformanceData.setTime8192States(pmr.getTime8192States());
99 bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL());
100 bPerformanceData.setSnirMin(pmr.getSnirMin());
101 bPerformanceData.setSnirMax(pmr.getSnirMax());
102 bPerformanceData.setSnirAvg(pmr.getSnirAvg());
103 bPerformanceData.setXpdMin(pmr.getXpdMin());
104 bPerformanceData.setXpdMax(pmr.getXpdMax());
105 bPerformanceData.setXpdAvg(pmr.getXpdAvg());
106 bPerformanceData.setRfTempMin(pmr.getRfTempMin());
107 bPerformanceData.setRfTempMax(pmr.getRfTempMax());
108 bPerformanceData.setRfTempAvg(pmr.getRfTempAvg());
109 bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum());
110 this.setPerformanceData(bPerformanceData.build());
114 * Move data to generic type
116 * @param nodeId of node
117 * @param lp to get data from
118 * @param pmRecord data itself
119 * @throws InconsistentPMDataException
121 public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord)
122 throws InconsistentPMDataException {
123 this(nodeId, lp, (OtnHistoryDataG) pmRecord);
124 org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.@NonNull PerformanceData pmr =
125 Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(),
126 getLayerProtocolName());
128 PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder();
129 bPerformanceData.setTimePeriod(pmr.getTimePeriod());
130 bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM());
131 bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS());
132 bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum());
133 this.setPerformanceData(bPerformanceData.build());