blob: c902389878b12d380eb9c5a8e803c6d9e8b2e1be [file] [log] [blame]
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +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 */
16package org.onosproject.yangutils.datamodel;
17
Bharat saraswal2f00b4b2016-03-04 20:08:09 +053018import java.util.LinkedList;
19import java.util.List;
Bharat saraswal2f00b4b2016-03-04 20:08:09 +053020import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
Vinod Kumar S67e7be62016-02-11 20:13:28 +053021import org.onosproject.yangutils.parser.Parsable;
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053022import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S38046502016-03-23 15:30:27 +053023
24import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053025import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList;
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/**
Bharat saraswald9822e92016-04-05 15:13:44 +053068 * Represents data model node to maintain information defined in YANG module.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053069 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +053070public class YangModule extends YangNode
Gaurav Agrawal56527662016-04-20 15:49:17 +053071 implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, HasResolutionInfo,
72 HasRpcNotification {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053073
74 /**
75 * Name of the module.
76 */
77 private String name;
78
79 /**
80 * Reference:RFC 6020.
Vinod Kumar S67e7be62016-02-11 20:13:28 +053081 *
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053082 * The "contact" statement provides contact information for the module. The
83 * argument is a string that is used to specify contact information for the
84 * person or persons to whom technical queries concerning this module should
85 * be sent, such as their name, postal address, telephone number, and
86 * electronic mail address.
87 */
88 private String contact;
89
90 /**
91 * Reference:RFC 6020.
Vinod Kumar S67e7be62016-02-11 20:13:28 +053092 *
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +053093 * The "description" statement takes as an argument a string that contains a
94 * human-readable textual description of this definition. The text is
95 * provided in a language (or languages) chosen by the module developer; for
96 * the sake of interoperability.
97 */
98 private String description;
99
100 /**
101 * List of YANG modules imported.
102 */
103 private List<YangImport> importList;
104
105 /**
106 * List of YANG sub-modules included.
107 */
108 private List<YangInclude> includeList;
109
110 /**
111 * List of leaves at root level in the module.
112 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530113 private List<YangLeaf> listOfLeaf;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530114
115 /**
116 * List of leaf-lists at root level in the module.
117 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530118 private List<YangLeafList> listOfLeafList;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530119
120 /**
121 * Name space of the module.
122 */
123 private YangNameSpace nameSpace;
124
125 /**
126 * Reference:RFC 6020.
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530127 *
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530128 * The "organization" statement defines the party responsible for this
129 * module. The argument is a string that is used to specify a textual
130 * description of the organization(s) under whose auspices this module was
131 * developed.
132 */
133 private String organization;
134
135 /**
136 * Prefix to refer to the objects in module.
137 */
138 private String prefix;
139
140 /**
141 * Reference of the module.
142 */
143 private String reference;
144
145 /**
146 * Revision info of the module.
147 */
148 private YangRevision revision;
149
150 /**
151 * YANG version.
152 */
153 private byte version;
154
Vinod Kumar S71cba682016-02-25 15:52:16 +0530155 /*-
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530156 * Reference RFC 6020.
157 *
Vinod Kumar S71cba682016-02-25 15:52:16 +0530158 * Nested typedefs and groupings.
159 * Typedefs and groupings may appear nested under many YANG statements,
160 * allowing these to be lexically scoped by the hierarchy under which
161 * they appear. This allows types and groupings to be defined near
162 * where they are used, rather than placing them at the top level of the
163 * hierarchy. The close proximity increases readability.
164 *
165 * Scoping also allows types to be defined without concern for naming
166 * conflicts between types in different submodules. Type names can be
167 * specified without adding leading strings designed to prevent name
168 * collisions within large modules.
169 *
170 * Finally, scoping allows the module author to keep types and groupings
171 * private to their module or submodule, preventing their reuse. Since
172 * only top-level types and groupings (i.e., those appearing as
173 * sub-statements to a module or submodule statement) can be used outside
174 * the module or submodule, the developer has more control over what
175 * pieces of their module are presented to the outside world, supporting
176 * the need to hide internal information and maintaining a boundary
177 * between what is shared with the outside world and what is kept
178 * private.
179 *
180 * Scoped definitions MUST NOT shadow definitions at a higher scope. A
181 * type or grouping cannot be defined if a higher level in the schema
182 * hierarchy has a definition with a matching identifier.
183 *
184 * A reference to an unprefixed type or grouping, or one which uses the
185 * prefix of the current module, is resolved by locating the closest
186 * matching "typedef" or "grouping" statement among the immediate
187 * sub-statements of each ancestor statement.
188 */
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530189 private List<YangResolutionInfo> unresolvedResolutionList;
Vinod Kumar S71cba682016-02-25 15:52:16 +0530190
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530191 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530192 * Creates a YANG node of module type.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530193 */
194 public YangModule() {
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530195
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530196 super(YangNodeType.MODULE_NODE);
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530197 unresolvedResolutionList = new LinkedList<YangResolutionInfo>();
198 importList = new LinkedList<YangImport>();
199 includeList = new LinkedList<YangInclude>();
200 listOfLeaf = new LinkedList<YangLeaf>();
201 listOfLeafList = new LinkedList<YangLeafList>();
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530202 }
203
Vinod Kumar S71cba682016-02-25 15:52:16 +0530204 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530205 * Returns name of the module.
Vinod Kumar S71cba682016-02-25 15:52:16 +0530206 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530207 * @return module name
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530208 */
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530209 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530210 public String getName() {
211 return name;
212 }
213
Vinod Kumar S71cba682016-02-25 15:52:16 +0530214 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530215 * Sets module name.
Vinod Kumar S71cba682016-02-25 15:52:16 +0530216 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530217 * @param moduleName module name
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530218 */
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530219 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530220 public void setName(String moduleName) {
221 name = moduleName;
222 }
223
224 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530225 * Returns the contact details of the module owner.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530226 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530227 * @return the contact details of YANG owner
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530228 */
229 public String getContact() {
230 return contact;
231 }
232
233 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530234 * Sets the contact details of the module owner.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530235 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530236 * @param contact the contact details of YANG owner
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530237 */
238 public void setContact(String contact) {
239 this.contact = contact;
240 }
241
242 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530243 * Returns the description of module.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530244 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530245 * @return the description of YANG module
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530246 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530247 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530248 public String getDescription() {
249 return description;
250 }
251
252 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530253 * Sets the description of module.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530254 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530255 * @param description set the description of YANG module
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530256 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530257 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530258 public void setDescription(String description) {
259 this.description = description;
260 }
261
262 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530263 * Returns the list of imported modules.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530264 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530265 * @return the list of imported modules
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530266 */
267 public List<YangImport> getImportList() {
268 return importList;
269 }
270
271 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530272 * Adds the imported module information to the import list.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530273 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530274 * @param importedModule module being imported
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530275 */
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530276 public void addToImportList(YangImport importedModule) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530277 getImportList().add(importedModule);
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530278 }
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530279
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530280 @Override
281 public void setImportList(List<YangImport> importList) {
282 this.importList = importList;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530283 }
284
285 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530286 * Returns the list of included sub modules.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530287 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530288 * @return the included list of sub modules
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530289 */
290 public List<YangInclude> getIncludeList() {
291 return includeList;
292 }
293
294 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530295 * Adds the included sub module information to the include list.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530296 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530297 * @param includeModule submodule being included
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530298 */
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530299 public void addToIncludeList(YangInclude includeModule) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530300 getIncludeList().add(includeModule);
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530301 }
302
303 @Override
304 public void setIncludeList(List<YangInclude> includeList) {
305 this.includeList = includeList;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530306 }
307
308 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530309 * Returns the list of leaves in module.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530310 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530311 * @return the list of leaves
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530312 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530313 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530314 public List<YangLeaf> getListOfLeaf() {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530315 return listOfLeaf;
316 }
317
318 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530319 * Adds a leaf in module.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530320 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530321 * @param leaf the leaf to be added
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530322 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530323 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530324 public void addLeaf(YangLeaf leaf) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530325 getListOfLeaf().add(leaf);
326 }
327
328 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530329 * Returns the list of leaf-list from module.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530330 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530331 * @return the list of leaf-list
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530332 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530333 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530334 public List<YangLeafList> getListOfLeafList() {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530335 return listOfLeafList;
336 }
337
338 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530339 * Adds a leaf-list in module.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530340 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530341 * @param leafList the leaf-list to be added
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530342 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530343 @Override
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530344 public void addLeafList(YangLeafList leafList) {
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530345 getListOfLeafList().add(leafList);
346 }
347
348 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530349 * Returns the name space of module elements.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530350 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530351 * @return the nameSpace
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530352 */
353 public YangNameSpace getNameSpace() {
354 return nameSpace;
355 }
356
357 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530358 * Sets the name space of module elements.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530359 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530360 * @param nameSpace the nameSpace to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530361 */
362 public void setNameSpace(YangNameSpace nameSpace) {
363 this.nameSpace = nameSpace;
364 }
365
366 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530367 * Returns the modules organization.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530368 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530369 * @return the organization
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530370 */
371 public String getOrganization() {
372 return organization;
373 }
374
375 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530376 * Sets the modules organization.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530377 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530378 * @param org the organization to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530379 */
380 public void setOrganization(String org) {
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530381 organization = org;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530382 }
383
384 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530385 * Returns the prefix.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530386 *
387 * @return the prefix
388 */
389 public String getPrefix() {
390 return prefix;
391 }
392
393 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530394 * Sets the prefix.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530395 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530396 * @param prefix the prefix to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530397 */
398 public void setPrefix(String prefix) {
399 this.prefix = prefix;
400 }
401
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530402 @Override
403 public void resolveSelfFileLinking() throws DataModelException {
404 // Get the list to be resolved.
405 List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList();
406 // Resolve linking for a resolution list.
407 resolveLinkingForResolutionList(resolutionList, this);
408 }
409
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530410 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530411 * Returns the textual reference.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530412 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530413 * @return the reference
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530414 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530415 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530416 public String getReference() {
417 return reference;
418 }
419
420 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530421 * Sets the textual reference.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530422 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530423 * @param reference the reference to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530424 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530425 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530426 public void setReference(String reference) {
427 this.reference = reference;
428 }
429
430 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530431 * Returns the revision.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530432 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530433 * @return the revision
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530434 */
435 public YangRevision getRevision() {
436 return revision;
437 }
438
439 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530440 * Sets the revision.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530441 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530442 * @param revision the revision to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530443 */
444 public void setRevision(YangRevision revision) {
445 this.revision = revision;
446 }
447
448 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530449 * Returns the version.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530450 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530451 * @return the version
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530452 */
453 public byte getVersion() {
454 return version;
455 }
456
457 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530458 * Sets the version.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530459 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530460 * @param version the version to set
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530461 */
462 public void setVersion(byte version) {
463 this.version = version;
464 }
465
466 /**
467 * Returns the type of the parsed data.
468 *
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530469 * @return returns MODULE_DATA
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530470 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530471 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530472 public YangConstructType getYangConstructType() {
473 return YangConstructType.MODULE_DATA;
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530474 }
475
476 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530477 * Validates the data on entering the corresponding parse tree node.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530478 *
479 * @throws DataModelException a violation of data model rules
480 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530481 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530482 public void validateDataOnEntry() throws DataModelException {
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530483 /*
484 * Module is root in the data model tree, hence there is no entry
485 * validation
486 */
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530487 }
488
489 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530490 * Validates the data on exiting the corresponding parse tree node.
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530491 *
492 * @throws DataModelException a violation of data model rules
493 */
Bharat saraswal870c56f2016-02-20 21:57:16 +0530494 @Override
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530495 public void validateDataOnExit() throws DataModelException {
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530496 /*
497 * TODO: perform symbol linking for the imported or included YANG info.
498 * TODO: perform symbol resolution for referred YANG entities.
499 */
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530500 }
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530501
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530502 @Override
503 public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
504 // Asks helper to detect colliding child.
505 detectCollidingChildUtil(identifierName, dataType, this);
506 }
507
508 @Override
509 public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
510 // Not required as module doesn't have any parent.
511 }
Vinod Kumar S38046502016-03-23 15:30:27 +0530512
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530513 @Override
514 public List<YangResolutionInfo> getUnresolvedResolutionList() {
515 return unresolvedResolutionList;
516 }
517
518 @Override
519 public void addToResolutionList(YangResolutionInfo resolutionInfo) {
520 unresolvedResolutionList.add(resolutionInfo);
521 }
522
523 @Override
524 public void setResolutionList(List<YangResolutionInfo> resolutionList) {
525 unresolvedResolutionList = resolutionList;
526 }
Vinod Kumar S1ede5ab2016-02-09 20:14:53 +0530527}