blob: 65e7ca3c3fada0ed33e08f590819b290bef04f89 [file] [log] [blame]
Jonghwan Hyuna76bf032018-04-09 09:40:50 -07001/*
2 * Copyright 2016-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.onosproject.segmentrouting.storekey;
17
18import org.onlab.packet.IpAddress;
19import org.onosproject.net.ConnectPoint;
20
21import java.util.Objects;
22
23import static com.google.common.base.MoreObjects.toStringHelper;
24
25/**
26 * Key of VLAN ID to DummyVlanIdStore.
27 */
28public class DummyVlanIdStoreKey {
29 private final ConnectPoint connectPoint;
30 private final IpAddress ipAddress;
31
32 /**
33 * Construct the key of dummy vlan id key store.
34 *
35 * @param connectPoint connect point that this vlan id is associated
36 * @param ipAddress IP address that this vlan id is associated
37 */
38 public DummyVlanIdStoreKey(ConnectPoint connectPoint, IpAddress ipAddress) {
39 this.connectPoint = connectPoint;
40 this.ipAddress = ipAddress;
41 }
42
43 /**
44 * Returns the connect point in the key.
45 *
46 * @return connect point
47 */
48 public ConnectPoint connectPoint() {
49 return connectPoint;
50 }
51
52 /**
53 * Returns the IP address in the key.
54 *
55 * @return IP address
56 */
57 public IpAddress ipAddress() {
58 return ipAddress;
59 }
60
61 @Override
62 public boolean equals(Object o) {
63 if (this == o) {
64 return true;
65 }
66 if (!(o instanceof DummyVlanIdStoreKey)) {
67 return false;
68 }
69 DummyVlanIdStoreKey that = (DummyVlanIdStoreKey) o;
70 return (Objects.equals(this.connectPoint, that.connectPoint) &&
71 Objects.equals(this.ipAddress, that.ipAddress));
72 }
73
74 @Override
75 public int hashCode() {
76 return Objects.hash(connectPoint, ipAddress);
77 }
78
79 @Override
80 public String toString() {
81 return toStringHelper(getClass())
82 .add("connectPoint", connectPoint)
83 .add("ipAddress", ipAddress)
84 .toString();
85 }
86}