blob: 420b5deb51474f7bdbd19f5ac4e85bc820502139 [file] [log] [blame]
sunish vk7bdf4d42016-06-24 12:29:43 +05301/*
Brian O'Connor0a4e6742016-09-15 23:03:10 -07002 * Copyright 2016-present Open Networking Laboratory
sunish vk7bdf4d42016-06-24 12:29:43 +05303 *
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.isis.controller.impl.topology;
18
19import com.google.common.base.MoreObjects;
20import com.google.common.base.Objects;
21import org.onlab.packet.Ip4Address;
22import org.onosproject.isis.controller.topology.IsisLink;
23import org.onosproject.isis.controller.topology.IsisLinkTed;
24
25/**
26 * Representation of an ISIS Link.
27 */
28public class DefaultIsisLink implements IsisLink {
29
30 private String remoteSystemId;
31 private String localSystemId;
32 private Ip4Address interfaceIp;
33 private Ip4Address neighborIp;
34 private IsisLinkTed linkTed;
35
36 @Override
37 public String remoteSystemId() {
38 return this.remoteSystemId;
39 }
40
41 @Override
42 public String localSystemId() {
43 return this.localSystemId;
44 }
45
46 @Override
47 public Ip4Address interfaceIp() {
48 return this.interfaceIp;
49 }
50
51 @Override
52 public Ip4Address neighborIp() {
53 return this.neighborIp;
54 }
55
56 @Override
57 public IsisLinkTed linkTed() {
58 return this.linkTed;
59 }
60
61 @Override
62 public void setRemoteSystemId(String remoteSystemId) {
63 this.remoteSystemId = remoteSystemId;
64 }
65
66 @Override
67 public void setLocalSystemId(String localSystemId) {
68 this.localSystemId = localSystemId;
69 }
70
71 @Override
72 public void setInterfaceIp(Ip4Address interfaceIp) {
73 this.interfaceIp = interfaceIp;
74 }
75
76 @Override
77 public void setNeighborIp(Ip4Address neighborIp) {
78 this.neighborIp = neighborIp;
79 }
80
81 @Override
82 public void setLinkTed(IsisLinkTed linkTed) {
83 this.linkTed = linkTed;
84 }
85
86 @Override
87 public String toString() {
88 return MoreObjects.toStringHelper(getClass())
89 .omitNullValues()
90 .add("remoteSystemId", remoteSystemId)
91 .add("localSystemId", localSystemId)
92 .add("interfaceIp", interfaceIp)
93 .add("neighborIp", neighborIp)
94 .add("linkTed", linkTed)
95 .toString();
96 }
97
98 @Override
99 public boolean equals(Object o) {
100 if (this == o) {
101 return true;
102 }
103 if (o == null || getClass() != o.getClass()) {
104 return false;
105 }
106 DefaultIsisLink that = (DefaultIsisLink) o;
107 return Objects.equal(remoteSystemId, that.remoteSystemId) &&
108 Objects.equal(localSystemId, that.localSystemId) &&
109 Objects.equal(interfaceIp, that.interfaceIp) &&
110 Objects.equal(neighborIp, that.neighborIp) &&
111 Objects.equal(linkTed, that.linkTed);
112 }
113
114 @Override
115 public int hashCode() {
116 return Objects.hashCode(remoteSystemId, localSystemId, interfaceIp, neighborIp, linkTed);
117 }
118}