Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.yangutils.datamodel; |
| 17 | |
| 18 | import java.util.LinkedList; |
| 19 | import java.util.List; |
| 20 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 21 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 22 | import org.onosproject.yangutils.parser.Parsable; |
| 23 | import org.onosproject.yangutils.utils.YangConstructType; |
| 24 | |
| 25 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil; |
| 26 | |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 27 | /* |
| 28 | * Reference RFC 6020. |
| 29 | * |
| 30 | * While the primary unit in YANG is a module, a YANG module can itself |
| 31 | * be constructed out of several submodules. Submodules allow a module |
| 32 | * designer to split a complex model into several pieces where all the |
| 33 | * submodules contribute to a single namespace, which is defined by the |
| 34 | * module that includes the submodules. |
| 35 | * |
| 36 | * The "submodule" statement defines the submodule's name, and groups |
| 37 | * all statements that belong to the submodule together. The |
| 38 | * "submodule" statement's argument is the name of the submodule, |
| 39 | * followed by a block of sub-statements that hold detailed submodule |
| 40 | * information. |
| 41 | * |
| 42 | * The submodule's sub-statements |
| 43 | * |
| 44 | * +--------------+---------+-------------+------------------+ |
| 45 | * | substatement | section | cardinality |data model mapping| |
| 46 | * +--------------+---------+-------------+------------------+ |
| 47 | * | anyxml | 7.10 | 0..n | - not supported | |
| 48 | * | augment | 7.15 | 0..n | - child nodes | |
| 49 | * | belongs-to | 7.2.2 | 1 | - YangBelongsTo | |
| 50 | * | choice | 7.9 | 0..n | - child nodes | |
| 51 | * | contact | 7.1.8 | 0..1 | - string | |
| 52 | * | container | 7.5 | 0..n | - child nodes | |
| 53 | * | description | 7.19.3 | 0..1 | - string | |
| 54 | * | deviation | 7.18.3 | 0..n | - TODO | |
| 55 | * | extension | 7.17 | 0..n | - TODO | |
| 56 | * | feature | 7.18.1 | 0..n | - TODO | |
| 57 | * | grouping | 7.11 | 0..n | - child nodes | |
| 58 | * | identity | 7.16 | 0..n | - TODO | |
| 59 | * | import | 7.1.5 | 0..n | - YangImport | |
| 60 | * | include | 7.1.6 | 0..n | - YangInclude | |
| 61 | * | leaf | 7.6 | 0..n | - YangLeaf | |
| 62 | * | leaf-list | 7.7 | 0..n | - YangLeafList | |
| 63 | * | list | 7.8 | 0..n | - child nodes | |
| 64 | * | notification | 7.14 | 0..n | - TODO | |
| 65 | * | organization | 7.1.7 | 0..1 | - string | |
| 66 | * | reference | 7.19.4 | 0..1 | - string | |
| 67 | * | revision | 7.1.9 | 0..n | - string | |
| 68 | * | rpc | 7.13 | 0..n | - TODO | |
| 69 | * | typedef | 7.3 | 0..n | - child nodes | |
| 70 | * | uses | 7.12 | 0..n | - child nodes | |
| 71 | * | YANG-version | 7.1.2 | 0..1 | - int | |
| 72 | * +--------------+---------+-------------+------------------+ |
| 73 | */ |
| 74 | /** |
| 75 | * Data model node to maintain information defined in YANG sub-module. |
| 76 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 77 | public class YangSubModule extends YangNode |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 78 | implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Name of sub module. |
| 82 | */ |
| 83 | private String name; |
| 84 | |
| 85 | /** |
| 86 | * Module to which it belongs to. |
| 87 | */ |
| 88 | private YangBelongsTo belongsTo; |
| 89 | |
| 90 | /** |
| 91 | * Reference RFC 6020. |
| 92 | * |
| 93 | * The "contact" statement provides contact information for the module. The |
| 94 | * argument is a string that is used to specify contact information for the |
| 95 | * person or persons to whom technical queries concerning this module should |
| 96 | * be sent, such as their name, postal address, telephone number, and |
| 97 | * electronic mail address. |
| 98 | */ |
| 99 | private String contact; |
| 100 | |
| 101 | /** |
| 102 | * Description. |
| 103 | */ |
| 104 | private String description; |
| 105 | |
| 106 | /** |
| 107 | * List of YANG modules imported. |
| 108 | */ |
| 109 | private List<YangImport> importList; |
| 110 | |
| 111 | /** |
| 112 | * List of YANG sub-modules included. |
| 113 | */ |
| 114 | private List<YangInclude> includeList; |
| 115 | |
| 116 | /** |
| 117 | * List of leaves at root level in the sub-module. |
| 118 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 119 | private List<YangLeaf> listOfLeaf; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 120 | |
| 121 | /** |
| 122 | * List of leaf-lists at root level in the sub-module. |
| 123 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 124 | private List<YangLeafList> listOfLeafList; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * organization owner of the sub-module. |
| 128 | */ |
| 129 | private String organization; |
| 130 | |
| 131 | /** |
| 132 | * reference of the sub-module. |
| 133 | */ |
| 134 | private String reference; |
| 135 | |
| 136 | /** |
| 137 | * revision info of the sub-module. |
| 138 | */ |
| 139 | private YangRevision revision; |
| 140 | |
| 141 | /** |
| 142 | * YANG version. |
| 143 | */ |
| 144 | private byte version; |
| 145 | |
| 146 | /** |
| 147 | * Create a sub module node. |
| 148 | */ |
| 149 | public YangSubModule() { |
| 150 | super(YangNodeType.SUB_MODULE_NODE); |
| 151 | } |
| 152 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 153 | /** |
| 154 | * Get the YANG name of the sub module. |
| 155 | * |
| 156 | * @return YANG name of the sub module |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 157 | */ |
| 158 | @Override |
| 159 | public String getName() { |
| 160 | return name; |
| 161 | } |
| 162 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 163 | /** |
| 164 | * Set YANG name of the sub module. |
| 165 | * |
| 166 | * @param subModuleName YANG name of the sub module |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 167 | */ |
| 168 | @Override |
| 169 | public void setName(String subModuleName) { |
| 170 | name = subModuleName; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Get the module info. |
| 175 | * |
| 176 | * @return the belongs to info |
| 177 | */ |
| 178 | public YangBelongsTo getBelongsTo() { |
| 179 | return belongsTo; |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Set the module info. |
| 184 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 185 | * @param belongsTo module info to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 186 | */ |
| 187 | public void setBelongsTo(YangBelongsTo belongsTo) { |
| 188 | this.belongsTo = belongsTo; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Get the contact. |
| 193 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 194 | * @return the contact |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 195 | */ |
| 196 | public String getContact() { |
| 197 | return contact; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Set the contact. |
| 202 | * |
| 203 | * @param contact the contact to set |
| 204 | */ |
| 205 | public void setContact(String contact) { |
| 206 | this.contact = contact; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Get the description. |
| 211 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 212 | * @return the description |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 213 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 214 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 215 | public String getDescription() { |
| 216 | return description; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Set the description. |
| 221 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 222 | * @param description set the description |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 223 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 224 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 225 | public void setDescription(String description) { |
| 226 | this.description = description; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Get the list of imported modules. |
| 231 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 232 | * @return the list of imported modules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 233 | */ |
| 234 | public List<YangImport> getImportList() { |
| 235 | return importList; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * prevent setting the import list from outside. |
| 240 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 241 | * @param importList the import list to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 242 | */ |
| 243 | private void setImportList(List<YangImport> importList) { |
| 244 | this.importList = importList; |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * Add the imported module information to the import list. |
| 249 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 250 | * @param importedModule module being imported |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 251 | */ |
| 252 | public void addImportedInfo(YangImport importedModule) { |
| 253 | |
| 254 | if (getImportList() == null) { |
| 255 | setImportList(new LinkedList<YangImport>()); |
| 256 | } |
| 257 | |
| 258 | getImportList().add(importedModule); |
| 259 | |
| 260 | return; |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * Get the list of included sub modules. |
| 265 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 266 | * @return the included list of sub modules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 267 | */ |
| 268 | public List<YangInclude> getIncludeList() { |
| 269 | return includeList; |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * Set the list of included sub modules. |
| 274 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 275 | * @param includeList the included list to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 276 | */ |
| 277 | private void setIncludeList(List<YangInclude> includeList) { |
| 278 | this.includeList = includeList; |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * Add the included sub module information to the include list. |
| 283 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 284 | * @param includeModule submodule being included |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 285 | */ |
| 286 | public void addIncludedInfo(YangInclude includeModule) { |
| 287 | |
| 288 | if (getIncludeList() == null) { |
| 289 | setIncludeList(new LinkedList<YangInclude>()); |
| 290 | } |
| 291 | |
| 292 | getIncludeList().add(includeModule); |
| 293 | return; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Get the list of leaves. |
| 298 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 299 | * @return the list of leaves |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 300 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 301 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 302 | public List<YangLeaf> getListOfLeaf() { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 303 | return listOfLeaf; |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * Set the list of leaves. |
| 308 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 309 | * @param leafsList the list of leaf to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 310 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 311 | private void setListOfLeaf(List<YangLeaf> leafsList) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 312 | listOfLeaf = leafsList; |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Add a leaf. |
| 317 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 318 | * @param leaf the leaf to be added |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 319 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 320 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 321 | public void addLeaf(YangLeaf leaf) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 322 | if (getListOfLeaf() == null) { |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 323 | setListOfLeaf(new LinkedList<YangLeaf>()); |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | getListOfLeaf().add(leaf); |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * Get the list of leaf-list. |
| 331 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 332 | * @return the list of leaf-list |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 333 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 334 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 335 | public List<YangLeafList> getListOfLeafList() { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 336 | return listOfLeafList; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * Set the list of leaf-list. |
| 341 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 342 | * @param listOfLeafList the list of leaf-list to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 343 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 344 | private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 345 | this.listOfLeafList = listOfLeafList; |
| 346 | } |
| 347 | |
| 348 | /** |
| 349 | * Add a leaf-list. |
| 350 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 351 | * @param leafList the leaf-list to be added |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 352 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 353 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 354 | public void addLeafList(YangLeafList leafList) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 355 | if (getListOfLeafList() == null) { |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 356 | setListOfLeafList(new LinkedList<YangLeafList>()); |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | getListOfLeafList().add(leafList); |
| 360 | } |
| 361 | |
| 362 | /** |
| 363 | * Get the sub-modules organization. |
| 364 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 365 | * @return the organization |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 366 | */ |
| 367 | public String getOrganization() { |
| 368 | return organization; |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Set the sub-modules organization. |
| 373 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 374 | * @param org the organization to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 375 | */ |
| 376 | public void setOrganization(String org) { |
| 377 | organization = org; |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * Get the textual reference. |
| 382 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 383 | * @return the reference |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 384 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 385 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 386 | public String getReference() { |
| 387 | return reference; |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Set the textual reference. |
| 392 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 393 | * @param reference the reference to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 394 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 395 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 396 | public void setReference(String reference) { |
| 397 | this.reference = reference; |
| 398 | } |
| 399 | |
| 400 | /** |
| 401 | * Get the revision. |
| 402 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 403 | * @return the revision |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 404 | */ |
| 405 | public YangRevision getRevision() { |
| 406 | return revision; |
| 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Set the revision. |
| 411 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 412 | * @param revision the revision to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 413 | */ |
| 414 | public void setRevision(YangRevision revision) { |
| 415 | this.revision = revision; |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * Get the version. |
| 420 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 421 | * @return the version |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 422 | */ |
| 423 | public byte getVersion() { |
| 424 | return version; |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * Set the version. |
| 429 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 430 | * @param version the version to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 431 | */ |
| 432 | public void setVersion(byte version) { |
| 433 | this.version = version; |
| 434 | } |
| 435 | |
| 436 | /** |
| 437 | * Returns the type of the parsed data. |
| 438 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 439 | * @return returns SUB_MODULE_DATA |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 440 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 441 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 442 | public YangConstructType getYangConstructType() { |
| 443 | return YangConstructType.SUB_MODULE_DATA; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | /** |
| 447 | * Validate the data on entering the corresponding parse tree node. |
| 448 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 449 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 450 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 451 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 452 | public void validateDataOnEntry() throws DataModelException { |
| 453 | // TODO auto-generated method stub, to be implemented by parser |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * Validate the data on exiting the corresponding parse tree node. |
| 458 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 459 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 460 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 461 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 462 | public void validateDataOnExit() throws DataModelException { |
| 463 | // TODO auto-generated method stub, to be implemented by parser |
| 464 | } |
| 465 | |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 466 | @Override |
| 467 | public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException { |
| 468 | // Asks helper to detect colliding child. |
| 469 | detectCollidingChildUtil(identifierName, dataType, this); |
| 470 | } |
| 471 | |
| 472 | @Override |
| 473 | public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException { |
| 474 | // Not required as module doesn't have any parent. |
| 475 | } |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 476 | } |