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 | /** |
| 23 | * Represents bandwidth profile details such as PIR, CIR, AIR values. |
| 24 | */ |
| 25 | public class BandwidthProfileInformation extends BaseInformation { |
| 26 | |
| 27 | @JsonProperty(value = "cir") |
| 28 | long committedInformationRate; |
| 29 | |
| 30 | @JsonProperty(value = "cbs") |
| 31 | Long committedBurstSize; |
| 32 | |
| 33 | @JsonProperty(value = "eir") |
| 34 | long exceededInformationRate; |
| 35 | |
| 36 | @JsonProperty(value = "ebs") |
| 37 | Long exceededBurstSize; |
| 38 | |
| 39 | @JsonProperty(value = "air") |
| 40 | long assuredInformationRate; |
| 41 | |
| 42 | //note that: the burst size of assured bandwidth will be always 0 |
| 43 | //the rate information must be in Kbps and burst must be in Kbits |
| 44 | |
Gamze Abaka | 1e5ccf5 | 2018-07-02 11:59:03 +0000 | [diff] [blame] | 45 | public final long committedInformationRate() { |
| 46 | return this.committedInformationRate; |
| 47 | } |
| 48 | |
| 49 | public final void setCommittedInformationRate(final long committedInformationRate) { |
| 50 | this.committedInformationRate = committedInformationRate; |
| 51 | } |
| 52 | |
| 53 | public final Long committedBurstSize() { |
| 54 | return this.committedBurstSize; |
| 55 | } |
| 56 | |
| 57 | public final void setCommittedBurstSize(final Long committedBurstSize) { |
| 58 | this.committedBurstSize = committedBurstSize; |
| 59 | } |
| 60 | |
| 61 | public final long exceededInformationRate() { |
| 62 | return this.exceededInformationRate; |
| 63 | } |
| 64 | |
| 65 | public final void setExceededInformationRate(final long exceededInformationRate) { |
| 66 | this.exceededInformationRate = exceededInformationRate; |
| 67 | } |
| 68 | |
| 69 | public final Long exceededBurstSize() { |
| 70 | return this.exceededBurstSize; |
| 71 | } |
| 72 | |
| 73 | public final void setExceededBurstSize(final Long exceededBurstSize) { |
| 74 | this.exceededBurstSize = exceededBurstSize; |
| 75 | } |
| 76 | |
| 77 | public final long assuredInformationRate() { |
| 78 | return this.assuredInformationRate; |
| 79 | } |
| 80 | |
| 81 | public final void setAssuredInformationRate(final long assuredInformationRate) { |
| 82 | this.assuredInformationRate = assuredInformationRate; |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public boolean equals(Object o) { |
| 87 | if (this == o) { |
| 88 | return true; |
| 89 | } |
| 90 | if (o == null || getClass() != o.getClass()) { |
| 91 | return false; |
| 92 | } |
| 93 | BandwidthProfileInformation that = (BandwidthProfileInformation) o; |
| 94 | return committedInformationRate == that.committedInformationRate && |
| 95 | exceededInformationRate == that.exceededInformationRate && |
| 96 | assuredInformationRate == that.assuredInformationRate && |
| 97 | Objects.equals(committedBurstSize, that.committedBurstSize) && |
| 98 | Objects.equals(exceededBurstSize, that.exceededBurstSize); |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | public int hashCode() { |
| 103 | |
| 104 | return Objects.hash(committedInformationRate, committedBurstSize, exceededInformationRate, exceededBurstSize, |
| 105 | assuredInformationRate); |
| 106 | } |
| 107 | |
| 108 | @Override |
| 109 | public String toString() { |
| 110 | final StringBuilder sb = new StringBuilder("BandwidthProfileInformation{"); |
| 111 | sb.append("id=").append(id); |
| 112 | sb.append(", committedInformationRate=").append(committedInformationRate); |
| 113 | sb.append(", committedBurstSize=").append(committedBurstSize); |
| 114 | sb.append(", exceededInformationRate=").append(exceededInformationRate); |
| 115 | sb.append(", exceededBurstSize=").append(exceededBurstSize); |
| 116 | sb.append(", assuredInformationRate=").append(assuredInformationRate); |
| 117 | sb.append('}'); |
| 118 | return sb.toString(); |
| 119 | } |
| 120 | } |