blob: 0e5c43897b454ab9960dc1610149aff97f8d6bb4 [file] [log] [blame]
Matteo Scandolo198aef92020-01-08 00:43:17 +00001/*
2 * Copyright 2017-present Open Networking Foundation
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.opencord.sadis;
17
18import com.fasterxml.jackson.annotation.JsonProperty;
19import org.onlab.packet.VlanId;
20
Andrea Campanella092df202021-11-29 10:38:45 -080021import java.util.Objects;
22
Matteo Scandolo198aef92020-01-08 00:43:17 +000023/**
24 * Represents a unit of information about a service.
25 */
26public final class UniTagInformation {
27
28 @JsonProperty(value = "uniTagMatch")
Matteo Scandoloc1e72722020-03-20 12:53:14 -070029 private VlanId uniTagMatch = VlanId.vlanId(VlanId.NO_VID);
Matteo Scandolo198aef92020-01-08 00:43:17 +000030
31 @JsonProperty(value = "ponCTag")
32 private VlanId ponCTag;
33
34 @JsonProperty(value = "ponSTag")
35 private VlanId ponSTag;
36
37 @JsonProperty(value = "usPonCTagPriority")
38 private int usPonCTagPriority = -1;
39
40 @JsonProperty(value = "usPonSTagPriority")
41 private int usPonSTagPriority = -1;
42
43 @JsonProperty(value = "dsPonCTagPriority")
44 private int dsPonCTagPriority = -1;
45
46 @JsonProperty(value = "dsPonSTagPriority")
47 private int dsPonSTagPriority = -1;
48
49 @JsonProperty(value = "technologyProfileId")
50 private int technologyProfileId = -1;
51
52 @JsonProperty(value = "upstreamBandwidthProfile")
53 private String upstreamBandwidthProfile;
54
55 @JsonProperty(value = "downstreamBandwidthProfile")
56 private String downstreamBandwidthProfile;
57
yasin sapli2c93ddb2021-06-11 17:46:26 +030058 @JsonProperty(value = "upstreamOltBandwidthProfile")
59 private String upstreamOltBandwidthProfile;
60
61 @JsonProperty(value = "downstreamOltBandwidthProfile")
62 private String downstreamOltBandwidthProfile;
63
Matteo Scandolo198aef92020-01-08 00:43:17 +000064 @JsonProperty(value = "serviceName")
65 private String serviceName;
66
67 @JsonProperty(value = "enableMacLearning")
68 private boolean enableMacLearning = false;
69
70 @JsonProperty(value = "configuredMacAddress")
71 private String configuredMacAddress;
72
73 @JsonProperty(value = "isDhcpRequired")
74 private boolean isDhcpRequired;
75
76 @JsonProperty(value = "isIgmpRequired")
77 private boolean isIgmpRequired;
78
yasin sapli9e3ebed2021-07-09 14:06:35 +000079 @JsonProperty(value = "isPppoeRequired")
80 private boolean isPppoeRequired;
81
Matteo Scandolo198aef92020-01-08 00:43:17 +000082 public UniTagInformation() {
83
84 }
yasin sapli2c93ddb2021-06-11 17:46:26 +030085 //CHECKSTYLE:OFF
Matteo Scandolo198aef92020-01-08 00:43:17 +000086 private UniTagInformation(final VlanId uniTagMatch, final VlanId ponCTag, final VlanId ponSTag,
87 final int usPonCTagPriority, final int usPonSTagPriority,
88 final int dsPonCTagPriority, final int dsPonSTagPriority,
89 final int technologyProfileId,
yasin sapli2c93ddb2021-06-11 17:46:26 +030090 final String upstreamBandwidthProfile,
91 final String downstreamBandwidthProfile,
92 final String upstreamOltBandwidthProfile,
93 final String downstreamOltBandwidthProfile,
Matteo Scandolo198aef92020-01-08 00:43:17 +000094 final String serviceName, final boolean enableMacLearning,
95 final String configuredMacAddress, final boolean isDhcpRequired,
yasin sapli9e3ebed2021-07-09 14:06:35 +000096 final boolean isIgmpRequired, final boolean isPppoeRequired) {
Matteo Scandolo198aef92020-01-08 00:43:17 +000097 this.uniTagMatch = uniTagMatch;
98 this.ponCTag = ponCTag;
99 this.ponSTag = ponSTag;
100 this.usPonCTagPriority = usPonCTagPriority;
101 this.usPonSTagPriority = usPonSTagPriority;
102 this.dsPonCTagPriority = dsPonCTagPriority;
103 this.dsPonSTagPriority = dsPonSTagPriority;
104 this.technologyProfileId = technologyProfileId;
105 this.upstreamBandwidthProfile = upstreamBandwidthProfile;
106 this.downstreamBandwidthProfile = downstreamBandwidthProfile;
yasin sapli2c93ddb2021-06-11 17:46:26 +0300107 this.upstreamOltBandwidthProfile = upstreamOltBandwidthProfile;
108 this.downstreamOltBandwidthProfile = downstreamOltBandwidthProfile;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000109 this.serviceName = serviceName;
110 this.enableMacLearning = enableMacLearning;
111 this.configuredMacAddress = configuredMacAddress;
112 this.isDhcpRequired = isDhcpRequired;
113 this.isIgmpRequired = isIgmpRequired;
yasin sapli9e3ebed2021-07-09 14:06:35 +0000114 this.isPppoeRequired = isPppoeRequired;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000115 }
yasin sapli2c93ddb2021-06-11 17:46:26 +0300116 //CHECKSTYLE:ON
Matteo Scandolo198aef92020-01-08 00:43:17 +0000117
118 public final VlanId getUniTagMatch() {
119 return uniTagMatch;
120 }
121
122 public final VlanId getPonCTag() {
123 return ponCTag;
124 }
125
126 public final VlanId getPonSTag() {
127 return ponSTag;
128 }
129
130 public final int getUsPonCTagPriority() {
131 return usPonCTagPriority;
132 }
133
134 public final int getUsPonSTagPriority() {
135 return usPonSTagPriority;
136 }
137
138 public final int getDsPonCTagPriority() {
139 return dsPonCTagPriority;
140 }
141
142 public final int getDsPonSTagPriority() {
143 return dsPonSTagPriority;
144 }
145
146 public final int getTechnologyProfileId() {
147 return technologyProfileId;
148 }
149
150 public final String getUpstreamBandwidthProfile() {
151 return upstreamBandwidthProfile;
152 }
153
154 public final String getDownstreamBandwidthProfile() {
155 return downstreamBandwidthProfile;
156 }
157
yasin sapli2c93ddb2021-06-11 17:46:26 +0300158 public final String getUpstreamOltBandwidthProfile() {
159 return upstreamOltBandwidthProfile;
160 }
161
162 public final String getDownstreamOltBandwidthProfile() {
163 return downstreamOltBandwidthProfile;
164 }
165
Matteo Scandolo198aef92020-01-08 00:43:17 +0000166 public final String getServiceName() {
167 return serviceName;
168 }
169
170 public final boolean getEnableMacLearning() {
171 return enableMacLearning;
172 }
173
174 public final String getConfiguredMacAddress() {
175 return configuredMacAddress;
176 }
177
178 public final boolean getIsDhcpRequired() {
179 return isDhcpRequired;
180 }
181
182 public final boolean getIsIgmpRequired() {
183 return isIgmpRequired;
184 }
185
yasin sapli9e3ebed2021-07-09 14:06:35 +0000186 public final boolean getIsPppoeRequired() {
187 return isPppoeRequired;
188 }
189
Matteo Scandolo198aef92020-01-08 00:43:17 +0000190 @Override
191 public boolean equals(Object o) {
192 if (this == o) {
193 return true;
194 }
195 if (o == null || getClass() != o.getClass()) {
196 return false;
197 }
198
199 UniTagInformation that = (UniTagInformation) o;
200
Andrea Campanella092df202021-11-29 10:38:45 -0800201 if (!Objects.equals(uniTagMatch, that.uniTagMatch)) {
Matteo Scandolo198aef92020-01-08 00:43:17 +0000202 return false;
203 }
204 if (technologyProfileId != that.technologyProfileId) {
205 return false;
206 }
Andrea Campanella092df202021-11-29 10:38:45 -0800207 if (!Objects.equals(ponCTag, that.ponCTag)) {
Matteo Scandolo198aef92020-01-08 00:43:17 +0000208 return false;
209 }
Andrea Campanella092df202021-11-29 10:38:45 -0800210 if (!Objects.equals(ponSTag, that.ponSTag)) {
Matteo Scandolo198aef92020-01-08 00:43:17 +0000211 return false;
212 }
213 if (usPonCTagPriority != that.usPonCTagPriority) {
214 return false;
215 }
216 if (usPonSTagPriority != that.usPonSTagPriority) {
217 return false;
218 }
219 if (dsPonCTagPriority != that.dsPonCTagPriority) {
220 return false;
221 }
222 if (dsPonSTagPriority != that.dsPonSTagPriority) {
223 return false;
224 }
225 if (enableMacLearning != that.enableMacLearning) {
226 return false;
227 }
Andrea Campanella092df202021-11-29 10:38:45 -0800228 if (!Objects.equals(configuredMacAddress, that.configuredMacAddress)) {
Matteo Scandolo198aef92020-01-08 00:43:17 +0000229 return false;
230 }
231 if (isDhcpRequired != that.isDhcpRequired) {
232 return false;
233 }
234 if (isIgmpRequired != that.isIgmpRequired) {
235 return false;
236 }
yasin sapli9e3ebed2021-07-09 14:06:35 +0000237 if (isPppoeRequired != that.isPppoeRequired) {
238 return false;
239 }
Matteo Scandolo198aef92020-01-08 00:43:17 +0000240 if (upstreamBandwidthProfile != null ? !upstreamBandwidthProfile.equals(that.upstreamBandwidthProfile) :
241 that.upstreamBandwidthProfile != null) {
242 return false;
243 }
244 if (downstreamBandwidthProfile != null ? !downstreamBandwidthProfile.equals(that.downstreamBandwidthProfile) :
245 that.downstreamBandwidthProfile != null) {
246 return false;
247 }
yasin sapli2c93ddb2021-06-11 17:46:26 +0300248 if (upstreamOltBandwidthProfile != null ?
249 !upstreamOltBandwidthProfile.equals(that.upstreamOltBandwidthProfile) :
250 that.upstreamOltBandwidthProfile != null) {
251 return false;
252 }
253 if (downstreamOltBandwidthProfile != null ?
254 !downstreamOltBandwidthProfile.equals(that.downstreamOltBandwidthProfile) :
255 that.downstreamOltBandwidthProfile != null) {
256 return false;
257 }
Matteo Scandolo198aef92020-01-08 00:43:17 +0000258 return serviceName != null ? serviceName.equals(that.serviceName) : that.serviceName == null;
259 }
260
261 @Override
262 public int hashCode() {
263 int result = uniTagMatch != null ? uniTagMatch.hashCode() : 0;
264 result = 31 * result + (ponCTag != null ? ponCTag.hashCode() : 0);
265 result = 31 * result + (ponSTag != null ? ponSTag.hashCode() : 0);
266 result = 31 * result + usPonCTagPriority;
267 result = 31 * result + usPonSTagPriority;
268 result = 31 * result + dsPonCTagPriority;
269 result = 31 * result + dsPonSTagPriority;
270 result = 31 * result + technologyProfileId;
271 result = 31 * result + (upstreamBandwidthProfile != null ? upstreamBandwidthProfile.hashCode() : 0);
272 result = 31 * result + (downstreamBandwidthProfile != null ? downstreamBandwidthProfile.hashCode() : 0);
yasin sapli2c93ddb2021-06-11 17:46:26 +0300273 result = 31 * result + (upstreamOltBandwidthProfile != null ? upstreamOltBandwidthProfile.hashCode() : 0);
274 result = 31 * result + (downstreamOltBandwidthProfile != null ? downstreamOltBandwidthProfile.hashCode() : 0);
Matteo Scandolo198aef92020-01-08 00:43:17 +0000275 result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
276 result = 31 * result + (enableMacLearning ? 1 : 0);
277 result = 31 * result + (configuredMacAddress != null ? configuredMacAddress.hashCode() : 0);
278 result = 31 * result + (isDhcpRequired ? 1 : 0);
279 result = 31 * result + (isIgmpRequired ? 1 : 0);
yasin sapli9e3ebed2021-07-09 14:06:35 +0000280 result = 31 * result + (isPppoeRequired ? 1 : 0);
Matteo Scandolo198aef92020-01-08 00:43:17 +0000281 return result;
282 }
283
284 @Override
285 public String toString() {
286 final StringBuilder sb = new StringBuilder("UniTagInformation{");
287 sb.append("uniTagMatch=").append(uniTagMatch);
288 sb.append(", ponCTag=").append(ponCTag);
289 sb.append(", ponSTag=").append(ponSTag);
290 sb.append(", usPonCTagPriority=").append(usPonCTagPriority);
291 sb.append(", usPonSTagPriority=").append(usPonSTagPriority);
292 sb.append(", dsPonCTagPriority=").append(dsPonCTagPriority);
293 sb.append(", dsPonSTagPriority=").append(dsPonSTagPriority);
294 sb.append(", technologyProfileId=").append(technologyProfileId);
295 sb.append(", enableMacLearning=").append(enableMacLearning);
296 sb.append(", upstreamBandwidthProfile='").append(upstreamBandwidthProfile).append('\'');
297 sb.append(", downstreamBandwidthProfile='").append(downstreamBandwidthProfile).append('\'');
yasin sapli2c93ddb2021-06-11 17:46:26 +0300298 sb.append(", upstreamOltBandwidthProfile='").append(upstreamOltBandwidthProfile).append('\'');
299 sb.append(", downstreamOltBandwidthProfile='").append(downstreamOltBandwidthProfile).append('\'');
Matteo Scandolo198aef92020-01-08 00:43:17 +0000300 sb.append(", serviceName='").append(serviceName).append('\'');
301 sb.append(", configuredMacAddress='").append(configuredMacAddress).append('\'');
302 sb.append(", isDhcpRequired=").append(isDhcpRequired);
303 sb.append(", isIgmpRequired=").append(isIgmpRequired);
yasin sapli9e3ebed2021-07-09 14:06:35 +0000304 sb.append(", isPppoeRequired=").append(isPppoeRequired);
Matteo Scandolo198aef92020-01-08 00:43:17 +0000305 sb.append('}');
306 return sb.toString();
307 }
308
309 public static final class Builder {
310
311 private VlanId uniTagMatch;
312 private VlanId ponCTag;
313 private VlanId ponSTag;
Gamze Abaka7f987c02020-02-03 08:19:32 +0000314 private int usPonCTagPriority = -1;
315 private int usPonSTagPriority = -1;
316 private int dsPonCTagPriority = -1;
317 private int dsPonSTagPriority = -1;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000318 private int technologyProfileId;
319 private String upstreamBandwidthProfile;
320 private String downstreamBandwidthProfile;
yasin sapli2c93ddb2021-06-11 17:46:26 +0300321 private String upstreamOltBandwidthProfile;
322 private String downstreamOltBandwidthProfile;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000323 private String serviceName;
324 private boolean enableMacLearning;
325 private String configuredMacAddress;
326 private boolean isDhcpRequired;
327 private boolean isIgmpRequired;
yasin sapli9e3ebed2021-07-09 14:06:35 +0000328 private boolean isPppoeRequired;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000329
330 public final Builder setUniTagMatch(final VlanId uniTagMatch) {
331 this.uniTagMatch = uniTagMatch;
332 return this;
333 }
334
335 public final Builder setPonCTag(final VlanId ponCTag) {
336 this.ponCTag = ponCTag;
337 return this;
338 }
339
340 public final Builder setPonSTag(final VlanId ponSTag) {
341 this.ponSTag = ponSTag;
342 return this;
343 }
344
345 public final Builder setUsPonCTagPriority(final int usPonCTagPriority) {
346 this.usPonCTagPriority = usPonCTagPriority;
347 return this;
348 }
349
350 public final Builder setUsPonSTagPriority(final int usPonSTagPriority) {
351 this.usPonSTagPriority = usPonSTagPriority;
352 return this;
353 }
354
355 public final Builder setDsPonCTagPriority(final int dsPonCTagPriority) {
356 this.dsPonCTagPriority = dsPonCTagPriority;
357 return this;
358 }
359
360 public final Builder setDsPonSTagPriority(final int dsPonSTagPriority) {
361 this.dsPonSTagPriority = dsPonSTagPriority;
362 return this;
363 }
364
365 public final Builder setTechnologyProfileId(final int technologyProfileId) {
366 this.technologyProfileId = technologyProfileId;
367 return this;
368 }
369
370 public final Builder setUpstreamBandwidthProfile(final String upstreamBandwidthProfile) {
371 this.upstreamBandwidthProfile = upstreamBandwidthProfile;
372 return this;
373 }
374
375 public final Builder setDownstreamBandwidthProfile(final String downstreamBandwidthProfile) {
376 this.downstreamBandwidthProfile = downstreamBandwidthProfile;
377 return this;
378 }
379
yasin sapli2c93ddb2021-06-11 17:46:26 +0300380 public final Builder setUpstreamOltBandwidthProfile(final String upstreamOltBandwidthProfile) {
381 this.upstreamOltBandwidthProfile = upstreamOltBandwidthProfile;
382 return this;
383 }
384
385 public final Builder setDownstreamOltBandwidthProfile(final String downstreamOltBandwidthProfile) {
386 this.downstreamOltBandwidthProfile = downstreamOltBandwidthProfile;
387 return this;
388 }
389
Matteo Scandolo198aef92020-01-08 00:43:17 +0000390 public final Builder setServiceName(final String serviceName) {
391 this.serviceName = serviceName;
392 return this;
393 }
394
395 public final Builder setEnableMacLearning(final boolean enableMacLearning) {
396 this.enableMacLearning = enableMacLearning;
397 return this;
398 }
399
400 public final Builder setConfiguredMacAddress(final String configuredMacAddress) {
401 this.configuredMacAddress = configuredMacAddress;
402 return this;
403 }
404
405 public final Builder setIsDhcpRequired(final boolean isDhcpRequired) {
406 this.isDhcpRequired = isDhcpRequired;
407 return this;
408 }
409
410 public final Builder setIsIgmpRequired(final boolean isIgmpRequired) {
411 this.isIgmpRequired = isIgmpRequired;
412 return this;
413 }
414
yasin sapli9e3ebed2021-07-09 14:06:35 +0000415 public final Builder setIsPppoeRequired(final boolean isPppoeRequired) {
416 this.isPppoeRequired = isPppoeRequired;
417 return this;
418 }
419
Matteo Scandolo198aef92020-01-08 00:43:17 +0000420 public final UniTagInformation build() {
421 return new UniTagInformation(this.uniTagMatch, this.ponCTag,
422 this.ponSTag, this.usPonCTagPriority, this.usPonSTagPriority,
423 this.dsPonCTagPriority, this.dsPonSTagPriority, this.technologyProfileId,
yasin sapli2c93ddb2021-06-11 17:46:26 +0300424 this.upstreamBandwidthProfile, this.downstreamBandwidthProfile,
425 this.upstreamOltBandwidthProfile, this.downstreamOltBandwidthProfile,
yasin sapli9e3ebed2021-07-09 14:06:35 +0000426 this.serviceName, this.enableMacLearning, this.configuredMacAddress,
427 this.isDhcpRequired, this.isIgmpRequired, this.isPppoeRequired);
Matteo Scandolo198aef92020-01-08 00:43:17 +0000428 }
429 }
430}