Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +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 | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.yangutils.datamodel; |
| 17 | |
| 18 | import java.util.LinkedList; |
| 19 | import java.util.List; |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 20 | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 21 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 22 | import org.onosproject.yangutils.datamodel.utils.Parsable; |
| 23 | import org.onosproject.yangutils.datamodel.utils.YangConstructType; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 24 | |
Gaurav Agrawal | bd80447 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 25 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil; |
| 26 | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 27 | /*- |
| 28 | * Reference RFC 6020. |
| 29 | * |
| 30 | * The "grouping" statement is used to define a reusable block of nodes, |
| 31 | * which may be used locally in the module, in modules that include it, |
| 32 | * and by other modules that import from it. It takes one argument, |
| 33 | * which is an identifier, followed by a block of sub-statements that |
| 34 | * holds detailed grouping information. |
| 35 | * |
| 36 | * The "grouping" statement is not a data definition statement and, as |
| 37 | * such, does not define any nodes in the schema tree. |
| 38 | * |
| 39 | * A grouping is like a "structure" or a "record" in conventional |
| 40 | * programming languages. |
| 41 | * Once a grouping is defined, it can be referenced in a "uses" |
| 42 | * statement. A grouping MUST NOT reference itself, |
| 43 | * neither directly nor indirectly through a chain of other groupings. |
| 44 | * |
| 45 | * If the grouping is defined at the top level of a YANG module or |
| 46 | * submodule, the grouping's identifier MUST be unique within the |
| 47 | * module. |
| 48 | * |
| 49 | * A grouping is more than just a mechanism for textual substitution, |
| 50 | * but defines a collection of nodes. Identifiers appearing inside the |
| 51 | * grouping are resolved relative to the scope in which the grouping is |
| 52 | * defined, not where it is used. Prefix mappings, type names, grouping |
| 53 | * names, and extension usage are evaluated in the hierarchy where the |
| 54 | * "grouping" statement appears. For extensions, this means that |
| 55 | * extensions are applied to the grouping node, not the uses node. |
| 56 | * |
| 57 | * The grouping's sub-statements |
| 58 | * |
| 59 | * +--------------+---------+-------------+------------------+ |
| 60 | * | substatement | section | cardinality |data model mapping| |
| 61 | * +--------------+---------+-------------+------------------+ |
| 62 | * | anyxml | 7.10 | 0..n |-not supported | |
| 63 | * | choice | 7.9 | 0..n |-child nodes | |
| 64 | * | container | 7.5 | 0..n |-child nodes | |
| 65 | * | description | 7.19.3 | 0..1 |-string | |
| 66 | * | grouping | 7.11 | 0..n |-child nodes | |
| 67 | * | leaf | 7.6 | 0..n |-YangLeaf | |
| 68 | * | leaf-list | 7.7 | 0..n |-YangLeafList | |
| 69 | * | list | 7.8 | 0..n |-child nodes | |
| 70 | * | reference | 7.19.4 | 0..1 |-string | |
| 71 | * | status | 7.19.2 | 0..1 |-YangStatus | |
| 72 | * | typedef | 7.3 | 0..n |-child nodes | |
| 73 | * | uses | 7.12 | 0..n |-child nodes | |
| 74 | * +--------------+---------+-------------+------------------+ |
| 75 | */ |
| 76 | |
| 77 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 78 | * Represents data model node to maintain information defined in YANG grouping. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 79 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 80 | public class YangGrouping |
| 81 | extends YangNode |
Gaurav Agrawal | bd80447 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 82 | implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 83 | |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 84 | private static final long serialVersionUID = 806201607L; |
| 85 | |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 86 | /** |
| 87 | * Name of the grouping. |
| 88 | */ |
| 89 | private String name; |
| 90 | |
| 91 | /** |
| 92 | * Description. |
| 93 | */ |
| 94 | private String description; |
| 95 | |
| 96 | /** |
| 97 | * List of leaves. |
| 98 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 99 | private List<YangLeaf> listOfLeaf; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * List of leaf lists. |
| 103 | */ |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 104 | private List<YangLeafList> listOfLeafList; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 105 | |
| 106 | /** |
| 107 | * Reference of the module. |
| 108 | */ |
| 109 | private String reference; |
| 110 | |
| 111 | /** |
| 112 | * Status of the node. |
| 113 | */ |
| 114 | private YangStatusType status; |
| 115 | |
| 116 | /** |
| 117 | * Creates the grouping node. |
| 118 | */ |
| 119 | public YangGrouping() { |
| 120 | super(YangNodeType.GROUPING_NODE); |
Gaurav Agrawal | bd80447 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 121 | listOfLeaf = new LinkedList<YangLeaf>(); |
| 122 | listOfLeafList = new LinkedList<YangLeafList>(); |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 123 | } |
| 124 | |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 125 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 126 | * Returns YANG grouping name. |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 127 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 128 | * @return YANG grouping name |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 129 | */ |
| 130 | @Override |
| 131 | public String getName() { |
| 132 | return name; |
| 133 | } |
| 134 | |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 135 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 136 | * Sets YANG grouping name. |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 137 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 138 | * @param name YANG grouping name |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 139 | */ |
| 140 | @Override |
| 141 | public void setName(String name) { |
| 142 | this.name = name; |
| 143 | } |
| 144 | |
| 145 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 146 | * Returns the description. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 147 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 148 | * @return the description |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 149 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 150 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 151 | public String getDescription() { |
| 152 | return description; |
| 153 | } |
| 154 | |
| 155 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 156 | * Sets the description. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 157 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 158 | * @param description set the description |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 159 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 160 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 161 | public void setDescription(String description) { |
| 162 | this.description = description; |
| 163 | } |
| 164 | |
| 165 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 166 | * Returns the list of leaves. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 167 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 168 | * @return the list of leaves |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 169 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 170 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 171 | public List<YangLeaf> getListOfLeaf() { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 172 | return listOfLeaf; |
| 173 | } |
| 174 | |
| 175 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 176 | * Sets the list of leaves. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 177 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 178 | * @param leafsList the list of leaf to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 179 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 180 | @Override |
| 181 | public void setListOfLeaf(List<YangLeaf> leafsList) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 182 | listOfLeaf = leafsList; |
| 183 | } |
| 184 | |
| 185 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 186 | * Adds a leaf. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 187 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 188 | * @param leaf the leaf to be added |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 189 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 190 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 191 | public void addLeaf(YangLeaf leaf) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 192 | getListOfLeaf().add(leaf); |
| 193 | } |
| 194 | |
| 195 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 196 | * Returns the list of leaf-list. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 197 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 198 | * @return the list of leaf-list |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 199 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 200 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 201 | public List<YangLeafList> getListOfLeafList() { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 202 | return listOfLeafList; |
| 203 | } |
| 204 | |
| 205 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 206 | * Sets the list of leaf-list. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 207 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 208 | * @param listOfLeafList the list of leaf-list to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 209 | */ |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 210 | @Override |
| 211 | public void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 212 | this.listOfLeafList = listOfLeafList; |
| 213 | } |
| 214 | |
| 215 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 216 | * Adds a leaf-list. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 217 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 218 | * @param leafList the leaf-list to be added |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 219 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 220 | @Override |
Vinod Kumar S | 0c330cd | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 221 | public void addLeafList(YangLeafList leafList) { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 222 | getListOfLeafList().add(leafList); |
| 223 | } |
| 224 | |
| 225 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 226 | * Returns the textual reference. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 227 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 228 | * @return the reference |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 229 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 230 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 231 | public String getReference() { |
| 232 | return reference; |
| 233 | } |
| 234 | |
| 235 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 236 | * Sets the textual reference. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 237 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 238 | * @param reference the reference to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 239 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 240 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 241 | public void setReference(String reference) { |
| 242 | this.reference = reference; |
| 243 | } |
| 244 | |
| 245 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 246 | * Returns the status. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 247 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 248 | * @return the status |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 249 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 250 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 251 | public YangStatusType getStatus() { |
| 252 | return status; |
| 253 | } |
| 254 | |
| 255 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 256 | * Sets the status. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 257 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 258 | * @param status the status to set |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 259 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 260 | @Override |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 261 | public void setStatus(YangStatusType status) { |
| 262 | this.status = status; |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Returns the type of the data. |
| 267 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 268 | * @return returns GROUPING_DATA |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 269 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 270 | @Override |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 271 | public YangConstructType getYangConstructType() { |
| 272 | return YangConstructType.GROUPING_DATA; |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 276 | * Validates the data on entering the corresponding parse tree node. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 277 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 278 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 279 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 280 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 281 | public void validateDataOnEntry() |
| 282 | throws DataModelException { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 283 | // TODO auto-generated method stub, to be implemented by parser |
| 284 | } |
| 285 | |
| 286 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 287 | * Validates the data on exiting the corresponding parse tree node. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 288 | * |
Gaurav Agrawal | 8e8770a | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 289 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 290 | */ |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 291 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 292 | public void validateDataOnExit() |
| 293 | throws DataModelException { |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 294 | // TODO auto-generated method stub, to be implemented by parser |
| 295 | } |
Gaurav Agrawal | bd80447 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 296 | |
| 297 | /* |
| 298 | * Reference RFC6020 |
| 299 | * |
| 300 | * Once a grouping is defined, it can be referenced in a "uses" |
| 301 | * statement (see Section 7.12). A grouping MUST NOT reference itself, |
| 302 | * neither directly nor indirectly through a chain of other groupings. |
| 303 | * |
| 304 | * If the grouping is defined at the top level of a YANG module or |
| 305 | * submodule, the grouping's identifier MUST be unique within the |
| 306 | * module. |
| 307 | */ |
| 308 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 309 | public void detectCollidingChild(String identifierName, YangConstructType dataType) |
| 310 | throws DataModelException { |
Gaurav Agrawal | bd80447 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 311 | // Asks helper to detect colliding child. |
| 312 | detectCollidingChildUtil(identifierName, dataType, this); |
| 313 | } |
| 314 | |
| 315 | @Override |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 316 | public void detectSelfCollision(String identifierName, YangConstructType dataType) |
| 317 | throws DataModelException { |
Gaurav Agrawal | bd80447 | 2016-03-25 11:25:36 +0530 | [diff] [blame] | 318 | if (getName().equals(identifierName)) { |
| 319 | throw new DataModelException("YANG file error: Duplicate input identifier detected, same as grouping \"" + |
| 320 | getName() + "\""); |
| 321 | } |
| 322 | } |
| 323 | // TODO A grouping MUST NOT reference itself, neither directly nor indirectly through a chain of other groupings. |
Vinod Kumar S | 2ff139c | 2016-02-16 01:37:16 +0530 | [diff] [blame] | 324 | } |