blob: 49a4a34e9a1fe4eeec4e2f9238e688d24525cbb3 [file] [log] [blame]
Andrea Campanella0c3309d2020-05-29 01:51:18 -07001/*
2 * Copyright 2020-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.olt.impl;
17
18import org.onosproject.net.DeviceId;
19import org.opencord.sadis.BandwidthProfileInformation;
20
21import java.util.Objects;
22
23/**
24 * Class containing a mapping of DeviceId to BandwidthProfileInformation.
25 */
26class DeviceBandwidthProfile {
27 private final DeviceId devId;
28 private BandwidthProfileInformation bwInfo;
29
30 /**
31 * Creates the Mapping.
32 *
33 * @param devId the device id
34 * @param bwInfo the bandwidth profile information
35 */
36 DeviceBandwidthProfile(DeviceId devId, BandwidthProfileInformation bwInfo) {
37 this.devId = devId;
38 this.bwInfo = bwInfo;
39 }
40
41 /**
42 * Returns the device id.
43 *
44 * @return device id.
45 */
46 DeviceId getDevId() {
47 return devId;
48 }
49
50 /**
51 * Returns the Bandwidth profile for this device.
52 *
53 * @return bandwidth profile information
54 */
55 BandwidthProfileInformation getBwInfo() {
56 return bwInfo;
57 }
58
59 @Override
60 public boolean equals(Object o) {
61 if (this == o) {
62 return true;
63 }
64 if (o == null || getClass() != o.getClass()) {
65 return false;
66 }
67 DeviceBandwidthProfile that = (DeviceBandwidthProfile) o;
68 return devId.equals(that.devId)
69 && bwInfo.equals(that.bwInfo);
70 }
71
72 @Override
73 public int hashCode() {
74 return Objects.hash(devId, bwInfo);
75 }
76
77 @Override
78 public String toString() {
79 return com.google.common.base.MoreObjects.toStringHelper(this)
80 .add("devId", devId)
81 .add("bwInfo", bwInfo)
82 .toString();
83 }
84}