Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | package org.opencord.sadis; |
| 17 | |
| 18 | import com.fasterxml.jackson.annotation.JsonProperty; |
| 19 | |
| 20 | import java.util.Objects; |
| 21 | |
| 22 | /** |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 23 | * Represents bandwidth profile details such as PIR, CIR, GIR values. |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 24 | */ |
| 25 | public class BandwidthProfileInformation extends BaseInformation { |
| 26 | |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 27 | @JsonProperty(value = "pir") |
| 28 | long peakInformationRate; |
| 29 | |
| 30 | @JsonProperty(value = "pbs") |
| 31 | Long peakBurstSize; |
| 32 | |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 33 | @JsonProperty(value = "cir") |
| 34 | long committedInformationRate; |
| 35 | |
| 36 | @JsonProperty(value = "cbs") |
| 37 | Long committedBurstSize; |
| 38 | |
| 39 | @JsonProperty(value = "eir") |
| 40 | long exceededInformationRate; |
| 41 | |
| 42 | @JsonProperty(value = "ebs") |
| 43 | Long exceededBurstSize; |
| 44 | |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 45 | // Deprecated in VOLTHA 2.8 (sadis 5.4.0) |
| 46 | // Will be removed in 2.9, use GIR instead |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 47 | @JsonProperty(value = "air") |
| 48 | long assuredInformationRate; |
| 49 | |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 50 | @JsonProperty(value = "gir") |
| 51 | long guaranteedInformationRate; |
| 52 | |
| 53 | //note that: the burst size of guaranteed bandwidth will be always 0 |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 54 | //the rate information must be in Kbps and burst must be in Kbits |
| 55 | |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 56 | public final long peakInformationRate() { |
| 57 | return this.peakInformationRate; |
| 58 | } |
| 59 | |
| 60 | public final void setPeakInformationRate(final long peakInformationRate) { |
| 61 | this.peakInformationRate = peakInformationRate; |
| 62 | } |
| 63 | |
| 64 | public final Long peakBurstSize() { |
| 65 | return this.peakBurstSize; |
| 66 | } |
| 67 | |
| 68 | public final void setPeakBurstSize(final Long peakBurstSize) { |
| 69 | this.peakBurstSize = peakBurstSize; |
| 70 | } |
| 71 | |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 72 | public final long committedInformationRate() { |
| 73 | return this.committedInformationRate; |
| 74 | } |
| 75 | |
| 76 | public final void setCommittedInformationRate(final long committedInformationRate) { |
| 77 | this.committedInformationRate = committedInformationRate; |
| 78 | } |
| 79 | |
| 80 | public final Long committedBurstSize() { |
| 81 | return this.committedBurstSize; |
| 82 | } |
| 83 | |
| 84 | public final void setCommittedBurstSize(final Long committedBurstSize) { |
| 85 | this.committedBurstSize = committedBurstSize; |
| 86 | } |
| 87 | |
| 88 | public final long exceededInformationRate() { |
| 89 | return this.exceededInformationRate; |
| 90 | } |
| 91 | |
| 92 | public final void setExceededInformationRate(final long exceededInformationRate) { |
| 93 | this.exceededInformationRate = exceededInformationRate; |
| 94 | } |
| 95 | |
| 96 | public final Long exceededBurstSize() { |
| 97 | return this.exceededBurstSize; |
| 98 | } |
| 99 | |
| 100 | public final void setExceededBurstSize(final Long exceededBurstSize) { |
| 101 | this.exceededBurstSize = exceededBurstSize; |
| 102 | } |
| 103 | |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 104 | // Deprecated in VOLTHA 2.8 (sadis 5.4.0) |
| 105 | // Will be removed in 2.9, use guaranteedInformationRate instead. |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 106 | public final long assuredInformationRate() { |
| 107 | return this.assuredInformationRate; |
| 108 | } |
| 109 | |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 110 | // Deprecated in VOLTHA 2.8 (sadis 5.4.0) |
| 111 | // Will be removed in 2.9, use guaranteedInformationRate instead. |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 112 | public final void setAssuredInformationRate(final long assuredInformationRate) { |
| 113 | this.assuredInformationRate = assuredInformationRate; |
| 114 | } |
| 115 | |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 116 | public final long guaranteedInformationRate() { |
| 117 | return this.guaranteedInformationRate; |
| 118 | } |
| 119 | |
| 120 | public final void setGuaranteedInformationRate(final long guaranteedInformationRate) { |
| 121 | this.guaranteedInformationRate = guaranteedInformationRate; |
| 122 | } |
| 123 | |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 124 | @Override |
| 125 | public boolean equals(Object o) { |
| 126 | if (this == o) { |
| 127 | return true; |
| 128 | } |
| 129 | if (o == null || getClass() != o.getClass()) { |
| 130 | return false; |
| 131 | } |
| 132 | BandwidthProfileInformation that = (BandwidthProfileInformation) o; |
Andrea Campanella | c019e16 | 2021-04-27 16:34:18 +0000 | [diff] [blame] | 133 | return Objects.equals(id, that.id) && |
| 134 | peakInformationRate == that.peakInformationRate && |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 135 | committedInformationRate == that.committedInformationRate && |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 136 | exceededInformationRate == that.exceededInformationRate && |
| 137 | assuredInformationRate == that.assuredInformationRate && |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 138 | guaranteedInformationRate == that.guaranteedInformationRate && |
| 139 | Objects.equals(peakBurstSize, that.peakBurstSize) && |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 140 | Objects.equals(committedBurstSize, that.committedBurstSize) && |
| 141 | Objects.equals(exceededBurstSize, that.exceededBurstSize); |
| 142 | } |
| 143 | |
| 144 | @Override |
| 145 | public int hashCode() { |
| 146 | |
Andrea Campanella | c019e16 | 2021-04-27 16:34:18 +0000 | [diff] [blame] | 147 | return Objects.hash(id, peakInformationRate, peakBurstSize, committedInformationRate, committedBurstSize, |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 148 | exceededInformationRate, exceededBurstSize, assuredInformationRate, guaranteedInformationRate); |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | @Override |
| 152 | public String toString() { |
| 153 | final StringBuilder sb = new StringBuilder("BandwidthProfileInformation{"); |
| 154 | sb.append("id=").append(id); |
Andrea Campanella | ddac1a8 | 2021-05-04 11:05:34 +0200 | [diff] [blame^] | 155 | if (peakInformationRate == 0 && peakBurstSize == null) { |
| 156 | sb.append(", exceededInformationRate=").append(exceededInformationRate); |
| 157 | sb.append(", exceededBurstSize=").append(exceededBurstSize); |
| 158 | } else { |
| 159 | sb.append(", peakInformationRate=").append(peakInformationRate); |
| 160 | sb.append(", peakBurstSize=").append(peakBurstSize); |
| 161 | } |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 162 | sb.append(", committedInformationRate=").append(committedInformationRate); |
| 163 | sb.append(", committedBurstSize=").append(committedBurstSize); |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 164 | sb.append(", assuredInformationRate=").append(assuredInformationRate); |
Gamze Abaka | d46003f | 2021-03-03 10:37:07 +0000 | [diff] [blame] | 165 | sb.append(", guaranteedInformationRate=").append(guaranteedInformationRate); |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 166 | sb.append('}'); |
| 167 | return sb.toString(); |
| 168 | } |
| 169 | } |