blob: 05fa7ffc90a6b22113bc3eedae55bcd0ef6b76af [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
21/**
22 * Represents a unit of information about a service.
23 */
24public final class UniTagInformation {
25
26 @JsonProperty(value = "uniTagMatch")
Matteo Scandoloc1e72722020-03-20 12:53:14 -070027 private VlanId uniTagMatch = VlanId.vlanId(VlanId.NO_VID);
Matteo Scandolo198aef92020-01-08 00:43:17 +000028
29 @JsonProperty(value = "ponCTag")
30 private VlanId ponCTag;
31
32 @JsonProperty(value = "ponSTag")
33 private VlanId ponSTag;
34
35 @JsonProperty(value = "usPonCTagPriority")
36 private int usPonCTagPriority = -1;
37
38 @JsonProperty(value = "usPonSTagPriority")
39 private int usPonSTagPriority = -1;
40
41 @JsonProperty(value = "dsPonCTagPriority")
42 private int dsPonCTagPriority = -1;
43
44 @JsonProperty(value = "dsPonSTagPriority")
45 private int dsPonSTagPriority = -1;
46
47 @JsonProperty(value = "technologyProfileId")
48 private int technologyProfileId = -1;
49
50 @JsonProperty(value = "upstreamBandwidthProfile")
51 private String upstreamBandwidthProfile;
52
53 @JsonProperty(value = "downstreamBandwidthProfile")
54 private String downstreamBandwidthProfile;
55
yasin sapli2c93ddb2021-06-11 17:46:26 +030056 @JsonProperty(value = "upstreamOltBandwidthProfile")
57 private String upstreamOltBandwidthProfile;
58
59 @JsonProperty(value = "downstreamOltBandwidthProfile")
60 private String downstreamOltBandwidthProfile;
61
Matteo Scandolo198aef92020-01-08 00:43:17 +000062 @JsonProperty(value = "serviceName")
63 private String serviceName;
64
65 @JsonProperty(value = "enableMacLearning")
66 private boolean enableMacLearning = false;
67
68 @JsonProperty(value = "configuredMacAddress")
69 private String configuredMacAddress;
70
71 @JsonProperty(value = "isDhcpRequired")
72 private boolean isDhcpRequired;
73
74 @JsonProperty(value = "isIgmpRequired")
75 private boolean isIgmpRequired;
76
77 public UniTagInformation() {
78
79 }
yasin sapli2c93ddb2021-06-11 17:46:26 +030080 //CHECKSTYLE:OFF
Matteo Scandolo198aef92020-01-08 00:43:17 +000081 private UniTagInformation(final VlanId uniTagMatch, final VlanId ponCTag, final VlanId ponSTag,
82 final int usPonCTagPriority, final int usPonSTagPriority,
83 final int dsPonCTagPriority, final int dsPonSTagPriority,
84 final int technologyProfileId,
yasin sapli2c93ddb2021-06-11 17:46:26 +030085 final String upstreamBandwidthProfile,
86 final String downstreamBandwidthProfile,
87 final String upstreamOltBandwidthProfile,
88 final String downstreamOltBandwidthProfile,
Matteo Scandolo198aef92020-01-08 00:43:17 +000089 final String serviceName, final boolean enableMacLearning,
90 final String configuredMacAddress, final boolean isDhcpRequired,
91 final boolean isIgmpRequired) {
92 this.uniTagMatch = uniTagMatch;
93 this.ponCTag = ponCTag;
94 this.ponSTag = ponSTag;
95 this.usPonCTagPriority = usPonCTagPriority;
96 this.usPonSTagPriority = usPonSTagPriority;
97 this.dsPonCTagPriority = dsPonCTagPriority;
98 this.dsPonSTagPriority = dsPonSTagPriority;
99 this.technologyProfileId = technologyProfileId;
100 this.upstreamBandwidthProfile = upstreamBandwidthProfile;
101 this.downstreamBandwidthProfile = downstreamBandwidthProfile;
yasin sapli2c93ddb2021-06-11 17:46:26 +0300102 this.upstreamOltBandwidthProfile = upstreamOltBandwidthProfile;
103 this.downstreamOltBandwidthProfile = downstreamOltBandwidthProfile;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000104 this.serviceName = serviceName;
105 this.enableMacLearning = enableMacLearning;
106 this.configuredMacAddress = configuredMacAddress;
107 this.isDhcpRequired = isDhcpRequired;
108 this.isIgmpRequired = isIgmpRequired;
109 }
yasin sapli2c93ddb2021-06-11 17:46:26 +0300110 //CHECKSTYLE:ON
Matteo Scandolo198aef92020-01-08 00:43:17 +0000111
112 public final VlanId getUniTagMatch() {
113 return uniTagMatch;
114 }
115
116 public final VlanId getPonCTag() {
117 return ponCTag;
118 }
119
120 public final VlanId getPonSTag() {
121 return ponSTag;
122 }
123
124 public final int getUsPonCTagPriority() {
125 return usPonCTagPriority;
126 }
127
128 public final int getUsPonSTagPriority() {
129 return usPonSTagPriority;
130 }
131
132 public final int getDsPonCTagPriority() {
133 return dsPonCTagPriority;
134 }
135
136 public final int getDsPonSTagPriority() {
137 return dsPonSTagPriority;
138 }
139
140 public final int getTechnologyProfileId() {
141 return technologyProfileId;
142 }
143
144 public final String getUpstreamBandwidthProfile() {
145 return upstreamBandwidthProfile;
146 }
147
148 public final String getDownstreamBandwidthProfile() {
149 return downstreamBandwidthProfile;
150 }
151
yasin sapli2c93ddb2021-06-11 17:46:26 +0300152 public final String getUpstreamOltBandwidthProfile() {
153 return upstreamOltBandwidthProfile;
154 }
155
156 public final String getDownstreamOltBandwidthProfile() {
157 return downstreamOltBandwidthProfile;
158 }
159
Matteo Scandolo198aef92020-01-08 00:43:17 +0000160 public final String getServiceName() {
161 return serviceName;
162 }
163
164 public final boolean getEnableMacLearning() {
165 return enableMacLearning;
166 }
167
168 public final String getConfiguredMacAddress() {
169 return configuredMacAddress;
170 }
171
172 public final boolean getIsDhcpRequired() {
173 return isDhcpRequired;
174 }
175
176 public final boolean getIsIgmpRequired() {
177 return isIgmpRequired;
178 }
179
180 @Override
181 public boolean equals(Object o) {
182 if (this == o) {
183 return true;
184 }
185 if (o == null || getClass() != o.getClass()) {
186 return false;
187 }
188
189 UniTagInformation that = (UniTagInformation) o;
190
191 if (uniTagMatch != that.uniTagMatch) {
192 return false;
193 }
194 if (technologyProfileId != that.technologyProfileId) {
195 return false;
196 }
197 if (ponCTag != that.ponCTag) {
198 return false;
199 }
200 if (ponSTag != that.ponSTag) {
201 return false;
202 }
203 if (usPonCTagPriority != that.usPonCTagPriority) {
204 return false;
205 }
206 if (usPonSTagPriority != that.usPonSTagPriority) {
207 return false;
208 }
209 if (dsPonCTagPriority != that.dsPonCTagPriority) {
210 return false;
211 }
212 if (dsPonSTagPriority != that.dsPonSTagPriority) {
213 return false;
214 }
215 if (enableMacLearning != that.enableMacLearning) {
216 return false;
217 }
218 if (configuredMacAddress != that.configuredMacAddress) {
219 return false;
220 }
221 if (isDhcpRequired != that.isDhcpRequired) {
222 return false;
223 }
224 if (isIgmpRequired != that.isIgmpRequired) {
225 return false;
226 }
227 if (upstreamBandwidthProfile != null ? !upstreamBandwidthProfile.equals(that.upstreamBandwidthProfile) :
228 that.upstreamBandwidthProfile != null) {
229 return false;
230 }
231 if (downstreamBandwidthProfile != null ? !downstreamBandwidthProfile.equals(that.downstreamBandwidthProfile) :
232 that.downstreamBandwidthProfile != null) {
233 return false;
234 }
yasin sapli2c93ddb2021-06-11 17:46:26 +0300235 if (upstreamOltBandwidthProfile != null ?
236 !upstreamOltBandwidthProfile.equals(that.upstreamOltBandwidthProfile) :
237 that.upstreamOltBandwidthProfile != null) {
238 return false;
239 }
240 if (downstreamOltBandwidthProfile != null ?
241 !downstreamOltBandwidthProfile.equals(that.downstreamOltBandwidthProfile) :
242 that.downstreamOltBandwidthProfile != null) {
243 return false;
244 }
Matteo Scandolo198aef92020-01-08 00:43:17 +0000245 return serviceName != null ? serviceName.equals(that.serviceName) : that.serviceName == null;
246 }
247
248 @Override
249 public int hashCode() {
250 int result = uniTagMatch != null ? uniTagMatch.hashCode() : 0;
251 result = 31 * result + (ponCTag != null ? ponCTag.hashCode() : 0);
252 result = 31 * result + (ponSTag != null ? ponSTag.hashCode() : 0);
253 result = 31 * result + usPonCTagPriority;
254 result = 31 * result + usPonSTagPriority;
255 result = 31 * result + dsPonCTagPriority;
256 result = 31 * result + dsPonSTagPriority;
257 result = 31 * result + technologyProfileId;
258 result = 31 * result + (upstreamBandwidthProfile != null ? upstreamBandwidthProfile.hashCode() : 0);
259 result = 31 * result + (downstreamBandwidthProfile != null ? downstreamBandwidthProfile.hashCode() : 0);
yasin sapli2c93ddb2021-06-11 17:46:26 +0300260 result = 31 * result + (upstreamOltBandwidthProfile != null ? upstreamOltBandwidthProfile.hashCode() : 0);
261 result = 31 * result + (downstreamOltBandwidthProfile != null ? downstreamOltBandwidthProfile.hashCode() : 0);
Matteo Scandolo198aef92020-01-08 00:43:17 +0000262 result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
263 result = 31 * result + (enableMacLearning ? 1 : 0);
264 result = 31 * result + (configuredMacAddress != null ? configuredMacAddress.hashCode() : 0);
265 result = 31 * result + (isDhcpRequired ? 1 : 0);
266 result = 31 * result + (isIgmpRequired ? 1 : 0);
267 return result;
268 }
269
270 @Override
271 public String toString() {
272 final StringBuilder sb = new StringBuilder("UniTagInformation{");
273 sb.append("uniTagMatch=").append(uniTagMatch);
274 sb.append(", ponCTag=").append(ponCTag);
275 sb.append(", ponSTag=").append(ponSTag);
276 sb.append(", usPonCTagPriority=").append(usPonCTagPriority);
277 sb.append(", usPonSTagPriority=").append(usPonSTagPriority);
278 sb.append(", dsPonCTagPriority=").append(dsPonCTagPriority);
279 sb.append(", dsPonSTagPriority=").append(dsPonSTagPriority);
280 sb.append(", technologyProfileId=").append(technologyProfileId);
281 sb.append(", enableMacLearning=").append(enableMacLearning);
282 sb.append(", upstreamBandwidthProfile='").append(upstreamBandwidthProfile).append('\'');
283 sb.append(", downstreamBandwidthProfile='").append(downstreamBandwidthProfile).append('\'');
yasin sapli2c93ddb2021-06-11 17:46:26 +0300284 sb.append(", upstreamOltBandwidthProfile='").append(upstreamOltBandwidthProfile).append('\'');
285 sb.append(", downstreamOltBandwidthProfile='").append(downstreamOltBandwidthProfile).append('\'');
Matteo Scandolo198aef92020-01-08 00:43:17 +0000286 sb.append(", serviceName='").append(serviceName).append('\'');
287 sb.append(", configuredMacAddress='").append(configuredMacAddress).append('\'');
288 sb.append(", isDhcpRequired=").append(isDhcpRequired);
289 sb.append(", isIgmpRequired=").append(isIgmpRequired);
290 sb.append('}');
291 return sb.toString();
292 }
293
294 public static final class Builder {
295
296 private VlanId uniTagMatch;
297 private VlanId ponCTag;
298 private VlanId ponSTag;
Gamze Abaka7f987c02020-02-03 08:19:32 +0000299 private int usPonCTagPriority = -1;
300 private int usPonSTagPriority = -1;
301 private int dsPonCTagPriority = -1;
302 private int dsPonSTagPriority = -1;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000303 private int technologyProfileId;
304 private String upstreamBandwidthProfile;
305 private String downstreamBandwidthProfile;
yasin sapli2c93ddb2021-06-11 17:46:26 +0300306 private String upstreamOltBandwidthProfile;
307 private String downstreamOltBandwidthProfile;
Matteo Scandolo198aef92020-01-08 00:43:17 +0000308 private String serviceName;
309 private boolean enableMacLearning;
310 private String configuredMacAddress;
311 private boolean isDhcpRequired;
312 private boolean isIgmpRequired;
313
314 public final Builder setUniTagMatch(final VlanId uniTagMatch) {
315 this.uniTagMatch = uniTagMatch;
316 return this;
317 }
318
319 public final Builder setPonCTag(final VlanId ponCTag) {
320 this.ponCTag = ponCTag;
321 return this;
322 }
323
324 public final Builder setPonSTag(final VlanId ponSTag) {
325 this.ponSTag = ponSTag;
326 return this;
327 }
328
329 public final Builder setUsPonCTagPriority(final int usPonCTagPriority) {
330 this.usPonCTagPriority = usPonCTagPriority;
331 return this;
332 }
333
334 public final Builder setUsPonSTagPriority(final int usPonSTagPriority) {
335 this.usPonSTagPriority = usPonSTagPriority;
336 return this;
337 }
338
339 public final Builder setDsPonCTagPriority(final int dsPonCTagPriority) {
340 this.dsPonCTagPriority = dsPonCTagPriority;
341 return this;
342 }
343
344 public final Builder setDsPonSTagPriority(final int dsPonSTagPriority) {
345 this.dsPonSTagPriority = dsPonSTagPriority;
346 return this;
347 }
348
349 public final Builder setTechnologyProfileId(final int technologyProfileId) {
350 this.technologyProfileId = technologyProfileId;
351 return this;
352 }
353
354 public final Builder setUpstreamBandwidthProfile(final String upstreamBandwidthProfile) {
355 this.upstreamBandwidthProfile = upstreamBandwidthProfile;
356 return this;
357 }
358
359 public final Builder setDownstreamBandwidthProfile(final String downstreamBandwidthProfile) {
360 this.downstreamBandwidthProfile = downstreamBandwidthProfile;
361 return this;
362 }
363
yasin sapli2c93ddb2021-06-11 17:46:26 +0300364 public final Builder setUpstreamOltBandwidthProfile(final String upstreamOltBandwidthProfile) {
365 this.upstreamOltBandwidthProfile = upstreamOltBandwidthProfile;
366 return this;
367 }
368
369 public final Builder setDownstreamOltBandwidthProfile(final String downstreamOltBandwidthProfile) {
370 this.downstreamOltBandwidthProfile = downstreamOltBandwidthProfile;
371 return this;
372 }
373
Matteo Scandolo198aef92020-01-08 00:43:17 +0000374 public final Builder setServiceName(final String serviceName) {
375 this.serviceName = serviceName;
376 return this;
377 }
378
379 public final Builder setEnableMacLearning(final boolean enableMacLearning) {
380 this.enableMacLearning = enableMacLearning;
381 return this;
382 }
383
384 public final Builder setConfiguredMacAddress(final String configuredMacAddress) {
385 this.configuredMacAddress = configuredMacAddress;
386 return this;
387 }
388
389 public final Builder setIsDhcpRequired(final boolean isDhcpRequired) {
390 this.isDhcpRequired = isDhcpRequired;
391 return this;
392 }
393
394 public final Builder setIsIgmpRequired(final boolean isIgmpRequired) {
395 this.isIgmpRequired = isIgmpRequired;
396 return this;
397 }
398
399 public final UniTagInformation build() {
400 return new UniTagInformation(this.uniTagMatch, this.ponCTag,
401 this.ponSTag, this.usPonCTagPriority, this.usPonSTagPriority,
402 this.dsPonCTagPriority, this.dsPonSTagPriority, this.technologyProfileId,
yasin sapli2c93ddb2021-06-11 17:46:26 +0300403 this.upstreamBandwidthProfile, this.downstreamBandwidthProfile,
404 this.upstreamOltBandwidthProfile, this.downstreamOltBandwidthProfile,
405 this.serviceName, this.enableMacLearning,
406 this.configuredMacAddress, this.isDhcpRequired, this.isIgmpRequired);
Matteo Scandolo198aef92020-01-08 00:43:17 +0000407 }
408 }
409}