blob: 5d9f2fd15f95fd7a636b6cdc045fe35438bf3b92 [file] [log] [blame]
Charles Chan59cc16d2017-02-02 16:20:42 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Charles Chan59cc16d2017-02-02 16:20:42 -08003 *
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
17package org.onosproject.segmentrouting.storekey;
18
19import org.onlab.packet.VlanId;
20import org.onosproject.net.DeviceId;
21
22import java.util.Objects;
23
24/**
25 * Key of VLAN to NextObjective store.
26 */
27public class VlanNextObjectiveStoreKey {
28 private final DeviceId deviceId;
29 private final VlanId vlanId;
30
31 /**
32 * Constructs the key of VLAN next objective store.
33 *
34 * @param deviceId device ID
35 * @param vlanId VLAN information
36 */
37 public VlanNextObjectiveStoreKey(DeviceId deviceId,
38 VlanId vlanId) {
39 this.deviceId = deviceId;
40 this.vlanId = vlanId;
41 }
42
43 /**
44 * Gets device id in this VlanNextObjectiveStoreKey.
45 *
46 * @return device id
47 */
48 public DeviceId deviceId() {
49 return this.deviceId;
50 }
51
52 /**
53 * Gets vlan information in this VlanNextObjectiveStoreKey.
54 *
55 * @return vlan id
56 */
57 public VlanId vlanId() {
58 return this.vlanId;
59 }
60
61 @Override
62 public boolean equals(Object o) {
63 if (this == o) {
64 return true;
65 }
66 if (!(o instanceof VlanNextObjectiveStoreKey)) {
67 return false;
68 }
69 VlanNextObjectiveStoreKey that =
70 (VlanNextObjectiveStoreKey) o;
71 return (Objects.equals(this.deviceId, that.deviceId) &&
72 Objects.equals(this.vlanId, that.vlanId));
73 }
74
75 @Override
76 public int hashCode() {
77 return Objects.hash(deviceId, vlanId);
78 }
79
80 @Override
81 public String toString() {
82 return "deviceId: " + deviceId + " vlanId: " + vlanId;
83 }
84}