blob: 510b617854e3799ce307ca6f3553829f9a449c18 [file] [log] [blame]
Matteo Scandoloaa2adde2021-09-13 12:45:32 -07001/*
2 * Copyright 2021-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
Gustavo Silva29fb20e2022-05-26 09:59:54 -030017package org.opencord.olt;
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070018
19import org.onosproject.net.meter.MeterCellId;
20import org.onosproject.net.meter.MeterId;
21import org.onosproject.net.meter.MeterState;
22
23import java.util.Objects;
24
25/**
26 * Class containing Meter Data.
27 */
28public class MeterData {
29 private MeterCellId meterCellId;
30 private MeterState meterStatus;
31 private String bandwidthProfileName;
32
Gustavo Silva29fb20e2022-05-26 09:59:54 -030033 /**
34 * Creates a MeterData for a given cellid, status and bandwidth profile.
35 *
36 * @param meterCellId the cell id
37 * @param meterStatus the status
38 * @param bandwidthProfile the bandwidth profile
39 */
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070040 public MeterData(MeterCellId meterCellId, MeterState meterStatus, String bandwidthProfile) {
41 this.meterCellId = meterCellId;
42 this.meterStatus = meterStatus;
43 this.bandwidthProfileName = bandwidthProfile;
44 }
45
Gustavo Silva29fb20e2022-05-26 09:59:54 -030046 /**
47 * Sets the meter cell id.
48 *
49 * @param meterCellId the meter cell id.
50 */
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070051 public void setMeterCellId(MeterCellId meterCellId) {
52 this.meterCellId = meterCellId;
53 }
54
Gustavo Silva29fb20e2022-05-26 09:59:54 -030055 /**
56 * Sets the meter status.
57 *
58 * @param meterStatus the meter status.
59 */
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070060 public void setMeterStatus(MeterState meterStatus) {
61 this.meterStatus = meterStatus;
62 }
63
Gustavo Silva29fb20e2022-05-26 09:59:54 -030064 /**
65 * Gets the meter id.
66 *
67 * @return Meter id.
68 */
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070069 public MeterId getMeterId() {
70 return (MeterId) meterCellId;
71 }
72
Gustavo Silva29fb20e2022-05-26 09:59:54 -030073 /**
74 * Gets the meter cell id.
75 *
76 * @return Meter cell id.
77 */
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070078 public MeterCellId getMeterCellId() {
79 return meterCellId;
80 }
81
Gustavo Silva29fb20e2022-05-26 09:59:54 -030082 /**
83 * Gets the meter status.
84 *
85 * @return Meter status.
86 */
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070087 public MeterState getMeterStatus() {
88 return meterStatus;
89 }
90
Gustavo Silva29fb20e2022-05-26 09:59:54 -030091 /**
92 * Gets the bandwidth profile name.
93 *
94 * @return Bandwidth profile name.
95 */
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070096 public String getBandwidthProfileName() {
97 return bandwidthProfileName;
98 }
99
100 @Override
101 public boolean equals(Object o) {
102 if (this == o) {
103 return true;
104 }
105 if (o == null || getClass() != o.getClass()) {
106 return false;
107 }
108 MeterData meterData = (MeterData) o;
109 return Objects.equals(meterCellId, meterData.meterCellId) &&
110 meterStatus == meterData.meterStatus &&
111 Objects.equals(bandwidthProfileName, meterData.bandwidthProfileName);
112 }
113
114 @Override
115 public int hashCode() {
116 return Objects.hash(meterCellId, meterStatus, bandwidthProfileName);
117 }
118
119 @Override
120 public String toString() {
121 return "MeterData{" +
122 "meterCellId=" + meterCellId +
123 ", meterStatus=" + meterStatus +
124 ", bandwidthProfile='" + bandwidthProfileName + '\'' +
125 '}';
126 }
127}