blob: fc0fbd7568b796fdb6e90f2ca677f25c86071a55 [file] [log] [blame]
Vinod Kumar S8c4e6492016-02-05 20:21:19 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S8c4e6492016-02-05 20:21:19 +05303 *
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 */
Bharat saraswal96dfef02016-06-16 00:29:12 +053016package org.onosproject.yangutils.datamodel.utils;
Vinod Kumar S8c4e6492016-02-05 20:21:19 +053017
18/**
Bharat saraswald9822e92016-04-05 15:13:44 +053019 * Represents ENUM to represent the type of data in parse tree.
Vinod Kumar S8c4e6492016-02-05 20:21:19 +053020 */
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053021public enum YangConstructType {
Vinod Kumar S8c4e6492016-02-05 20:21:19 +053022 /**
23 * Identifies the module parsed data.
24 */
25 MODULE_DATA,
26
27 /**
28 * Identifies the sub module parsed data.
29 */
30 SUB_MODULE_DATA,
31
32 /**
33 * Identifies the typedef parsed data.
34 */
35 TYPEDEF_DATA,
36
37 /**
38 * Identifies the type parsed data.
39 */
40 TYPE_DATA,
41
42 /**
43 * Identifies the choice parsed data.
44 */
45 CHOICE_DATA,
46
47 /**
48 * Identifies the case parsed data.
49 */
50 CASE_DATA,
51
52 /**
53 * Identifies the YANG enumeration parsed data.
54 */
55 ENUMERATION_DATA,
56
57 /**
58 * Identifies the grouping parsed data.
59 */
60 GROUPING_DATA,
61
62 /**
63 * Identifies the uses parsed data.
64 */
65 USES_DATA,
66
67 /**
68 * Identifies the augment parsed data.
69 */
70 AUGMENT_DATA,
71
72 /**
73 * Identifies the container parsed data.
74 */
75 CONTAINER_DATA,
76
77 /**
78 * Identifies the YANG list parsed data.
79 */
80 LIST_DATA,
81
82 /**
83 * Identifies the YANG belongs-to parsed data.
84 */
85 BELONGS_TO_DATA,
86
87 /**
88 * Identifies the YANG bit parsed data.
89 */
90 BIT_DATA,
91
92 /**
93 * Identifies the YANG bits parsed data.
94 */
95 BITS_DATA,
96
97 /**
Mahesh Poojary Huawei46fb4db2016-07-14 12:38:17 +053098 * Identifies the YANG decimal64 parsed data.
99 */
100 DECIMAL64_DATA,
101
102 /**
103 * Identifies the YANG fraction-digits parsed data.
104 */
105 FRACTION_DIGITS_DATA,
106
107 /**
Vinod Kumar S8c4e6492016-02-05 20:21:19 +0530108 * Identifies the YANG enum parsed data.
109 */
110 ENUM_DATA,
111
112 /**
113 * Identifies the YANG import parsed data.
114 */
115 IMPORT_DATA,
116
117 /**
118 * Identifies the YANG include parsed data.
119 */
120 INCLUDE_DATA,
121
122 /**
123 * Identifies the YANG leaf parsed data.
124 */
125 LEAF_DATA,
126
127 /**
128 * Identifies the YANG leaf list parsed data.
129 */
130 LEAF_LIST_DATA,
131
132 /**
133 * Identifies the YANG must parsed data.
134 */
135 MUST_DATA,
136
137 /**
138 * Identifies the YANG revision parsed data.
139 */
140 REVISION_DATA,
141
142 /**
Gaurav Agrawala04483c2016-02-13 14:23:40 +0530143 * Identifies the YANG revision date parsed data.
144 */
145 REVISION_DATE_DATA,
146
147 /**
Vinod Kumar S8c4e6492016-02-05 20:21:19 +0530148 * Identifies the YANG namespace parsed data.
149 */
Gaurav Agrawala04483c2016-02-13 14:23:40 +0530150 NAMESPACE_DATA,
151
152 /**
153 * Identifies the YANG contact parsed data.
154 */
155 CONTACT_DATA,
156
157 /**
158 * Identifies the YANG config parsed data.
159 */
160 CONFIG_DATA,
161
162 /**
163 * Identifies the YANG description parsed data.
164 */
165 DESCRIPTION_DATA,
166
167 /**
168 * Identifies the YANG key parsed data.
169 */
170 KEY_DATA,
171
172 /**
173 * Identifies the YANG mandatory parsed data.
174 */
175 MANDATORY_DATA,
176
177 /**
178 * Identifies the YANG max element parsed data.
179 */
180 MAX_ELEMENT_DATA,
181
182 /**
183 * Identifies the YANG min element parsed data.
184 */
185 MIN_ELEMENT_DATA,
186
187 /**
188 * Identifies the YANG presence element parsed data.
189 */
190 PRESENCE_DATA,
191
192 /**
193 * Identifies the YANG reference element parsed data.
194 */
195 REFERENCE_DATA,
196
197 /**
198 * Identifies the YANG status element parsed data.
199 */
200 STATUS_DATA,
201
202 /**
203 * Identifies the YANG units element parsed data.
204 */
205 UNITS_DATA,
206
207 /**
208 * Identifies the YANG version element parsed data.
209 */
210 VERSION_DATA,
211
212 /**
213 * Identifies the YANG base element parsed data.
214 */
215 YANGBASE_DATA,
216
217 /**
218 * Identifies the YANG prefix element parsed data.
219 */
220 PREFIX_DATA,
221
222 /**
223 * Identifies the YANG default element parsed data.
224 */
225 DEFAULT_DATA,
226
227 /**
Gaurav Agrawal9c512e02016-02-25 04:37:05 +0530228 * Identifies the YANG value element parsed data.
229 */
230 VALUE_DATA,
231
232 /**
Gaurav Agrawala04483c2016-02-13 14:23:40 +0530233 * Identifies the YANG organization parsed data.
234 */
Vinod Kumar S71cba682016-02-25 15:52:16 +0530235 ORGANIZATION_DATA,
236
237 /**
Gaurav Agrawal0cfdeed2016-02-26 02:47:39 +0530238 * Identifies the YANG position element parsed data.
239 */
240 POSITION_DATA,
241
242 /**
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530243 * Identifies the YANG data definition statements.
244 */
245 DATA_DEF_DATA,
246
247 /**
Gaurav Agrawale3ed0d92016-03-23 19:04:17 +0530248 * Identifies the YANG union element parsed data.
249 */
250 UNION_DATA,
251
252 /**
253 * Identifies the YANG notification element parsed data.
254 */
255 NOTIFICATION_DATA,
256
257 /**
258 * Identifies the YANG when element parsed data.
259 */
260 WHEN_DATA,
261
262 /**
263 * Identifies the YANG input element parsed data.
264 */
265 INPUT_DATA,
266
267 /**
268 * Identifies the YANG output element parsed data.
269 */
270 OUTPUT_DATA,
271
272 /**
273 * Identifies the YANG rpc element parsed data.
274 */
275 RPC_DATA,
276
277 /**
278 * Identifies the YANG short case element parsed data.
279 */
280 SHORT_CASE_DATA,
281
282 /**
Vinod Kumar S71cba682016-02-25 15:52:16 +0530283 * Identifies the derived data type.
284 */
Vidyashree Rama0b920732016-03-29 09:52:22 +0530285 DERIVED,
286
287 /**
288 * Identifies the YANG range element parsed data.
289 */
Vidyashree Ramaa2f73982016-04-12 23:33:33 +0530290 RANGE_DATA,
291
292 /**
293 * Identifies the YANG length element parsed data.
294 */
295 LENGTH_DATA,
296
297 /**
298 * Identifies the YANG pattern element parsed data.
299 */
Vidyashree Rama1db15562016-05-17 16:16:15 +0530300 PATTERN_DATA,
301
302 /**
303 * Identifies the YANG extension element parsed data.
304 */
305 EXTENSION_DATA,
306
307 /**
308 * Identifies the YANG identity element parsed data.
309 */
310 IDENTITY_DATA,
311
312 /**
313 * Identifies the YANG base element parsed data.
314 */
315 BASE_DATA,
316
317 /**
318 * Identifies the YANG feature element parsed data.
319 */
320 FEATURE_DATA,
321
322 /**
323 * Identifies the YANG if-feature element parsed data.
324 */
325 IF_FEATURE_DATA,
326
327 /**
328 * Identifies the YANG path element parsed data.
329 */
330 PATH_DATA,
331
332 /**
333 * Identifies the YANG require-instance element parsed data.
334 */
335 REQUIRE_INSTANCE_DATA,
336
337 /**
338 * Identifies the YANG ordered-by element parsed data.
339 */
340 ORDERED_BY_DATA,
341
342 /**
343 * Identifies the YANG error-message element parsed data.
344 */
345 ERROR_MESSAGE_DATA,
346
347 /**
348 * Identifies the YANG error-app-tag element parsed data.
349 */
350 ERROR_APP_TAG_DATA,
351
352 /**
353 * Identifies the YANG unique element parsed data.
354 */
355 UNIQUE_DATA,
356
357 /**
358 * Identifies the YANG refine element parsed data.
359 */
360 REFINE_DATA,
361
362 /**
janani b6240d292016-05-17 18:20:33 +0530363 * Identifies the YANG leafref element parsed data.
364 */
365 LEAFREF_DATA,
366
367 /**
368 * Identifies the YANG identityref element parsed data.
369 */
370 IDENTITYREF_DATA,
371
372 /**
373 * Identifies the YANG instance identifier element parsed data.
374 */
375 INSTANCE_IDENTIFIER_DATA,
376
377 /**
Vidyashree Rama1db15562016-05-17 16:16:15 +0530378 * Identifies the YANG deviation element parsed data.
379 */
380 DEVIATION_DATA,
381
382 /**
383 * Identifies the YANG anyxml element parsed data.
384 */
Vidyashree Rama36f2fab2016-07-15 14:06:56 +0530385 ANYXML_DATA,
386
387 /**
Vidyashree Rama07c26bb2016-07-28 17:33:15 +0530388 * Identifies the YANG compiler annotation element parsed data.
389 */
390 COMPILER_ANNOTATION_DATA,
391
392 /**
393 * Identifies the YANG app data structure element parsed data.
394 */
395 APP_DATA_STRUCTURE,
396
397 /**
398 * Identifies the YANG app extended element parsed data.
399 */
400 APP_EXTENDED_NAME_DATA,
401
402 /**
Vidyashree Rama36f2fab2016-07-15 14:06:56 +0530403 * Identifies the YANG argument element parsed data.
404 */
405 ARGUMENT_DATA;
Gaurav Agrawala04483c2016-02-13 14:23:40 +0530406
407 /**
408 * Returns the YANG construct keyword corresponding to enum values.
409 *
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530410 * @param yangConstructType enum value for parsable data type.
411 * @return YANG construct keyword.
Gaurav Agrawala04483c2016-02-13 14:23:40 +0530412 */
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530413 public static String getYangConstructType(YangConstructType yangConstructType) {
Gaurav Agrawala04483c2016-02-13 14:23:40 +0530414
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530415 switch (yangConstructType) {
Gaurav Agrawal9c512e02016-02-25 04:37:05 +0530416 case MODULE_DATA:
417 return "module";
418 case SUB_MODULE_DATA:
419 return "submodule";
420 case TYPEDEF_DATA:
421 return "typedef";
422 case TYPE_DATA:
423 return "type";
424 case CHOICE_DATA:
425 return "choice";
426 case CASE_DATA:
427 return "case";
428 case ENUMERATION_DATA:
429 return "enumeration";
430 case GROUPING_DATA:
431 return "grouping";
432 case USES_DATA:
433 return "uses";
434 case AUGMENT_DATA:
435 return "augment";
436 case CONTAINER_DATA:
437 return "container";
438 case LIST_DATA:
439 return "list";
440 case BELONGS_TO_DATA:
441 return "belongs-to";
442 case BIT_DATA:
443 return "bit";
444 case BITS_DATA:
445 return "bits";
Mahesh Poojary Huawei46fb4db2016-07-14 12:38:17 +0530446 case DECIMAL64_DATA:
447 return "decimal64";
448 case FRACTION_DIGITS_DATA:
449 return "fraction-digits";
Gaurav Agrawal9c512e02016-02-25 04:37:05 +0530450 case ENUM_DATA:
451 return "enum";
452 case IMPORT_DATA:
453 return "import";
454 case INCLUDE_DATA:
455 return "include";
456 case LEAF_DATA:
457 return "leaf";
458 case LEAF_LIST_DATA:
459 return "leaf-list";
460 case MUST_DATA:
461 return "must";
462 case REVISION_DATA:
463 return "revision";
464 case REVISION_DATE_DATA:
465 return "revision-date";
466 case NAMESPACE_DATA:
467 return "namespace";
468 case CONTACT_DATA:
469 return "contact";
470 case CONFIG_DATA:
471 return "config";
472 case DESCRIPTION_DATA:
473 return "description";
474 case KEY_DATA:
475 return "key";
476 case MANDATORY_DATA:
477 return "mandatory";
478 case MAX_ELEMENT_DATA:
479 return "max-elements";
480 case MIN_ELEMENT_DATA:
481 return "min-elements";
482 case PRESENCE_DATA:
483 return "presence";
484 case REFERENCE_DATA:
485 return "reference";
486 case STATUS_DATA:
487 return "status";
488 case UNITS_DATA:
489 return "units";
490 case VERSION_DATA:
491 return "version";
492 case YANGBASE_DATA:
493 return "yangbase";
494 case PREFIX_DATA:
495 return "prefix";
496 case ORGANIZATION_DATA:
497 return "organization";
498 case VALUE_DATA:
499 return "value";
Gaurav Agrawal0cfdeed2016-02-26 02:47:39 +0530500 case POSITION_DATA:
501 return "position";
Gaurav Agrawal9c512e02016-02-25 04:37:05 +0530502 case DEFAULT_DATA:
503 return "default";
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530504 case DATA_DEF_DATA:
505 return "data-def-substatements";
Gaurav Agrawale3ed0d92016-03-23 19:04:17 +0530506 case WHEN_DATA:
507 return "when";
508 case INPUT_DATA:
509 return "input";
510 case OUTPUT_DATA:
511 return "ouput";
512 case RPC_DATA:
513 return "rpc";
514 case SHORT_CASE_DATA:
515 return "short-case";
Vinod Kumar S71cba682016-02-25 15:52:16 +0530516 case DERIVED:
517 return "derived";
Gaurav Agrawale3ed0d92016-03-23 19:04:17 +0530518 case NOTIFICATION_DATA:
519 return "notification";
520 case UNION_DATA:
521 return "union";
Vidyashree Rama0b920732016-03-29 09:52:22 +0530522 case RANGE_DATA:
523 return "range";
Vidyashree Ramaa2f73982016-04-12 23:33:33 +0530524 case LENGTH_DATA:
525 return "length";
526 case PATTERN_DATA:
527 return "pattern";
Vidyashree Rama1db15562016-05-17 16:16:15 +0530528 case EXTENSION_DATA:
529 return "extension";
530 case IDENTITY_DATA:
531 return "identity";
532 case BASE_DATA:
533 return "base";
534 case FEATURE_DATA:
535 return "feature";
536 case IF_FEATURE_DATA:
537 return "if-feature";
538 case PATH_DATA:
539 return "path";
540 case REQUIRE_INSTANCE_DATA:
541 return "require-instance";
542 case ORDERED_BY_DATA:
543 return "ordered-by";
544 case ERROR_MESSAGE_DATA:
545 return "error-message";
546 case ERROR_APP_TAG_DATA:
547 return "error-app-tag";
548 case UNIQUE_DATA:
549 return "unique";
550 case REFINE_DATA:
551 return "refine";
janani b6240d292016-05-17 18:20:33 +0530552 case LEAFREF_DATA:
553 return "leafref";
554 case IDENTITYREF_DATA:
555 return "identityref";
556 case INSTANCE_IDENTIFIER_DATA:
557 return "instance-identifier";
Vidyashree Rama1db15562016-05-17 16:16:15 +0530558 case DEVIATION_DATA:
559 return "deviation";
560 case ANYXML_DATA:
561 return "anyxml";
Vidyashree Rama07c26bb2016-07-28 17:33:15 +0530562 case COMPILER_ANNOTATION_DATA:
563 return "compiler-annotation";
564 case APP_DATA_STRUCTURE:
565 return "app-data-structure";
566 case APP_EXTENDED_NAME_DATA:
567 return "app-extended-name";
Vidyashree Rama36f2fab2016-07-15 14:06:56 +0530568 case ARGUMENT_DATA:
569 return "argument";
Gaurav Agrawal9c512e02016-02-25 04:37:05 +0530570 default:
571 return "yang";
Gaurav Agrawala04483c2016-02-13 14:23:40 +0530572 }
573 }
Gaurav Agrawal9c512e02016-02-25 04:37:05 +0530574}