slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.xran.entities; |
| 18 | |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 19 | import com.fasterxml.jackson.annotation.*; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 20 | import com.fasterxml.jackson.databind.JsonNode; |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 21 | import com.google.common.collect.Lists; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 22 | import org.onosproject.net.DeviceId; |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 23 | import org.onosproject.store.Timestamp; |
| 24 | import org.onosproject.store.service.WallClockTimestamp; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 25 | import org.onosproject.xran.codecs.api.ECGI; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 26 | import org.onosproject.xran.codecs.api.PRBUsage; |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 27 | import org.onosproject.xran.codecs.api.XICICPA; |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 28 | import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream; |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 29 | import org.onosproject.xran.codecs.ber.types.BerBitString; |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 30 | import org.onosproject.xran.codecs.ber.types.BerInteger; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 31 | import org.onosproject.xran.codecs.pdu.CellConfigReport; |
| 32 | import org.onosproject.xran.codecs.pdu.L2MeasConfig; |
| 33 | import org.onosproject.xran.codecs.pdu.RRMConfig; |
| 34 | import org.onosproject.xran.codecs.pdu.SchedMeasReportPerCell; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 35 | |
| 36 | import javax.xml.bind.DatatypeConverter; |
| 37 | import java.io.ByteArrayInputStream; |
| 38 | import java.io.IOException; |
| 39 | import java.io.InputStream; |
| 40 | import java.net.URI; |
| 41 | import java.net.URISyntaxException; |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 42 | import java.util.List; |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 43 | import java.util.stream.Collectors; |
| 44 | import java.util.stream.Stream; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Created by dimitris on 7/22/17. |
| 48 | */ |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 49 | |
| 50 | @JsonPropertyOrder({ |
| 51 | "ECGI", |
| 52 | "Configuration", |
| 53 | "PRB-Usage", |
| 54 | "QCI", |
| 55 | "RRMConfiguration", |
| 56 | "MeasurementConfiguration" |
| 57 | }) |
| 58 | @JsonIgnoreProperties(ignoreUnknown = true) |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 59 | public class RnibCell { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 60 | @JsonIgnore |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 61 | private static final String SCHEME = "xran"; |
| 62 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 63 | @JsonProperty("ECGI") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 64 | private ECGI ecgi; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 65 | @JsonProperty("Configuration") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 66 | private CellConfigReport conf; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 67 | @JsonProperty("PRB-Usage") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 68 | private PrbUsageContainer prbUsage; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 69 | @JsonProperty("QCI") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 70 | private SchedMeasReportPerCell.QciVals qci; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 71 | @JsonProperty("RRMConfiguration") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 72 | private RRMConfig rrmConfig; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 73 | @JsonProperty("MeasurementConfiguration") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 74 | private L2MeasConfig measConfig; |
| 75 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 76 | @JsonIgnore |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 77 | private String version; |
| 78 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 79 | public RnibCell() { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 80 | version = "3"; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 81 | |
| 82 | rrmConfig = new RRMConfig(); |
| 83 | rrmConfig.setEcgi(ecgi); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | public static URI uri(ECGI ecgi) { |
| 87 | if (ecgi != null) { |
| 88 | try { |
| 89 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(4096); |
| 90 | ecgi.encode(os); |
| 91 | String message = DatatypeConverter.printHexBinary(os.getArray()); |
| 92 | return new URI(SCHEME, message, null); |
| 93 | } catch (URISyntaxException | IOException e) { |
| 94 | return null; |
| 95 | } |
| 96 | } |
| 97 | return null; |
| 98 | } |
| 99 | |
| 100 | public static ECGI decodeDeviceId(DeviceId deviceId) throws IOException { |
| 101 | String uri = deviceId.toString(); |
| 102 | String hexEcgi = uri.substring(uri.lastIndexOf("xran:") + 5); |
| 103 | |
| 104 | ECGI ecgi = new ECGI(); |
| 105 | byte[] bytearray = DatatypeConverter.parseHexBinary(hexEcgi); |
| 106 | InputStream inputStream = new ByteArrayInputStream(bytearray); |
| 107 | |
| 108 | ecgi.decode(inputStream); |
| 109 | return ecgi; |
| 110 | } |
| 111 | |
slowr | ed74ec7 | 2017-08-17 11:25:01 -0700 | [diff] [blame] | 112 | public int getVersion() { |
| 113 | return Integer.parseInt(version); |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | public void setVersion(String version) { |
| 117 | this.version = version; |
| 118 | } |
| 119 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 120 | @JsonProperty("RRMConfiguration") |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 121 | public RRMConfig getRrmConfig() { |
| 122 | return rrmConfig; |
| 123 | } |
| 124 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 125 | @JsonProperty("RRMConfiguration") |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 126 | public void setRrmConfig(RRMConfig rrmConfig) { |
| 127 | this.rrmConfig = rrmConfig; |
| 128 | } |
| 129 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 130 | @JsonProperty("PRB-Usage") |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 131 | public PrbUsageContainer getPrbUsage() { |
| 132 | return prbUsage; |
| 133 | } |
| 134 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 135 | @JsonProperty("PRB-Usage") |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 136 | public void setPrbUsage(PrbUsageContainer prbUsage) { |
| 137 | this.prbUsage = prbUsage; |
| 138 | } |
| 139 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 140 | @JsonProperty("ECGI") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 141 | public ECGI getEcgi() { |
| 142 | return ecgi; |
| 143 | } |
| 144 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 145 | @JsonProperty("ECGI") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 146 | public void setEcgi(ECGI ecgi) { |
| 147 | this.ecgi = ecgi; |
| 148 | } |
| 149 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 150 | @JsonProperty("Configuration") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 151 | public CellConfigReport getConf() { |
| 152 | return conf; |
| 153 | } |
| 154 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 155 | @JsonProperty("Configuration") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 156 | public void setConf(CellConfigReport conf) { |
| 157 | this.conf = conf; |
| 158 | } |
| 159 | |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 160 | public void modifyRrmConfig(JsonNode rrmConfigNode, List<RnibUe> ueList) throws Exception { |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 161 | RRMConfig.Crnti crnti = new RRMConfig.Crnti(); |
| 162 | ueList.forEach(ue -> crnti.addCRNTI(ue.getRanId())); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 163 | |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 164 | { |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 165 | JsonNode p_a = rrmConfigNode.path("p_a"); |
| 166 | if (!p_a.isMissingNode()) { |
| 167 | RRMConfig.Pa pa = new RRMConfig.Pa(); |
| 168 | if (p_a.isArray()) { |
| 169 | if (ueList.size() == p_a.size()) { |
| 170 | List<XICICPA> collect = Stream.of(p_a) |
| 171 | .map(val -> new XICICPA(val.asInt())) |
| 172 | .collect(Collectors.toList()); |
| 173 | pa.setXICICPA(collect); |
| 174 | } else { |
| 175 | throw new Exception("p_a size is not the same as UE size"); |
| 176 | } |
| 177 | } |
| 178 | rrmConfig.setPa(pa); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 183 | JsonNode start_prb_dl = rrmConfigNode.path("start_prb_dl"); |
| 184 | if (!start_prb_dl.isMissingNode()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 185 | RRMConfig.StartPrbDl startPrbDl = new RRMConfig.StartPrbDl(); |
| 186 | if (start_prb_dl.isArray()) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 187 | if (ueList.size() == start_prb_dl.size()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 188 | List<BerInteger> collect = Stream.of(start_prb_dl) |
| 189 | .map(val -> new BerInteger(val.asInt())) |
| 190 | .collect(Collectors.toList()); |
| 191 | startPrbDl.setSeqOf(collect); |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 192 | } else { |
| 193 | throw new Exception("start_prb_dl size is not the same as UE size"); |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 194 | } |
| 195 | } |
| 196 | rrmConfig.setStartPrbDl(startPrbDl); |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 197 | } |
| 198 | } |
slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame] | 199 | |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 200 | { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 201 | JsonNode end_prb_dl = rrmConfigNode.path("end_prb_dl"); |
| 202 | if (!end_prb_dl.isMissingNode()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 203 | RRMConfig.EndPrbDl endPrbDl = new RRMConfig.EndPrbDl(); |
| 204 | if (end_prb_dl.isArray()) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 205 | if (ueList.size() == end_prb_dl.size()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 206 | List<BerInteger> collect = Stream.of(end_prb_dl) |
| 207 | .map(val -> new BerInteger(val.asInt())) |
| 208 | .collect(Collectors.toList()); |
| 209 | endPrbDl.setSeqOf(collect); |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 210 | } else { |
| 211 | throw new Exception("end_prb_dl size is not the same as UE size"); |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 212 | } |
| 213 | } |
| 214 | rrmConfig.setEndPrbDl(endPrbDl); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | { |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 219 | JsonNode sub_frame_bitmask_dl = rrmConfigNode.path("sub_frame_bitmask_dl"); |
| 220 | if (!sub_frame_bitmask_dl.isMissingNode()) { |
| 221 | RRMConfig.SubframeBitmaskDl subframeBitmaskDl = new RRMConfig.SubframeBitmaskDl(); |
| 222 | if (sub_frame_bitmask_dl.isArray()) { |
| 223 | List<BerBitString> collect = Stream.of(sub_frame_bitmask_dl) |
| 224 | .map(val -> new BerBitString(DatatypeConverter.parseHexBinary(val.asText()), 10)) |
| 225 | .collect(Collectors.toList()); |
| 226 | |
| 227 | subframeBitmaskDl.setSeqOf(collect); |
| 228 | } else { |
| 229 | throw new Exception("sub_frame_bitmask_dl size is not the same as UE size"); |
| 230 | } |
| 231 | rrmConfig.setSubframeBitmaskDl(subframeBitmaskDl); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 236 | JsonNode start_prb_ul = rrmConfigNode.path("start_prb_ul"); |
| 237 | if (!start_prb_ul.isMissingNode()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 238 | RRMConfig.StartPrbUl startPrbUl = new RRMConfig.StartPrbUl(); |
| 239 | if (start_prb_ul.isArray()) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 240 | if (ueList.size() == start_prb_ul.size()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 241 | List<BerInteger> collect = Stream.of(start_prb_ul) |
| 242 | .map(val -> new BerInteger(val.asInt())) |
| 243 | .collect(Collectors.toList()); |
| 244 | startPrbUl.setSeqOf(collect); |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 245 | } else { |
| 246 | throw new Exception("start_prb_ul size is not the same as UE size"); |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 247 | } |
| 248 | } |
| 249 | rrmConfig.setStartPrbUl(startPrbUl); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 254 | JsonNode end_prb_ul = rrmConfigNode.path("end_prb_ul"); |
| 255 | if (!end_prb_ul.isMissingNode()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 256 | RRMConfig.EndPrbUl endPrbUl = new RRMConfig.EndPrbUl(); |
| 257 | if (end_prb_ul.isArray()) { |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 258 | if (ueList.size() == end_prb_ul.size()) { |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 259 | List<BerInteger> collect = Stream.of(end_prb_ul) |
| 260 | .map(val -> new BerInteger(val.asInt())) |
| 261 | .collect(Collectors.toList()); |
| 262 | endPrbUl.setSeqOf(collect); |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 263 | } else { |
| 264 | throw new Exception("end_prb_ul size is not the same as UE size"); |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 265 | } |
| 266 | } |
| 267 | rrmConfig.setEndPrbUl(endPrbUl); |
| 268 | } |
| 269 | } |
| 270 | |
slowr | 73b4eae | 2017-08-17 16:09:09 -0700 | [diff] [blame^] | 271 | { |
| 272 | JsonNode p0_ue_pusch = rrmConfigNode.path("p0_ue_pusch"); |
| 273 | if (!p0_ue_pusch.isMissingNode()) { |
| 274 | RRMConfig.P0UePusch p0UePusch = new RRMConfig.P0UePusch(); |
| 275 | if (p0_ue_pusch.isArray()) { |
| 276 | if (ueList.size() == p0_ue_pusch.size()) { |
| 277 | List<BerInteger> collect = Stream.of(p0_ue_pusch) |
| 278 | .map(val -> new BerInteger(val.asInt())) |
| 279 | .collect(Collectors.toList()); |
| 280 | p0UePusch.setSeqOf(collect); |
| 281 | } else { |
| 282 | throw new Exception("p0_ue_pusch size is not the same as UE size"); |
| 283 | } |
| 284 | } |
| 285 | rrmConfig.setP0UePusch(p0UePusch); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | { |
| 290 | JsonNode sub_frame_bitmask_ul = rrmConfigNode.path("sub_frame_bitmask_ul"); |
| 291 | if (!sub_frame_bitmask_ul.isMissingNode()) { |
| 292 | RRMConfig.SubframeBitmaskUl subframeBitmaskUl = new RRMConfig.SubframeBitmaskUl(); |
| 293 | if (sub_frame_bitmask_ul.isArray()) { |
| 294 | List<BerBitString> collect = Stream.of(sub_frame_bitmask_ul) |
| 295 | .map(val -> new BerBitString(DatatypeConverter.parseHexBinary(val.asText()), 10)) |
| 296 | .collect(Collectors.toList()); |
| 297 | |
| 298 | subframeBitmaskUl.setSeqOf(collect); |
| 299 | } else { |
| 300 | throw new Exception("sub_frame_bitmask_ul size is not the same as UE size"); |
| 301 | } |
| 302 | rrmConfig.setSubframeBitmaskUl(subframeBitmaskUl); |
| 303 | } |
| 304 | } |
| 305 | |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 306 | rrmConfig.setCrnti(crnti); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 307 | } |
| 308 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 309 | @JsonProperty("QCI") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 310 | public SchedMeasReportPerCell.QciVals getQci() { |
| 311 | return qci; |
| 312 | } |
| 313 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 314 | @JsonProperty("QCI") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 315 | public void setQci(SchedMeasReportPerCell.QciVals qci) { |
| 316 | this.qci = qci; |
| 317 | } |
| 318 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 319 | @JsonProperty("MeasurementConfiguration") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 320 | public L2MeasConfig getMeasConfig() { |
| 321 | return measConfig; |
| 322 | } |
| 323 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 324 | @JsonProperty("MeasurementConfiguration") |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 325 | public void setMeasConfig(L2MeasConfig measConfig) { |
| 326 | this.measConfig = measConfig; |
| 327 | } |
| 328 | |
| 329 | @Override |
| 330 | public String toString() { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 331 | return "RnibCell{" + |
| 332 | "ecgi=" + ecgi + |
| 333 | ", conf=" + conf + |
| 334 | ", prbUsage=" + prbUsage + |
| 335 | ", qci=" + qci + |
| 336 | ", rrmConfig=" + rrmConfig + |
| 337 | ", measConfig=" + measConfig + |
| 338 | ", version='" + version + '\'' + |
| 339 | '}'; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | @Override |
| 343 | public boolean equals(Object o) { |
| 344 | if (this == o) return true; |
| 345 | if (o == null || getClass() != o.getClass()) return false; |
| 346 | |
| 347 | RnibCell rnibCell = (RnibCell) o; |
| 348 | |
| 349 | return ecgi.equals(rnibCell.ecgi); |
| 350 | } |
| 351 | |
| 352 | @Override |
| 353 | public int hashCode() { |
| 354 | return ecgi.hashCode(); |
| 355 | } |
| 356 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 357 | @JsonPropertyOrder({ |
| 358 | "primary", |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 359 | "secondary", |
| 360 | "timesincelastupdate" |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 361 | }) |
| 362 | @JsonIgnoreProperties(ignoreUnknown = true) |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 363 | public static class PrbUsageContainer { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 364 | PRBUsage primary; |
| 365 | PRBUsage secondary; |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 366 | WallClockTimestamp timesincelastupdate; |
| 367 | |
| 368 | @JsonCreator |
| 369 | public PrbUsageContainer(@JsonProperty("primary") PRBUsage primary, @JsonProperty("secondary") PRBUsage secondary) { |
| 370 | this.primary = primary; |
| 371 | this.secondary = secondary; |
| 372 | this.timesincelastupdate = new WallClockTimestamp(); |
| 373 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 374 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 375 | public PRBUsage getPrimary() { |
| 376 | return primary; |
| 377 | } |
| 378 | |
| 379 | public void setPrimary(PRBUsage primary) { |
| 380 | this.primary = primary; |
| 381 | } |
| 382 | |
| 383 | public PRBUsage getSecondary() { |
| 384 | return secondary; |
| 385 | } |
| 386 | |
| 387 | public void setSecondary(PRBUsage secondary) { |
| 388 | this.secondary = secondary; |
| 389 | } |
| 390 | |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 391 | public long getTimesincelastupdate() { |
slowr | 7bebd7b | 2017-08-17 11:46:11 -0700 | [diff] [blame] | 392 | return new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp(); |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 393 | } |
slowr | 7bebd7b | 2017-08-17 11:46:11 -0700 | [diff] [blame] | 394 | |
slowr | c153ad9 | 2017-08-16 19:47:52 -0700 | [diff] [blame] | 395 | public void setTimesincelastupdate(WallClockTimestamp timesincelastupdate) { |
| 396 | this.timesincelastupdate = timesincelastupdate; |
| 397 | } |
| 398 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 399 | @Override |
| 400 | public String toString() { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 401 | return "PrbUsageContainer{" + |
| 402 | "primary=" + primary + |
| 403 | ", secondary=" + secondary + |
slowr | 7bebd7b | 2017-08-17 11:46:11 -0700 | [diff] [blame] | 404 | ", timesincelastupdate=" + (new WallClockTimestamp().unixTimestamp() - timesincelastupdate.unixTimestamp()) + |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 405 | '}'; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 406 | } |
| 407 | } |
| 408 | } |