blob: d979bea73f6054a253e93d7543caf02cae160aee [file] [log] [blame]
Vinod Kumar S2ff139c2016-02-16 01:37:16 +05301/*
2 * Copyright 2016 Open Networking Laboratory
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 */
16package org.onosproject.yangutils.datamodel;
17
18import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
19import org.onosproject.yangutils.parser.Parsable;
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053020import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053021
22/*-
23 * Reference RFC 6020.
24 *
25 * The "uses" statement is used to reference a "grouping" definition. It takes
26 * one argument, which is the name of the grouping.
27 *
28 * The effect of a "uses" reference to a grouping is that the nodes defined by
29 * the grouping are copied into the current schema tree, and then updated
30 * according to the "refine" and "augment" statements.
31 *
32 * The identifiers defined in the grouping are not bound to a namespace until
33 * the contents of the grouping are added to the schema tree via a "uses"
34 * statement that does not appear inside a "grouping" statement, at which point
35 * they are bound to the namespace of the current module.
36 *
37 * The uses's sub-statements
38 *
39 * +--------------+---------+-------------+------------------+
40 * | substatement | section | cardinality |data model mapping|
41 * +--------------+---------+-------------+------------------+
42 * | augment | 7.15 | 0..1 | -child nodes |
43 * | description | 7.19.3 | 0..1 | -string |
44 * | if-feature | 7.18.2 | 0..n | -TODO |
45 * | refine | 7.12.2 | 0..1 | -TODO |
46 * | reference | 7.19.4 | 0..1 | -string |
47 * | status | 7.19.2 | 0..1 | -YangStatus |
48 * | when | 7.19.5 | 0..1 | -TODO |
49 * +--------------+---------+-------------+------------------+
50 */
51/**
52 * Data model node to maintain information defined in YANG uses.
53 *
54 */
55public class YangUses extends YangNode implements YangCommonInfo, Parsable {
56
57 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +053058 * Name of YANG uses.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053059 */
60 private String name;
61
62 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +053063 * Referred group.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053064 */
65 private YangGrouping refGroup;
66
67 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +053068 * Description of YANG uses.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053069 */
70 private String description;
71
72 /**
73 * YANG reference.
74 */
75 private String reference;
76
77 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +053078 * Status of YANG uses.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053079 */
80 private YangStatusType status;
81
82 /**
83 * Create an YANG uses node.
84 */
85 public YangUses() {
86 super(YangNodeType.USES_NODE);
87 }
88
89 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +053090 * Returns the name.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053091 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053092 * @return the name
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053093 */
94 public String getRefGroupingName() {
95 return name;
96 }
97
98 /**
99 * Set the name.
100 *
101 * @param refGroupingName the referred grouping name to set
102 */
103 public void setRefGroupingName(String refGroupingName) {
104 name = refGroupingName;
105 }
106
107 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +0530108 * Returns the referred group.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530109 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530110 * @return the referred group
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530111 */
112 public YangGrouping getRefGroup() {
113 return refGroup;
114 }
115
116 /**
117 * Set the referred group.
118 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530119 * @param refGroup the referred group
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530120 */
121 public void setRefGroup(YangGrouping refGroup) {
122 this.refGroup = refGroup;
123 }
124
125 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +0530126 * Returns the description.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530127 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530128 * @return the description
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530129 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530130 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530131 public String getDescription() {
132 return description;
133 }
134
135 /**
136 * Set the description.
137 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530138 * @param description set the description
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530139 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530140 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530141 public void setDescription(String description) {
142 this.description = description;
143 }
144
145 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +0530146 * Returns the textual reference.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530147 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530148 * @return the reference
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530149 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530150 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530151 public String getReference() {
152 return reference;
153 }
154
155 /**
156 * Set the textual reference.
157 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530158 * @param reference the reference to set
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530159 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530160 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530161 public void setReference(String reference) {
162 this.reference = reference;
163 }
164
165 /**
Gaurav Agrawalbd804472016-03-25 11:25:36 +0530166 * Returns the status.
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530167 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530168 * @return the status
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530169 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530170 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530171 public YangStatusType getStatus() {
172 return status;
173 }
174
175 /**
176 * Set the status.
177 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530178 * @param status the status to set
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530179 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530180 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530181 public void setStatus(YangStatusType status) {
182 this.status = status;
183 }
184
185 /**
186 * Returns the type of the data.
187 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530188 * @return returns USES_DATA
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530189 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530190 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530191 public YangConstructType getYangConstructType() {
192 return YangConstructType.USES_DATA;
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530193 }
194
195 /**
196 * Validate the data on entering the corresponding parse tree node.
197 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530198 * @throws DataModelException a violation of data model rules
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530199 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530200 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530201 public void validateDataOnEntry() throws DataModelException {
202 // TODO auto-generated method stub, to be implemented by parser
203 }
204
205 /**
206 * Validate the data on exiting the corresponding parse tree node.
207 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530208 * @throws DataModelException a violation of data model rules
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530209 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530210 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530211 public void validateDataOnExit() throws DataModelException {
212 // TODO auto-generated method stub, to be implemented by parser
213 }
214
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530215 @Override
216 public String getName() {
Gaurav Agrawalbd804472016-03-25 11:25:36 +0530217 return name;
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530218 }
219
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530220 @Override
221 public void setName(String name) {
Gaurav Agrawalbd804472016-03-25 11:25:36 +0530222 this.name = name;
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530223 }
224
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530225}