blob: ea9fd31d9d8681d6683e14c6c55fd5696c2bf543 [file] [log] [blame]
Gamze Abaka1e5ccf52018-07-02 11:59:03 +00001/*
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 */
16package org.opencord.sadis;
17
18import com.fasterxml.jackson.annotation.JsonProperty;
19
20import java.util.Objects;
21
22/**
Gamze Abakad46003f2021-03-03 10:37:07 +000023 * Represents bandwidth profile details such as PIR, CIR, GIR values.
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000024 */
25public class BandwidthProfileInformation extends BaseInformation {
26
Gamze Abakad46003f2021-03-03 10:37:07 +000027 @JsonProperty(value = "pir")
28 long peakInformationRate;
29
30 @JsonProperty(value = "pbs")
31 Long peakBurstSize;
32
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000033 @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 Abakad46003f2021-03-03 10:37:07 +000045 // Deprecated in VOLTHA 2.8 (sadis 5.4.0)
46 // Will be removed in 2.9, use GIR instead
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000047 @JsonProperty(value = "air")
48 long assuredInformationRate;
49
Gamze Abakad46003f2021-03-03 10:37:07 +000050 @JsonProperty(value = "gir")
51 long guaranteedInformationRate;
52
53 //note that: the burst size of guaranteed bandwidth will be always 0
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000054 //the rate information must be in Kbps and burst must be in Kbits
55
Gamze Abakad46003f2021-03-03 10:37:07 +000056 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 Abaka1e5ccf52018-07-02 11:59:03 +000072 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 Abakad46003f2021-03-03 10:37:07 +0000104 // Deprecated in VOLTHA 2.8 (sadis 5.4.0)
105 // Will be removed in 2.9, use guaranteedInformationRate instead.
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000106 public final long assuredInformationRate() {
107 return this.assuredInformationRate;
108 }
109
Gamze Abakad46003f2021-03-03 10:37:07 +0000110 // Deprecated in VOLTHA 2.8 (sadis 5.4.0)
111 // Will be removed in 2.9, use guaranteedInformationRate instead.
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000112 public final void setAssuredInformationRate(final long assuredInformationRate) {
113 this.assuredInformationRate = assuredInformationRate;
114 }
115
Gamze Abakad46003f2021-03-03 10:37:07 +0000116 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 Abaka1e5ccf52018-07-02 11:59:03 +0000124 @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 Campanellac019e162021-04-27 16:34:18 +0000133 return Objects.equals(id, that.id) &&
134 peakInformationRate == that.peakInformationRate &&
Gamze Abakad46003f2021-03-03 10:37:07 +0000135 committedInformationRate == that.committedInformationRate &&
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000136 exceededInformationRate == that.exceededInformationRate &&
137 assuredInformationRate == that.assuredInformationRate &&
Gamze Abakad46003f2021-03-03 10:37:07 +0000138 guaranteedInformationRate == that.guaranteedInformationRate &&
139 Objects.equals(peakBurstSize, that.peakBurstSize) &&
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000140 Objects.equals(committedBurstSize, that.committedBurstSize) &&
141 Objects.equals(exceededBurstSize, that.exceededBurstSize);
142 }
143
144 @Override
145 public int hashCode() {
146
Andrea Campanellac019e162021-04-27 16:34:18 +0000147 return Objects.hash(id, peakInformationRate, peakBurstSize, committedInformationRate, committedBurstSize,
Gamze Abakad46003f2021-03-03 10:37:07 +0000148 exceededInformationRate, exceededBurstSize, assuredInformationRate, guaranteedInformationRate);
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000149 }
150
151 @Override
152 public String toString() {
153 final StringBuilder sb = new StringBuilder("BandwidthProfileInformation{");
154 sb.append("id=").append(id);
Andrea Campanelladdac1a82021-05-04 11:05:34 +0200155 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 Abaka1e5ccf52018-07-02 11:59:03 +0000162 sb.append(", committedInformationRate=").append(committedInformationRate);
163 sb.append(", committedBurstSize=").append(committedBurstSize);
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000164 sb.append(", assuredInformationRate=").append(assuredInformationRate);
Gamze Abakad46003f2021-03-03 10:37:07 +0000165 sb.append(", guaranteedInformationRate=").append(guaranteedInformationRate);
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000166 sb.append('}');
167 return sb.toString();
168 }
169}