blob: f57a75f88c7181df2aae55092b585f2b2c9ebf13 [file] [log] [blame]
Aihua Guo1ce2dd12016-08-12 23:37:44 -04001/*
2 * Copyright 2016 Open Networking Laboratory
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.tetopology.management.api.link;
17
18import java.util.List;
19import java.util.Objects;
20
21import org.onosproject.tetopology.management.api.node.TeNetworkTopologyId;
22
23import com.google.common.base.MoreObjects;
24
25/**
26 * Represents the common defintion of an underlay path that supports a TE link.
27 */
28public class UnderlayAbstractPath {
29 private TeNetworkTopologyId ref;
30 private List<PathElement> pathElements;
31
32 /**
33 * Creates an instance of UnderlayAbstractPath.
34 */
35 public UnderlayAbstractPath() {
36 }
37
38 /**
39 * Sets the TE Topology reference.
40 *
41 * @param ref the ref to set
42 */
43 public void setRef(TeNetworkTopologyId ref) {
44 this.ref = ref;
45 }
46
47 /**
48 * Sets the list of path elements.
49 *
50 * @param pathElements the pathElement to set
51 */
52 public void setPathElement(List<PathElement> pathElements) {
53 this.pathElements = pathElements;
54 }
55
56 /**
57 * Returns the TE Topology reference.
58 *
59 * @return value of TE network topology identifier
60 */
61 public TeNetworkTopologyId ref() {
62 return ref;
63 }
64
65 /**
66 * Returns the list of path elements.
67 *
68 * @return list of path elements
69 */
70 public List<PathElement> pathElements() {
71 return pathElements;
72 }
73
74 @Override
75 public int hashCode() {
76 return Objects.hash(ref, pathElements);
77 }
78
79 @Override
80 public boolean equals(Object obj) {
81 if (this == obj) {
82 return true;
83 }
84 if (obj instanceof UnderlayAbstractPath) {
85 UnderlayAbstractPath other = (UnderlayAbstractPath) obj;
86 return Objects.equals(ref, other.ref) &&
87 Objects.equals(pathElements, other.pathElements);
88 }
89 return false;
90 }
91
92 @Override
93 public String toString() {
94 return MoreObjects.toStringHelper(getClass())
95 .add("ref", ref)
96 .add("pathElements", pathElements)
97 .toString();
98 }
99}