blob: 13d5e66179dfbeeb1ec13bb76ba9db94295c1a32 [file] [log] [blame]
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +05301/*
2 * Copyright 2016 Open Networking Laboratory
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.onosproject.yangutils.datamodel;
17
Bharat saraswal2f00b4b2016-03-04 20:08:09 +053018import java.util.LinkedList;
19import java.util.List;
20
21import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
Vinod Kumar S67e7be62016-02-11 20:13:28 +053022import org.onosproject.yangutils.parser.Parsable;
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053023import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S38046502016-03-23 15:30:27 +053024
25import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
Vinod Kumar S67e7be62016-02-11 20:13:28 +053026
27/*-
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053028 * Reference:RFC 6020.
29 * The "module" statement defines the module's name,
30 * and groups all statements that belong to the module together. The "module"
31 * statement's argument is the name of the module, followed by a block of
32 * sub statements that hold detailed module information.
33 * The module's sub statements
34 *
35 * +--------------+---------+-------------+-----------------------+
36 * |sub statement | section | cardinality | data model mapping |
37 * +--------------+---------+-------------+-----------------------+
38 * | anyxml | 7.10 | 0..n | not supported |
39 * | augment | 7.15 | 0..n | child nodes |
40 * | choice | 7.9 | 0..n | child nodes |
41 * | contact | 7.1.8 | 0..1 | string |
42 * | container | 7.5 | 0..n | child nodes |
43 * | description | 7.19.3 | 0..1 | string |
44 * | deviation | 7.18.3 | 0..n | TODO |
45 * | extension | 7.17 | 0..n | TODO |
46 * | feature | 7.18.1 | 0..n | TODO |
47 * | grouping | 7.11 | 0..n | child nodes |
48 * | identity | 7.16 | 0..n | TODO |
49 * | import | 7.1.5 | 0..n | list of import info |
50 * | include | 7.1.6 | 0..n | list of include info |
51 * | leaf | 7.6 | 0..n | list of leaf info |
52 * | leaf-list | 7.7 | 0..n | list of leaf-list info|
53 * | list | 7.8 | 0..n | child nodes |
54 * | namespace | 7.1.3 | 1 | string/uri |
55 * | notification | 7.14 | 0..n | TODO |
56 * | organization | 7.1.7 | 0..1 | string |
57 * | prefix | 7.1.4 | 1 | string |
58 * | reference | 7.19.4 | 0..1 | string |
59 * | revision | 7.1.9 | 0..n | revision |
60 * | rpc | 7.13 | 0..n | TODO |
61 * | typedef | 7.3 | 0..n | child nodes |
62 * | uses | 7.12 | 0..n | child nodes |
63 * | YANG-version | 7.1.2 | 0..1 | int |
64 * +--------------+---------+-------------+-----------------------+
65 */
66
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053067/**
68 * Data model node to maintain information defined in YANG module.
69 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +053070public class YangModule extends YangNode
Vinod Kumar S38046502016-03-23 15:30:27 +053071 implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053072
73 /**
74 * Name of the module.
75 */
76 private String name;
77
78 /**
79 * Reference:RFC 6020.
Vinod Kumar S67e7be62016-02-11 20:13:28 +053080 *
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053081 * The "contact" statement provides contact information for the module. The
82 * argument is a string that is used to specify contact information for the
83 * person or persons to whom technical queries concerning this module should
84 * be sent, such as their name, postal address, telephone number, and
85 * electronic mail address.
86 */
87 private String contact;
88
89 /**
90 * Reference:RFC 6020.
Vinod Kumar S67e7be62016-02-11 20:13:28 +053091 *
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053092 * The "description" statement takes as an argument a string that contains a
93 * human-readable textual description of this definition. The text is
94 * provided in a language (or languages) chosen by the module developer; for
95 * the sake of interoperability.
96 */
97 private String description;
98
99 /**
100 * List of YANG modules imported.
101 */
102 private List<YangImport> importList;
103
104 /**
105 * List of YANG sub-modules included.
106 */
107 private List<YangInclude> includeList;
108
109 /**
110 * List of leaves at root level in the module.
111 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530112 private List<YangLeaf> listOfLeaf;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530113
114 /**
115 * List of leaf-lists at root level in the module.
116 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530117 private List<YangLeafList> listOfLeafList;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530118
119 /**
120 * Name space of the module.
121 */
122 private YangNameSpace nameSpace;
123
124 /**
125 * Reference:RFC 6020.
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530126 *
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530127 * The "organization" statement defines the party responsible for this
128 * module. The argument is a string that is used to specify a textual
129 * description of the organization(s) under whose auspices this module was
130 * developed.
131 */
132 private String organization;
133
134 /**
135 * Prefix to refer to the objects in module.
136 */
137 private String prefix;
138
139 /**
140 * Reference of the module.
141 */
142 private String reference;
143
144 /**
145 * Revision info of the module.
146 */
147 private YangRevision revision;
148
149 /**
150 * YANG version.
151 */
152 private byte version;
153
Vinod Kumar S71cba682016-02-25 15:52:16 +0530154 /*-
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530155 * Reference RFC 6020.
156 *
Vinod Kumar S71cba682016-02-25 15:52:16 +0530157 * Nested typedefs and groupings.
158 * Typedefs and groupings may appear nested under many YANG statements,
159 * allowing these to be lexically scoped by the hierarchy under which
160 * they appear. This allows types and groupings to be defined near
161 * where they are used, rather than placing them at the top level of the
162 * hierarchy. The close proximity increases readability.
163 *
164 * Scoping also allows types to be defined without concern for naming
165 * conflicts between types in different submodules. Type names can be
166 * specified without adding leading strings designed to prevent name
167 * collisions within large modules.
168 *
169 * Finally, scoping allows the module author to keep types and groupings
170 * private to their module or submodule, preventing their reuse. Since
171 * only top-level types and groupings (i.e., those appearing as
172 * sub-statements to a module or submodule statement) can be used outside
173 * the module or submodule, the developer has more control over what
174 * pieces of their module are presented to the outside world, supporting
175 * the need to hide internal information and maintaining a boundary
176 * between what is shared with the outside world and what is kept
177 * private.
178 *
179 * Scoped definitions MUST NOT shadow definitions at a higher scope. A
180 * type or grouping cannot be defined if a higher level in the schema
181 * hierarchy has a definition with a matching identifier.
182 *
183 * A reference to an unprefixed type or grouping, or one which uses the
184 * prefix of the current module, is resolved by locating the closest
185 * matching "typedef" or "grouping" statement among the immediate
186 * sub-statements of each ancestor statement.
187 */
188 /**
189 * List of nodes which require nested reference resolution.
190 */
191 private List<YangNode> nestedReferenceResoulutionList;
192
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530193 /**
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530194 * Create a YANG node of module type.
195 */
196 public YangModule() {
197 super(YangNodeType.MODULE_NODE);
198 }
199
Vinod Kumar S71cba682016-02-25 15:52:16 +0530200 /**
201 * Get name of the module.
202 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530203 * @return module name
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530204 */
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530205 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530206 public String getName() {
207 return name;
208 }
209
Vinod Kumar S71cba682016-02-25 15:52:16 +0530210 /**
211 * Set module name.
212 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530213 * @param moduleName module name
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530214 */
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530215 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530216 public void setName(String moduleName) {
217 name = moduleName;
218 }
219
220 /**
221 * Get the contact details of the module owner.
222 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530223 * @return the contact details of YANG owner
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530224 */
225 public String getContact() {
226 return contact;
227 }
228
229 /**
230 * Set the contact details of the module owner.
231 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530232 * @param contact the contact details of YANG owner
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530233 */
234 public void setContact(String contact) {
235 this.contact = contact;
236 }
237
238 /**
239 * Get the description of module.
240 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530241 * @return the description of YANG module
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530242 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530243 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530244 public String getDescription() {
245 return description;
246 }
247
248 /**
249 * Set the description of module.
250 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530251 * @param description set the description of YANG module
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530252 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530253 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530254 public void setDescription(String description) {
255 this.description = description;
256 }
257
258 /**
259 * Get the list of imported modules.
260 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530261 * @return the list of imported modules
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530262 */
263 public List<YangImport> getImportList() {
264 return importList;
265 }
266
267 /**
268 * prevent setting the import list from outside.
269 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530270 * @param importList the import list to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530271 */
272 private void setImportList(List<YangImport> importList) {
273 this.importList = importList;
274 }
275
276 /**
277 * Add the imported module information to the import list.
278 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530279 * @param importedModule module being imported
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530280 */
281 public void addImportedInfo(YangImport importedModule) {
282
283 if (getImportList() == null) {
284 setImportList(new LinkedList<YangImport>());
285 }
286
287 getImportList().add(importedModule);
288
289 return;
290 }
291
292 /**
293 * Get the list of included sub modules.
294 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530295 * @return the included list of sub modules
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530296 */
297 public List<YangInclude> getIncludeList() {
298 return includeList;
299 }
300
301 /**
302 * Set the list of included sub modules.
303 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530304 * @param includeList the included list to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530305 */
306 private void setIncludeList(List<YangInclude> includeList) {
307 this.includeList = includeList;
308 }
309
310 /**
311 * Add the included sub module information to the include list.
312 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530313 * @param includeModule submodule being included
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530314 */
315 public void addIncludedInfo(YangInclude includeModule) {
316
317 if (getIncludeList() == null) {
318 setIncludeList(new LinkedList<YangInclude>());
319 }
320
321 getIncludeList().add(includeModule);
322 return;
323 }
324
325 /**
326 * Get the list of leaves in module.
327 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530328 * @return the list of leaves
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530329 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530330 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530331 public List<YangLeaf> getListOfLeaf() {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530332 return listOfLeaf;
333 }
334
335 /**
336 * Set the list of leaf in module.
337 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530338 * @param leafsList the list of leaf to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530339 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530340 private void setListOfLeaf(List<YangLeaf> leafsList) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530341 listOfLeaf = leafsList;
342 }
343
344 /**
345 * Add a leaf in module.
346 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530347 * @param leaf the leaf to be added
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530348 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530349 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530350 public void addLeaf(YangLeaf leaf) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530351 if (getListOfLeaf() == null) {
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530352 setListOfLeaf(new LinkedList<YangLeaf>());
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530353 }
354
355 getListOfLeaf().add(leaf);
356 }
357
358 /**
359 * Get the list of leaf-list from module.
360 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530361 * @return the list of leaf-list
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530362 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530363 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530364 public List<YangLeafList> getListOfLeafList() {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530365 return listOfLeafList;
366 }
367
368 /**
369 * Set the list of leaf-list in module.
370 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530371 * @param listOfLeafList the list of leaf-list to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530372 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530373 private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530374 this.listOfLeafList = listOfLeafList;
375 }
376
377 /**
378 * Add a leaf-list in module.
379 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530380 * @param leafList the leaf-list to be added
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530381 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530382 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530383 public void addLeafList(YangLeafList leafList) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530384 if (getListOfLeafList() == null) {
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530385 setListOfLeafList(new LinkedList<YangLeafList>());
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530386 }
387
388 getListOfLeafList().add(leafList);
389 }
390
391 /**
392 * Get the name space of module elements.
393 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530394 * @return the nameSpace
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530395 */
396 public YangNameSpace getNameSpace() {
397 return nameSpace;
398 }
399
400 /**
401 * Set the name space of module elements.
402 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530403 * @param nameSpace the nameSpace to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530404 */
405 public void setNameSpace(YangNameSpace nameSpace) {
406 this.nameSpace = nameSpace;
407 }
408
409 /**
410 * Get the modules organization.
411 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530412 * @return the organization
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530413 */
414 public String getOrganization() {
415 return organization;
416 }
417
418 /**
419 * Set the modules organization.
420 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530421 * @param org the organization to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530422 */
423 public void setOrganization(String org) {
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530424 organization = org;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530425 }
426
427 /**
428 * Get the prefix.
429 *
430 * @return the prefix
431 */
432 public String getPrefix() {
433 return prefix;
434 }
435
436 /**
437 * Set the prefix.
438 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530439 * @param prefix the prefix to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530440 */
441 public void setPrefix(String prefix) {
442 this.prefix = prefix;
443 }
444
445 /**
446 * Get the textual reference.
447 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530448 * @return the reference
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530449 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530450 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530451 public String getReference() {
452 return reference;
453 }
454
455 /**
456 * Set the textual reference.
457 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530458 * @param reference the reference to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530459 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530460 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530461 public void setReference(String reference) {
462 this.reference = reference;
463 }
464
465 /**
466 * Get the revision.
467 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530468 * @return the revision
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530469 */
470 public YangRevision getRevision() {
471 return revision;
472 }
473
474 /**
475 * Set the revision.
476 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530477 * @param revision the revision to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530478 */
479 public void setRevision(YangRevision revision) {
480 this.revision = revision;
481 }
482
483 /**
484 * Get the version.
485 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530486 * @return the version
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530487 */
488 public byte getVersion() {
489 return version;
490 }
491
492 /**
493 * Set the version.
494 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530495 * @param version the version to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530496 */
497 public void setVersion(byte version) {
498 this.version = version;
499 }
500
501 /**
Vinod Kumar S71cba682016-02-25 15:52:16 +0530502 * Get the list of nested reference's which required resolution.
503 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530504 * @return list of nested reference's which required resolution
Vinod Kumar S71cba682016-02-25 15:52:16 +0530505 */
506 public List<YangNode> getNestedReferenceResoulutionList() {
507 return nestedReferenceResoulutionList;
508 }
509
510 /**
511 * Set list of nested reference's which requires resolution.
512 *
513 * @param nestedReferenceResoulutionList list of nested reference's which
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530514 * requires resolution
Vinod Kumar S71cba682016-02-25 15:52:16 +0530515 */
516 private void setNestedReferenceResoulutionList(List<YangNode> nestedReferenceResoulutionList) {
517 this.nestedReferenceResoulutionList = nestedReferenceResoulutionList;
518 }
519
520 /**
521 * Set list of nested reference's which requires resolution.
522 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530523 * @param nestedReference nested reference which requires resolution
Vinod Kumar S71cba682016-02-25 15:52:16 +0530524 */
525 public void addToNestedReferenceResoulutionList(YangNode nestedReference) {
526 if (getNestedReferenceResoulutionList() == null) {
527 setNestedReferenceResoulutionList(new LinkedList<YangNode>());
528 }
529 getNestedReferenceResoulutionList().add(nestedReference);
530 }
531
532 /**
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530533 * Returns the type of the parsed data.
534 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530535 * @return returns MODULE_DATA
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530536 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530537 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530538 public YangConstructType getYangConstructType() {
539 return YangConstructType.MODULE_DATA;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530540 }
541
542 /**
543 * Validate the data on entering the corresponding parse tree node.
544 *
545 * @throws DataModelException a violation of data model rules
546 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530547 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530548 public void validateDataOnEntry() throws DataModelException {
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530549 /*
550 * Module is root in the data model tree, hence there is no entry
551 * validation
552 */
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530553 }
554
555 /**
556 * Validate the data on exiting the corresponding parse tree node.
557 *
558 * @throws DataModelException a violation of data model rules
559 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530560 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530561 public void validateDataOnExit() throws DataModelException {
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530562 /*
563 * TODO: perform symbol linking for the imported or included YANG info.
564 * TODO: perform symbol resolution for referred YANG entities.
565 */
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530566 }
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530567
568 /**
Vinod Kumar S71cba682016-02-25 15:52:16 +0530569 * Add a type to resolve the nested references.
570 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530571 * @param node grouping or typedef node which needs to be resolved
572 * @throws DataModelException data model exception
Vinod Kumar S71cba682016-02-25 15:52:16 +0530573 */
574 public static void addToResolveList(YangNode node) throws DataModelException {
575 /* get the module node to add maintain the list of nested reference */
576 YangModule module;
577 YangNode curNode = node;
578 while (curNode.getNodeType() != YangNodeType.MODULE_NODE) {
579 curNode = curNode.getParent();
580 if (curNode == null) {
581 break;
582 }
583 }
584 if (curNode == null) {
585 throw new DataModelException("Datamodel tree is not correct");
586 }
587
588 module = (YangModule) curNode;
589 module.addToNestedReferenceResoulutionList(node);
590 return;
591 }
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530592
593 @Override
594 public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
595 // Asks helper to detect colliding child.
596 detectCollidingChildUtil(identifierName, dataType, this);
597 }
598
599 @Override
600 public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
601 // Not required as module doesn't have any parent.
602 }
Vinod Kumar S38046502016-03-23 15:30:27 +0530603
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530604}