blob: 8bdde452633378bd3d04b939aeabe36e7875feb8 [file] [log] [blame]
Daniele Moro82d9a362019-11-06 23:51:20 +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")
27 private VlanId uniTagMatch = VlanId.NONE;
28
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
56 @JsonProperty(value = "serviceName")
57 private String serviceName;
58
59 @JsonProperty(value = "enableMacLearning")
60 private boolean enableMacLearning = false;
61
62 @JsonProperty(value = "configuredMacAddress")
63 private String configuredMacAddress;
64
65 @JsonProperty(value = "isDhcpRequired")
66 private boolean isDhcpRequired;
67
68 @JsonProperty(value = "isIgmpRequired")
69 private boolean isIgmpRequired;
70
71 public UniTagInformation() {
72
73 }
74
75 private UniTagInformation(final VlanId uniTagMatch, final VlanId ponCTag, final VlanId ponSTag,
76 final int usPonCTagPriority, final int usPonSTagPriority,
77 final int dsPonCTagPriority, final int dsPonSTagPriority,
78 final int technologyProfileId,
79 final String upstreamBandwidthProfile, final String downstreamBandwidthProfile,
80 final String serviceName, final boolean enableMacLearning,
81 final String configuredMacAddress, final boolean isDhcpRequired,
82 final boolean isIgmpRequired) {
83 this.uniTagMatch = uniTagMatch;
84 this.ponCTag = ponCTag;
85 this.ponSTag = ponSTag;
86 this.usPonCTagPriority = usPonCTagPriority;
87 this.usPonSTagPriority = usPonSTagPriority;
88 this.dsPonCTagPriority = dsPonCTagPriority;
89 this.dsPonSTagPriority = dsPonSTagPriority;
90 this.technologyProfileId = technologyProfileId;
91 this.upstreamBandwidthProfile = upstreamBandwidthProfile;
92 this.downstreamBandwidthProfile = downstreamBandwidthProfile;
93 this.serviceName = serviceName;
94 this.enableMacLearning = enableMacLearning;
95 this.configuredMacAddress = configuredMacAddress;
96 this.isDhcpRequired = isDhcpRequired;
97 this.isIgmpRequired = isIgmpRequired;
98 }
99
100 public final VlanId getUniTagMatch() {
101 return uniTagMatch;
102 }
103
104 public final VlanId getPonCTag() {
105 return ponCTag;
106 }
107
108 public final VlanId getPonSTag() {
109 return ponSTag;
110 }
111
112 public final int getUsPonCTagPriority() {
113 return usPonCTagPriority;
114 }
115
116 public final int getUsPonSTagPriority() {
117 return usPonSTagPriority;
118 }
119
120 public final int getDsPonCTagPriority() {
121 return dsPonCTagPriority;
122 }
123
124 public final int getDsPonSTagPriority() {
125 return dsPonSTagPriority;
126 }
127
128 public final int getTechnologyProfileId() {
129 return technologyProfileId;
130 }
131
132 public final String getUpstreamBandwidthProfile() {
133 return upstreamBandwidthProfile;
134 }
135
136 public final String getDownstreamBandwidthProfile() {
137 return downstreamBandwidthProfile;
138 }
139
140 public final String getServiceName() {
141 return serviceName;
142 }
143
144 public final boolean getEnableMacLearning() {
145 return enableMacLearning;
146 }
147
148 public final String getConfiguredMacAddress() {
149 return configuredMacAddress;
150 }
151
152 public final boolean getIsDhcpRequired() {
153 return isDhcpRequired;
154 }
155
156 public final boolean getIsIgmpRequired() {
157 return isIgmpRequired;
158 }
159
160 @Override
161 public boolean equals(Object o) {
162 if (this == o) {
163 return true;
164 }
165 if (o == null || getClass() != o.getClass()) {
166 return false;
167 }
168
169 UniTagInformation that = (UniTagInformation) o;
170
171 if (uniTagMatch != that.uniTagMatch) {
172 return false;
173 }
174 if (technologyProfileId != that.technologyProfileId) {
175 return false;
176 }
177 if (ponCTag != that.ponCTag) {
178 return false;
179 }
180 if (ponSTag != that.ponSTag) {
181 return false;
182 }
183 if (usPonCTagPriority != that.usPonCTagPriority) {
184 return false;
185 }
186 if (usPonSTagPriority != that.usPonSTagPriority) {
187 return false;
188 }
189 if (dsPonCTagPriority != that.dsPonCTagPriority) {
190 return false;
191 }
192 if (dsPonSTagPriority != that.dsPonSTagPriority) {
193 return false;
194 }
195 if (enableMacLearning != that.enableMacLearning) {
196 return false;
197 }
198 if (configuredMacAddress != that.configuredMacAddress) {
199 return false;
200 }
201 if (isDhcpRequired != that.isDhcpRequired) {
202 return false;
203 }
204 if (isIgmpRequired != that.isIgmpRequired) {
205 return false;
206 }
207 if (upstreamBandwidthProfile != null ? !upstreamBandwidthProfile.equals(that.upstreamBandwidthProfile) :
208 that.upstreamBandwidthProfile != null) {
209 return false;
210 }
211 if (downstreamBandwidthProfile != null ? !downstreamBandwidthProfile.equals(that.downstreamBandwidthProfile) :
212 that.downstreamBandwidthProfile != null) {
213 return false;
214 }
215 return serviceName != null ? serviceName.equals(that.serviceName) : that.serviceName == null;
216 }
217
218 @Override
219 public int hashCode() {
220 int result = uniTagMatch != null ? uniTagMatch.hashCode() : 0;
221 result = 31 * result + (ponCTag != null ? ponCTag.hashCode() : 0);
222 result = 31 * result + (ponSTag != null ? ponSTag.hashCode() : 0);
223 result = 31 * result + usPonCTagPriority;
224 result = 31 * result + usPonSTagPriority;
225 result = 31 * result + dsPonCTagPriority;
226 result = 31 * result + dsPonSTagPriority;
227 result = 31 * result + technologyProfileId;
228 result = 31 * result + (upstreamBandwidthProfile != null ? upstreamBandwidthProfile.hashCode() : 0);
229 result = 31 * result + (downstreamBandwidthProfile != null ? downstreamBandwidthProfile.hashCode() : 0);
230 result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
231 result = 31 * result + (enableMacLearning ? 1 : 0);
232 result = 31 * result + (configuredMacAddress != null ? configuredMacAddress.hashCode() : 0);
233 result = 31 * result + (isDhcpRequired ? 1 : 0);
234 result = 31 * result + (isIgmpRequired ? 1 : 0);
235 return result;
236 }
237
238 @Override
239 public String toString() {
240 final StringBuilder sb = new StringBuilder("UniTagInformation{");
241 sb.append("uniTagMatch=").append(uniTagMatch);
242 sb.append(", ponCTag=").append(ponCTag);
243 sb.append(", ponSTag=").append(ponSTag);
244 sb.append(", usPonCTagPriority=").append(usPonCTagPriority);
245 sb.append(", usPonSTagPriority=").append(usPonSTagPriority);
246 sb.append(", dsPonCTagPriority=").append(dsPonCTagPriority);
247 sb.append(", dsPonSTagPriority=").append(dsPonSTagPriority);
248 sb.append(", technologyProfileId=").append(technologyProfileId);
249 sb.append(", enableMacLearning=").append(enableMacLearning);
250 sb.append(", upstreamBandwidthProfile='").append(upstreamBandwidthProfile).append('\'');
251 sb.append(", downstreamBandwidthProfile='").append(downstreamBandwidthProfile).append('\'');
252 sb.append(", serviceName='").append(serviceName).append('\'');
253 sb.append(", configuredMacAddress='").append(configuredMacAddress).append('\'');
254 sb.append(", isDhcpRequired=").append(isDhcpRequired);
255 sb.append(", isIgmpRequired=").append(isIgmpRequired);
256 sb.append('}');
257 return sb.toString();
258 }
259
260 public static final class Builder {
261
262 private VlanId uniTagMatch;
263 private VlanId ponCTag;
264 private VlanId ponSTag;
265 private int usPonCTagPriority;
266 private int usPonSTagPriority;
267 private int dsPonCTagPriority;
268 private int dsPonSTagPriority;
269 private int technologyProfileId;
270 private String upstreamBandwidthProfile;
271 private String downstreamBandwidthProfile;
272 private String serviceName;
273 private boolean enableMacLearning;
274 private String configuredMacAddress;
275 private boolean isDhcpRequired;
276 private boolean isIgmpRequired;
277
278 public final Builder setUniTagMatch(final VlanId uniTagMatch) {
279 this.uniTagMatch = uniTagMatch;
280 return this;
281 }
282
283 public final Builder setPonCTag(final VlanId ponCTag) {
284 this.ponCTag = ponCTag;
285 return this;
286 }
287
288 public final Builder setPonSTag(final VlanId ponSTag) {
289 this.ponSTag = ponSTag;
290 return this;
291 }
292
293 public final Builder setUsPonCTagPriority(final int usPonCTagPriority) {
294 this.usPonCTagPriority = usPonCTagPriority;
295 return this;
296 }
297
298 public final Builder setUsPonSTagPriority(final int usPonSTagPriority) {
299 this.usPonSTagPriority = usPonSTagPriority;
300 return this;
301 }
302
303 public final Builder setDsPonCTagPriority(final int dsPonCTagPriority) {
304 this.dsPonCTagPriority = dsPonCTagPriority;
305 return this;
306 }
307
308 public final Builder setDsPonSTagPriority(final int dsPonSTagPriority) {
309 this.dsPonSTagPriority = dsPonSTagPriority;
310 return this;
311 }
312
313 public final Builder setTechnologyProfileId(final int technologyProfileId) {
314 this.technologyProfileId = technologyProfileId;
315 return this;
316 }
317
318 public final Builder setUpstreamBandwidthProfile(final String upstreamBandwidthProfile) {
319 this.upstreamBandwidthProfile = upstreamBandwidthProfile;
320 return this;
321 }
322
323 public final Builder setDownstreamBandwidthProfile(final String downstreamBandwidthProfile) {
324 this.downstreamBandwidthProfile = downstreamBandwidthProfile;
325 return this;
326 }
327
328 public final Builder setServiceName(final String serviceName) {
329 this.serviceName = serviceName;
330 return this;
331 }
332
333 public final Builder setEnableMacLearning(final boolean enableMacLearning) {
334 this.enableMacLearning = enableMacLearning;
335 return this;
336 }
337
338 public final Builder setConfiguredMacAddress(final String configuredMacAddress) {
339 this.configuredMacAddress = configuredMacAddress;
340 return this;
341 }
342
343 public final Builder setIsDhcpRequired(final boolean isDhcpRequired) {
344 this.isDhcpRequired = isDhcpRequired;
345 return this;
346 }
347
348 public final Builder setIsIgmpRequired(final boolean isIgmpRequired) {
349 this.isIgmpRequired = isIgmpRequired;
350 return this;
351 }
352
353 public final UniTagInformation build() {
354 return new UniTagInformation(this.uniTagMatch, this.ponCTag,
355 this.ponSTag, this.usPonCTagPriority, this.usPonSTagPriority,
356 this.dsPonCTagPriority, this.dsPonSTagPriority, this.technologyProfileId,
357 this.upstreamBandwidthProfile, this.downstreamBandwidthProfile, this.serviceName,
358 this.enableMacLearning, this.configuredMacAddress, this.isDhcpRequired, this.isIgmpRequired);
359 }
360 }
361}