blob: c3bab5f0d917af85720e6bc5941693296fa7cdb7 [file] [log] [blame]
Vinod Kumar S5a39e012016-02-16 01:37:16 +05301/*
Brian O'Connor0f7908b2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S5a39e012016-02-16 01:37:16 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.yangutils.datamodel;
17
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +053018import java.util.LinkedList;
19import java.util.List;
Vinod Kumar S5a39e012016-02-16 01:37:16 +053020import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +053021import org.onosproject.yangutils.linker.Resolvable;
22import org.onosproject.yangutils.linker.ResolvableStatus;
Vinod Kumar S5a39e012016-02-16 01:37:16 +053023import org.onosproject.yangutils.parser.Parsable;
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +053024import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S5a39e012016-02-16 01:37:16 +053025
janani b06eca9b2016-04-26 18:49:20 +053026import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
Vinod Kumar S9aacac52016-04-20 13:02:58 +053027import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getParentNodeInGenCode;
28
Vinod Kumar S5a39e012016-02-16 01:37:16 +053029/*-
30 * Reference RFC 6020.
31 *
32 * The "uses" statement is used to reference a "grouping" definition. It takes
33 * one argument, which is the name of the grouping.
34 *
35 * The effect of a "uses" reference to a grouping is that the nodes defined by
36 * the grouping are copied into the current schema tree, and then updated
37 * according to the "refine" and "augment" statements.
38 *
39 * The identifiers defined in the grouping are not bound to a namespace until
40 * the contents of the grouping are added to the schema tree via a "uses"
41 * statement that does not appear inside a "grouping" statement, at which point
42 * they are bound to the namespace of the current module.
43 *
44 * The uses's sub-statements
45 *
46 * +--------------+---------+-------------+------------------+
47 * | substatement | section | cardinality |data model mapping|
48 * +--------------+---------+-------------+------------------+
49 * | augment | 7.15 | 0..1 | -child nodes |
50 * | description | 7.19.3 | 0..1 | -string |
51 * | if-feature | 7.18.2 | 0..n | -TODO |
52 * | refine | 7.12.2 | 0..1 | -TODO |
53 * | reference | 7.19.4 | 0..1 | -string |
54 * | status | 7.19.2 | 0..1 | -YangStatus |
55 * | when | 7.19.5 | 0..1 | -TODO |
56 * +--------------+---------+-------------+------------------+
57 */
Vinod Kumar Sf677daf2016-04-15 18:08:57 +053058
Vinod Kumar S5a39e012016-02-16 01:37:16 +053059/**
Bharat saraswal63f26fb2016-04-05 15:13:44 +053060 * Represents data model node to maintain information defined in YANG uses.
Vinod Kumar S5a39e012016-02-16 01:37:16 +053061 */
Vinod Kumar Sf677daf2016-04-15 18:08:57 +053062public class YangUses
63 extends YangNode
janani b06eca9b2016-04-26 18:49:20 +053064 implements YangCommonInfo, Parsable, Resolvable, CollisionDetector {
Vinod Kumar S5a39e012016-02-16 01:37:16 +053065
66 /**
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +053067 * YANG node identifier.
Vinod Kumar S5a39e012016-02-16 01:37:16 +053068 */
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +053069 private YangNodeIdentifier nodeIdentifier;
Vinod Kumar S5a39e012016-02-16 01:37:16 +053070
71 /**
Gaurav Agrawalf6ccc972016-03-25 11:25:36 +053072 * Referred group.
Vinod Kumar S5a39e012016-02-16 01:37:16 +053073 */
74 private YangGrouping refGroup;
75
76 /**
Gaurav Agrawalf6ccc972016-03-25 11:25:36 +053077 * Description of YANG uses.
Vinod Kumar S5a39e012016-02-16 01:37:16 +053078 */
79 private String description;
80
81 /**
82 * YANG reference.
83 */
84 private String reference;
85
86 /**
Gaurav Agrawalf6ccc972016-03-25 11:25:36 +053087 * Status of YANG uses.
Vinod Kumar S5a39e012016-02-16 01:37:16 +053088 */
89 private YangStatusType status;
90
91 /**
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +053092 * Status of resolution. If completely resolved enum value is "RESOLVED",
93 * if not enum value is "UNRESOLVED", in case reference of grouping/typedef
94 * is added to uses/type but it's not resolved value of enum should be
Vinod Kumar Sf677daf2016-04-15 18:08:57 +053095 * "INTRA_FILE_RESOLVED".
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +053096 */
97 private ResolvableStatus resolvableStatus;
98
99 /**
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530100 * Effective list of nodes of grouping that needs to replicated at YANG uses.
101 */
102 List<YangNode> resolvedGroupingNodes;
103
104 /**
105 * Effective list of leaves of grouping that needs to replicated at YANG uses.
106 */
107 List<List<YangLeaf>> resolvedGroupingLeaves;
108
109 /**
110 * Effective list of leaf lists of grouping that needs to replicated at YANG uses.
111 */
112 List<List<YangLeafList>> resolvedGroupingLeafLists;
113
114 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530115 * Creates an YANG uses node.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530116 */
117 public YangUses() {
118 super(YangNodeType.USES_NODE);
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +0530119 nodeIdentifier = new YangNodeIdentifier();
120 resolvableStatus = ResolvableStatus.UNRESOLVED;
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530121 resolvedGroupingNodes = new LinkedList<YangNode>();
122 resolvedGroupingLeaves = new LinkedList<List<YangLeaf>>();
123 resolvedGroupingLeafLists = new LinkedList<List<YangLeafList>>();
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530124 }
125
126 /**
Gaurav Agrawalf6ccc972016-03-25 11:25:36 +0530127 * Returns the referred group.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530128 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530129 * @return the referred group
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530130 */
131 public YangGrouping getRefGroup() {
132 return refGroup;
133 }
134
135 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530136 * Sets the referred group.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530137 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530138 * @param refGroup the referred group
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530139 */
140 public void setRefGroup(YangGrouping refGroup) {
141 this.refGroup = refGroup;
142 }
143
144 /**
Gaurav Agrawalf6ccc972016-03-25 11:25:36 +0530145 * Returns the description.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530146 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530147 * @return the description
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530148 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530149 @Override
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530150 public String getDescription() {
151 return description;
152 }
153
154 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530155 * Sets the description.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530156 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530157 * @param description set the description
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530158 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530159 @Override
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530160 public void setDescription(String description) {
161 this.description = description;
162 }
163
164 /**
Gaurav Agrawalf6ccc972016-03-25 11:25:36 +0530165 * Returns the textual reference.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530166 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530167 * @return the reference
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530168 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530169 @Override
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530170 public String getReference() {
171 return reference;
172 }
173
174 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530175 * Sets the textual reference.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530176 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530177 * @param reference the reference to set
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530178 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530179 @Override
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530180 public void setReference(String reference) {
181 this.reference = reference;
182 }
183
184 /**
Gaurav Agrawalf6ccc972016-03-25 11:25:36 +0530185 * Returns the status.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530186 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530187 * @return the status
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530188 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530189 @Override
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530190 public YangStatusType getStatus() {
191 return status;
192 }
193
194 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530195 * Sets the status.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530196 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530197 * @param status the status to set
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530198 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530199 @Override
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530200 public void setStatus(YangStatusType status) {
201 this.status = status;
202 }
203
204 /**
205 * Returns the type of the data.
206 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530207 * @return returns USES_DATA
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530208 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530209 @Override
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530210 public YangConstructType getYangConstructType() {
211 return YangConstructType.USES_DATA;
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530212 }
213
214 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530215 * Validates the data on entering the corresponding parse tree node.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530216 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530217 * @throws DataModelException a violation of data model rules
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530218 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530219 @Override
Vinod Kumar Sf677daf2016-04-15 18:08:57 +0530220 public void validateDataOnEntry()
221 throws DataModelException {
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530222 // TODO auto-generated method stub, to be implemented by parser
223 }
224
225 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530226 * Validates the data on exiting the corresponding parse tree node.
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530227 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530228 * @throws DataModelException a violation of data model rules
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530229 */
Bharat saraswal5e3c45c2016-02-22 22:15:21 +0530230 @Override
Vinod Kumar Sf677daf2016-04-15 18:08:57 +0530231 public void validateDataOnExit()
232 throws DataModelException {
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530233 // TODO auto-generated method stub, to be implemented by parser
234 }
235
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530236 @Override
237 public String getName() {
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +0530238 return nodeIdentifier.getName();
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530239 }
240
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530241 @Override
242 public void setName(String name) {
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +0530243 nodeIdentifier.setName(name);
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530244 }
245
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +0530246 /**
247 * Returns node identifier.
248 *
249 * @return node identifier
250 */
251 public YangNodeIdentifier getNodeIdentifier() {
252 return nodeIdentifier;
253 }
254
255 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530256 * Sets node identifier.
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +0530257 *
258 * @param nodeIdentifier the node identifier
259 */
260 public void setNodeIdentifier(YangNodeIdentifier nodeIdentifier) {
261 this.nodeIdentifier = nodeIdentifier;
262 }
263
264 /**
265 * Returns prefix associated with uses.
266 *
267 * @return prefix associated with uses
268 */
269 public String getPrefix() {
270 return nodeIdentifier.getPrefix();
271 }
272
273 /**
274 * Get prefix associated with uses.
275 *
276 * @param prefix prefix associated with uses
277 */
278 public void setPrefix(String prefix) {
279 nodeIdentifier.setPrefix(prefix);
280 }
281
282 @Override
Vinod Kumar S9aacac52016-04-20 13:02:58 +0530283 public void resolve()
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530284 throws DataModelException {
Vinod Kumar S9aacac52016-04-20 13:02:58 +0530285
286 YangGrouping referredGrouping = getRefGroup();
287
288 if (referredGrouping == null) {
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530289 throw new DataModelException("YANG uses linker error, cannot resolve uses");
Vinod Kumar S9aacac52016-04-20 13:02:58 +0530290 }
291
292 YangNode usesParentNode = getParentNodeInGenCode(this);
Bharat saraswal5cd9e9c2016-05-26 23:48:38 +0530293 if (!(usesParentNode instanceof YangLeavesHolder)
294 || !(usesParentNode instanceof CollisionDetector)) {
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530295 throw new DataModelException("YANG uses holder construct is wrong");
Vinod Kumar S9aacac52016-04-20 13:02:58 +0530296 }
297
298 YangLeavesHolder usesParentLeavesHolder = (YangLeavesHolder) usesParentNode;
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530299 if (referredGrouping.getListOfLeaf() != null
300 && referredGrouping.getListOfLeaf().size() != 0) {
301 addLeavesOfGrouping(
302 cloneLeavesList(referredGrouping.getListOfLeaf(),
303 usesParentLeavesHolder));
Vinod Kumar S9aacac52016-04-20 13:02:58 +0530304 }
305
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530306 if (referredGrouping.getListOfLeafList() != null
307 && referredGrouping.getListOfLeafList().size() != 0) {
308 addListOfLeafListOfGrouping(
309 cloneListOfLeafList(referredGrouping.getListOfLeafList(),
310 usesParentLeavesHolder));
311 }
312
313 YangNode childInGrouping = referredGrouping.getChild();
314
315 while (childInGrouping != null) {
316 if ((childInGrouping instanceof YangEnumeration)
317 || (childInGrouping instanceof YangUnion)
318 || (childInGrouping instanceof YangTypeDef)) {
319
320 /*
321 * No need to copy the leaves, union / enum class,
322 * as these will be generated in the scope of grouping
323 */
324 childInGrouping = childInGrouping.getNextSibling();
325 continue;
326 } else if ((childInGrouping instanceof YangUses)) {
327 addResolvedUsesInfoOfGrouping((YangUses) childInGrouping,
328 usesParentLeavesHolder);
329 } else {
330 addNodeOfGrouping(childInGrouping);
331 }
332
333 childInGrouping = childInGrouping.getNextSibling();
Gaurav Agrawalab7c4bd2016-05-17 18:06:38 +0530334 }
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +0530335 }
336
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530337 /**
338 * Clone the resolved uses contained in grouping to the uses of grouping.
339 *
340 * @param usesInGrouping resolved uses in grouping
341 * @param usesHolder holder of uses
342 */
343 private void addResolvedUsesInfoOfGrouping(YangUses usesInGrouping,
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530344 YangLeavesHolder usesHolder) throws DataModelException {
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530345 for (YangNode usesResolvedNode :
346 usesInGrouping.getUsesResolvedNodeList()) {
347 addNodeOfGrouping(usesResolvedNode);
348 }
349
350 for (List<YangLeaf> leavesList :
351 usesInGrouping.getUsesResolvedLeavesList()) {
352 addLeavesOfGrouping(cloneLeavesList(leavesList, usesHolder));
353 }
354
355 for (List<YangLeafList> listOfLeafLists :
356 usesInGrouping.getUsesResolvedListOfLeafList()) {
357 addListOfLeafListOfGrouping(
358 cloneListOfLeafList(listOfLeafLists, usesHolder));
359 }
360 }
361
362 /**
363 * Clone the list of leaves and return the cloned list leaves.
364 *
365 * @param listOfLeaves list of leaves to be cloned
366 * @param usesParentNode parent of the cloned location
367 * @return cloned list of leaves
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530368 * @throws DataModelException a violation in data model rule
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530369 */
370 private List<YangLeaf> cloneLeavesList(List<YangLeaf> listOfLeaves,
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530371 YangLeavesHolder usesParentNode) throws DataModelException {
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530372 if ((listOfLeaves == null) || listOfLeaves.size() == 0) {
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530373 throw new DataModelException("No leaves to clone");
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530374 }
375
376 List<YangLeaf> newLeavesList = new LinkedList<YangLeaf>();
377 for (YangLeaf leaf : listOfLeaves) {
378 YangLeaf clonedLeaf;
379 try {
380 ((CollisionDetector) usesParentNode).detectCollidingChild(leaf.getName(),
381 YangConstructType.LEAF_DATA);
382 clonedLeaf = leaf.clone();
383 } catch (CloneNotSupportedException | DataModelException e) {
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530384 throw new DataModelException(e.getMessage());
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530385 }
386
387 clonedLeaf.setContainedIn(usesParentNode);
388 newLeavesList.add(clonedLeaf);
389 }
390
391 return newLeavesList;
392 }
393
394 /**
395 * Clone the list of leaf list.
396 *
397 * @param listOfLeafList list of leaf list that needs to be cloned
398 * @param usesParentNode parent of uses
399 * @return cloned list of leaf list
400 */
401 private List<YangLeafList> cloneListOfLeafList(List<YangLeafList> listOfLeafList,
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530402 YangLeavesHolder usesParentNode) throws DataModelException {
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530403 if ((listOfLeafList == null) || listOfLeafList.size() == 0) {
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530404 throw new DataModelException("No leaf lists to clone");
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530405 }
406
407 List<YangLeafList> newListOfLeafList = new LinkedList<YangLeafList>();
408 for (YangLeafList leafList : listOfLeafList) {
409 YangLeafList clonedLeafList;
410 try {
411 ((CollisionDetector) usesParentNode).detectCollidingChild(leafList.getName(),
412 YangConstructType.LEAF_LIST_DATA);
413 clonedLeafList = leafList.clone();
414 } catch (CloneNotSupportedException | DataModelException e) {
Gaurav Agrawal58b348e2016-06-07 14:00:26 +0530415 throw new DataModelException(e.getMessage());
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530416 }
417
418 clonedLeafList.setContainedIn(usesParentNode);
419 newListOfLeafList.add(clonedLeafList);
420 }
421
422 return newListOfLeafList;
423 }
424
425
Gaurav Agrawal1fbfae12016-03-29 02:17:23 +0530426 @Override
427 public ResolvableStatus getResolvableStatus() {
428 return resolvableStatus;
429 }
430
431 @Override
432 public void setResolvableStatus(ResolvableStatus resolvableStatus) {
433 this.resolvableStatus = resolvableStatus;
434 }
janani b06eca9b2016-04-26 18:49:20 +0530435
436 @Override
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530437 public void detectCollidingChild(String identifierName, YangConstructType dataType)
438 throws DataModelException {
janani b06eca9b2016-04-26 18:49:20 +0530439 detectCollidingChildUtil(identifierName, dataType, this);
440 }
441
442 @Override
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530443 public void detectSelfCollision(String identifierName, YangConstructType dataType)
444 throws DataModelException {
janani b06eca9b2016-04-26 18:49:20 +0530445
446 if (getName().equals(identifierName)) {
447 throw new DataModelException("YANG file error: Duplicate input identifier detected, same as uses \""
448 + getName() + "\"");
449 }
450 }
451
VinodKumarS-Huaweid81eccb2016-06-01 14:30:22 +0530452
453 /**
454 * Adds the node under grouping to the effective uses resolved info.
455 *
456 * @param nodeInGrouping node defined under grouping which needs to be copied in
457 * the context of uses
458 */
459 public void addNodeOfGrouping(YangNode nodeInGrouping) {
460 resolvedGroupingNodes.add(nodeInGrouping);
461 }
462
463 /**
464 * Returns the effective list of nodes added due to uses linking.
465 *
466 * @return effective list of nodes added due to uses linking
467 */
468 public List<YangNode> getUsesResolvedNodeList() {
469 return resolvedGroupingNodes;
470 }
471
472 /**
473 * Adds the leaves under grouping to the effective uses resolved info.
474 *
475 * @param leavesInGrouping Leaves defined under grouping which needs to be copied in
476 * the context of uses
477 */
478 public void addLeavesOfGrouping(List<YangLeaf> leavesInGrouping) {
479 resolvedGroupingLeaves.add(leavesInGrouping);
480 }
481
482 /**
483 * Returns the effective list of Leaves added due to uses linking.
484 *
485 * @return effective list of Leaves added due to uses linking
486 */
487 public List<List<YangLeaf>> getUsesResolvedLeavesList() {
488 return resolvedGroupingLeaves;
489 }
490
491 /**
492 * Adds the leaf-lists under grouping to the effective uses resolved info.
493 *
494 * @param leafListsInGrouping leaf-lists defined under grouping which needs to be copied in
495 * the context of uses
496 */
497 public void addListOfLeafListOfGrouping(List<YangLeafList> leafListsInGrouping) {
498 resolvedGroupingLeafLists.add(leafListsInGrouping);
499 }
500
501 /**
502 * Returns the effective list of Leaves added due to uses linking.
503 *
504 * @return effective list of Leaves added due to uses linking
505 */
506 public List<List<YangLeafList>> getUsesResolvedListOfLeafList() {
507 return resolvedGroupingLeafLists;
508 }
Vinod Kumar S5a39e012016-02-16 01:37:16 +0530509}