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 | |
| 19 | import org.onosproject.xran.codecs.api.*; |
| 20 | import org.onosproject.xran.codecs.pdu.PDCPMeasReportPerUe; |
| 21 | import org.onosproject.xran.codecs.pdu.RRMConfig; |
| 22 | import org.onosproject.xran.identifiers.LinkId; |
| 23 | import org.openmuc.jasn1.ber.types.BerInteger; |
| 24 | |
| 25 | import java.util.Timer; |
| 26 | |
| 27 | /** |
| 28 | * Created by dimitris on 7/22/17. |
| 29 | */ |
| 30 | public class RnibLink { |
| 31 | private LinkId linkId; |
| 32 | // private String type; |
| 33 | private RRMConfig rrmParameters; |
| 34 | |
| 35 | private TrafficSplitPercentage trafficPercent; |
| 36 | private ERABParams bearerParameters; |
| 37 | |
| 38 | private LinkQuality quality; |
| 39 | private PDCPThroughput pdcpThroughput; |
| 40 | private PDCPPacketDelay pdcpPackDelay; |
| 41 | private ResourceUsage resourceUsage; |
| 42 | private Type type; |
| 43 | private Timer timer; |
| 44 | |
| 45 | public RnibLink() { |
| 46 | trafficPercent = new TrafficSplitPercentage(); |
| 47 | trafficPercent.setTrafficPercentDl(new BerInteger(100)); |
| 48 | trafficPercent.setTrafficPercentUl(new BerInteger(100)); |
| 49 | |
| 50 | pdcpThroughput = new PDCPThroughput(); |
| 51 | quality = new LinkQuality(); |
| 52 | pdcpPackDelay = new PDCPPacketDelay(); |
| 53 | resourceUsage = new ResourceUsage(); |
| 54 | timer = new Timer(); |
| 55 | } |
| 56 | |
| 57 | public Timer getTimer() { |
| 58 | return timer; |
| 59 | } |
| 60 | |
| 61 | public void setTimer(Timer timer) { |
| 62 | this.timer.cancel(); |
| 63 | this.timer.purge(); |
| 64 | this.timer = timer; |
| 65 | } |
| 66 | |
| 67 | public LinkId getLinkId() { |
| 68 | return linkId; |
| 69 | } |
| 70 | |
| 71 | public void setLinkId(LinkId linkId) { |
| 72 | this.linkId = linkId; |
| 73 | } |
| 74 | |
| 75 | public void setLinkId(RnibCell cell, RnibUe ue) { |
| 76 | this.linkId = new LinkId(cell.getEcgi(), ue.getMmeS1apId()); |
| 77 | trafficPercent.setEcgi(cell.getEcgi()); |
| 78 | } |
| 79 | |
| 80 | public Type getType() { |
| 81 | return type; |
| 82 | } |
| 83 | |
| 84 | public void setType(Type type) { |
| 85 | this.type = type; |
| 86 | } |
| 87 | |
| 88 | public TrafficSplitPercentage getTrafficPercent() { |
| 89 | return trafficPercent; |
| 90 | } |
| 91 | |
| 92 | public void setTrafficPercent(TrafficSplitPercentage trafficPercent) { |
| 93 | this.trafficPercent = trafficPercent; |
| 94 | } |
| 95 | |
| 96 | public ERABParams getBearerParameters() { |
| 97 | return bearerParameters; |
| 98 | } |
| 99 | |
| 100 | public void setBearerParameters(ERABParams bearerParameters) { |
| 101 | this.bearerParameters = bearerParameters; |
| 102 | } |
| 103 | |
| 104 | public LinkQuality getQuality() { |
| 105 | return quality; |
| 106 | } |
| 107 | |
| 108 | public void setQuality(LinkQuality quality) { |
| 109 | this.quality = quality; |
| 110 | } |
| 111 | |
| 112 | public RRMConfig getRrmParameters() { |
| 113 | return rrmParameters; |
| 114 | } |
| 115 | |
| 116 | public void setRrmParameters(RRMConfig rrmParameters) { |
| 117 | this.rrmParameters = rrmParameters; |
| 118 | } |
| 119 | |
| 120 | public PDCPThroughput getPdcpThroughput() { |
| 121 | return pdcpThroughput; |
| 122 | } |
| 123 | |
| 124 | public void setPdcpThroughput(PDCPThroughput pdcpThroughput) { |
| 125 | this.pdcpThroughput = pdcpThroughput; |
| 126 | } |
| 127 | |
| 128 | public PDCPPacketDelay getPdcpPackDelay() { |
| 129 | return pdcpPackDelay; |
| 130 | } |
| 131 | |
| 132 | public void setPdcpPackDelay(PDCPPacketDelay pdcpPackDelay) { |
| 133 | this.pdcpPackDelay = pdcpPackDelay; |
| 134 | } |
| 135 | |
| 136 | public ResourceUsage getResourceUsage() { |
| 137 | return resourceUsage; |
| 138 | } |
| 139 | |
| 140 | public void setResourceUsage(ResourceUsage resourceUsage) { |
| 141 | this.resourceUsage = resourceUsage; |
| 142 | } |
| 143 | |
| 144 | @Override |
| 145 | public String toString() { |
| 146 | StringBuilder sb = new StringBuilder(); |
| 147 | sb.append("{\n") |
| 148 | .append(linkId != null ? "\"link-id\":" + linkId : "") |
| 149 | .append(type != null ? ",\n\"type\":" + type : "") |
| 150 | .append(rrmParameters != null ? ",\n\"rrm-params\":" + rrmParameters : "") |
| 151 | .append(trafficPercent != null ? ",\n\"traffic-percent\":" + trafficPercent : "") |
| 152 | .append(bearerParameters != null ? ",\n\"bearer-params\":" + bearerParameters : "") |
| 153 | .append(quality != null ? ",\n\"quality\":" + quality : "") |
| 154 | .append(pdcpThroughput != null ? ",\n\"pdcp-throughput\":" + pdcpThroughput : "") |
| 155 | .append(pdcpPackDelay != null ? ",\n\"pdcp-packet-delay\":" + pdcpPackDelay : "") |
| 156 | .append(resourceUsage != null ? ",\n\"resource-usage\":" + resourceUsage : "") |
| 157 | .append("\n}\n"); |
| 158 | return sb.toString(); |
| 159 | } |
| 160 | |
| 161 | @Override |
| 162 | public boolean equals(Object o) { |
| 163 | if (this == o) return true; |
| 164 | if (o == null || getClass() != o.getClass()) return false; |
| 165 | |
| 166 | RnibLink link = (RnibLink) o; |
| 167 | |
| 168 | return linkId.equals(link.linkId); |
| 169 | } |
| 170 | |
| 171 | @Override |
| 172 | public int hashCode() { |
| 173 | return linkId.hashCode(); |
| 174 | } |
| 175 | |
| 176 | public enum Type { |
| 177 | SERVING_PRIMARY { |
| 178 | @Override |
| 179 | public String toString() { |
| 180 | return "\"serving/primary\""; |
| 181 | } |
| 182 | }, |
| 183 | // TODO: Add CA/DC |
| 184 | SERVING_SECONDARY { |
| 185 | @Override |
| 186 | public String toString() { |
| 187 | return "\"serving/secondary\""; |
| 188 | } |
| 189 | }, |
| 190 | NON_SERVING { |
| 191 | @Override |
| 192 | public String toString() { |
| 193 | return "\"non-serving\""; |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | public class PDCPThroughput { |
| 199 | private PDCPMeasReportPerUe.ThroughputDl dl; |
| 200 | private PDCPMeasReportPerUe.ThroughputUl ul; |
| 201 | |
| 202 | public PDCPMeasReportPerUe.ThroughputDl getDl() { |
| 203 | return dl; |
| 204 | } |
| 205 | |
| 206 | public void setDl(PDCPMeasReportPerUe.ThroughputDl dl) { |
| 207 | this.dl = dl; |
| 208 | } |
| 209 | |
| 210 | public PDCPMeasReportPerUe.ThroughputUl getUl() { |
| 211 | return ul; |
| 212 | } |
| 213 | |
| 214 | public void setUl(PDCPMeasReportPerUe.ThroughputUl ul) { |
| 215 | this.ul = ul; |
| 216 | } |
| 217 | |
| 218 | @Override |
| 219 | public String toString() { |
| 220 | StringBuilder sb = new StringBuilder(); |
| 221 | sb.append("{\n") |
| 222 | .append(dl != null ? "\"dl\":" + dl : "") |
| 223 | .append(ul != null ? ",\n\"ul\":" + ul : "") |
| 224 | .append("\n}\n"); |
| 225 | return sb.toString(); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | public class PDCPPacketDelay { |
| 230 | PDCPMeasReportPerUe.PktDelayDl dl; |
| 231 | PDCPMeasReportPerUe.PktDelayUl ul; |
| 232 | |
| 233 | public PDCPMeasReportPerUe.PktDelayDl getDl() { |
| 234 | return dl; |
| 235 | } |
| 236 | |
| 237 | public void setDl(PDCPMeasReportPerUe.PktDelayDl dl) { |
| 238 | this.dl = dl; |
| 239 | } |
| 240 | |
| 241 | public PDCPMeasReportPerUe.PktDelayUl getUl() { |
| 242 | return ul; |
| 243 | } |
| 244 | |
| 245 | public void setUl(PDCPMeasReportPerUe.PktDelayUl ul) { |
| 246 | this.ul = ul; |
| 247 | } |
| 248 | |
| 249 | @Override |
| 250 | public String toString() { |
| 251 | StringBuilder sb = new StringBuilder(); |
| 252 | sb.append("{\n") |
| 253 | .append(dl != null ? "\"dl\":" + dl : "") |
| 254 | .append(ul != null ? ",\n\"ul\":" + ul : "") |
| 255 | .append("\n}\n"); |
| 256 | return sb.toString(); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | public class ResourceUsage { |
| 261 | PRBUsage.PrbUsageDl dl; |
| 262 | PRBUsage.PrbUsageUl ul; |
| 263 | |
| 264 | public PRBUsage.PrbUsageDl getDl() { |
| 265 | return dl; |
| 266 | } |
| 267 | |
| 268 | public void setDl(PRBUsage.PrbUsageDl dl) { |
| 269 | this.dl = dl; |
| 270 | } |
| 271 | |
| 272 | public PRBUsage.PrbUsageUl getUl() { |
| 273 | return ul; |
| 274 | } |
| 275 | |
| 276 | public void setUl(PRBUsage.PrbUsageUl ul) { |
| 277 | this.ul = ul; |
| 278 | } |
| 279 | |
| 280 | @Override |
| 281 | public String toString() { |
| 282 | StringBuilder sb = new StringBuilder(); |
| 283 | sb.append("{\n") |
| 284 | .append(dl != null ? "\"dl\":" + dl : "") |
| 285 | .append(ul != null ? ",\n\"ul\":" + ul : "") |
| 286 | .append("\n}\n"); |
| 287 | return sb.toString(); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | public class LinkQuality { |
| 292 | double rsrp; |
| 293 | double rsrq; |
| 294 | RadioRepPerServCell.CqiHist cqiHist; |
| 295 | double cqiMode; |
| 296 | double cqiMean; |
| 297 | SchedMeasRepPerServCell.McsDl mcs_dl; |
| 298 | SchedMeasRepPerServCell.McsUl mcs_ul; |
| 299 | |
| 300 | public double getRsrp() { |
| 301 | return rsrp; |
| 302 | } |
| 303 | |
| 304 | public void setRsrp(double rsrp) { |
| 305 | this.rsrp = rsrp; |
| 306 | } |
| 307 | |
| 308 | public double getRsrq() { |
| 309 | return rsrq; |
| 310 | } |
| 311 | |
| 312 | public void setRsrq(double rsrq) { |
| 313 | this.rsrq = rsrq; |
| 314 | } |
| 315 | |
| 316 | public RadioRepPerServCell.CqiHist getCqiHist() { |
| 317 | return cqiHist; |
| 318 | } |
| 319 | |
| 320 | public void setCqiHist(RadioRepPerServCell.CqiHist cqiHist) { |
| 321 | this.cqiHist = cqiHist; |
| 322 | } |
| 323 | |
| 324 | public double getCqiMode() { |
| 325 | return cqiMode; |
| 326 | } |
| 327 | |
| 328 | public void setCqiMode(double cqiMode) { |
| 329 | this.cqiMode = cqiMode; |
| 330 | } |
| 331 | |
| 332 | public double getCqiMean() { |
| 333 | return cqiMean; |
| 334 | } |
| 335 | |
| 336 | public void setCqiMean(double cqiMean) { |
| 337 | this.cqiMean = cqiMean; |
| 338 | } |
| 339 | |
| 340 | public SchedMeasRepPerServCell.McsDl getMcs_dl() { |
| 341 | return mcs_dl; |
| 342 | } |
| 343 | |
| 344 | public void setMcs_dl(SchedMeasRepPerServCell.McsDl mcs_dl) { |
| 345 | this.mcs_dl = mcs_dl; |
| 346 | } |
| 347 | |
| 348 | public SchedMeasRepPerServCell.McsUl getMcs_ul() { |
| 349 | return mcs_ul; |
| 350 | } |
| 351 | |
| 352 | public void setMcs_ul(SchedMeasRepPerServCell.McsUl mcs_ul) { |
| 353 | this.mcs_ul = mcs_ul; |
| 354 | } |
| 355 | |
| 356 | @Override |
| 357 | public String toString() { |
| 358 | StringBuilder sb = new StringBuilder(); |
| 359 | sb.append("{\n") |
| 360 | .append("\"rsrp\":" + rsrp) |
| 361 | .append(",\n\"rsrq\":" + rsrq) |
| 362 | .append(",\n\"cqiMode\":" + cqiMode) |
| 363 | .append(",\n\"cqiMean\":" + cqiMean) |
| 364 | .append(mcs_dl != null ? ",\n\"mcs-dl\":" + mcs_dl : "") |
| 365 | .append(mcs_ul != null ? ",\n\"mcs-ul\":" + mcs_ul : "") |
| 366 | .append("\n}\n"); |
| 367 | return sb.toString(); |
| 368 | } |
| 369 | } |
| 370 | } |