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 | |
| 45 | protected BandwidthProfileInformation() { |
| 46 | } |
| 47 | |
| 48 | public final long committedInformationRate() { |
| 49 | return this.committedInformationRate; |
| 50 | } |
| 51 | |
| 52 | public final void setCommittedInformationRate(final long committedInformationRate) { |
| 53 | this.committedInformationRate = committedInformationRate; |
| 54 | } |
| 55 | |
| 56 | public final Long committedBurstSize() { |
| 57 | return this.committedBurstSize; |
| 58 | } |
| 59 | |
| 60 | public final void setCommittedBurstSize(final Long committedBurstSize) { |
| 61 | this.committedBurstSize = committedBurstSize; |
| 62 | } |
| 63 | |
| 64 | public final long exceededInformationRate() { |
| 65 | return this.exceededInformationRate; |
| 66 | } |
| 67 | |
| 68 | public final void setExceededInformationRate(final long exceededInformationRate) { |
| 69 | this.exceededInformationRate = exceededInformationRate; |
| 70 | } |
| 71 | |
| 72 | public final Long exceededBurstSize() { |
| 73 | return this.exceededBurstSize; |
| 74 | } |
| 75 | |
| 76 | public final void setExceededBurstSize(final Long exceededBurstSize) { |
| 77 | this.exceededBurstSize = exceededBurstSize; |
| 78 | } |
| 79 | |
| 80 | public final long assuredInformationRate() { |
| 81 | return this.assuredInformationRate; |
| 82 | } |
| 83 | |
| 84 | public final void setAssuredInformationRate(final long assuredInformationRate) { |
| 85 | this.assuredInformationRate = assuredInformationRate; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public boolean equals(Object o) { |
| 90 | if (this == o) { |
| 91 | return true; |
| 92 | } |
| 93 | if (o == null || getClass() != o.getClass()) { |
| 94 | return false; |
| 95 | } |
| 96 | BandwidthProfileInformation that = (BandwidthProfileInformation) o; |
| 97 | return committedInformationRate == that.committedInformationRate && |
| 98 | exceededInformationRate == that.exceededInformationRate && |
| 99 | assuredInformationRate == that.assuredInformationRate && |
| 100 | Objects.equals(committedBurstSize, that.committedBurstSize) && |
| 101 | Objects.equals(exceededBurstSize, that.exceededBurstSize); |
| 102 | } |
| 103 | |
| 104 | @Override |
| 105 | public int hashCode() { |
| 106 | |
| 107 | return Objects.hash(committedInformationRate, committedBurstSize, exceededInformationRate, exceededBurstSize, |
| 108 | assuredInformationRate); |
| 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public String toString() { |
| 113 | final StringBuilder sb = new StringBuilder("BandwidthProfileInformation{"); |
| 114 | sb.append("id=").append(id); |
| 115 | sb.append(", committedInformationRate=").append(committedInformationRate); |
| 116 | sb.append(", committedBurstSize=").append(committedBurstSize); |
| 117 | sb.append(", exceededInformationRate=").append(exceededInformationRate); |
| 118 | sb.append(", exceededBurstSize=").append(exceededBurstSize); |
| 119 | sb.append(", assuredInformationRate=").append(assuredInformationRate); |
| 120 | sb.append('}'); |
| 121 | return sb.toString(); |
| 122 | } |
| 123 | } |