blob: 08ab94eeef16196b436c309f3f3574efb0ab8228 [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;
Daniele Moroefe448c2019-11-06 23:33:43 +000020import com.fasterxml.jackson.annotation.JsonProperty;
Gamze Abaka94f12a02019-08-21 07:21:41 +000021
Daniele Moro82d9a362019-11-06 23:51:20 +000022import java.util.List;
23
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
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070029 @JsonProperty(value = "nasPortId")
30 String nasPortId;
31
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000032 @JsonProperty(value = "uplinkPort")
33 int uplinkPort = -1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070034
35 @JsonProperty(value = "slot")
Amit Ghosh38b232a2017-07-23 15:11:56 +010036 int slot = -1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070037
38 @JsonProperty(value = "hardwareIdentifier")
39 MacAddress hardwareIdentifier;
40
Amit Ghosh38b232a2017-07-23 15:11:56 +010041 @JsonProperty(value = "ipAddress")
42 Ip4Address ipAddress;
43
44 @JsonProperty(value = "nasId")
45 String nasId;
46
David K. Bainbridge8bf98e02017-08-07 10:41:56 -070047 @JsonProperty(value = "circuitId")
48 String circuitId;
49
50 @JsonProperty(value = "remoteId")
51 String remoteId;
52
Daniele Moro82d9a362019-11-06 23:51:20 +000053 @JsonProperty(value = "uniTagList")
54 List<UniTagInformation> uniTagList;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +000055
Daniele Moro82d9a362019-11-06 23:51:20 +000056 public SubscriberAndDeviceInformation() {
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070057 }
58
59 public final String nasPortId() {
60 return this.nasPortId;
61 }
62
63 public final void setNasPortId(final String nasPortId) {
64 this.nasPortId = nasPortId;
65 }
66
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000067 public final int uplinkPort() {
68 return this.uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070069 }
70
Amit Ghoshd5d60cf2017-11-09 11:00:09 +000071 public final void setUplinkPort(final int uplinkPort) {
72 this.uplinkPort = uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -070073 }
74
75 public final int slot() {
76 return this.slot;
77 }
78
79 public final void setSlot(final int slot) {
80 this.slot = slot;
81 }
82
83 public final MacAddress hardwareIdentifier() {
84 return this.hardwareIdentifier;
85 }
86
87 public final void setHardwareIdentifier(final MacAddress hardwareIdentifier) {
88 this.hardwareIdentifier = hardwareIdentifier;
89 }
90
Amit Ghosh38b232a2017-07-23 15:11:56 +010091 public final Ip4Address ipAddress() {
92 return this.ipAddress;
93 }
94
95 public final void setIPAddress(final Ip4Address ipAddress) {
96 this.ipAddress = ipAddress;
97 }
98
99 public final String nasId() {
100 return this.nasId;
101 }
102
103 public final void setNasId(final String nasId) {
104 this.nasId = nasId;
105 }
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700106
107 public final String circuitId() {
108 return this.circuitId;
109 }
110
111 public final void setCircuitId(final String circuitId) {
112 this.circuitId = circuitId;
113 }
114
115 public final String remoteId() {
116 return this.remoteId;
117 }
118
119 public final void setRemoteId(final String remoteId) {
120 this.remoteId = remoteId;
121 }
122
Daniele Moro82d9a362019-11-06 23:51:20 +0000123 public final List<UniTagInformation> uniTagList() {
124 return this.uniTagList;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000125 }
126
Daniele Moro82d9a362019-11-06 23:51:20 +0000127 public final void setUniTagList(final List<UniTagInformation> uniTagList) {
128 this.uniTagList = uniTagList;
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000129 }
130
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000131
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700132 /*
133 * (non-Javadoc)
134 *
135 * @see java.lang.Object#hashCode()
136 */
137 @Override
138 public int hashCode() {
139 final int prime = 31;
140 int result = 1;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700141 result = prime * result + (this.hardwareIdentifier == null ? 0 : this.hardwareIdentifier.hashCode());
142 result = prime * result + (this.id == null ? 0 : this.id.hashCode());
143 result = prime * result + (this.nasPortId == null ? 0 : this.nasPortId.hashCode());
Amit Ghoshd5d60cf2017-11-09 11:00:09 +0000144 result = prime * result + this.uplinkPort;
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700145 result = prime * result + this.slot;
Amit Ghosh38b232a2017-07-23 15:11:56 +0100146 result = prime * result + (this.ipAddress == null ? 0 : this.ipAddress.hashCode());
147 result = prime * result + (this.nasId == null ? 0 : this.nasId.hashCode());
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700148 result = prime + result + (this.circuitId == null ? 0 : this.circuitId.hashCode());
149 result = prime + result + (this.remoteId == null ? 0 : this.remoteId.hashCode());
Daniele Moro82d9a362019-11-06 23:51:20 +0000150 result = prime + result + (this.uniTagList == null ? 0 : this.uniTagList.hashCode());
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700151 return result;
152 }
153
154 /*
155 * (non-Javadoc)
156 *
157 * @see java.lang.Object#equals(java.lang.Object)
158 */
159 @Override
160 public boolean equals(final Object obj) {
161 if (this == obj) {
162 return true;
163 }
164 if (obj == null) {
165 return false;
166 }
167 if (this.getClass() != obj.getClass()) {
168 return false;
169 }
170 final SubscriberAndDeviceInformation other = (SubscriberAndDeviceInformation) obj;
Daniele Moro82d9a362019-11-06 23:51:20 +0000171
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700172 if (this.hardwareIdentifier == null) {
173 if (other.hardwareIdentifier != null) {
174 return false;
175 }
176 } else if (!this.hardwareIdentifier.equals(other.hardwareIdentifier)) {
177 return false;
178 }
179 if (this.id == null) {
180 if (other.id != null) {
181 return false;
182 }
183 } else if (!this.id.equals(other.id)) {
184 return false;
185 }
186 if (this.nasPortId == null) {
187 if (other.nasPortId != null) {
188 return false;
189 }
190 } else if (!this.nasPortId.equals(other.nasPortId)) {
191 return false;
192 }
Amit Ghosh38b232a2017-07-23 15:11:56 +0100193 if (this.nasId == null) {
194 if (other.nasId != null) {
195 return false;
196 }
197 } else if (!this.nasId.equals(other.nasId)) {
198 return false;
199 }
200 if (this.ipAddress == null) {
201 if (other.ipAddress != null) {
202 return false;
203 }
204 } else if (!this.ipAddress.equals(other.ipAddress())) {
205 return false;
206 }
Amit Ghoshd5d60cf2017-11-09 11:00:09 +0000207 if (this.uplinkPort != other.uplinkPort) {
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700208 return false;
209 }
Daniele Moro82d9a362019-11-06 23:51:20 +0000210
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700211 if (this.slot != other.slot) {
212 return false;
213 }
David K. Bainbridge8bf98e02017-08-07 10:41:56 -0700214 if (this.circuitId == null) {
215 if (other.circuitId != null) {
216 return false;
217 }
218 } else if (!this.circuitId.equals(other.circuitId)) {
219 return false;
220 }
221 if (this.remoteId == null) {
222 if (other.remoteId != null) {
223 return false;
224 }
225 } else if (!this.remoteId.equals(other.remoteId)) {
226 return false;
227 }
Daniele Moro82d9a362019-11-06 23:51:20 +0000228 if (this.uniTagList == null) {
229 if (other.uniTagList != null) {
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000230 return false;
231 }
Daniele Moro82d9a362019-11-06 23:51:20 +0000232 } else if (!this.uniTagList.equals(other.uniTagList)) {
Gamze Abaka1e5ccf52018-07-02 11:59:03 +0000233 return false;
234 }
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700235 return true;
236 }
237
238 /*
239 * (non-Javadoc)
240 *
241 * @see java.lang.Object#toString()
242 */
243 @Override
244 public String toString() {
245 final StringBuilder buf = new StringBuilder();
246 buf.append('[');
Daniele Moro82d9a362019-11-06 23:51:20 +0000247 buf.append("id:").append(this.id);
248 buf.append(",nasPortId:").append(this.nasPortId);
249 buf.append(",uplinkPort:").append(this.uplinkPort);
250 buf.append(",slot:").append(this.slot);
251 buf.append(",hardwareIdentifier:").append(this.hardwareIdentifier);
252 buf.append(",ipaddress:").append(this.ipAddress);
253 buf.append(",nasId:").append(this.nasId);
254 buf.append(",circuitId:").append(this.circuitId);
255 buf.append(",remoteId:").append(this.remoteId);
256 buf.append(",uniTagList:").append(this.uniTagList);
David K. Bainbridgeeda2b052017-07-12 09:41:04 -0700257 buf.append(']');
258
259 return buf.toString();
260 }
261
262}