blob: a3d4e9d07d221fa8a92dede3e622007771a1300c [file] [log] [blame]
Tunahan Sezen03e55272020-04-18 09:18:53 +00001/*
Joey Armstrong53fcac22023-01-11 13:25:01 -05002 * Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
Tunahan Sezen03e55272020-04-18 09:18:53 +00003 *
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.maclearner.api;
17
18import org.onlab.packet.MacAddress;
19
20import java.util.Objects;
21
22/**
23 * Value of Mac Address Map which keeps a timestamp via Mac Address.
24 */
25public class MacLearnerValue {
26
27 private MacAddress macAddress;
28 private long timestamp;
29
30 public MacAddress getMacAddress() {
31 return macAddress;
32 }
33
34 public void setMacAddress(MacAddress macAddress) {
35 this.macAddress = macAddress;
36 }
37
38 public long getTimestamp() {
39 return timestamp;
40 }
41
42 public void setTimestamp(long timestamp) {
43 this.timestamp = timestamp;
44 }
45
46 public MacLearnerValue(MacAddress macAddress, long timestamp) {
47 this.macAddress = macAddress;
48 this.timestamp = timestamp;
49 }
50
51 @Override
52 public String toString() {
53 return "MacLearnerValue{" +
54 "macAddress=" + macAddress +
55 ", timestamp=" + timestamp +
56 '}';
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 MacLearnerValue that = (MacLearnerValue) o;
68 return timestamp == that.timestamp &&
69 Objects.equals(macAddress, that.macAddress);
70 }
71
72 @Override
73 public int hashCode() {
74 return Objects.hash(macAddress, timestamp);
75 }
76
77}