blob: 6efe465ff96b2d762fe52d6fe1102a0bf0a07a95 [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001/**
2 * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org)
3 */
4package org.onosproject.xran.codecs.pdu;
5
6import org.onosproject.xran.codecs.api.CRNTI;
7import org.onosproject.xran.codecs.api.ECGI;
8import org.onosproject.xran.codecs.api.PCIARFCN;
9import org.onosproject.xran.codecs.api.XICICPA;
10import org.openmuc.jasn1.ber.BerByteArrayOutputStream;
11import org.openmuc.jasn1.ber.BerLength;
12import org.openmuc.jasn1.ber.BerTag;
13import org.openmuc.jasn1.ber.types.BerBitString;
14import org.openmuc.jasn1.ber.types.BerInteger;
slowr8ddc2b12017-08-14 14:13:38 -070015import org.openmuc.jasn1.ber.types.string.BerUTF8String;
16
slowr13fa5b02017-08-08 16:32:31 -070017import java.io.IOException;
18import java.io.InputStream;
19import java.io.Serializable;
slowr8ddc2b12017-08-14 14:13:38 -070020import java.io.UnsupportedEncodingException;
slowr13fa5b02017-08-08 16:32:31 -070021
22public class XICICConfig implements Serializable {
23
24 private static final long serialVersionUID = 1L;
25
26 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
27
28 public byte[] code = null;
29 private ECGI ecgi = null;
30 private PCIARFCN pciArfcn = null;
31 private CRNTI crnti = null;
32 private XICICPA pa = null;
33 private BerInteger startPrbDl = null;
34 private BerInteger endPrbDl = null;
35 private BerBitString subframeBitmaskDl = null;
36 private BerInteger p0UePusch = null;
37 private BerInteger startPrbUl = null;
38 private BerInteger endPrbUl = null;
39 private BerBitString subframeBitmaskUl = null;
40
41 public XICICConfig() {
42 }
43
44 public XICICConfig(byte[] code) {
45 this.code = code;
46 }
47
48 public void setEcgi(ECGI ecgi) {
49 this.ecgi = ecgi;
50 }
51
52 public ECGI getEcgi() {
53 return ecgi;
54 }
55
56 public void setPciArfcn(PCIARFCN pciArfcn) {
57 this.pciArfcn = pciArfcn;
58 }
59
60 public PCIARFCN getPciArfcn() {
61 return pciArfcn;
62 }
63
64 public void setCrnti(CRNTI crnti) {
65 this.crnti = crnti;
66 }
67
68 public CRNTI getCrnti() {
69 return crnti;
70 }
71
72 public void setPa(XICICPA pa) {
73 this.pa = pa;
74 }
75
76 public XICICPA getPa() {
77 return pa;
78 }
79
80 public void setStartPrbDl(BerInteger startPrbDl) {
81 this.startPrbDl = startPrbDl;
82 }
83
84 public BerInteger getStartPrbDl() {
85 return startPrbDl;
86 }
87
88 public void setEndPrbDl(BerInteger endPrbDl) {
89 this.endPrbDl = endPrbDl;
90 }
91
92 public BerInteger getEndPrbDl() {
93 return endPrbDl;
94 }
95
96 public void setSubframeBitmaskDl(BerBitString subframeBitmaskDl) {
97 this.subframeBitmaskDl = subframeBitmaskDl;
98 }
99
100 public BerBitString getSubframeBitmaskDl() {
101 return subframeBitmaskDl;
102 }
103
104 public void setP0UePusch(BerInteger p0UePusch) {
105 this.p0UePusch = p0UePusch;
106 }
107
108 public BerInteger getP0UePusch() {
109 return p0UePusch;
110 }
111
112 public void setStartPrbUl(BerInteger startPrbUl) {
113 this.startPrbUl = startPrbUl;
114 }
115
116 public BerInteger getStartPrbUl() {
117 return startPrbUl;
118 }
119
120 public void setEndPrbUl(BerInteger endPrbUl) {
121 this.endPrbUl = endPrbUl;
122 }
123
124 public BerInteger getEndPrbUl() {
125 return endPrbUl;
126 }
127
128 public void setSubframeBitmaskUl(BerBitString subframeBitmaskUl) {
129 this.subframeBitmaskUl = subframeBitmaskUl;
130 }
131
132 public BerBitString getSubframeBitmaskUl() {
133 return subframeBitmaskUl;
134 }
135
136 public int encode(BerByteArrayOutputStream os) throws IOException {
137 return encode(os, true);
138 }
139
140 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
141
142 if (code != null) {
143 for (int i = code.length - 1; i >= 0; i--) {
144 os.write(code[i]);
145 }
146 if (withTag) {
147 return tag.encode(os) + code.length;
148 }
149 return code.length;
150 }
151
152 int codeLength = 0;
153 codeLength += subframeBitmaskUl.encode(os, false);
154 // write tag: CONTEXT_CLASS, PRIMITIVE, 10
155 os.write(0x8A);
156 codeLength += 1;
157
158 codeLength += endPrbUl.encode(os, false);
159 // write tag: CONTEXT_CLASS, PRIMITIVE, 9
160 os.write(0x89);
161 codeLength += 1;
162
163 codeLength += startPrbUl.encode(os, false);
164 // write tag: CONTEXT_CLASS, PRIMITIVE, 8
165 os.write(0x88);
166 codeLength += 1;
167
168 codeLength += p0UePusch.encode(os, false);
169 // write tag: CONTEXT_CLASS, PRIMITIVE, 7
170 os.write(0x87);
171 codeLength += 1;
172
173 codeLength += subframeBitmaskDl.encode(os, false);
174 // write tag: CONTEXT_CLASS, PRIMITIVE, 6
175 os.write(0x86);
176 codeLength += 1;
177
178 codeLength += endPrbDl.encode(os, false);
179 // write tag: CONTEXT_CLASS, PRIMITIVE, 5
180 os.write(0x85);
181 codeLength += 1;
182
183 codeLength += startPrbDl.encode(os, false);
184 // write tag: CONTEXT_CLASS, PRIMITIVE, 4
185 os.write(0x84);
186 codeLength += 1;
187
188 codeLength += pa.encode(os, false);
189 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
190 os.write(0x83);
191 codeLength += 1;
192
193 codeLength += crnti.encode(os, false);
194 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
195 os.write(0x82);
196 codeLength += 1;
197
198 codeLength += pciArfcn.encode(os, false);
199 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
200 os.write(0xA1);
201 codeLength += 1;
202
203 codeLength += ecgi.encode(os, false);
204 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
205 os.write(0xA0);
206 codeLength += 1;
207
208 codeLength += BerLength.encodeLength(os, codeLength);
209
210 if (withTag) {
211 codeLength += tag.encode(os);
212 }
213
214 return codeLength;
215
216 }
217
218 public int decode(InputStream is) throws IOException {
219 return decode(is, true);
220 }
221
222 public int decode(InputStream is, boolean withTag) throws IOException {
223 int codeLength = 0;
224 int subCodeLength = 0;
225 BerTag berTag = new BerTag();
226
227 if (withTag) {
228 codeLength += tag.decodeAndCheck(is);
229 }
230
231 BerLength length = new BerLength();
232 codeLength += length.decode(is);
233
234 int totalLength = length.val;
235 codeLength += totalLength;
236
237 subCodeLength += berTag.decode(is);
238 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
239 ecgi = new ECGI();
240 subCodeLength += ecgi.decode(is, false);
241 subCodeLength += berTag.decode(is);
242 }
243 else {
244 throw new IOException("Tag does not match the mandatory sequence element tag.");
245 }
246
247 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
248 pciArfcn = new PCIARFCN();
249 subCodeLength += pciArfcn.decode(is, false);
250 subCodeLength += berTag.decode(is);
251 }
252 else {
253 throw new IOException("Tag does not match the mandatory sequence element tag.");
254 }
255
256 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
257 crnti = new CRNTI();
258 subCodeLength += crnti.decode(is, false);
259 subCodeLength += berTag.decode(is);
260 }
261 else {
262 throw new IOException("Tag does not match the mandatory sequence element tag.");
263 }
264
265 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
266 pa = new XICICPA();
267 subCodeLength += pa.decode(is, false);
268 subCodeLength += berTag.decode(is);
269 }
270 else {
271 throw new IOException("Tag does not match the mandatory sequence element tag.");
272 }
273
274 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
275 startPrbDl = new BerInteger();
276 subCodeLength += startPrbDl.decode(is, false);
277 subCodeLength += berTag.decode(is);
278 }
279 else {
280 throw new IOException("Tag does not match the mandatory sequence element tag.");
281 }
282
283 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) {
284 endPrbDl = new BerInteger();
285 subCodeLength += endPrbDl.decode(is, false);
286 subCodeLength += berTag.decode(is);
287 }
288 else {
289 throw new IOException("Tag does not match the mandatory sequence element tag.");
290 }
291
292 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
293 subframeBitmaskDl = new BerBitString();
294 subCodeLength += subframeBitmaskDl.decode(is, false);
295 subCodeLength += berTag.decode(is);
296 }
297 else {
298 throw new IOException("Tag does not match the mandatory sequence element tag.");
299 }
300
301 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
302 p0UePusch = new BerInteger();
303 subCodeLength += p0UePusch.decode(is, false);
304 subCodeLength += berTag.decode(is);
305 }
306 else {
307 throw new IOException("Tag does not match the mandatory sequence element tag.");
308 }
309
310 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
311 startPrbUl = new BerInteger();
312 subCodeLength += startPrbUl.decode(is, false);
313 subCodeLength += berTag.decode(is);
314 }
315 else {
316 throw new IOException("Tag does not match the mandatory sequence element tag.");
317 }
318
319 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
320 endPrbUl = new BerInteger();
321 subCodeLength += endPrbUl.decode(is, false);
322 subCodeLength += berTag.decode(is);
323 }
324 else {
325 throw new IOException("Tag does not match the mandatory sequence element tag.");
326 }
327
328 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) {
329 subframeBitmaskUl = new BerBitString();
330 subCodeLength += subframeBitmaskUl.decode(is, false);
331 if (subCodeLength == totalLength) {
332 return codeLength;
333 }
334 }
335 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
336
337
338 }
339
340 public void encodeAndSave(int encodingSizeGuess) throws IOException {
341 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
342 encode(os, false);
343 code = os.getArray();
344 }
345
346 public String toString() {
347 StringBuilder sb = new StringBuilder();
348 appendAsString(sb, 0);
349 return sb.toString();
350 }
351
352 public void appendAsString(StringBuilder sb, int indentLevel) {
353
354 sb.append("{");
355 sb.append("\n");
356 for (int i = 0; i < indentLevel + 1; i++) {
357 sb.append("\t");
358 }
359 if (ecgi != null) {
360 sb.append("\"ecgi\": ");
361 ecgi.appendAsString(sb, indentLevel + 1);
362 }
363
364 sb.append(",\n");
365 for (int i = 0; i < indentLevel + 1; i++) {
366 sb.append("\t");
367 }
368 if (pciArfcn != null) {
369 sb.append("\"pciArfcn\": ");
370 pciArfcn.appendAsString(sb, indentLevel + 1);
371 }
372
373 sb.append(",\n");
374 for (int i = 0; i < indentLevel + 1; i++) {
375 sb.append("\t");
376 }
377 if (crnti != null) {
378 sb.append("\"crnti\": ").append(crnti);
379 }
380
381 sb.append(",\n");
382 for (int i = 0; i < indentLevel + 1; i++) {
383 sb.append("\t");
384 }
385 if (pa != null) {
386 sb.append("\"pa\": ").append(pa);
387 }
388
389 sb.append(",\n");
390 for (int i = 0; i < indentLevel + 1; i++) {
391 sb.append("\t");
392 }
393 if (startPrbDl != null) {
394 sb.append("\"startPrbDl\": ").append(startPrbDl);
395 }
396
397 sb.append(",\n");
398 for (int i = 0; i < indentLevel + 1; i++) {
399 sb.append("\t");
400 }
401 if (endPrbDl != null) {
402 sb.append("\"endPrbDl\": ").append(endPrbDl);
403 }
404
405 sb.append(",\n");
406 for (int i = 0; i < indentLevel + 1; i++) {
407 sb.append("\t");
408 }
409 if (subframeBitmaskDl != null) {
410 sb.append("\"subframeBitmaskDl\": ").append(subframeBitmaskDl);
411 }
412
413 sb.append(",\n");
414 for (int i = 0; i < indentLevel + 1; i++) {
415 sb.append("\t");
416 }
417 if (p0UePusch != null) {
418 sb.append("\"p0UePusch\": ").append(p0UePusch);
419 }
420
421 sb.append(",\n");
422 for (int i = 0; i < indentLevel + 1; i++) {
423 sb.append("\t");
424 }
425 if (startPrbUl != null) {
426 sb.append("\"startPrbUl\": ").append(startPrbUl);
427 }
428
429 sb.append(",\n");
430 for (int i = 0; i < indentLevel + 1; i++) {
431 sb.append("\t");
432 }
433 if (endPrbUl != null) {
434 sb.append("\"endPrbUl\": ").append(endPrbUl);
435 }
436
437 sb.append(",\n");
438 for (int i = 0; i < indentLevel + 1; i++) {
439 sb.append("\t");
440 }
441 if (subframeBitmaskUl != null) {
442 sb.append("\"subframeBitmaskUl\": ").append(subframeBitmaskUl);
443 }
444
445 sb.append("\n");
446 for (int i = 0; i < indentLevel; i++) {
447 sb.append("\t");
448 }
449 sb.append("}");
450 }
451
slowr8ddc2b12017-08-14 14:13:38 -0700452 public static XrancPdu constructPacket(RRMConfig config) {
453 XrancPduBody body = new XrancPduBody();
454 body.setRRMConfig(config);
455
456 BerUTF8String ver = null;
457 try {
458 ver = new BerUTF8String("3");
459 } catch (UnsupportedEncodingException e) {
460 e.printStackTrace();
461 }
462
463 XrancApiID apiID = new XrancApiID(23);
464 XrancPduHdr hdr = new XrancPduHdr();
465 hdr.setVer(ver);
466 hdr.setApiId(apiID);
467
468 XrancPdu pdu = new XrancPdu();
469 pdu.setHdr(hdr);
470 pdu.setBody(body);
471 return pdu;
472 }
slowr13fa5b02017-08-08 16:32:31 -0700473}
474