blob: 846a8d1b8b7a8da9c401a8c01c0233e5e8ecad71 [file] [log] [blame]
Jonathan Harte9c0c6e2017-08-09 16:44:13 -07001/*
2 * Copyright 2017-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
Ray Milkeya95193c2017-08-10 15:35:36 -070017package org.onosproject.evpnrouteservice;
Jonathan Harte9c0c6e2017-08-09 16:44:13 -070018
19import java.util.Objects;
20
21/**
22 * Identifier for an EVPN routing table.
23 */
24public class EvpnRouteTableId {
25 private final String name;
26
27 /**
28 * Creates a new route table ID.
29 *
30 * @param name unique name for the route table
31 */
32 public EvpnRouteTableId(String name) {
33 this.name = name;
34 }
35
36 /**
37 * Returns the name of the route table.
38 *
39 * @return table name
40 */
41 public String name() {
42 return name;
43 }
44
45 @Override
46 public boolean equals(Object obj) {
47 if (this == obj) {
48 return true;
49 }
50
51 if (obj instanceof EvpnRouteTableId) {
52 EvpnRouteTableId that = (EvpnRouteTableId) obj;
53
54 return Objects.equals(this.name, that.name);
55 }
56 return false;
57 }
58
59 @Override
60 public int hashCode() {
61 return Objects.hash(name);
62 }
63
64 @Override
65 public String toString() {
66 return name;
67 }
68}