Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +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 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 18 | import java.util.Iterator; |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 19 | import java.util.LinkedList; |
| 20 | import java.util.List; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 21 | import java.util.Set; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 22 | |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 23 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 24 | import org.onosproject.yangutils.datamodel.utils.Parsable; |
| 25 | import org.onosproject.yangutils.datamodel.utils.YangConstructType; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 26 | |
| 27 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 28 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.linkInterFileReferences; |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 29 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLinkingForResolutionList; |
Vinod Kumar S | 67e7be6 | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 30 | |
| 31 | /*- |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 32 | * Reference:RFC 6020. |
| 33 | * The "module" statement defines the module's name, |
| 34 | * and groups all statements that belong to the module together. The "module" |
| 35 | * statement's argument is the name of the module, followed by a block of |
| 36 | * sub statements that hold detailed module information. |
| 37 | * The module's sub statements |
| 38 | * |
| 39 | * +--------------+---------+-------------+-----------------------+ |
| 40 | * |sub statement | section | cardinality | data model mapping | |
| 41 | * +--------------+---------+-------------+-----------------------+ |
| 42 | * | anyxml | 7.10 | 0..n | not supported | |
| 43 | * | augment | 7.15 | 0..n | child nodes | |
| 44 | * | choice | 7.9 | 0..n | child nodes | |
| 45 | * | contact | 7.1.8 | 0..1 | string | |
| 46 | * | container | 7.5 | 0..n | child nodes | |
| 47 | * | description | 7.19.3 | 0..1 | string | |
| 48 | * | deviation | 7.18.3 | 0..n | TODO | |
| 49 | * | extension | 7.17 | 0..n | TODO | |
| 50 | * | feature | 7.18.1 | 0..n | TODO | |
| 51 | * | grouping | 7.11 | 0..n | child nodes | |
| 52 | * | identity | 7.16 | 0..n | TODO | |
| 53 | * | import | 7.1.5 | 0..n | list of import info | |
| 54 | * | include | 7.1.6 | 0..n | list of include info | |
| 55 | * | leaf | 7.6 | 0..n | list of leaf info | |
| 56 | * | leaf-list | 7.7 | 0..n | list of leaf-list info| |
| 57 | * | list | 7.8 | 0..n | child nodes | |
| 58 | * | namespace | 7.1.3 | 1 | string/uri | |
| 59 | * | notification | 7.14 | 0..n | TODO | |
| 60 | * | organization | 7.1.7 | 0..1 | string | |
| 61 | * | prefix | 7.1.4 | 1 | string | |
| 62 | * | reference | 7.19.4 | 0..1 | string | |
| 63 | * | revision | 7.1.9 | 0..n | revision | |
| 64 | * | rpc | 7.13 | 0..n | TODO | |
| 65 | * | typedef | 7.3 | 0..n | child nodes | |
| 66 | * | uses | 7.12 | 0..n | child nodes | |
| 67 | * | YANG-version | 7.1.2 | 0..1 | int | |
| 68 | * +--------------+---------+-------------+-----------------------+ |
| 69 | */ |
| 70 | |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 71 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 72 | * Represents data model node to maintain information defined in YANG module. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 73 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 74 | public class YangModule |
| 75 | extends YangNode |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 76 | implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver, |
| 77 | RpcNotificationContainer { |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 78 | |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 79 | private static final long serialVersionUID = 806201610L; |
| 80 | |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 81 | /** |
| 82 | * Name of the module. |
| 83 | */ |
| 84 | private String name; |
| 85 | |
| 86 | /** |
| 87 | * Reference:RFC 6020. |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 88 | * <p> |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 89 | * The "contact" statement provides contact information for the module. The |
| 90 | * argument is a string that is used to specify contact information for the |
| 91 | * person or persons to whom technical queries concerning this module should |
| 92 | * be sent, such as their name, postal address, telephone number, and |
| 93 | * electronic mail address. |
| 94 | */ |
| 95 | private String contact; |
| 96 | |
| 97 | /** |
| 98 | * Reference:RFC 6020. |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 99 | * <p> |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 100 | * The "description" statement takes as an argument a string that contains a |
| 101 | * human-readable textual description of this definition. The text is |
| 102 | * provided in a language (or languages) chosen by the module developer; for |
| 103 | * the sake of interoperability. |
| 104 | */ |
| 105 | private String description; |
| 106 | |
| 107 | /** |
| 108 | * List of YANG modules imported. |
| 109 | */ |
| 110 | private List<YangImport> importList; |
| 111 | |
| 112 | /** |
| 113 | * List of YANG sub-modules included. |
| 114 | */ |
| 115 | private List<YangInclude> includeList; |
| 116 | |
| 117 | /** |
| 118 | * List of leaves at root level in the module. |
| 119 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 120 | private List<YangLeaf> listOfLeaf; |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 121 | |
| 122 | /** |
| 123 | * List of leaf-lists at root level in the module. |
| 124 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 125 | private List<YangLeafList> listOfLeafList; |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 126 | |
| 127 | /** |
| 128 | * Name space of the module. |
| 129 | */ |
| 130 | private YangNameSpace nameSpace; |
| 131 | |
| 132 | /** |
| 133 | * Reference:RFC 6020. |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 134 | * <p> |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 135 | * The "organization" statement defines the party responsible for this |
| 136 | * module. The argument is a string that is used to specify a textual |
| 137 | * description of the organization(s) under whose auspices this module was |
| 138 | * developed. |
| 139 | */ |
| 140 | private String organization; |
| 141 | |
| 142 | /** |
| 143 | * Prefix to refer to the objects in module. |
| 144 | */ |
| 145 | private String prefix; |
| 146 | |
| 147 | /** |
| 148 | * Reference of the module. |
| 149 | */ |
| 150 | private String reference; |
| 151 | |
| 152 | /** |
| 153 | * Revision info of the module. |
| 154 | */ |
| 155 | private YangRevision revision; |
| 156 | |
| 157 | /** |
| 158 | * YANG version. |
| 159 | */ |
| 160 | private byte version; |
| 161 | |
Vinod Kumar S | 71cba68 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 162 | /*- |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame] | 163 | * Reference RFC 6020. |
| 164 | * |
Vinod Kumar S | 71cba68 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 165 | * Nested typedefs and groupings. |
| 166 | * Typedefs and groupings may appear nested under many YANG statements, |
| 167 | * allowing these to be lexically scoped by the hierarchy under which |
| 168 | * they appear. This allows types and groupings to be defined near |
| 169 | * where they are used, rather than placing them at the top level of the |
| 170 | * hierarchy. The close proximity increases readability. |
| 171 | * |
| 172 | * Scoping also allows types to be defined without concern for naming |
| 173 | * conflicts between types in different submodules. Type names can be |
| 174 | * specified without adding leading strings designed to prevent name |
| 175 | * collisions within large modules. |
| 176 | * |
| 177 | * Finally, scoping allows the module author to keep types and groupings |
| 178 | * private to their module or submodule, preventing their reuse. Since |
| 179 | * only top-level types and groupings (i.e., those appearing as |
| 180 | * sub-statements to a module or submodule statement) can be used outside |
| 181 | * the module or submodule, the developer has more control over what |
| 182 | * pieces of their module are presented to the outside world, supporting |
| 183 | * the need to hide internal information and maintaining a boundary |
| 184 | * between what is shared with the outside world and what is kept |
| 185 | * private. |
| 186 | * |
| 187 | * Scoped definitions MUST NOT shadow definitions at a higher scope. A |
| 188 | * type or grouping cannot be defined if a higher level in the schema |
| 189 | * hierarchy has a definition with a matching identifier. |
| 190 | * |
| 191 | * A reference to an unprefixed type or grouping, or one which uses the |
| 192 | * prefix of the current module, is resolved by locating the closest |
| 193 | * matching "typedef" or "grouping" statement among the immediate |
| 194 | * sub-statements of each ancestor statement. |
| 195 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 196 | private List<YangResolutionInfo> derivedTypeResolutionList; |
| 197 | |
| 198 | /** |
| 199 | * uses resolution list. |
| 200 | */ |
| 201 | private List<YangResolutionInfo> usesResolutionList; |
Vinod Kumar S | 71cba68 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 202 | |
Vinod Kumar S | 67e7be6 | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 203 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 204 | * Creates a YANG node of module type. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 205 | */ |
| 206 | public YangModule() { |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 207 | |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 208 | super(YangNodeType.MODULE_NODE); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 209 | derivedTypeResolutionList = new LinkedList<>(); |
| 210 | usesResolutionList = new LinkedList<>(); |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 211 | importList = new LinkedList<YangImport>(); |
| 212 | includeList = new LinkedList<YangInclude>(); |
| 213 | listOfLeaf = new LinkedList<YangLeaf>(); |
| 214 | listOfLeafList = new LinkedList<YangLeafList>(); |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 215 | } |
| 216 | |
Vinod Kumar S | 71cba68 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 217 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 218 | * Returns name of the module. |
Vinod Kumar S | 71cba68 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 219 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 220 | * @return module name |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 221 | */ |
Vinod Kumar S | 67e7be6 | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 222 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 223 | public String getName() { |
| 224 | return name; |
| 225 | } |
| 226 | |
Vinod Kumar S | 71cba68 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 227 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 228 | * Sets module name. |
Vinod Kumar S | 71cba68 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 229 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 230 | * @param moduleName module name |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 231 | */ |
Vinod Kumar S | 67e7be6 | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 232 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 233 | public void setName(String moduleName) { |
| 234 | name = moduleName; |
| 235 | } |
| 236 | |
| 237 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 238 | * Returns the contact details of the module owner. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 239 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 240 | * @return the contact details of YANG owner |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 241 | */ |
| 242 | public String getContact() { |
| 243 | return contact; |
| 244 | } |
| 245 | |
| 246 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 247 | * Sets the contact details of the module owner. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 248 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 249 | * @param contact the contact details of YANG owner |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 250 | */ |
| 251 | public void setContact(String contact) { |
| 252 | this.contact = contact; |
| 253 | } |
| 254 | |
| 255 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 256 | * Returns the description of module. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 257 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 258 | * @return the description of YANG module |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 259 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 260 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 261 | public String getDescription() { |
| 262 | return description; |
| 263 | } |
| 264 | |
| 265 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 266 | * Sets the description of module. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 267 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 268 | * @param description set the description of YANG module |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 269 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 270 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 271 | public void setDescription(String description) { |
| 272 | this.description = description; |
| 273 | } |
| 274 | |
| 275 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 276 | * Returns the list of imported modules. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 277 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 278 | * @return the list of imported modules |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 279 | */ |
Bharat saraswal | cad0e65 | 2016-05-26 23:48:38 +0530 | [diff] [blame] | 280 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 281 | public List<YangImport> getImportList() { |
| 282 | return importList; |
| 283 | } |
| 284 | |
| 285 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 286 | * Adds the imported module information to the import list. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 287 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 288 | * @param importedModule module being imported |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 289 | */ |
Bharat saraswal | cad0e65 | 2016-05-26 23:48:38 +0530 | [diff] [blame] | 290 | @Override |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 291 | public void addToImportList(YangImport importedModule) { |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 292 | getImportList().add(importedModule); |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 293 | } |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 294 | |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 295 | @Override |
| 296 | public void setImportList(List<YangImport> importList) { |
| 297 | this.importList = importList; |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 301 | * Returns the list of included sub modules. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 302 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 303 | * @return the included list of sub modules |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 304 | */ |
Bharat saraswal | cad0e65 | 2016-05-26 23:48:38 +0530 | [diff] [blame] | 305 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 306 | public List<YangInclude> getIncludeList() { |
| 307 | return includeList; |
| 308 | } |
| 309 | |
| 310 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 311 | * Adds the included sub module information to the include list. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 312 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 313 | * @param includeModule submodule being included |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 314 | */ |
Bharat saraswal | cad0e65 | 2016-05-26 23:48:38 +0530 | [diff] [blame] | 315 | @Override |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 316 | public void addToIncludeList(YangInclude includeModule) { |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 317 | getIncludeList().add(includeModule); |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | @Override |
| 321 | public void setIncludeList(List<YangInclude> includeList) { |
| 322 | this.includeList = includeList; |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 326 | * Returns the list of leaves in module. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 327 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 328 | * @return the list of leaves |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 329 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 330 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 331 | public List<YangLeaf> getListOfLeaf() { |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 332 | return listOfLeaf; |
| 333 | } |
| 334 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 335 | @Override |
| 336 | public void setListOfLeaf(List<YangLeaf> leafsList) { |
| 337 | listOfLeaf = leafsList; |
| 338 | } |
| 339 | |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 340 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 341 | * Adds a leaf in module. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 342 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 343 | * @param leaf the leaf to be added |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 344 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 345 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 346 | public void addLeaf(YangLeaf leaf) { |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 347 | getListOfLeaf().add(leaf); |
| 348 | } |
| 349 | |
| 350 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 351 | * Returns the list of leaf-list from module. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 352 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 353 | * @return the list of leaf-list |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 354 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 355 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 356 | public List<YangLeafList> getListOfLeafList() { |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 357 | return listOfLeafList; |
| 358 | } |
| 359 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 360 | @Override |
| 361 | public void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
| 362 | this.listOfLeafList = listOfLeafList; |
| 363 | } |
| 364 | |
| 365 | |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 366 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 367 | * Adds a leaf-list in module. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 368 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 369 | * @param leafList the leaf-list to be added |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 370 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 371 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 372 | public void addLeafList(YangLeafList leafList) { |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 373 | getListOfLeafList().add(leafList); |
| 374 | } |
| 375 | |
| 376 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 377 | * Returns the name space of module elements. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 378 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 379 | * @return the nameSpace |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 380 | */ |
| 381 | public YangNameSpace getNameSpace() { |
| 382 | return nameSpace; |
| 383 | } |
| 384 | |
| 385 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 386 | * Sets the name space of module elements. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 387 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 388 | * @param nameSpace the nameSpace to set |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 389 | */ |
| 390 | public void setNameSpace(YangNameSpace nameSpace) { |
| 391 | this.nameSpace = nameSpace; |
| 392 | } |
| 393 | |
| 394 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 395 | * Returns the modules organization. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 396 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 397 | * @return the organization |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 398 | */ |
| 399 | public String getOrganization() { |
| 400 | return organization; |
| 401 | } |
| 402 | |
| 403 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 404 | * Sets the modules organization. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 405 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 406 | * @param org the organization to set |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 407 | */ |
| 408 | public void setOrganization(String org) { |
Vinod Kumar S | 67e7be6 | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 409 | organization = org; |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 413 | * Returns the prefix. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 414 | * |
| 415 | * @return the prefix |
| 416 | */ |
Bharat saraswal | cad0e65 | 2016-05-26 23:48:38 +0530 | [diff] [blame] | 417 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 418 | public String getPrefix() { |
| 419 | return prefix; |
| 420 | } |
| 421 | |
| 422 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 423 | * Sets the prefix. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 424 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 425 | * @param prefix the prefix to set |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 426 | */ |
Bharat saraswal | cad0e65 | 2016-05-26 23:48:38 +0530 | [diff] [blame] | 427 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 428 | public void setPrefix(String prefix) { |
| 429 | this.prefix = prefix; |
| 430 | } |
| 431 | |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 432 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 433 | public void resolveSelfFileLinking(ResolvableType type) |
| 434 | throws DataModelException { |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 435 | // Get the list to be resolved. |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 436 | List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type); |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 437 | // Resolve linking for a resolution list. |
| 438 | resolveLinkingForResolutionList(resolutionList, this); |
| 439 | } |
| 440 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 441 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 442 | public void resolveInterFileLinking(ResolvableType type) |
| 443 | throws DataModelException { |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 444 | // Get the list to be resolved. |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 445 | List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(type); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 446 | // Resolve linking for a resolution list. |
| 447 | linkInterFileReferences(resolutionList, this); |
| 448 | } |
| 449 | |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 450 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 451 | * Returns the textual reference. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 452 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 453 | * @return the reference |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 454 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 455 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 456 | public String getReference() { |
| 457 | return reference; |
| 458 | } |
| 459 | |
| 460 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 461 | * Sets the textual reference. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 462 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 463 | * @param reference the reference to set |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 464 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 465 | @Override |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 466 | public void setReference(String reference) { |
| 467 | this.reference = reference; |
| 468 | } |
| 469 | |
| 470 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 471 | * Returns the revision. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 472 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 473 | * @return the revision |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 474 | */ |
| 475 | public YangRevision getRevision() { |
| 476 | return revision; |
| 477 | } |
| 478 | |
| 479 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 480 | * Sets the revision. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 481 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 482 | * @param revision the revision to set |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 483 | */ |
| 484 | public void setRevision(YangRevision revision) { |
| 485 | this.revision = revision; |
| 486 | } |
| 487 | |
| 488 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 489 | * Returns the version. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 490 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 491 | * @return the version |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 492 | */ |
| 493 | public byte getVersion() { |
| 494 | return version; |
| 495 | } |
| 496 | |
| 497 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 498 | * Sets the version. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 499 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 500 | * @param version the version to set |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 501 | */ |
| 502 | public void setVersion(byte version) { |
| 503 | this.version = version; |
| 504 | } |
| 505 | |
| 506 | /** |
| 507 | * Returns the type of the parsed data. |
| 508 | * |
Bharat saraswal | 2f00b4b | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 509 | * @return returns MODULE_DATA |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 510 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 511 | @Override |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 512 | public YangConstructType getYangConstructType() { |
| 513 | return YangConstructType.MODULE_DATA; |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 517 | * Validates the data on entering the corresponding parse tree node. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 518 | * |
| 519 | * @throws DataModelException a violation of data model rules |
| 520 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 521 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 522 | public void validateDataOnEntry() |
| 523 | throws DataModelException { |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 524 | /* |
| 525 | * Module is root in the data model tree, hence there is no entry |
| 526 | * validation |
| 527 | */ |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 528 | } |
| 529 | |
| 530 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 531 | * Validates the data on exiting the corresponding parse tree node. |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 532 | * |
| 533 | * @throws DataModelException a violation of data model rules |
| 534 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 535 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 536 | public void validateDataOnExit() |
| 537 | throws DataModelException { |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 538 | /* |
| 539 | * TODO: perform symbol linking for the imported or included YANG info. |
| 540 | * TODO: perform symbol resolution for referred YANG entities. |
| 541 | */ |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 542 | } |
Vinod Kumar S | 67e7be6 | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 543 | |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 544 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 545 | public void detectCollidingChild(String identifierName, YangConstructType dataType) |
| 546 | throws DataModelException { |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 547 | // Asks helper to detect colliding child. |
| 548 | detectCollidingChildUtil(identifierName, dataType, this); |
| 549 | } |
| 550 | |
| 551 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 552 | public void detectSelfCollision(String identifierName, YangConstructType dataType) |
| 553 | throws DataModelException { |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 554 | // Not required as module doesn't have any parent. |
| 555 | } |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 556 | |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 557 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 558 | public List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type) { |
| 559 | if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) { |
| 560 | return derivedTypeResolutionList; |
| 561 | } else { |
| 562 | return usesResolutionList; |
| 563 | } |
| 564 | |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 565 | } |
| 566 | |
| 567 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 568 | public void addToResolutionList(YangResolutionInfo resolutionInfo, |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 569 | ResolvableType type) { |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 570 | if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) { |
| 571 | derivedTypeResolutionList.add(resolutionInfo); |
| 572 | } else if (type == ResolvableType.YANG_USES) { |
| 573 | usesResolutionList.add(resolutionInfo); |
| 574 | } |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 578 | public void setResolutionList(List<YangResolutionInfo> resolutionList, |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 579 | ResolvableType type) { |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 580 | if (type == ResolvableType.YANG_DERIVED_DATA_TYPE) { |
| 581 | derivedTypeResolutionList = resolutionList; |
| 582 | } else if (type == ResolvableType.YANG_USES) { |
| 583 | usesResolutionList = resolutionList; |
| 584 | } |
| 585 | |
Gaurav Agrawal | d9d6cc8 | 2016-03-29 02:17:23 +0530 | [diff] [blame] | 586 | } |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 587 | |
| 588 | @Override |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 589 | public void addReferencesToImportList(Set<YangNode> yangNodeSet) |
| 590 | throws DataModelException { |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 591 | Iterator<YangImport> importInfoIterator = getImportList().iterator(); |
| 592 | // Run through the imported list to add references. |
| 593 | while (importInfoIterator.hasNext()) { |
| 594 | YangImport yangImport = importInfoIterator.next(); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 595 | yangImport.addReferenceToImport(yangNodeSet); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 596 | } |
| 597 | } |
| 598 | |
| 599 | @Override |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 600 | public void addReferencesToIncludeList(Set<YangNode> yangNodeSet) |
| 601 | throws DataModelException { |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 602 | Iterator<YangInclude> includeInfoIterator = getIncludeList().iterator(); |
| 603 | // Run through the included list to add references. |
| 604 | while (includeInfoIterator.hasNext()) { |
| 605 | YangInclude yangInclude = includeInfoIterator.next(); |
| 606 | YangSubModule subModule = null; |
| 607 | try { |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 608 | subModule = yangInclude.addReferenceToInclude(yangNodeSet); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 609 | } catch (DataModelException e) { |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 610 | throw e; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 611 | } |
| 612 | // Check if the referred sub-modules parent is self |
| 613 | if (!(subModule.getBelongsTo().getModuleNode() == this)) { |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 614 | yangInclude.reportIncludeError(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 615 | } |
| 616 | } |
| 617 | } |
Vinod Kumar S | 1ede5ab | 2016-02-09 20:14:53 +0530 | [diff] [blame] | 618 | } |