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