blob: 28540a08bc56f2cfe14901b04faf9c82e1073f45 [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;
Matteo Scandoloe4f4b632020-01-07 23:54:35 +000020import org.onlab.packet.VlanId;
Gamze Abaka94f12a02019-08-21 07:21:41 +000021
Matteo Scandoloe4f4b632020-01-07 23:54:35 +000022import com.fasterxml.jackson.annotation.JsonProperty;
Daniele Moro82d9a362019-11-06 23:51:20 +000023
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070024/**
25 * Represents a unit of information about a subscriber or access device.
26 */
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000027public class SubscriberAndDeviceInformation extends BaseInformation {
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070028
Matteo Scandoloe4f4b632020-01-07 23:54:35 +000029
30 @JsonProperty(value = "sTag")
31 VlanId sTag;
32
33 @JsonProperty(value = "cTag")
34 VlanId cTag;
35
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070036 @JsonProperty(value = "nasPortId")
37 String nasPortId;
38
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000039 @JsonProperty(value = "uplinkPort")
40 int uplinkPort = -1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070041
42 @JsonProperty(value = "slot")
Amit Ghosh38b232a2017-07-23 15:11:56 +010043 int slot = -1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070044
45 @JsonProperty(value = "hardwareIdentifier")
46 MacAddress hardwareIdentifier;
47
Amit Ghosh38b232a2017-07-23 15:11:56 +010048 @JsonProperty(value = "ipAddress")
49 Ip4Address ipAddress;
50
51 @JsonProperty(value = "nasId")
52 String nasId;
53
David K. Bainbridge8bf98e02017-08-07 10:41:56 -070054 @JsonProperty(value = "circuitId")
55 String circuitId;
56
57 @JsonProperty(value = "remoteId")
58 String remoteId;
59
Matteo Scandoloe4f4b632020-01-07 23:54:35 +000060 @JsonProperty(value = "technologyProfileId")
61 int technologyProfileId = -1;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000062
Matteo Scandoloe4f4b632020-01-07 23:54:35 +000063 @JsonProperty(value = "upstreamBandwidthProfile")
64 String upstreamBandwidthProfile;
65
66 @JsonProperty(value = "downstreamBandwidthProfile")
67 String downstreamBandwidthProfile;
68
69 protected SubscriberAndDeviceInformation() {
70 }
71
72 public final VlanId sTag() {
73 return this.sTag;
74 }
75
76 public final void setSTag(final VlanId stag) {
77 this.sTag = stag;
78 }
79
80 public final VlanId cTag() {
81 return this.cTag;
82 }
83
84 public final void setCTag(final VlanId ctag) {
85 this.cTag = ctag;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070086 }
87
88 public final String nasPortId() {
89 return this.nasPortId;
90 }
91
92 public final void setNasPortId(final String nasPortId) {
93 this.nasPortId = nasPortId;
94 }
95
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000096 public final int uplinkPort() {
97 return this.uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070098 }
99
Amit Ghoshd5d60cf2017-11-09 11:00:09 +0000100 public final void setUplinkPort(final int uplinkPort) {
101 this.uplinkPort = uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700102 }
103
104 public final int slot() {
105 return this.slot;
106 }
107
108 public final void setSlot(final int slot) {
109 this.slot = slot;
110 }
111
112 public final MacAddress hardwareIdentifier() {
113 return this.hardwareIdentifier;
114 }
115
116 public final void setHardwareIdentifier(final MacAddress hardwareIdentifier) {
117 this.hardwareIdentifier = hardwareIdentifier;
118 }
119
Amit Ghosh38b232a2017-07-23 15:11:56 +0100120 public final Ip4Address ipAddress() {
121 return this.ipAddress;
122 }
123
124 public final void setIPAddress(final Ip4Address ipAddress) {
125 this.ipAddress = ipAddress;
126 }
127
128 public final String nasId() {
129 return this.nasId;
130 }
131
132 public final void setNasId(final String nasId) {
133 this.nasId = nasId;
134 }
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700135
136 public final String circuitId() {
137 return this.circuitId;
138 }
139
140 public final void setCircuitId(final String circuitId) {
141 this.circuitId = circuitId;
142 }
143
144 public final String remoteId() {
145 return this.remoteId;
146 }
147
148 public final void setRemoteId(final String remoteId) {
149 this.remoteId = remoteId;
150 }
151
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000152 public final int technologyProfileId() {
153 return this.technologyProfileId;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000154 }
155
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000156 public final void setTechnologyProfileId(final int technologyProfileId) {
157 this.technologyProfileId = technologyProfileId;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000158 }
159
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000160 public final String upstreamBandwidthProfile() {
161 return this.upstreamBandwidthProfile;
162 }
163
164 public final void setUpstreamBandwidthProfile(final String upstreamBandwidthProfile) {
165 this.upstreamBandwidthProfile = upstreamBandwidthProfile;
166 }
167
168 public final String downstreamBandwidthProfile() {
169 return this.downstreamBandwidthProfile;
170 }
171
172 public final void setDownstreamBandwidthProfile(final String downstreamBandwidthProfile) {
173 this.downstreamBandwidthProfile = downstreamBandwidthProfile;
174 }
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000175
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700176 /*
177 * (non-Javadoc)
178 *
179 * @see java.lang.Object#hashCode()
180 */
181 @Override
182 public int hashCode() {
183 final int prime = 31;
184 int result = 1;
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000185 result = prime * result + (this.cTag == null ? 0 : this.cTag.hashCode());
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700186 result = prime * result + (this.hardwareIdentifier == null ? 0 : this.hardwareIdentifier.hashCode());
187 result = prime * result + (this.id == null ? 0 : this.id.hashCode());
188 result = prime * result + (this.nasPortId == null ? 0 : this.nasPortId.hashCode());
Amit Ghoshd5d60cf2017-11-09 11:00:09 +0000189 result = prime * result + this.uplinkPort;
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000190 result = prime * result + (this.sTag == null ? 0 : this.sTag.hashCode());
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700191 result = prime * result + this.slot;
Amit Ghosh38b232a2017-07-23 15:11:56 +0100192 result = prime * result + (this.ipAddress == null ? 0 : this.ipAddress.hashCode());
193 result = prime * result + (this.nasId == null ? 0 : this.nasId.hashCode());
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700194 result = prime + result + (this.circuitId == null ? 0 : this.circuitId.hashCode());
195 result = prime + result + (this.remoteId == null ? 0 : this.remoteId.hashCode());
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000196 result = prime + result + this.technologyProfileId;
197 result = prime + result +
198 (this.upstreamBandwidthProfile == null ? 0 : this.upstreamBandwidthProfile.hashCode());
199 result = prime + result +
200 (this.downstreamBandwidthProfile == null ? 0 : this.downstreamBandwidthProfile.hashCode());
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700201 return result;
202 }
203
204 /*
205 * (non-Javadoc)
206 *
207 * @see java.lang.Object#equals(java.lang.Object)
208 */
209 @Override
210 public boolean equals(final Object obj) {
211 if (this == obj) {
212 return true;
213 }
214 if (obj == null) {
215 return false;
216 }
217 if (this.getClass() != obj.getClass()) {
218 return false;
219 }
220 final SubscriberAndDeviceInformation other = (SubscriberAndDeviceInformation) obj;
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000221 if (this.cTag == null) {
222 if (other.cTag != null) {
223 return false;
224 }
225 } else if (!this.cTag.equals(other.cTag)) {
226 return false;
227 }
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700228 if (this.hardwareIdentifier == null) {
229 if (other.hardwareIdentifier != null) {
230 return false;
231 }
232 } else if (!this.hardwareIdentifier.equals(other.hardwareIdentifier)) {
233 return false;
234 }
235 if (this.id == null) {
236 if (other.id != null) {
237 return false;
238 }
239 } else if (!this.id.equals(other.id)) {
240 return false;
241 }
242 if (this.nasPortId == null) {
243 if (other.nasPortId != null) {
244 return false;
245 }
246 } else if (!this.nasPortId.equals(other.nasPortId)) {
247 return false;
248 }
Amit Ghosh38b232a2017-07-23 15:11:56 +0100249 if (this.nasId == null) {
250 if (other.nasId != null) {
251 return false;
252 }
253 } else if (!this.nasId.equals(other.nasId)) {
254 return false;
255 }
256 if (this.ipAddress == null) {
257 if (other.ipAddress != null) {
258 return false;
259 }
260 } else if (!this.ipAddress.equals(other.ipAddress())) {
261 return false;
262 }
Amit Ghoshd5d60cf2017-11-09 11:00:09 +0000263 if (this.uplinkPort != other.uplinkPort) {
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700264 return false;
265 }
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000266 if (this.sTag == null) {
267 if (other.sTag != null) {
268 return false;
269 }
270 } else if (!this.sTag.equals(other.sTag)) {
271 return false;
272 }
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700273 if (this.slot != other.slot) {
274 return false;
275 }
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700276 if (this.circuitId == null) {
277 if (other.circuitId != null) {
278 return false;
279 }
280 } else if (!this.circuitId.equals(other.circuitId)) {
281 return false;
282 }
283 if (this.remoteId == null) {
284 if (other.remoteId != null) {
285 return false;
286 }
287 } else if (!this.remoteId.equals(other.remoteId)) {
288 return false;
289 }
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000290 if (this.technologyProfileId != other.technologyProfileId) {
291 return false;
292 }
293 if (this.upstreamBandwidthProfile == null) {
294 if (other.upstreamBandwidthProfile != null) {
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000295 return false;
296 }
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000297 } else if (!this.upstreamBandwidthProfile.equals(other.upstreamBandwidthProfile)) {
298 return false;
299 }
300 if (this.downstreamBandwidthProfile == null) {
301 if (other.downstreamBandwidthProfile != null) {
302 return false;
303 }
304 } else if (!this.downstreamBandwidthProfile.equals(other.downstreamBandwidthProfile)) {
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000305 return false;
306 }
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700307 return true;
308 }
309
310 /*
311 * (non-Javadoc)
312 *
313 * @see java.lang.Object#toString()
314 */
315 @Override
316 public String toString() {
317 final StringBuilder buf = new StringBuilder();
318 buf.append('[');
Matteo Scandoloe4f4b632020-01-07 23:54:35 +0000319 buf.append("id:");
320 buf.append(this.id);
321 buf.append(",cTag:");
322 buf.append(this.cTag);
323 buf.append(",sTag:");
324 buf.append(this.sTag);
325 buf.append(",nasPortId:");
326 buf.append(this.nasPortId);
327 buf.append(",uplinkPort:");
328 buf.append(this.uplinkPort);
329 buf.append(",slot:");
330 buf.append(this.slot);
331 buf.append(",hardwareIdentifier:");
332 buf.append(this.hardwareIdentifier);
333 buf.append(",ipaddress:");
334 buf.append(this.ipAddress);
335 buf.append(",nasId:");
336 buf.append(this.nasId);
337 buf.append(",circuitId:");
338 buf.append(this.circuitId);
339 buf.append(",remoteId:");
340 buf.append(this.remoteId);
341 buf.append(",technologyProfileId:");
342 buf.append(this.technologyProfileId);
343 buf.append(",upstreamBandwidthProfile:");
344 buf.append(this.upstreamBandwidthProfile);
345 buf.append(",downstreamBandwidthProfile:");
346 buf.append(this.downstreamBandwidthProfile);
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700347 buf.append(']');
348
349 return buf.toString();
350 }
351
352}