Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 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; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 20 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 21 | import org.onosproject.yangutils.parser.Parsable; |
| 22 | import org.onosproject.yangutils.utils.YangConstructType; |
| 23 | |
| 24 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil; |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 25 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 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 | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 78 | implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, HasResolutionInfo { |
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 | /** |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 127 | * Organization owner of the sub-module. |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 128 | */ |
| 129 | private String organization; |
| 130 | |
| 131 | /** |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 132 | * Reference of the sub-module. |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 133 | */ |
| 134 | private String reference; |
| 135 | |
| 136 | /** |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 137 | * Revision info of the sub-module. |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 138 | */ |
| 139 | private YangRevision revision; |
| 140 | |
| 141 | /** |
| 142 | * YANG version. |
| 143 | */ |
| 144 | private byte version; |
| 145 | |
| 146 | /** |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 147 | * Prefix of parent module. |
| 148 | */ |
| 149 | private String prefix; |
| 150 | /*- |
| 151 | * Reference RFC 6020. |
| 152 | * |
| 153 | * Nested typedefs and groupings. |
| 154 | * Typedefs and groupings may appear nested under many YANG statements, |
| 155 | * allowing these to be lexically scoped by the hierarchy under which |
| 156 | * they appear. This allows types and groupings to be defined near |
| 157 | * where they are used, rather than placing them at the top level of the |
| 158 | * hierarchy. The close proximity increases readability. |
| 159 | * |
| 160 | * Scoping also allows types to be defined without concern for naming |
| 161 | * conflicts between types in different submodules. Type names can be |
| 162 | * specified without adding leading strings designed to prevent name |
| 163 | * collisions within large modules. |
| 164 | * |
| 165 | * Finally, scoping allows the module author to keep types and groupings |
| 166 | * private to their module or submodule, preventing their reuse. Since |
| 167 | * only top-level types and groupings (i.e., those appearing as |
| 168 | * sub-statements to a module or submodule statement) can be used outside |
| 169 | * the module or submodule, the developer has more control over what |
| 170 | * pieces of their module are presented to the outside world, supporting |
| 171 | * the need to hide internal information and maintaining a boundary |
| 172 | * between what is shared with the outside world and what is kept |
| 173 | * private. |
| 174 | * |
| 175 | * Scoped definitions MUST NOT shadow definitions at a higher scope. A |
| 176 | * type or grouping cannot be defined if a higher level in the schema |
| 177 | * hierarchy has a definition with a matching identifier. |
| 178 | * |
| 179 | * A reference to an unprefixed type or grouping, or one which uses the |
| 180 | * prefix of the current module, is resolved by locating the closest |
| 181 | * matching "typedef" or "grouping" statement among the immediate |
| 182 | * sub-statements of each ancestor statement. |
| 183 | */ |
| 184 | private List<YangResolutionInfo> unresolvedResolutionList; |
| 185 | /** |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 186 | * Create a sub module node. |
| 187 | */ |
| 188 | public YangSubModule() { |
| 189 | super(YangNodeType.SUB_MODULE_NODE); |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 190 | unresolvedResolutionList = new LinkedList<YangResolutionInfo>(); |
| 191 | importList = new LinkedList<YangImport>(); |
| 192 | includeList = new LinkedList<YangInclude>(); |
| 193 | listOfLeaf = new LinkedList<YangLeaf>(); |
| 194 | listOfLeafList = new LinkedList<YangLeafList>(); |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 195 | } |
| 196 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 197 | /** |
| 198 | * Get the YANG name of the sub module. |
| 199 | * |
| 200 | * @return YANG name of the sub module |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 201 | */ |
| 202 | @Override |
| 203 | public String getName() { |
| 204 | return name; |
| 205 | } |
| 206 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 207 | /** |
| 208 | * Set YANG name of the sub module. |
| 209 | * |
| 210 | * @param subModuleName YANG name of the sub module |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 211 | */ |
| 212 | @Override |
| 213 | public void setName(String subModuleName) { |
| 214 | name = subModuleName; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * Get the module info. |
| 219 | * |
| 220 | * @return the belongs to info |
| 221 | */ |
| 222 | public YangBelongsTo getBelongsTo() { |
| 223 | return belongsTo; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Set the module info. |
| 228 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 229 | * @param belongsTo module info to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 230 | */ |
| 231 | public void setBelongsTo(YangBelongsTo belongsTo) { |
| 232 | this.belongsTo = belongsTo; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Get the contact. |
| 237 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 238 | * @return the contact |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 239 | */ |
| 240 | public String getContact() { |
| 241 | return contact; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Set the contact. |
| 246 | * |
| 247 | * @param contact the contact to set |
| 248 | */ |
| 249 | public void setContact(String contact) { |
| 250 | this.contact = contact; |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Get the description. |
| 255 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 256 | * @return the description |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 257 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 258 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 259 | public String getDescription() { |
| 260 | return description; |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * Set the description. |
| 265 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 266 | * @param description set the description |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 267 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 268 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 269 | public void setDescription(String description) { |
| 270 | this.description = description; |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * Get the list of imported modules. |
| 275 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 276 | * @return the list of imported modules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 277 | */ |
| 278 | public List<YangImport> getImportList() { |
| 279 | return importList; |
| 280 | } |
| 281 | |
| 282 | /** |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 283 | * Add the imported module information to the import list. |
| 284 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 285 | * @param importedModule module being imported |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 286 | */ |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 287 | public void addToImportList(YangImport importedModule) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 288 | getImportList().add(importedModule); |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 289 | } |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 290 | |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 291 | @Override |
| 292 | public void setImportList(List<YangImport> importList) { |
| 293 | this.importList = importList; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Get the list of included sub modules. |
| 298 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 299 | * @return the included list of sub modules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 300 | */ |
| 301 | public List<YangInclude> getIncludeList() { |
| 302 | return includeList; |
| 303 | } |
| 304 | |
| 305 | /** |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 306 | * Add the included sub module information to the include list. |
| 307 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 308 | * @param includeModule submodule being included |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 309 | */ |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 310 | public void addToIncludeList(YangInclude includeModule) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 311 | getIncludeList().add(includeModule); |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | @Override |
| 315 | public void setIncludeList(List<YangInclude> includeList) { |
| 316 | this.includeList = includeList; |
| 317 | } |
| 318 | |
| 319 | @Override |
| 320 | public String getPrefix() { |
| 321 | return prefix; |
| 322 | } |
| 323 | |
| 324 | @Override |
| 325 | public void setPrefix(String prefix) { |
| 326 | this.prefix = prefix; |
| 327 | } |
| 328 | |
| 329 | @Override |
| 330 | public void resolveSelfFileLinking() throws DataModelException { |
| 331 | // Get the list to be resolved. |
| 332 | List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(); |
| 333 | // Resolve linking for a resolution list. |
| 334 | resolveLinkingForResolutionList(resolutionList, this); |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | /** |
| 338 | * Get the list of leaves. |
| 339 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 340 | * @return the list of leaves |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 341 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 342 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 343 | public List<YangLeaf> getListOfLeaf() { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 344 | return listOfLeaf; |
| 345 | } |
| 346 | |
| 347 | /** |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 348 | * Add a leaf. |
| 349 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 350 | * @param leaf the leaf to be added |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 351 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 352 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 353 | public void addLeaf(YangLeaf leaf) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 354 | getListOfLeaf().add(leaf); |
| 355 | } |
| 356 | |
| 357 | /** |
| 358 | * Get the list of leaf-list. |
| 359 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 360 | * @return the list of leaf-list |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 361 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 362 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 363 | public List<YangLeafList> getListOfLeafList() { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 364 | return listOfLeafList; |
| 365 | } |
| 366 | |
| 367 | /** |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 368 | * Add a leaf-list. |
| 369 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 370 | * @param leafList the leaf-list to be added |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 371 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 372 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 373 | public void addLeafList(YangLeafList leafList) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 374 | getListOfLeafList().add(leafList); |
| 375 | } |
| 376 | |
| 377 | /** |
| 378 | * Get the sub-modules organization. |
| 379 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 380 | * @return the organization |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 381 | */ |
| 382 | public String getOrganization() { |
| 383 | return organization; |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Set the sub-modules organization. |
| 388 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 389 | * @param org the organization to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 390 | */ |
| 391 | public void setOrganization(String org) { |
| 392 | organization = org; |
| 393 | } |
| 394 | |
| 395 | /** |
| 396 | * Get the textual reference. |
| 397 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 398 | * @return the reference |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 399 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 400 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 401 | public String getReference() { |
| 402 | return reference; |
| 403 | } |
| 404 | |
| 405 | /** |
| 406 | * Set the textual reference. |
| 407 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 408 | * @param reference the reference to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 409 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 410 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 411 | public void setReference(String reference) { |
| 412 | this.reference = reference; |
| 413 | } |
| 414 | |
| 415 | /** |
| 416 | * Get the revision. |
| 417 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 418 | * @return the revision |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 419 | */ |
| 420 | public YangRevision getRevision() { |
| 421 | return revision; |
| 422 | } |
| 423 | |
| 424 | /** |
| 425 | * Set the revision. |
| 426 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 427 | * @param revision the revision to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 428 | */ |
| 429 | public void setRevision(YangRevision revision) { |
| 430 | this.revision = revision; |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | * Get the version. |
| 435 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 436 | * @return the version |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 437 | */ |
| 438 | public byte getVersion() { |
| 439 | return version; |
| 440 | } |
| 441 | |
| 442 | /** |
| 443 | * Set the version. |
| 444 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 445 | * @param version the version to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 446 | */ |
| 447 | public void setVersion(byte version) { |
| 448 | this.version = version; |
| 449 | } |
| 450 | |
| 451 | /** |
| 452 | * Returns the type of the parsed data. |
| 453 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 454 | * @return returns SUB_MODULE_DATA |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 455 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 456 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 457 | public YangConstructType getYangConstructType() { |
| 458 | return YangConstructType.SUB_MODULE_DATA; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | /** |
| 462 | * Validate the data on entering the corresponding parse tree node. |
| 463 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 464 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 465 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 466 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 467 | public void validateDataOnEntry() throws DataModelException { |
| 468 | // TODO auto-generated method stub, to be implemented by parser |
| 469 | } |
| 470 | |
| 471 | /** |
| 472 | * Validate the data on exiting the corresponding parse tree node. |
| 473 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 474 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 475 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 476 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 477 | public void validateDataOnExit() throws DataModelException { |
| 478 | // TODO auto-generated method stub, to be implemented by parser |
| 479 | } |
| 480 | |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 481 | @Override |
| 482 | public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException { |
| 483 | // Asks helper to detect colliding child. |
| 484 | detectCollidingChildUtil(identifierName, dataType, this); |
| 485 | } |
| 486 | |
| 487 | @Override |
| 488 | public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException { |
| 489 | // Not required as module doesn't have any parent. |
| 490 | } |
Gaurav Agrawal | 1fbfae1 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 491 | |
| 492 | @Override |
| 493 | public List<YangResolutionInfo> getUnresolvedResolutionList() { |
| 494 | return unresolvedResolutionList; |
| 495 | } |
| 496 | |
| 497 | @Override |
| 498 | public void addToResolutionList(YangResolutionInfo resolutionInfo) { |
| 499 | this.unresolvedResolutionList.add(resolutionInfo); |
| 500 | } |
| 501 | |
| 502 | @Override |
| 503 | public void setResolutionList(List<YangResolutionInfo> resolutionList) { |
| 504 | this.unresolvedResolutionList = resolutionList; |
| 505 | } |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 506 | } |