blob: 350f3d5b940cc0cd077672aeb17fd7026aca60c4 [file] [log] [blame]
David K. Bainbridgeeda2b052017-07-12 09:41:04 -07001/*
Brian O'Connor180c1092017-08-03 22:46:14 -07002 * Copyright 2017-present Open Networking Foundation
David K. Bainbridgeeda2b052017-07-12 09:41:04 -07003 *
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.opencord.sadis;
17
Amit Ghosh38b232a2017-07-23 15:11:56 +010018import org.onlab.packet.Ip4Address;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070019import org.onlab.packet.MacAddress;
amit.ghosh3b225bb2022-02-17 18:41:00 +010020import org.onlab.packet.VlanId;
21
Matteo Scandoloe4f4b632020-01-07 23:54:35 +000022import com.fasterxml.jackson.annotation.JsonProperty;
Daniele Moro82d9a362019-11-06 23:51:20 +000023
Matteo Scandolo198aef92020-01-08 00:43:17 +000024import java.util.List;
amit.ghosh3b225bb2022-02-17 18:41:00 +010025import java.util.Objects;
Matteo Scandolo198aef92020-01-08 00:43:17 +000026
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070027/**
28 * Represents a unit of information about a subscriber or access device.
29 */
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000030public class SubscriberAndDeviceInformation extends BaseInformation {
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070031
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070032 @JsonProperty(value = "nasPortId")
33 String nasPortId;
34
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000035 @JsonProperty(value = "uplinkPort")
36 int uplinkPort = -1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070037
38 @JsonProperty(value = "slot")
Amit Ghosh38b232a2017-07-23 15:11:56 +010039 int slot = -1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070040
41 @JsonProperty(value = "hardwareIdentifier")
42 MacAddress hardwareIdentifier;
43
Amit Ghosh38b232a2017-07-23 15:11:56 +010044 @JsonProperty(value = "ipAddress")
45 Ip4Address ipAddress;
46
47 @JsonProperty(value = "nasId")
48 String nasId;
49
David K. Bainbridge8bf98e02017-08-07 10:41:56 -070050 @JsonProperty(value = "circuitId")
51 String circuitId;
52
53 @JsonProperty(value = "remoteId")
54 String remoteId;
55
amit.ghosh3b225bb2022-02-17 18:41:00 +010056 @JsonProperty(value = "nniDhcpTrapVid")
57 VlanId nniDhcpTrapVid = VlanId.vlanId(VlanId.NO_VID);
58
Matteo Scandolo198aef92020-01-08 00:43:17 +000059 @JsonProperty(value = "uniTagList")
60 List<UniTagInformation> uniTagList;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000061
Matteo Scandolo198aef92020-01-08 00:43:17 +000062 public SubscriberAndDeviceInformation() {
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070063 }
64
65 public final String nasPortId() {
66 return this.nasPortId;
67 }
68
69 public final void setNasPortId(final String nasPortId) {
70 this.nasPortId = nasPortId;
71 }
72
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000073 public final int uplinkPort() {
74 return this.uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070075 }
76
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000077 public final void setUplinkPort(final int uplinkPort) {
78 this.uplinkPort = uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070079 }
80
81 public final int slot() {
82 return this.slot;
83 }
84
85 public final void setSlot(final int slot) {
86 this.slot = slot;
87 }
88
89 public final MacAddress hardwareIdentifier() {
90 return this.hardwareIdentifier;
91 }
92
93 public final void setHardwareIdentifier(final MacAddress hardwareIdentifier) {
94 this.hardwareIdentifier = hardwareIdentifier;
95 }
96
Amit Ghosh38b232a2017-07-23 15:11:56 +010097 public final Ip4Address ipAddress() {
98 return this.ipAddress;
99 }
100
101 public final void setIPAddress(final Ip4Address ipAddress) {
102 this.ipAddress = ipAddress;
103 }
104
105 public final String nasId() {
106 return this.nasId;
107 }
108
109 public final void setNasId(final String nasId) {
110 this.nasId = nasId;
111 }
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700112
113 public final String circuitId() {
114 return this.circuitId;
115 }
116
117 public final void setCircuitId(final String circuitId) {
118 this.circuitId = circuitId;
119 }
120
121 public final String remoteId() {
122 return this.remoteId;
123 }
124
125 public final void setRemoteId(final String remoteId) {
126 this.remoteId = remoteId;
127 }
128
amit.ghosh3b225bb2022-02-17 18:41:00 +0100129 public final VlanId nniDhcpTrapVid() {
130 return this.nniDhcpTrapVid;
131 }
132
133 public final void setNniDhcpTrapVid(final VlanId vid) {
134 this.nniDhcpTrapVid = vid;
135 }
136
Matteo Scandolo198aef92020-01-08 00:43:17 +0000137 public final List<UniTagInformation> uniTagList() {
138 return this.uniTagList;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000139 }
140
Matteo Scandolo198aef92020-01-08 00:43:17 +0000141 public final void setUniTagList(final List<UniTagInformation> uniTagList) {
142 this.uniTagList = uniTagList;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000143 }
144
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000145
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700146 /*
147 * (non-Javadoc)
148 *
149 * @see java.lang.Object#hashCode()
150 */
151 @Override
152 public int hashCode() {
153 final int prime = 31;
154 int result = 1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700155 result = prime * result + (this.hardwareIdentifier == null ? 0 : this.hardwareIdentifier.hashCode());
156 result = prime * result + (this.id == null ? 0 : this.id.hashCode());
157 result = prime * result + (this.nasPortId == null ? 0 : this.nasPortId.hashCode());
Amit Ghoshd5d60cf2017-11-09 11:00:09 +0000158 result = prime * result + this.uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700159 result = prime * result + this.slot;
Amit Ghosh38b232a2017-07-23 15:11:56 +0100160 result = prime * result + (this.ipAddress == null ? 0 : this.ipAddress.hashCode());
161 result = prime * result + (this.nasId == null ? 0 : this.nasId.hashCode());
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700162 result = prime + result + (this.circuitId == null ? 0 : this.circuitId.hashCode());
163 result = prime + result + (this.remoteId == null ? 0 : this.remoteId.hashCode());
Matteo Scandolo198aef92020-01-08 00:43:17 +0000164 result = prime + result + (this.uniTagList == null ? 0 : this.uniTagList.hashCode());
amit.ghosh3b225bb2022-02-17 18:41:00 +0100165 result = prime + result + (this.nniDhcpTrapVid != null ? this.nniDhcpTrapVid.hashCode() : 0);
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700166 return result;
167 }
168
169 /*
170 * (non-Javadoc)
171 *
172 * @see java.lang.Object#equals(java.lang.Object)
173 */
174 @Override
175 public boolean equals(final Object obj) {
176 if (this == obj) {
177 return true;
178 }
179 if (obj == null) {
180 return false;
181 }
182 if (this.getClass() != obj.getClass()) {
183 return false;
184 }
185 final SubscriberAndDeviceInformation other = (SubscriberAndDeviceInformation) obj;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000186
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700187 if (this.hardwareIdentifier == null) {
188 if (other.hardwareIdentifier != null) {
189 return false;
190 }
191 } else if (!this.hardwareIdentifier.equals(other.hardwareIdentifier)) {
192 return false;
193 }
194 if (this.id == null) {
195 if (other.id != null) {
196 return false;
197 }
198 } else if (!this.id.equals(other.id)) {
199 return false;
200 }
201 if (this.nasPortId == null) {
202 if (other.nasPortId != null) {
203 return false;
204 }
205 } else if (!this.nasPortId.equals(other.nasPortId)) {
206 return false;
207 }
Amit Ghosh38b232a2017-07-23 15:11:56 +0100208 if (this.nasId == null) {
209 if (other.nasId != null) {
210 return false;
211 }
212 } else if (!this.nasId.equals(other.nasId)) {
213 return false;
214 }
215 if (this.ipAddress == null) {
216 if (other.ipAddress != null) {
217 return false;
218 }
219 } else if (!this.ipAddress.equals(other.ipAddress())) {
220 return false;
221 }
Amit Ghoshd5d60cf2017-11-09 11:00:09 +0000222 if (this.uplinkPort != other.uplinkPort) {
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700223 return false;
224 }
Matteo Scandolo198aef92020-01-08 00:43:17 +0000225
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700226 if (this.slot != other.slot) {
227 return false;
228 }
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700229 if (this.circuitId == null) {
230 if (other.circuitId != null) {
231 return false;
232 }
233 } else if (!this.circuitId.equals(other.circuitId)) {
234 return false;
235 }
236 if (this.remoteId == null) {
237 if (other.remoteId != null) {
238 return false;
239 }
240 } else if (!this.remoteId.equals(other.remoteId)) {
241 return false;
242 }
Matteo Scandolo198aef92020-01-08 00:43:17 +0000243 if (this.uniTagList == null) {
244 if (other.uniTagList != null) {
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000245 return false;
246 }
Matteo Scandolo198aef92020-01-08 00:43:17 +0000247 } else if (!this.uniTagList.equals(other.uniTagList)) {
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000248 return false;
249 }
amit.ghosh3b225bb2022-02-17 18:41:00 +0100250 if (!Objects.equals(this.nniDhcpTrapVid, other.nniDhcpTrapVid)) {
251 return false;
252 }
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700253 return true;
254 }
255
256 /*
257 * (non-Javadoc)
258 *
259 * @see java.lang.Object#toString()
260 */
261 @Override
262 public String toString() {
263 final StringBuilder buf = new StringBuilder();
264 buf.append('[');
Matteo Scandolo198aef92020-01-08 00:43:17 +0000265 buf.append("id:").append(this.id);
266 buf.append(",nasPortId:").append(this.nasPortId);
267 buf.append(",uplinkPort:").append(this.uplinkPort);
268 buf.append(",slot:").append(this.slot);
269 buf.append(",hardwareIdentifier:").append(this.hardwareIdentifier);
270 buf.append(",ipaddress:").append(this.ipAddress);
271 buf.append(",nasId:").append(this.nasId);
272 buf.append(",circuitId:").append(this.circuitId);
273 buf.append(",remoteId:").append(this.remoteId);
amit.ghosh3b225bb2022-02-17 18:41:00 +0100274 buf.append(",nniDhcpTrapVid:").append(this.nniDhcpTrapVid);
Matteo Scandolo198aef92020-01-08 00:43:17 +0000275 buf.append(",uniTagList:").append(this.uniTagList);
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700276 buf.append(']');
277
278 return buf.toString();
279 }
280
281}