Committed by
Gerrit Code Review
[ONOS-3902, ONOS-3903, ONOS-3904] string type, integer type derrived type
Change-Id: I8279e93fcb7dfb82491cc09057c9d75165add68d
Showing
49 changed files
with
1254 additions
and
595 deletions
1 | +/*Copyright 2016.year Open Networking Laboratory | ||
2 | + | ||
3 | +Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +you may not use this file except in compliance with the License. | ||
5 | +You may obtain a copy of the License at | ||
6 | + | ||
7 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | + | ||
9 | +Unless required by applicable law or agreed to in writing, software | ||
10 | +distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +See the License for the specific language governing permissions and | ||
13 | +limitations under the License.*/ | ||
14 | +package org.onosproject.yangutils.datamodel; | ||
15 | + | ||
16 | +/** | ||
17 | + * Abstraction of error message and application info processing. | ||
18 | + */ | ||
19 | +public interface YangAppErrorInfo { | ||
20 | + /** | ||
21 | + * Get the application's error message for data error. | ||
22 | + * | ||
23 | + * @return application's error message for data error. | ||
24 | + */ | ||
25 | + String getGetErrorMessage(); | ||
26 | + | ||
27 | + /** | ||
28 | + * Set the application's error message for data error. | ||
29 | + * | ||
30 | + * @param errorMessage application's error message for data error. | ||
31 | + */ | ||
32 | + void setErrorMessage(String errorMessage); | ||
33 | + | ||
34 | + /** | ||
35 | + * Get the application's error tag for data error. | ||
36 | + * | ||
37 | + * @return application's error tag for data error. | ||
38 | + */ | ||
39 | + String getGetErrorAppTag(); | ||
40 | + | ||
41 | + /** | ||
42 | + * Set the application's error tag for data error. | ||
43 | + * | ||
44 | + * @param errorMessage application's error tag for data error. | ||
45 | + */ | ||
46 | + void setErrorAppTag(String errorMessage); | ||
47 | +} |
... | @@ -92,12 +92,12 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -92,12 +92,12 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
92 | /** | 92 | /** |
93 | * List of leaves. | 93 | * List of leaves. |
94 | */ | 94 | */ |
95 | - private List<YangLeaf<?>> listOfLeaf; | 95 | + private List<YangLeaf> listOfLeaf; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * List of leaf-lists. | 98 | * List of leaf-lists. |
99 | */ | 99 | */ |
100 | - private List<YangLeafList<?>> listOfLeafList; | 100 | + private List<YangLeafList> listOfLeafList; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * reference. | 103 | * reference. |
... | @@ -110,6 +110,11 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -110,6 +110,11 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
110 | private YangStatusType status; | 110 | private YangStatusType status; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | + * package of the generated java code. | ||
114 | + */ | ||
115 | + private String pkg; | ||
116 | + | ||
117 | + /** | ||
113 | * Create a YANG augment node. | 118 | * Create a YANG augment node. |
114 | */ | 119 | */ |
115 | public YangAugment() { | 120 | public YangAugment() { |
... | @@ -160,7 +165,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -160,7 +165,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
160 | * @return the list of leaves. | 165 | * @return the list of leaves. |
161 | */ | 166 | */ |
162 | @Override | 167 | @Override |
163 | - public List<YangLeaf<?>> getListOfLeaf() { | 168 | + public List<YangLeaf> getListOfLeaf() { |
164 | return listOfLeaf; | 169 | return listOfLeaf; |
165 | } | 170 | } |
166 | 171 | ||
... | @@ -169,7 +174,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -169,7 +174,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
169 | * | 174 | * |
170 | * @param leafsList the list of leaf to set. | 175 | * @param leafsList the list of leaf to set. |
171 | */ | 176 | */ |
172 | - private void setListOfLeaf(List<YangLeaf<?>> leafsList) { | 177 | + private void setListOfLeaf(List<YangLeaf> leafsList) { |
173 | listOfLeaf = leafsList; | 178 | listOfLeaf = leafsList; |
174 | } | 179 | } |
175 | 180 | ||
... | @@ -179,9 +184,9 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -179,9 +184,9 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
179 | * @param leaf the leaf to be added. | 184 | * @param leaf the leaf to be added. |
180 | */ | 185 | */ |
181 | @Override | 186 | @Override |
182 | - public void addLeaf(YangLeaf<?> leaf) { | 187 | + public void addLeaf(YangLeaf leaf) { |
183 | if (getListOfLeaf() == null) { | 188 | if (getListOfLeaf() == null) { |
184 | - setListOfLeaf(new LinkedList<YangLeaf<?>>()); | 189 | + setListOfLeaf(new LinkedList<YangLeaf>()); |
185 | } | 190 | } |
186 | 191 | ||
187 | getListOfLeaf().add(leaf); | 192 | getListOfLeaf().add(leaf); |
... | @@ -193,7 +198,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -193,7 +198,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
193 | * @return the list of leaf-list. | 198 | * @return the list of leaf-list. |
194 | */ | 199 | */ |
195 | @Override | 200 | @Override |
196 | - public List<YangLeafList<?>> getListOfLeafList() { | 201 | + public List<YangLeafList> getListOfLeafList() { |
197 | return listOfLeafList; | 202 | return listOfLeafList; |
198 | } | 203 | } |
199 | 204 | ||
... | @@ -202,7 +207,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -202,7 +207,7 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
202 | * | 207 | * |
203 | * @param listOfLeafList the list of leaf-list to set. | 208 | * @param listOfLeafList the list of leaf-list to set. |
204 | */ | 209 | */ |
205 | - private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) { | 210 | + private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
206 | this.listOfLeafList = listOfLeafList; | 211 | this.listOfLeafList = listOfLeafList; |
207 | } | 212 | } |
208 | 213 | ||
... | @@ -212,9 +217,9 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -212,9 +217,9 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
212 | * @param leafList the leaf-list to be added. | 217 | * @param leafList the leaf-list to be added. |
213 | */ | 218 | */ |
214 | @Override | 219 | @Override |
215 | - public void addLeafList(YangLeafList<?> leafList) { | 220 | + public void addLeafList(YangLeafList leafList) { |
216 | if (getListOfLeafList() == null) { | 221 | if (getListOfLeafList() == null) { |
217 | - setListOfLeafList(new LinkedList<YangLeafList<?>>()); | 222 | + setListOfLeafList(new LinkedList<YangLeafList>()); |
218 | } | 223 | } |
219 | 224 | ||
220 | getListOfLeafList().add(leafList); | 225 | getListOfLeafList().add(leafList); |
... | @@ -290,44 +295,51 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -290,44 +295,51 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
290 | // TODO auto-generated method stub, to be implemented by parser | 295 | // TODO auto-generated method stub, to be implemented by parser |
291 | } | 296 | } |
292 | 297 | ||
293 | - /* (non-Javadoc) | 298 | + /** |
294 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | 299 | + * Get the target nodes name where the augmentation is being done. |
300 | + * | ||
301 | + * @return target nodes name where the augmentation is being done. | ||
295 | */ | 302 | */ |
296 | @Override | 303 | @Override |
297 | public String getName() { | 304 | public String getName() { |
298 | - // TODO Auto-generated method stub | 305 | + return targetNode; |
299 | - return null; | ||
300 | } | 306 | } |
301 | 307 | ||
302 | - /* (non-Javadoc) | 308 | + /** |
303 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | 309 | + * Set the target nodes name where the augmentation is being done. |
310 | + * | ||
311 | + * @param name target nodes name where the augmentation is being done. | ||
304 | */ | 312 | */ |
305 | @Override | 313 | @Override |
306 | public void setName(String name) { | 314 | public void setName(String name) { |
307 | - // TODO Auto-generated method stub | 315 | + targetNode = name; |
308 | 316 | ||
309 | } | 317 | } |
310 | 318 | ||
311 | - /* (non-Javadoc) | 319 | + /** |
312 | - * @see org.onosproject.yangutils.datamodel.YangNode#getPackage() | 320 | + * Get the mapped java package. |
321 | + * | ||
322 | + * @return the java package | ||
313 | */ | 323 | */ |
314 | @Override | 324 | @Override |
315 | public String getPackage() { | 325 | public String getPackage() { |
316 | - // TODO Auto-generated method stub | 326 | + return pkg; |
317 | - return null; | ||
318 | } | 327 | } |
319 | 328 | ||
320 | - /* (non-Javadoc) | 329 | + /** |
321 | - * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String) | 330 | + * Set the mapped java package. |
331 | + * | ||
332 | + * @param pakg the package to set | ||
322 | */ | 333 | */ |
323 | @Override | 334 | @Override |
324 | - public void setPackage(String pkg) { | 335 | + public void setPackage(String pakg) { |
325 | - // TODO Auto-generated method stub | 336 | + pkg = pakg; |
326 | 337 | ||
327 | } | 338 | } |
328 | 339 | ||
329 | - /* (non-Javadoc) | 340 | + /** |
330 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry() | 341 | + * Prepare the information for java code generation corresponding to YANG |
342 | + * grouping info. | ||
331 | */ | 343 | */ |
332 | @Override | 344 | @Override |
333 | public void generateJavaCodeEntry() { | 345 | public void generateJavaCodeEntry() { |
... | @@ -335,8 +347,8 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo | ... | @@ -335,8 +347,8 @@ public class YangAugment extends YangNode implements YangLeavesHolder, YangCommo |
335 | 347 | ||
336 | } | 348 | } |
337 | 349 | ||
338 | - /* (non-Javadoc) | 350 | + /** |
339 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit() | 351 | + * Create a java file using the YANG grouping info. |
340 | */ | 352 | */ |
341 | @Override | 353 | @Override |
342 | public void generateJavaCodeExit() { | 354 | public void generateJavaCodeExit() { | ... | ... |
... | @@ -114,6 +114,7 @@ public class YangBelongsTo implements Parsable { | ... | @@ -114,6 +114,7 @@ public class YangBelongsTo implements Parsable { |
114 | * | 114 | * |
115 | * @return ParsedDataType returns BELONGS_TO_DATA | 115 | * @return ParsedDataType returns BELONGS_TO_DATA |
116 | */ | 116 | */ |
117 | + @Override | ||
117 | public ParsableDataType getParsableDataType() { | 118 | public ParsableDataType getParsableDataType() { |
118 | return ParsableDataType.BELONGS_TO_DATA; | 119 | return ParsableDataType.BELONGS_TO_DATA; |
119 | } | 120 | } |
... | @@ -123,6 +124,7 @@ public class YangBelongsTo implements Parsable { | ... | @@ -123,6 +124,7 @@ public class YangBelongsTo implements Parsable { |
123 | * | 124 | * |
124 | * @throws DataModelException a violation of data model rules. | 125 | * @throws DataModelException a violation of data model rules. |
125 | */ | 126 | */ |
127 | + @Override | ||
126 | public void validateDataOnEntry() throws DataModelException { | 128 | public void validateDataOnEntry() throws DataModelException { |
127 | // TODO auto-generated method stub, to be implemented by parser | 129 | // TODO auto-generated method stub, to be implemented by parser |
128 | } | 130 | } |
... | @@ -132,6 +134,7 @@ public class YangBelongsTo implements Parsable { | ... | @@ -132,6 +134,7 @@ public class YangBelongsTo implements Parsable { |
132 | * | 134 | * |
133 | * @throws DataModelException a violation of data model rules. | 135 | * @throws DataModelException a violation of data model rules. |
134 | */ | 136 | */ |
137 | + @Override | ||
135 | public void validateDataOnExit() throws DataModelException { | 138 | public void validateDataOnExit() throws DataModelException { |
136 | // TODO auto-generated method stub, to be implemented by parser | 139 | // TODO auto-generated method stub, to be implemented by parser |
137 | } | 140 | } | ... | ... |
... | @@ -101,6 +101,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -101,6 +101,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
101 | * | 101 | * |
102 | * @return the description. | 102 | * @return the description. |
103 | */ | 103 | */ |
104 | + @Override | ||
104 | public String getDescription() { | 105 | public String getDescription() { |
105 | return description; | 106 | return description; |
106 | } | 107 | } |
... | @@ -110,6 +111,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -110,6 +111,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
110 | * | 111 | * |
111 | * @param description set the description. | 112 | * @param description set the description. |
112 | */ | 113 | */ |
114 | + @Override | ||
113 | public void setDescription(String description) { | 115 | public void setDescription(String description) { |
114 | this.description = description; | 116 | this.description = description; |
115 | } | 117 | } |
... | @@ -119,6 +121,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -119,6 +121,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
119 | * | 121 | * |
120 | * @return the reference. | 122 | * @return the reference. |
121 | */ | 123 | */ |
124 | + @Override | ||
122 | public String getReference() { | 125 | public String getReference() { |
123 | return reference; | 126 | return reference; |
124 | } | 127 | } |
... | @@ -128,6 +131,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -128,6 +131,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
128 | * | 131 | * |
129 | * @param reference the reference to set. | 132 | * @param reference the reference to set. |
130 | */ | 133 | */ |
134 | + @Override | ||
131 | public void setReference(String reference) { | 135 | public void setReference(String reference) { |
132 | this.reference = reference; | 136 | this.reference = reference; |
133 | } | 137 | } |
... | @@ -137,6 +141,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -137,6 +141,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
137 | * | 141 | * |
138 | * @return the status. | 142 | * @return the status. |
139 | */ | 143 | */ |
144 | + @Override | ||
140 | public YangStatusType getStatus() { | 145 | public YangStatusType getStatus() { |
141 | return status; | 146 | return status; |
142 | } | 147 | } |
... | @@ -146,6 +151,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -146,6 +151,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
146 | * | 151 | * |
147 | * @param status the status to set. | 152 | * @param status the status to set. |
148 | */ | 153 | */ |
154 | + @Override | ||
149 | public void setStatus(YangStatusType status) { | 155 | public void setStatus(YangStatusType status) { |
150 | this.status = status; | 156 | this.status = status; |
151 | } | 157 | } |
... | @@ -173,6 +179,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -173,6 +179,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
173 | * | 179 | * |
174 | * @return ParsedDataType returns BIT_DATA | 180 | * @return ParsedDataType returns BIT_DATA |
175 | */ | 181 | */ |
182 | + @Override | ||
176 | public ParsableDataType getParsableDataType() { | 183 | public ParsableDataType getParsableDataType() { |
177 | return ParsableDataType.BIT_DATA; | 184 | return ParsableDataType.BIT_DATA; |
178 | } | 185 | } |
... | @@ -182,6 +189,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -182,6 +189,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
182 | * | 189 | * |
183 | * @throws DataModelException a violation of data model rules. | 190 | * @throws DataModelException a violation of data model rules. |
184 | */ | 191 | */ |
192 | + @Override | ||
185 | public void validateDataOnEntry() throws DataModelException { | 193 | public void validateDataOnEntry() throws DataModelException { |
186 | // TODO auto-generated method stub, to be implemented by parser | 194 | // TODO auto-generated method stub, to be implemented by parser |
187 | } | 195 | } |
... | @@ -191,6 +199,7 @@ public class YangBit implements YangCommonInfo, Parsable { | ... | @@ -191,6 +199,7 @@ public class YangBit implements YangCommonInfo, Parsable { |
191 | * | 199 | * |
192 | * @throws DataModelException a violation of data model rules. | 200 | * @throws DataModelException a violation of data model rules. |
193 | */ | 201 | */ |
202 | + @Override | ||
194 | public void validateDataOnExit() throws DataModelException { | 203 | public void validateDataOnExit() throws DataModelException { |
195 | // TODO auto-generated method stub, to be implemented by parser | 204 | // TODO auto-generated method stub, to be implemented by parser |
196 | } | 205 | } | ... | ... |
... | @@ -77,6 +77,7 @@ public class YangBits implements Parsable { | ... | @@ -77,6 +77,7 @@ public class YangBits implements Parsable { |
77 | * | 77 | * |
78 | * @return ParsedDataType returns BITS_DATA | 78 | * @return ParsedDataType returns BITS_DATA |
79 | */ | 79 | */ |
80 | + @Override | ||
80 | public ParsableDataType getParsableDataType() { | 81 | public ParsableDataType getParsableDataType() { |
81 | return ParsableDataType.BITS_DATA; | 82 | return ParsableDataType.BITS_DATA; |
82 | } | 83 | } |
... | @@ -86,6 +87,7 @@ public class YangBits implements Parsable { | ... | @@ -86,6 +87,7 @@ public class YangBits implements Parsable { |
86 | * | 87 | * |
87 | * @throws DataModelException a violation of data model rules. | 88 | * @throws DataModelException a violation of data model rules. |
88 | */ | 89 | */ |
90 | + @Override | ||
89 | public void validateDataOnEntry() throws DataModelException { | 91 | public void validateDataOnEntry() throws DataModelException { |
90 | // TODO auto-generated method stub, to be implemented by parser | 92 | // TODO auto-generated method stub, to be implemented by parser |
91 | } | 93 | } |
... | @@ -95,6 +97,7 @@ public class YangBits implements Parsable { | ... | @@ -95,6 +97,7 @@ public class YangBits implements Parsable { |
95 | * | 97 | * |
96 | * @throws DataModelException a violation of data model rules. | 98 | * @throws DataModelException a violation of data model rules. |
97 | */ | 99 | */ |
100 | + @Override | ||
98 | public void validateDataOnExit() throws DataModelException { | 101 | public void validateDataOnExit() throws DataModelException { |
99 | // TODO auto-generated method stub, to be implemented by parser | 102 | // TODO auto-generated method stub, to be implemented by parser |
100 | } | 103 | } | ... | ... |
... | @@ -89,7 +89,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; | ... | @@ -89,7 +89,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; |
89 | /** | 89 | /** |
90 | * Data model node to maintain information defined in YANG case. | 90 | * Data model node to maintain information defined in YANG case. |
91 | */ | 91 | */ |
92 | -public class YangCase extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable { | 92 | +public class YangCase extends YangNode |
93 | + implements YangLeavesHolder, YangCommonInfo, Parsable { | ||
93 | 94 | ||
94 | /** | 95 | /** |
95 | * Case name. | 96 | * Case name. |
... | @@ -106,12 +107,12 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -106,12 +107,12 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
106 | /** | 107 | /** |
107 | * List of leaves. | 108 | * List of leaves. |
108 | */ | 109 | */ |
109 | - private List<YangLeaf<?>> listOfLeaf; | 110 | + private List<YangLeaf> listOfLeaf; |
110 | 111 | ||
111 | /** | 112 | /** |
112 | * List of leaf lists. | 113 | * List of leaf lists. |
113 | */ | 114 | */ |
114 | - private List<YangLeafList<?>> listOfLeafList; | 115 | + private List<YangLeafList> listOfLeafList; |
115 | 116 | ||
116 | /** | 117 | /** |
117 | * Reference of the module. | 118 | * Reference of the module. |
... | @@ -124,22 +125,31 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -124,22 +125,31 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
124 | private YangStatusType status; | 125 | private YangStatusType status; |
125 | 126 | ||
126 | /** | 127 | /** |
128 | + * package of the generated java code. | ||
129 | + */ | ||
130 | + private String pkg; | ||
131 | + | ||
132 | + /** | ||
127 | * Create a choice node. | 133 | * Create a choice node. |
128 | */ | 134 | */ |
129 | public YangCase() { | 135 | public YangCase() { |
130 | super(YangNodeType.CASE_NODE); | 136 | super(YangNodeType.CASE_NODE); |
131 | } | 137 | } |
132 | 138 | ||
133 | - /* (non-Javadoc) | 139 | + /** |
134 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | 140 | + * Get the case name. |
141 | + * | ||
142 | + * @return case name. | ||
135 | */ | 143 | */ |
136 | @Override | 144 | @Override |
137 | public String getName() { | 145 | public String getName() { |
138 | return name; | 146 | return name; |
139 | } | 147 | } |
140 | 148 | ||
141 | - /* (non-Javadoc) | 149 | + /** |
142 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | 150 | + * Set the case name. |
151 | + * | ||
152 | + * @param name case name. | ||
143 | */ | 153 | */ |
144 | @Override | 154 | @Override |
145 | public void setName(String name) { | 155 | public void setName(String name) { |
... | @@ -172,7 +182,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -172,7 +182,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
172 | * @return the list of leaves. | 182 | * @return the list of leaves. |
173 | */ | 183 | */ |
174 | @Override | 184 | @Override |
175 | - public List<YangLeaf<?>> getListOfLeaf() { | 185 | + public List<YangLeaf> getListOfLeaf() { |
176 | return listOfLeaf; | 186 | return listOfLeaf; |
177 | } | 187 | } |
178 | 188 | ||
... | @@ -181,7 +191,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -181,7 +191,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
181 | * | 191 | * |
182 | * @param leafsList the list of leaf to set. | 192 | * @param leafsList the list of leaf to set. |
183 | */ | 193 | */ |
184 | - private void setListOfLeaf(List<YangLeaf<?>> leafsList) { | 194 | + private void setListOfLeaf(List<YangLeaf> leafsList) { |
185 | listOfLeaf = leafsList; | 195 | listOfLeaf = leafsList; |
186 | } | 196 | } |
187 | 197 | ||
... | @@ -191,9 +201,9 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -191,9 +201,9 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
191 | * @param leaf the leaf to be added. | 201 | * @param leaf the leaf to be added. |
192 | */ | 202 | */ |
193 | @Override | 203 | @Override |
194 | - public void addLeaf(YangLeaf<?> leaf) { | 204 | + public void addLeaf(YangLeaf leaf) { |
195 | if (getListOfLeaf() == null) { | 205 | if (getListOfLeaf() == null) { |
196 | - setListOfLeaf(new LinkedList<YangLeaf<?>>()); | 206 | + setListOfLeaf(new LinkedList<YangLeaf>()); |
197 | } | 207 | } |
198 | 208 | ||
199 | getListOfLeaf().add(leaf); | 209 | getListOfLeaf().add(leaf); |
... | @@ -205,7 +215,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -205,7 +215,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
205 | * @return the list of leaf-list. | 215 | * @return the list of leaf-list. |
206 | */ | 216 | */ |
207 | @Override | 217 | @Override |
208 | - public List<YangLeafList<?>> getListOfLeafList() { | 218 | + public List<YangLeafList> getListOfLeafList() { |
209 | return listOfLeafList; | 219 | return listOfLeafList; |
210 | } | 220 | } |
211 | 221 | ||
... | @@ -214,7 +224,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -214,7 +224,7 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
214 | * | 224 | * |
215 | * @param listOfLeafList the list of leaf-list to set. | 225 | * @param listOfLeafList the list of leaf-list to set. |
216 | */ | 226 | */ |
217 | - private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) { | 227 | + private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
218 | this.listOfLeafList = listOfLeafList; | 228 | this.listOfLeafList = listOfLeafList; |
219 | } | 229 | } |
220 | 230 | ||
... | @@ -224,9 +234,9 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -224,9 +234,9 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
224 | * @param leafList the leaf-list to be added. | 234 | * @param leafList the leaf-list to be added. |
225 | */ | 235 | */ |
226 | @Override | 236 | @Override |
227 | - public void addLeafList(YangLeafList<?> leafList) { | 237 | + public void addLeafList(YangLeafList leafList) { |
228 | if (getListOfLeafList() == null) { | 238 | if (getListOfLeafList() == null) { |
229 | - setListOfLeafList(new LinkedList<YangLeafList<?>>()); | 239 | + setListOfLeafList(new LinkedList<YangLeafList>()); |
230 | } | 240 | } |
231 | 241 | ||
232 | getListOfLeafList().add(leafList); | 242 | getListOfLeafList().add(leafList); |
... | @@ -302,26 +312,29 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -302,26 +312,29 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
302 | // TODO auto-generated method stub, to be implemented by parser | 312 | // TODO auto-generated method stub, to be implemented by parser |
303 | } | 313 | } |
304 | 314 | ||
305 | - /* (non-Javadoc) | 315 | + /** |
306 | - * @see org.onosproject.yangutils.datamodel.YangNode#getPackage() | 316 | + * Get the mapped java package. |
317 | + * | ||
318 | + * @return the java package | ||
307 | */ | 319 | */ |
308 | @Override | 320 | @Override |
309 | public String getPackage() { | 321 | public String getPackage() { |
310 | - // TODO Auto-generated method stub | 322 | + return pkg; |
311 | - return null; | ||
312 | } | 323 | } |
313 | 324 | ||
314 | - /* (non-Javadoc) | 325 | + /** |
315 | - * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String) | 326 | + * Set the mapped java package. |
327 | + * | ||
328 | + * @param pakg the package to set | ||
316 | */ | 329 | */ |
317 | @Override | 330 | @Override |
318 | - public void setPackage(String pkg) { | 331 | + public void setPackage(String pakg) { |
319 | - // TODO Auto-generated method stub | 332 | + pkg = pakg; |
320 | 333 | ||
321 | } | 334 | } |
322 | 335 | ||
323 | - /* (non-Javadoc) | 336 | + /** |
324 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry() | 337 | + * Generate the code corresponding to YANG case info. |
325 | */ | 338 | */ |
326 | @Override | 339 | @Override |
327 | public void generateJavaCodeEntry() { | 340 | public void generateJavaCodeEntry() { |
... | @@ -329,8 +342,9 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -329,8 +342,9 @@ public class YangCase extends YangNode implements YangLeavesHolder, YangCommonIn |
329 | 342 | ||
330 | } | 343 | } |
331 | 344 | ||
332 | - /* (non-Javadoc) | 345 | + /** |
333 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit() | 346 | + * Free resource used for generating code and generate valid java files |
347 | + * corresponding to YANG case info. | ||
334 | */ | 348 | */ |
335 | @Override | 349 | @Override |
336 | public void generateJavaCodeExit() { | 350 | public void generateJavaCodeExit() { | ... | ... |
... | @@ -109,12 +109,12 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -109,12 +109,12 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
109 | /** | 109 | /** |
110 | * List of leaves contained. | 110 | * List of leaves contained. |
111 | */ | 111 | */ |
112 | - private List<YangLeaf<?>> listOfLeaf; | 112 | + private List<YangLeaf> listOfLeaf; |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * List of leaf-lists contained. | 115 | * List of leaf-lists contained. |
116 | */ | 116 | */ |
117 | - private List<YangLeafList<?>> listOfLeafList; | 117 | + private List<YangLeafList> listOfLeafList; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * If it is a presence container, then the textual documentation of presence | 120 | * If it is a presence container, then the textual documentation of presence |
... | @@ -130,7 +130,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -130,7 +130,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
130 | /** | 130 | /** |
131 | * Status of the node. | 131 | * Status of the node. |
132 | */ | 132 | */ |
133 | - private YangStatusType status; | 133 | + private YangStatusType status = YangStatusType.CURRENT; |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Package of the generated java code. | 136 | * Package of the generated java code. |
... | @@ -149,16 +149,20 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -149,16 +149,20 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
149 | super(YangNodeType.CONTAINER_NODE); | 149 | super(YangNodeType.CONTAINER_NODE); |
150 | } | 150 | } |
151 | 151 | ||
152 | - /* (non-Javadoc) | 152 | + /** |
153 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | 153 | + * Get the YANG name of container. |
154 | + * | ||
155 | + * @return the name of container as defined in YANG file. | ||
154 | */ | 156 | */ |
155 | @Override | 157 | @Override |
156 | public String getName() { | 158 | public String getName() { |
157 | return name; | 159 | return name; |
158 | } | 160 | } |
159 | 161 | ||
160 | - /* (non-Javadoc) | 162 | + /** |
161 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | 163 | + * Set the YANG name of container. |
164 | + * | ||
165 | + * @param name the name of container as defined in YANG file. | ||
162 | */ | 166 | */ |
163 | @Override | 167 | @Override |
164 | public void setName(String name) { | 168 | public void setName(String name) { |
... | @@ -209,7 +213,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -209,7 +213,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
209 | * @return the list of leaves. | 213 | * @return the list of leaves. |
210 | */ | 214 | */ |
211 | @Override | 215 | @Override |
212 | - public List<YangLeaf<?>> getListOfLeaf() { | 216 | + public List<YangLeaf> getListOfLeaf() { |
213 | return listOfLeaf; | 217 | return listOfLeaf; |
214 | } | 218 | } |
215 | 219 | ||
... | @@ -218,7 +222,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -218,7 +222,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
218 | * | 222 | * |
219 | * @param leafsList the list of leaf to set. | 223 | * @param leafsList the list of leaf to set. |
220 | */ | 224 | */ |
221 | - private void setListOfLeaf(List<YangLeaf<?>> leafsList) { | 225 | + private void setListOfLeaf(List<YangLeaf> leafsList) { |
222 | listOfLeaf = leafsList; | 226 | listOfLeaf = leafsList; |
223 | } | 227 | } |
224 | 228 | ||
... | @@ -228,9 +232,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -228,9 +232,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
228 | * @param leaf the leaf to be added. | 232 | * @param leaf the leaf to be added. |
229 | */ | 233 | */ |
230 | @Override | 234 | @Override |
231 | - public void addLeaf(YangLeaf<?> leaf) { | 235 | + public void addLeaf(YangLeaf leaf) { |
232 | if (getListOfLeaf() == null) { | 236 | if (getListOfLeaf() == null) { |
233 | - setListOfLeaf(new LinkedList<YangLeaf<?>>()); | 237 | + setListOfLeaf(new LinkedList<YangLeaf>()); |
234 | } | 238 | } |
235 | 239 | ||
236 | getListOfLeaf().add(leaf); | 240 | getListOfLeaf().add(leaf); |
... | @@ -242,7 +246,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -242,7 +246,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
242 | * @return the list of leaf-list. | 246 | * @return the list of leaf-list. |
243 | */ | 247 | */ |
244 | @Override | 248 | @Override |
245 | - public List<YangLeafList<?>> getListOfLeafList() { | 249 | + public List<YangLeafList> getListOfLeafList() { |
246 | return listOfLeafList; | 250 | return listOfLeafList; |
247 | } | 251 | } |
248 | 252 | ||
... | @@ -251,7 +255,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -251,7 +255,7 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
251 | * | 255 | * |
252 | * @param listOfLeafList the list of leaf-list to set. | 256 | * @param listOfLeafList the list of leaf-list to set. |
253 | */ | 257 | */ |
254 | - private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) { | 258 | + private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
255 | this.listOfLeafList = listOfLeafList; | 259 | this.listOfLeafList = listOfLeafList; |
256 | } | 260 | } |
257 | 261 | ||
... | @@ -261,9 +265,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -261,9 +265,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
261 | * @param leafList the leaf-list to be added. | 265 | * @param leafList the leaf-list to be added. |
262 | */ | 266 | */ |
263 | @Override | 267 | @Override |
264 | - public void addLeafList(YangLeafList<?> leafList) { | 268 | + public void addLeafList(YangLeafList leafList) { |
265 | if (getListOfLeafList() == null) { | 269 | if (getListOfLeafList() == null) { |
266 | - setListOfLeafList(new LinkedList<YangLeafList<?>>()); | 270 | + setListOfLeafList(new LinkedList<YangLeafList>()); |
267 | } | 271 | } |
268 | 272 | ||
269 | getListOfLeafList().add(leafList); | 273 | getListOfLeafList().add(leafList); |
... | @@ -397,6 +401,11 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -397,6 +401,11 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
397 | pkg = pcg; | 401 | pkg = pcg; |
398 | } | 402 | } |
399 | 403 | ||
404 | + /** | ||
405 | + * Generate the java code corresponding to YANG container. | ||
406 | + * | ||
407 | + * @throws IOException when fails to generate the source files. | ||
408 | + */ | ||
400 | @Override | 409 | @Override |
401 | public void generateJavaCodeEntry() throws IOException { | 410 | public void generateJavaCodeEntry() throws IOException { |
402 | YangNode parent = getParent(); | 411 | YangNode parent = getParent(); |
... | @@ -416,8 +425,6 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -416,8 +425,6 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
416 | 425 | ||
417 | /** | 426 | /** |
418 | * Adds current node attribute to parent file. | 427 | * Adds current node attribute to parent file. |
419 | - * | ||
420 | - * @param pkg java file package path | ||
421 | */ | 428 | */ |
422 | private void addAttributeInParent() { | 429 | private void addAttributeInParent() { |
423 | if (getParent() != null) { | 430 | if (getParent() != null) { |
... | @@ -439,9 +446,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -439,9 +446,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
439 | */ | 446 | */ |
440 | private void addLeavesAttributes() { | 447 | private void addLeavesAttributes() { |
441 | 448 | ||
442 | - List<YangLeaf<?>> leaves = getListOfLeaf(); | 449 | + List<YangLeaf> leaves = getListOfLeaf(); |
443 | if (leaves != null) { | 450 | if (leaves != null) { |
444 | - for (YangLeaf<?> leaf : leaves) { | 451 | + for (YangLeaf leaf : leaves) { |
445 | getFileHandle().addAttributeInfo(leaf.getDataType(), leaf.getLeafName(), false); | 452 | getFileHandle().addAttributeInfo(leaf.getDataType(), leaf.getLeafName(), false); |
446 | } | 453 | } |
447 | } | 454 | } |
... | @@ -451,9 +458,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom | ... | @@ -451,9 +458,9 @@ public class YangContainer extends YangNode implements YangLeavesHolder, YangCom |
451 | * Adds leaf list's attributes in generated files. | 458 | * Adds leaf list's attributes in generated files. |
452 | */ | 459 | */ |
453 | private void addLeafListAttributes() { | 460 | private void addLeafListAttributes() { |
454 | - List<YangLeafList<?>> leavesList = getListOfLeafList(); | 461 | + List<YangLeafList> leavesList = getListOfLeafList(); |
455 | if (leavesList != null) { | 462 | if (leavesList != null) { |
456 | - for (YangLeafList<?> leafList : leavesList) { | 463 | + for (YangLeafList leafList : leavesList) { |
457 | getFileHandle().addAttributeInfo(leafList.getDataType(), leafList.getLeafName(), true); | 464 | getFileHandle().addAttributeInfo(leafList.getDataType(), leafList.getLeafName(), true); |
458 | } | 465 | } |
459 | } | 466 | } | ... | ... |
... | @@ -105,6 +105,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -105,6 +105,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
105 | * | 105 | * |
106 | * @return the description. | 106 | * @return the description. |
107 | */ | 107 | */ |
108 | + @Override | ||
108 | public String getDescription() { | 109 | public String getDescription() { |
109 | return description; | 110 | return description; |
110 | } | 111 | } |
... | @@ -114,6 +115,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -114,6 +115,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
114 | * | 115 | * |
115 | * @param description set the description. | 116 | * @param description set the description. |
116 | */ | 117 | */ |
118 | + @Override | ||
117 | public void setDescription(String description) { | 119 | public void setDescription(String description) { |
118 | this.description = description; | 120 | this.description = description; |
119 | } | 121 | } |
... | @@ -123,6 +125,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -123,6 +125,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
123 | * | 125 | * |
124 | * @return the reference. | 126 | * @return the reference. |
125 | */ | 127 | */ |
128 | + @Override | ||
126 | public String getReference() { | 129 | public String getReference() { |
127 | return reference; | 130 | return reference; |
128 | } | 131 | } |
... | @@ -132,6 +135,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -132,6 +135,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
132 | * | 135 | * |
133 | * @param reference the reference to set. | 136 | * @param reference the reference to set. |
134 | */ | 137 | */ |
138 | + @Override | ||
135 | public void setReference(String reference) { | 139 | public void setReference(String reference) { |
136 | this.reference = reference; | 140 | this.reference = reference; |
137 | } | 141 | } |
... | @@ -141,6 +145,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -141,6 +145,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
141 | * | 145 | * |
142 | * @return the status. | 146 | * @return the status. |
143 | */ | 147 | */ |
148 | + @Override | ||
144 | public YangStatusType getStatus() { | 149 | public YangStatusType getStatus() { |
145 | return status; | 150 | return status; |
146 | } | 151 | } |
... | @@ -150,6 +155,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -150,6 +155,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
150 | * | 155 | * |
151 | * @param status the status to set. | 156 | * @param status the status to set. |
152 | */ | 157 | */ |
158 | + @Override | ||
153 | public void setStatus(YangStatusType status) { | 159 | public void setStatus(YangStatusType status) { |
154 | this.status = status; | 160 | this.status = status; |
155 | } | 161 | } |
... | @@ -177,6 +183,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -177,6 +183,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
177 | * | 183 | * |
178 | * @return ParsedDataType returns ENUM_DATA | 184 | * @return ParsedDataType returns ENUM_DATA |
179 | */ | 185 | */ |
186 | + @Override | ||
180 | public ParsableDataType getParsableDataType() { | 187 | public ParsableDataType getParsableDataType() { |
181 | return ParsableDataType.ENUM_DATA; | 188 | return ParsableDataType.ENUM_DATA; |
182 | } | 189 | } |
... | @@ -186,6 +193,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -186,6 +193,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
186 | * | 193 | * |
187 | * @throws DataModelException a violation of data model rules. | 194 | * @throws DataModelException a violation of data model rules. |
188 | */ | 195 | */ |
196 | + @Override | ||
189 | public void validateDataOnEntry() throws DataModelException { | 197 | public void validateDataOnEntry() throws DataModelException { |
190 | // TODO auto-generated method stub, to be implemented by parser | 198 | // TODO auto-generated method stub, to be implemented by parser |
191 | } | 199 | } |
... | @@ -195,6 +203,7 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -195,6 +203,7 @@ public class YangEnum implements YangCommonInfo, Parsable { |
195 | * | 203 | * |
196 | * @throws DataModelException a violation of data model rules. | 204 | * @throws DataModelException a violation of data model rules. |
197 | */ | 205 | */ |
206 | + @Override | ||
198 | public void validateDataOnExit() throws DataModelException { | 207 | public void validateDataOnExit() throws DataModelException { |
199 | // TODO auto-generated method stub, to be implemented by parser | 208 | // TODO auto-generated method stub, to be implemented by parser |
200 | } | 209 | } | ... | ... |
... | @@ -76,7 +76,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; | ... | @@ -76,7 +76,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; |
76 | /** | 76 | /** |
77 | * Data model node to maintain information defined in YANG grouping. | 77 | * Data model node to maintain information defined in YANG grouping. |
78 | */ | 78 | */ |
79 | -public class YangGrouping extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable { | 79 | +public class YangGrouping extends YangNode |
80 | + implements YangLeavesHolder, YangCommonInfo, Parsable { | ||
80 | 81 | ||
81 | /** | 82 | /** |
82 | * Name of the grouping. | 83 | * Name of the grouping. |
... | @@ -91,12 +92,12 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -91,12 +92,12 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
91 | /** | 92 | /** |
92 | * List of leaves. | 93 | * List of leaves. |
93 | */ | 94 | */ |
94 | - private List<YangLeaf<?>> listOfLeaf; | 95 | + private List<YangLeaf> listOfLeaf; |
95 | 96 | ||
96 | /** | 97 | /** |
97 | * List of leaf lists. | 98 | * List of leaf lists. |
98 | */ | 99 | */ |
99 | - private List<YangLeafList<?>> listOfLeafList; | 100 | + private List<YangLeafList> listOfLeafList; |
100 | 101 | ||
101 | /** | 102 | /** |
102 | * Reference of the module. | 103 | * Reference of the module. |
... | @@ -109,22 +110,31 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -109,22 +110,31 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
109 | private YangStatusType status; | 110 | private YangStatusType status; |
110 | 111 | ||
111 | /** | 112 | /** |
113 | + * package of the generated java code. | ||
114 | + */ | ||
115 | + private String pkg; | ||
116 | + | ||
117 | + /** | ||
112 | * Creates the grouping node. | 118 | * Creates the grouping node. |
113 | */ | 119 | */ |
114 | public YangGrouping() { | 120 | public YangGrouping() { |
115 | super(YangNodeType.GROUPING_NODE); | 121 | super(YangNodeType.GROUPING_NODE); |
116 | } | 122 | } |
117 | 123 | ||
118 | - /* (non-Javadoc) | 124 | + /** |
119 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | 125 | + * Get YANG grouping name. |
126 | + * | ||
127 | + * @return YANG grouping name. | ||
120 | */ | 128 | */ |
121 | @Override | 129 | @Override |
122 | public String getName() { | 130 | public String getName() { |
123 | return name; | 131 | return name; |
124 | } | 132 | } |
125 | 133 | ||
126 | - /* (non-Javadoc) | 134 | + /** |
127 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | 135 | + * Set YANG grouping name. |
136 | + * | ||
137 | + * @param name YANG grouping name. | ||
128 | */ | 138 | */ |
129 | @Override | 139 | @Override |
130 | public void setName(String name) { | 140 | public void setName(String name) { |
... | @@ -157,7 +167,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -157,7 +167,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
157 | * @return the list of leaves. | 167 | * @return the list of leaves. |
158 | */ | 168 | */ |
159 | @Override | 169 | @Override |
160 | - public List<YangLeaf<?>> getListOfLeaf() { | 170 | + public List<YangLeaf> getListOfLeaf() { |
161 | return listOfLeaf; | 171 | return listOfLeaf; |
162 | } | 172 | } |
163 | 173 | ||
... | @@ -166,7 +176,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -166,7 +176,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
166 | * | 176 | * |
167 | * @param leafsList the list of leaf to set. | 177 | * @param leafsList the list of leaf to set. |
168 | */ | 178 | */ |
169 | - private void setListOfLeaf(List<YangLeaf<?>> leafsList) { | 179 | + private void setListOfLeaf(List<YangLeaf> leafsList) { |
170 | listOfLeaf = leafsList; | 180 | listOfLeaf = leafsList; |
171 | } | 181 | } |
172 | 182 | ||
... | @@ -176,9 +186,9 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -176,9 +186,9 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
176 | * @param leaf the leaf to be added. | 186 | * @param leaf the leaf to be added. |
177 | */ | 187 | */ |
178 | @Override | 188 | @Override |
179 | - public void addLeaf(YangLeaf<?> leaf) { | 189 | + public void addLeaf(YangLeaf leaf) { |
180 | if (getListOfLeaf() == null) { | 190 | if (getListOfLeaf() == null) { |
181 | - setListOfLeaf(new LinkedList<YangLeaf<?>>()); | 191 | + setListOfLeaf(new LinkedList<YangLeaf>()); |
182 | } | 192 | } |
183 | 193 | ||
184 | getListOfLeaf().add(leaf); | 194 | getListOfLeaf().add(leaf); |
... | @@ -190,7 +200,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -190,7 +200,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
190 | * @return the list of leaf-list. | 200 | * @return the list of leaf-list. |
191 | */ | 201 | */ |
192 | @Override | 202 | @Override |
193 | - public List<YangLeafList<?>> getListOfLeafList() { | 203 | + public List<YangLeafList> getListOfLeafList() { |
194 | return listOfLeafList; | 204 | return listOfLeafList; |
195 | } | 205 | } |
196 | 206 | ||
... | @@ -199,7 +209,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -199,7 +209,7 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
199 | * | 209 | * |
200 | * @param listOfLeafList the list of leaf-list to set. | 210 | * @param listOfLeafList the list of leaf-list to set. |
201 | */ | 211 | */ |
202 | - private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) { | 212 | + private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
203 | this.listOfLeafList = listOfLeafList; | 213 | this.listOfLeafList = listOfLeafList; |
204 | } | 214 | } |
205 | 215 | ||
... | @@ -209,9 +219,9 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -209,9 +219,9 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
209 | * @param leafList the leaf-list to be added. | 219 | * @param leafList the leaf-list to be added. |
210 | */ | 220 | */ |
211 | @Override | 221 | @Override |
212 | - public void addLeafList(YangLeafList<?> leafList) { | 222 | + public void addLeafList(YangLeafList leafList) { |
213 | if (getListOfLeafList() == null) { | 223 | if (getListOfLeafList() == null) { |
214 | - setListOfLeafList(new LinkedList<YangLeafList<?>>()); | 224 | + setListOfLeafList(new LinkedList<YangLeafList>()); |
215 | } | 225 | } |
216 | 226 | ||
217 | getListOfLeafList().add(leafList); | 227 | getListOfLeafList().add(leafList); |
... | @@ -287,8 +297,8 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -287,8 +297,8 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
287 | // TODO auto-generated method stub, to be implemented by parser | 297 | // TODO auto-generated method stub, to be implemented by parser |
288 | } | 298 | } |
289 | 299 | ||
290 | - /* (non-Javadoc) | 300 | + /** |
291 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry() | 301 | + * Generate the code for YANG grouping. |
292 | */ | 302 | */ |
293 | @Override | 303 | @Override |
294 | public void generateJavaCodeEntry() { | 304 | public void generateJavaCodeEntry() { |
... | @@ -296,8 +306,9 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -296,8 +306,9 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
296 | 306 | ||
297 | } | 307 | } |
298 | 308 | ||
299 | - /* (non-Javadoc) | 309 | + /** |
300 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit() | 310 | + * Free the resources used to generate java files corresponding to YANG |
311 | + * grouping info and generate valid java files. | ||
301 | */ | 312 | */ |
302 | @Override | 313 | @Override |
303 | public void generateJavaCodeExit() { | 314 | public void generateJavaCodeExit() { |
... | @@ -305,21 +316,24 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm | ... | @@ -305,21 +316,24 @@ public class YangGrouping extends YangNode implements YangLeavesHolder, YangComm |
305 | 316 | ||
306 | } | 317 | } |
307 | 318 | ||
308 | - /* (non-Javadoc) | 319 | + /** |
309 | - * @see org.onosproject.yangutils.datamodel.YangNode#getPackage() | 320 | + * Get the mapped java package. |
321 | + * | ||
322 | + * @return the java package | ||
310 | */ | 323 | */ |
311 | @Override | 324 | @Override |
312 | public String getPackage() { | 325 | public String getPackage() { |
313 | - // TODO Auto-generated method stub | 326 | + return pkg; |
314 | - return null; | ||
315 | } | 327 | } |
316 | 328 | ||
317 | - /* (non-Javadoc) | 329 | + /** |
318 | - * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String) | 330 | + * Set the mapped java package. |
331 | + * | ||
332 | + * @param pakg the package to set | ||
319 | */ | 333 | */ |
320 | @Override | 334 | @Override |
321 | - public void setPackage(String pkg) { | 335 | + public void setPackage(String pakg) { |
322 | - // TODO Auto-generated method stub | 336 | + pkg = pakg; |
323 | 337 | ||
324 | } | 338 | } |
325 | 339 | ... | ... |
... | @@ -76,6 +76,7 @@ public class YangImport implements Parsable { | ... | @@ -76,6 +76,7 @@ public class YangImport implements Parsable { |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Reference:RFC 6020. | 78 | * Reference:RFC 6020. |
79 | + * | ||
79 | * The import's "revision-date" statement is used to specify the exact | 80 | * The import's "revision-date" statement is used to specify the exact |
80 | * version of the module to import. The "revision-date" statement MUST match | 81 | * version of the module to import. The "revision-date" statement MUST match |
81 | * the most recent "revision" statement in the imported module. organization | 82 | * the most recent "revision" statement in the imported module. organization |
... | @@ -150,6 +151,7 @@ public class YangImport implements Parsable { | ... | @@ -150,6 +151,7 @@ public class YangImport implements Parsable { |
150 | * | 151 | * |
151 | * @return returns IMPORT_DATA | 152 | * @return returns IMPORT_DATA |
152 | */ | 153 | */ |
154 | + @Override | ||
153 | public ParsableDataType getParsableDataType() { | 155 | public ParsableDataType getParsableDataType() { |
154 | return ParsableDataType.IMPORT_DATA; | 156 | return ParsableDataType.IMPORT_DATA; |
155 | } | 157 | } |
... | @@ -159,6 +161,7 @@ public class YangImport implements Parsable { | ... | @@ -159,6 +161,7 @@ public class YangImport implements Parsable { |
159 | * | 161 | * |
160 | * @throws DataModelException a violation of data model rules | 162 | * @throws DataModelException a violation of data model rules |
161 | */ | 163 | */ |
164 | + @Override | ||
162 | public void validateDataOnEntry() throws DataModelException { | 165 | public void validateDataOnEntry() throws DataModelException { |
163 | // TODO auto-generated method stub, to be implemented by parser | 166 | // TODO auto-generated method stub, to be implemented by parser |
164 | 167 | ||
... | @@ -169,6 +172,7 @@ public class YangImport implements Parsable { | ... | @@ -169,6 +172,7 @@ public class YangImport implements Parsable { |
169 | * | 172 | * |
170 | * @throws DataModelException a violation of data model rules | 173 | * @throws DataModelException a violation of data model rules |
171 | */ | 174 | */ |
175 | + @Override | ||
172 | public void validateDataOnExit() throws DataModelException { | 176 | public void validateDataOnExit() throws DataModelException { |
173 | // TODO auto-generated method stub, to be implemented by parser | 177 | // TODO auto-generated method stub, to be implemented by parser |
174 | 178 | ... | ... |
... | @@ -97,6 +97,7 @@ public class YangInclude implements Parsable { | ... | @@ -97,6 +97,7 @@ public class YangInclude implements Parsable { |
97 | * | 97 | * |
98 | * @return returns INCLUDE_DATA | 98 | * @return returns INCLUDE_DATA |
99 | */ | 99 | */ |
100 | + @Override | ||
100 | public ParsableDataType getParsableDataType() { | 101 | public ParsableDataType getParsableDataType() { |
101 | return ParsableDataType.INCLUDE_DATA; | 102 | return ParsableDataType.INCLUDE_DATA; |
102 | } | 103 | } |
... | @@ -106,6 +107,7 @@ public class YangInclude implements Parsable { | ... | @@ -106,6 +107,7 @@ public class YangInclude implements Parsable { |
106 | * | 107 | * |
107 | * @throws DataModelException a violation of data model rules | 108 | * @throws DataModelException a violation of data model rules |
108 | */ | 109 | */ |
110 | + @Override | ||
109 | public void validateDataOnEntry() throws DataModelException { | 111 | public void validateDataOnEntry() throws DataModelException { |
110 | // TODO auto-generated method stub, to be implemented by parser | 112 | // TODO auto-generated method stub, to be implemented by parser |
111 | 113 | ||
... | @@ -116,6 +118,7 @@ public class YangInclude implements Parsable { | ... | @@ -116,6 +118,7 @@ public class YangInclude implements Parsable { |
116 | * | 118 | * |
117 | * @throws DataModelException a violation of data model rules | 119 | * @throws DataModelException a violation of data model rules |
118 | */ | 120 | */ |
121 | + @Override | ||
119 | public void validateDataOnExit() throws DataModelException { | 122 | public void validateDataOnExit() throws DataModelException { |
120 | // TODO auto-generated method stub, to be implemented by parser | 123 | // TODO auto-generated method stub, to be implemented by parser |
121 | 124 | ... | ... |
... | @@ -56,9 +56,8 @@ import org.onosproject.yangutils.parser.ParsableDataType; | ... | @@ -56,9 +56,8 @@ import org.onosproject.yangutils.parser.ParsableDataType; |
56 | /** | 56 | /** |
57 | * Leaf data represented in YANG. | 57 | * Leaf data represented in YANG. |
58 | * | 58 | * |
59 | - * @param <T> YANG data type | ||
60 | */ | 59 | */ |
61 | -public class YangLeaf<T> implements YangCommonInfo, Parsable { | 60 | +public class YangLeaf implements YangCommonInfo, Parsable { |
62 | 61 | ||
63 | /** | 62 | /** |
64 | * Name of leaf. | 63 | * Name of leaf. |
... | @@ -88,7 +87,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -88,7 +87,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
88 | /** | 87 | /** |
89 | * Status of leaf in YANG definition. | 88 | * Status of leaf in YANG definition. |
90 | */ | 89 | */ |
91 | - private YangStatusType status; | 90 | + private YangStatusType status = YangStatusType.CURRENT; |
92 | 91 | ||
93 | /** | 92 | /** |
94 | * Textual units info. | 93 | * Textual units info. |
... | @@ -98,7 +97,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -98,7 +97,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
98 | /** | 97 | /** |
99 | * Data type of the leaf. | 98 | * Data type of the leaf. |
100 | */ | 99 | */ |
101 | - private YangType<T> dataType; | 100 | + private YangType<?> dataType; |
102 | 101 | ||
103 | /** | 102 | /** |
104 | * Default constructor to create a YANG leaf. | 103 | * Default constructor to create a YANG leaf. |
... | @@ -121,7 +120,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -121,7 +120,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
121 | * @param leafName the leaf name to set. | 120 | * @param leafName the leaf name to set. |
122 | */ | 121 | */ |
123 | public void setLeafName(String leafName) { | 122 | public void setLeafName(String leafName) { |
124 | - this.name = leafName; | 123 | + name = leafName; |
125 | } | 124 | } |
126 | 125 | ||
127 | /** | 126 | /** |
... | @@ -147,6 +146,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -147,6 +146,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
147 | * | 146 | * |
148 | * @return the description. | 147 | * @return the description. |
149 | */ | 148 | */ |
149 | + @Override | ||
150 | public String getDescription() { | 150 | public String getDescription() { |
151 | return description; | 151 | return description; |
152 | } | 152 | } |
... | @@ -156,6 +156,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -156,6 +156,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
156 | * | 156 | * |
157 | * @param description set the description. | 157 | * @param description set the description. |
158 | */ | 158 | */ |
159 | + @Override | ||
159 | public void setDescription(String description) { | 160 | public void setDescription(String description) { |
160 | this.description = description; | 161 | this.description = description; |
161 | } | 162 | } |
... | @@ -183,6 +184,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -183,6 +184,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
183 | * | 184 | * |
184 | * @return the reference. | 185 | * @return the reference. |
185 | */ | 186 | */ |
187 | + @Override | ||
186 | public String getReference() { | 188 | public String getReference() { |
187 | return reference; | 189 | return reference; |
188 | } | 190 | } |
... | @@ -192,6 +194,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -192,6 +194,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
192 | * | 194 | * |
193 | * @param reference the reference to set. | 195 | * @param reference the reference to set. |
194 | */ | 196 | */ |
197 | + @Override | ||
195 | public void setReference(String reference) { | 198 | public void setReference(String reference) { |
196 | this.reference = reference; | 199 | this.reference = reference; |
197 | } | 200 | } |
... | @@ -201,6 +204,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -201,6 +204,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
201 | * | 204 | * |
202 | * @return the status. | 205 | * @return the status. |
203 | */ | 206 | */ |
207 | + @Override | ||
204 | public YangStatusType getStatus() { | 208 | public YangStatusType getStatus() { |
205 | return status; | 209 | return status; |
206 | } | 210 | } |
... | @@ -210,6 +214,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -210,6 +214,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
210 | * | 214 | * |
211 | * @param status the status to set. | 215 | * @param status the status to set. |
212 | */ | 216 | */ |
217 | + @Override | ||
213 | public void setStatus(YangStatusType status) { | 218 | public void setStatus(YangStatusType status) { |
214 | this.status = status; | 219 | this.status = status; |
215 | } | 220 | } |
... | @@ -237,7 +242,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -237,7 +242,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
237 | * | 242 | * |
238 | * @return the data type. | 243 | * @return the data type. |
239 | */ | 244 | */ |
240 | - public YangType<T> getDataType() { | 245 | + public YangType<?> getDataType() { |
241 | return dataType; | 246 | return dataType; |
242 | } | 247 | } |
243 | 248 | ||
... | @@ -246,7 +251,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -246,7 +251,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
246 | * | 251 | * |
247 | * @param dataType the data type to set. | 252 | * @param dataType the data type to set. |
248 | */ | 253 | */ |
249 | - public void setDataType(YangType<T> dataType) { | 254 | + public void setDataType(YangType<?> dataType) { |
250 | this.dataType = dataType; | 255 | this.dataType = dataType; |
251 | } | 256 | } |
252 | 257 | ||
... | @@ -255,6 +260,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -255,6 +260,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
255 | * | 260 | * |
256 | * @return returns LEAF_DATA. | 261 | * @return returns LEAF_DATA. |
257 | */ | 262 | */ |
263 | + @Override | ||
258 | public ParsableDataType getParsableDataType() { | 264 | public ParsableDataType getParsableDataType() { |
259 | return ParsableDataType.LEAF_DATA; | 265 | return ParsableDataType.LEAF_DATA; |
260 | } | 266 | } |
... | @@ -264,6 +270,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -264,6 +270,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
264 | * | 270 | * |
265 | * @throws DataModelException a violation of data model rules. | 271 | * @throws DataModelException a violation of data model rules. |
266 | */ | 272 | */ |
273 | + @Override | ||
267 | public void validateDataOnEntry() throws DataModelException { | 274 | public void validateDataOnEntry() throws DataModelException { |
268 | // TODO auto-generated method stub, to be implemented by parser | 275 | // TODO auto-generated method stub, to be implemented by parser |
269 | 276 | ||
... | @@ -274,6 +281,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { | ... | @@ -274,6 +281,7 @@ public class YangLeaf<T> implements YangCommonInfo, Parsable { |
274 | * | 281 | * |
275 | * @throws DataModelException a violation of data model rules. | 282 | * @throws DataModelException a violation of data model rules. |
276 | */ | 283 | */ |
284 | + @Override | ||
277 | public void validateDataOnExit() throws DataModelException { | 285 | public void validateDataOnExit() throws DataModelException { |
278 | // TODO auto-generated method stub, to be implemented by parser | 286 | // TODO auto-generated method stub, to be implemented by parser |
279 | 287 | ... | ... |
... | @@ -51,10 +51,8 @@ import org.onosproject.yangutils.parser.ParsableDataType; | ... | @@ -51,10 +51,8 @@ import org.onosproject.yangutils.parser.ParsableDataType; |
51 | */ | 51 | */ |
52 | /** | 52 | /** |
53 | * Leaf-list data represented in YANG. | 53 | * Leaf-list data represented in YANG. |
54 | - * | ||
55 | - * @param <T> YANG data type | ||
56 | */ | 54 | */ |
57 | -public class YangLeafList<T> implements YangCommonInfo, Parsable { | 55 | +public class YangLeafList implements YangCommonInfo, Parsable { |
58 | 56 | ||
59 | /** | 57 | /** |
60 | * Name of leaf-list. | 58 | * Name of leaf-list. |
... | @@ -73,6 +71,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -73,6 +71,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
73 | 71 | ||
74 | /** | 72 | /** |
75 | * Reference:RFC 6020. | 73 | * Reference:RFC 6020. |
74 | + * | ||
76 | * The "max-elements" statement, which is optional, takes as an argument a | 75 | * The "max-elements" statement, which is optional, takes as an argument a |
77 | * positive integer or the string "unbounded", which puts a constraint on | 76 | * positive integer or the string "unbounded", which puts a constraint on |
78 | * valid list entries. A valid leaf-list or list always has at most | 77 | * valid list entries. A valid leaf-list or list always has at most |
... | @@ -80,10 +79,11 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -80,10 +79,11 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
80 | * | 79 | * |
81 | * If no "max-elements" statement is present, it defaults to "unbounded". | 80 | * If no "max-elements" statement is present, it defaults to "unbounded". |
82 | */ | 81 | */ |
83 | - private int maxElelements; | 82 | + private int maxElelements = Integer.MAX_VALUE; |
84 | 83 | ||
85 | /** | 84 | /** |
86 | * Reference:RFC 6020. | 85 | * Reference:RFC 6020. |
86 | + * | ||
87 | * The "min-elements" statement, which is optional, takes as an argument a | 87 | * The "min-elements" statement, which is optional, takes as an argument a |
88 | * non-negative integer that puts a constraint on valid list entries. A | 88 | * non-negative integer that puts a constraint on valid list entries. A |
89 | * valid leaf-list or list MUST have at least min-elements entries. | 89 | * valid leaf-list or list MUST have at least min-elements entries. |
... | @@ -99,7 +99,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -99,7 +99,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
99 | * | 99 | * |
100 | * o Otherwise, it is enforced if the ancestor node exists. | 100 | * o Otherwise, it is enforced if the ancestor node exists. |
101 | */ | 101 | */ |
102 | - private int minElements; | 102 | + private int minElements = 0; |
103 | 103 | ||
104 | /** | 104 | /** |
105 | * The textual reference to this leaf-list. | 105 | * The textual reference to this leaf-list. |
... | @@ -109,7 +109,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -109,7 +109,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
109 | /** | 109 | /** |
110 | * Status of the leaf-list in the YANG definition. | 110 | * Status of the leaf-list in the YANG definition. |
111 | */ | 111 | */ |
112 | - private YangStatusType status; | 112 | + private YangStatusType status = YangStatusType.CURRENT; |
113 | 113 | ||
114 | /** | 114 | /** |
115 | * Textual units. | 115 | * Textual units. |
... | @@ -119,7 +119,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -119,7 +119,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
119 | /** | 119 | /** |
120 | * Data type of leaf-list. | 120 | * Data type of leaf-list. |
121 | */ | 121 | */ |
122 | - private YangType<T> dataType; | 122 | + private YangType<?> dataType; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Default Constructor to create a YANG leaf-list. | 125 | * Default Constructor to create a YANG leaf-list. |
... | @@ -142,7 +142,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -142,7 +142,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
142 | * @param leafListName the leaf-list name to set. | 142 | * @param leafListName the leaf-list name to set. |
143 | */ | 143 | */ |
144 | public void setLeafName(String leafListName) { | 144 | public void setLeafName(String leafListName) { |
145 | - this.name = leafListName; | 145 | + name = leafListName; |
146 | } | 146 | } |
147 | 147 | ||
148 | /** | 148 | /** |
... | @@ -168,6 +168,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -168,6 +168,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
168 | * | 168 | * |
169 | * @return the description. | 169 | * @return the description. |
170 | */ | 170 | */ |
171 | + @Override | ||
171 | public String getDescription() { | 172 | public String getDescription() { |
172 | return description; | 173 | return description; |
173 | } | 174 | } |
... | @@ -177,6 +178,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -177,6 +178,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
177 | * | 178 | * |
178 | * @param description set the description. | 179 | * @param description set the description. |
179 | */ | 180 | */ |
181 | + @Override | ||
180 | public void setDescription(String description) { | 182 | public void setDescription(String description) { |
181 | this.description = description; | 183 | this.description = description; |
182 | } | 184 | } |
... | @@ -222,6 +224,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -222,6 +224,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
222 | * | 224 | * |
223 | * @return the reference. | 225 | * @return the reference. |
224 | */ | 226 | */ |
227 | + @Override | ||
225 | public String getReference() { | 228 | public String getReference() { |
226 | return reference; | 229 | return reference; |
227 | } | 230 | } |
... | @@ -231,6 +234,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -231,6 +234,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
231 | * | 234 | * |
232 | * @param reference the reference to set. | 235 | * @param reference the reference to set. |
233 | */ | 236 | */ |
237 | + @Override | ||
234 | public void setReference(String reference) { | 238 | public void setReference(String reference) { |
235 | this.reference = reference; | 239 | this.reference = reference; |
236 | } | 240 | } |
... | @@ -240,6 +244,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -240,6 +244,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
240 | * | 244 | * |
241 | * @return the status. | 245 | * @return the status. |
242 | */ | 246 | */ |
247 | + @Override | ||
243 | public YangStatusType getStatus() { | 248 | public YangStatusType getStatus() { |
244 | return status; | 249 | return status; |
245 | } | 250 | } |
... | @@ -249,6 +254,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -249,6 +254,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
249 | * | 254 | * |
250 | * @param status the status to set. | 255 | * @param status the status to set. |
251 | */ | 256 | */ |
257 | + @Override | ||
252 | public void setStatus(YangStatusType status) { | 258 | public void setStatus(YangStatusType status) { |
253 | this.status = status; | 259 | this.status = status; |
254 | } | 260 | } |
... | @@ -276,7 +282,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -276,7 +282,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
276 | * | 282 | * |
277 | * @return the data type. | 283 | * @return the data type. |
278 | */ | 284 | */ |
279 | - public YangType<T> getDataType() { | 285 | + public YangType<?> getDataType() { |
280 | return dataType; | 286 | return dataType; |
281 | } | 287 | } |
282 | 288 | ||
... | @@ -285,7 +291,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -285,7 +291,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
285 | * | 291 | * |
286 | * @param dataType the data type to set. | 292 | * @param dataType the data type to set. |
287 | */ | 293 | */ |
288 | - public void setDataType(YangType<T> dataType) { | 294 | + public void setDataType(YangType<?> dataType) { |
289 | this.dataType = dataType; | 295 | this.dataType = dataType; |
290 | } | 296 | } |
291 | 297 | ||
... | @@ -294,6 +300,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -294,6 +300,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
294 | * | 300 | * |
295 | * @return returns LEAF_LIST_DATA. | 301 | * @return returns LEAF_LIST_DATA. |
296 | */ | 302 | */ |
303 | + @Override | ||
297 | public ParsableDataType getParsableDataType() { | 304 | public ParsableDataType getParsableDataType() { |
298 | return ParsableDataType.LEAF_LIST_DATA; | 305 | return ParsableDataType.LEAF_LIST_DATA; |
299 | } | 306 | } |
... | @@ -303,6 +310,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -303,6 +310,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
303 | * | 310 | * |
304 | * @throws DataModelException a violation of data model rules. | 311 | * @throws DataModelException a violation of data model rules. |
305 | */ | 312 | */ |
313 | + @Override | ||
306 | public void validateDataOnEntry() throws DataModelException { | 314 | public void validateDataOnEntry() throws DataModelException { |
307 | // TODO auto-generated method stub, to be implemented by parser | 315 | // TODO auto-generated method stub, to be implemented by parser |
308 | 316 | ||
... | @@ -313,6 +321,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { | ... | @@ -313,6 +321,7 @@ public class YangLeafList<T> implements YangCommonInfo, Parsable { |
313 | * | 321 | * |
314 | * @throws DataModelException a violation of data model rules. | 322 | * @throws DataModelException a violation of data model rules. |
315 | */ | 323 | */ |
324 | + @Override | ||
316 | public void validateDataOnExit() throws DataModelException { | 325 | public void validateDataOnExit() throws DataModelException { |
317 | // TODO auto-generated method stub, to be implemented by parser | 326 | // TODO auto-generated method stub, to be implemented by parser |
318 | 327 | ... | ... |
... | @@ -27,26 +27,26 @@ public interface YangLeavesHolder { | ... | @@ -27,26 +27,26 @@ public interface YangLeavesHolder { |
27 | * | 27 | * |
28 | * @return the list of leaves. | 28 | * @return the list of leaves. |
29 | */ | 29 | */ |
30 | - public List<YangLeaf<?>> getListOfLeaf(); | 30 | + public List<YangLeaf> getListOfLeaf(); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Add a leaf in data holder like container / list. | 33 | * Add a leaf in data holder like container / list. |
34 | * | 34 | * |
35 | * @param leaf the leaf to be added. | 35 | * @param leaf the leaf to be added. |
36 | */ | 36 | */ |
37 | - void addLeaf(YangLeaf<?> leaf); | 37 | + void addLeaf(YangLeaf leaf); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Get the list of leaf-list from data holder like container / list. | 40 | * Get the list of leaf-list from data holder like container / list. |
41 | * | 41 | * |
42 | * @return the list of leaf-list. | 42 | * @return the list of leaf-list. |
43 | */ | 43 | */ |
44 | - List<YangLeafList<?>> getListOfLeafList(); | 44 | + List<YangLeafList> getListOfLeafList(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Add a leaf-list in data holder like container / list. | 47 | * Add a leaf-list in data holder like container / list. |
48 | * | 48 | * |
49 | * @param leafList the leaf-list to be added. | 49 | * @param leafList the leaf-list to be added. |
50 | */ | 50 | */ |
51 | - void addLeafList(YangLeafList<?> leafList); | 51 | + void addLeafList(YangLeafList leafList); |
52 | } | 52 | } | ... | ... |
... | @@ -66,7 +66,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; | ... | @@ -66,7 +66,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; |
66 | /** | 66 | /** |
67 | * List data represented in YANG. | 67 | * List data represented in YANG. |
68 | */ | 68 | */ |
69 | -public class YangList extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable { | 69 | +public class YangList extends YangNode |
70 | + implements YangLeavesHolder, YangCommonInfo, Parsable { | ||
70 | 71 | ||
71 | /** | 72 | /** |
72 | * name of the YANG list. | 73 | * name of the YANG list. |
... | @@ -113,12 +114,12 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -113,12 +114,12 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
113 | /** | 114 | /** |
114 | * List of leaves. | 115 | * List of leaves. |
115 | */ | 116 | */ |
116 | - private List<YangLeaf<?>> listOfLeaf; | 117 | + private List<YangLeaf> listOfLeaf; |
117 | 118 | ||
118 | /** | 119 | /** |
119 | * List of leaf-lists. | 120 | * List of leaf-lists. |
120 | */ | 121 | */ |
121 | - private List<YangLeafList<?>> listOfLeafList; | 122 | + private List<YangLeafList> listOfLeafList; |
122 | 123 | ||
123 | /** | 124 | /** |
124 | * The "max-elements" statement, which is optional, takes as an argument a | 125 | * The "max-elements" statement, which is optional, takes as an argument a |
... | @@ -128,7 +129,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -128,7 +129,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
128 | * | 129 | * |
129 | * If no "max-elements" statement is present, it defaults to "unbounded". | 130 | * If no "max-elements" statement is present, it defaults to "unbounded". |
130 | */ | 131 | */ |
131 | - private int maxElelements; | 132 | + private int maxElelements = Integer.MAX_VALUE; |
132 | 133 | ||
133 | /** | 134 | /** |
134 | * The "min-elements" statement, which is optional, takes as an argument a | 135 | * The "min-elements" statement, which is optional, takes as an argument a |
... | @@ -146,7 +147,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -146,7 +147,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
146 | * | 147 | * |
147 | * o Otherwise, it is enforced if the ancestor node exists. | 148 | * o Otherwise, it is enforced if the ancestor node exists. |
148 | */ | 149 | */ |
149 | - private int minElements; | 150 | + private int minElements = 0; |
150 | 151 | ||
151 | /** | 152 | /** |
152 | * reference. | 153 | * reference. |
... | @@ -157,7 +158,12 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -157,7 +158,12 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
157 | * Status of the node. | 158 | * Status of the node. |
158 | */ | 159 | */ |
159 | 160 | ||
160 | - private YangStatusType status; | 161 | + private YangStatusType status = YangStatusType.CURRENT; |
162 | + | ||
163 | + /** | ||
164 | + * package of the generated java code. | ||
165 | + */ | ||
166 | + private String pkg; | ||
161 | 167 | ||
162 | /** | 168 | /** |
163 | * Constructor. | 169 | * Constructor. |
... | @@ -168,16 +174,20 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -168,16 +174,20 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
168 | super(type); | 174 | super(type); |
169 | } | 175 | } |
170 | 176 | ||
171 | - /* (non-Javadoc) | 177 | + /** |
172 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | 178 | + * Get the YANG list name. |
179 | + * | ||
180 | + * @return YANG list name. | ||
173 | */ | 181 | */ |
174 | @Override | 182 | @Override |
175 | public String getName() { | 183 | public String getName() { |
176 | return name; | 184 | return name; |
177 | } | 185 | } |
178 | 186 | ||
179 | - /* (non-Javadoc) | 187 | + /** |
180 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | 188 | + * Set the YANG list name. |
189 | + * | ||
190 | + * @param name YANG list name. | ||
181 | */ | 191 | */ |
182 | @Override | 192 | @Override |
183 | public void setName(String name) { | 193 | public void setName(String name) { |
... | @@ -249,7 +259,6 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -249,7 +259,6 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
249 | if (getKeyList() == null) { | 259 | if (getKeyList() == null) { |
250 | setKeyList(new LinkedList<String>()); | 260 | setKeyList(new LinkedList<String>()); |
251 | } | 261 | } |
252 | - | ||
253 | getKeyList().add(key); | 262 | getKeyList().add(key); |
254 | } | 263 | } |
255 | 264 | ||
... | @@ -259,7 +268,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -259,7 +268,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
259 | * @return the list of leaves. | 268 | * @return the list of leaves. |
260 | */ | 269 | */ |
261 | @Override | 270 | @Override |
262 | - public List<YangLeaf<?>> getListOfLeaf() { | 271 | + public List<YangLeaf> getListOfLeaf() { |
263 | return listOfLeaf; | 272 | return listOfLeaf; |
264 | } | 273 | } |
265 | 274 | ||
... | @@ -268,7 +277,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -268,7 +277,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
268 | * | 277 | * |
269 | * @param leafsList the list of leaf to set. | 278 | * @param leafsList the list of leaf to set. |
270 | */ | 279 | */ |
271 | - private void setListOfLeaf(List<YangLeaf<?>> leafsList) { | 280 | + private void setListOfLeaf(List<YangLeaf> leafsList) { |
272 | listOfLeaf = leafsList; | 281 | listOfLeaf = leafsList; |
273 | } | 282 | } |
274 | 283 | ||
... | @@ -278,9 +287,9 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -278,9 +287,9 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
278 | * @param leaf the leaf to be added. | 287 | * @param leaf the leaf to be added. |
279 | */ | 288 | */ |
280 | @Override | 289 | @Override |
281 | - public void addLeaf(YangLeaf<?> leaf) { | 290 | + public void addLeaf(YangLeaf leaf) { |
282 | if (getListOfLeaf() == null) { | 291 | if (getListOfLeaf() == null) { |
283 | - setListOfLeaf(new LinkedList<YangLeaf<?>>()); | 292 | + setListOfLeaf(new LinkedList<YangLeaf>()); |
284 | } | 293 | } |
285 | 294 | ||
286 | getListOfLeaf().add(leaf); | 295 | getListOfLeaf().add(leaf); |
... | @@ -292,7 +301,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -292,7 +301,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
292 | * @return the list of leaf-list. | 301 | * @return the list of leaf-list. |
293 | */ | 302 | */ |
294 | @Override | 303 | @Override |
295 | - public List<YangLeafList<?>> getListOfLeafList() { | 304 | + public List<YangLeafList> getListOfLeafList() { |
296 | return listOfLeafList; | 305 | return listOfLeafList; |
297 | } | 306 | } |
298 | 307 | ||
... | @@ -301,7 +310,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -301,7 +310,7 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
301 | * | 310 | * |
302 | * @param listOfLeafList the list of leaf-list to set. | 311 | * @param listOfLeafList the list of leaf-list to set. |
303 | */ | 312 | */ |
304 | - private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) { | 313 | + private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
305 | this.listOfLeafList = listOfLeafList; | 314 | this.listOfLeafList = listOfLeafList; |
306 | } | 315 | } |
307 | 316 | ||
... | @@ -311,9 +320,9 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -311,9 +320,9 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
311 | * @param leafList the leaf-list to be added. | 320 | * @param leafList the leaf-list to be added. |
312 | */ | 321 | */ |
313 | @Override | 322 | @Override |
314 | - public void addLeafList(YangLeafList<?> leafList) { | 323 | + public void addLeafList(YangLeafList leafList) { |
315 | if (getListOfLeafList() == null) { | 324 | if (getListOfLeafList() == null) { |
316 | - setListOfLeafList(new LinkedList<YangLeafList<?>>()); | 325 | + setListOfLeafList(new LinkedList<YangLeafList>()); |
317 | } | 326 | } |
318 | 327 | ||
319 | getListOfLeafList().add(leafList); | 328 | getListOfLeafList().add(leafList); |
... | @@ -434,8 +443,9 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -434,8 +443,9 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
434 | 443 | ||
435 | } | 444 | } |
436 | 445 | ||
437 | - /* (non-Javadoc) | 446 | + /** |
438 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit() | 447 | + * Free the resources used to generate the java file corresponding to YANG |
448 | + * list info. | ||
439 | */ | 449 | */ |
440 | @Override | 450 | @Override |
441 | public void generateJavaCodeExit() { | 451 | public void generateJavaCodeExit() { |
... | @@ -443,21 +453,24 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn | ... | @@ -443,21 +453,24 @@ public class YangList extends YangNode implements YangLeavesHolder, YangCommonIn |
443 | 453 | ||
444 | } | 454 | } |
445 | 455 | ||
446 | - /* (non-Javadoc) | 456 | + /** |
447 | - * @see org.onosproject.yangutils.datamodel.YangNode#getPackage() | 457 | + * Get the mapped java package. |
458 | + * | ||
459 | + * @return the java package | ||
448 | */ | 460 | */ |
449 | @Override | 461 | @Override |
450 | public String getPackage() { | 462 | public String getPackage() { |
451 | - // TODO Auto-generated method stub | 463 | + return pkg; |
452 | - return null; | ||
453 | } | 464 | } |
454 | 465 | ||
455 | - /* (non-Javadoc) | 466 | + /** |
456 | - * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String) | 467 | + * Set the mapped java package. |
468 | + * | ||
469 | + * @param pakg the package to set | ||
457 | */ | 470 | */ |
458 | @Override | 471 | @Override |
459 | - public void setPackage(String pkg) { | 472 | + public void setPackage(String pakg) { |
460 | - // TODO Auto-generated method stub | 473 | + pkg = pakg; |
461 | 474 | ||
462 | } | 475 | } |
463 | 476 | ... | ... |
... | @@ -71,7 +71,8 @@ import org.onosproject.yangutils.utils.io.impl.FileSystemUtil; | ... | @@ -71,7 +71,8 @@ import org.onosproject.yangutils.utils.io.impl.FileSystemUtil; |
71 | /** | 71 | /** |
72 | * Data model node to maintain information defined in YANG module. | 72 | * Data model node to maintain information defined in YANG module. |
73 | */ | 73 | */ |
74 | -public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, YangReference, Parsable, CodeGenerator { | 74 | +public class YangModule extends YangNode |
75 | + implements YangLeavesHolder, YangDesc, YangReference, Parsable, CodeGenerator { | ||
75 | 76 | ||
76 | /** | 77 | /** |
77 | * Name of the module. | 78 | * Name of the module. |
... | @@ -112,12 +113,12 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -112,12 +113,12 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
112 | /** | 113 | /** |
113 | * List of leaves at root level in the module. | 114 | * List of leaves at root level in the module. |
114 | */ | 115 | */ |
115 | - private List<YangLeaf<?>> listOfLeaf; | 116 | + private List<YangLeaf> listOfLeaf; |
116 | 117 | ||
117 | /** | 118 | /** |
118 | * List of leaf-lists at root level in the module. | 119 | * List of leaf-lists at root level in the module. |
119 | */ | 120 | */ |
120 | - private List<YangLeafList<?>> listOfLeafList; | 121 | + private List<YangLeafList> listOfLeafList; |
121 | 122 | ||
122 | /** | 123 | /** |
123 | * Name space of the module. | 124 | * Name space of the module. |
... | @@ -298,7 +299,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -298,7 +299,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
298 | * @return the list of leaves. | 299 | * @return the list of leaves. |
299 | */ | 300 | */ |
300 | @Override | 301 | @Override |
301 | - public List<YangLeaf<?>> getListOfLeaf() { | 302 | + public List<YangLeaf> getListOfLeaf() { |
302 | return listOfLeaf; | 303 | return listOfLeaf; |
303 | } | 304 | } |
304 | 305 | ||
... | @@ -307,7 +308,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -307,7 +308,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
307 | * | 308 | * |
308 | * @param leafsList the list of leaf to set. | 309 | * @param leafsList the list of leaf to set. |
309 | */ | 310 | */ |
310 | - private void setListOfLeaf(List<YangLeaf<?>> leafsList) { | 311 | + private void setListOfLeaf(List<YangLeaf> leafsList) { |
311 | listOfLeaf = leafsList; | 312 | listOfLeaf = leafsList; |
312 | } | 313 | } |
313 | 314 | ||
... | @@ -317,9 +318,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -317,9 +318,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
317 | * @param leaf the leaf to be added. | 318 | * @param leaf the leaf to be added. |
318 | */ | 319 | */ |
319 | @Override | 320 | @Override |
320 | - public void addLeaf(YangLeaf<?> leaf) { | 321 | + public void addLeaf(YangLeaf leaf) { |
321 | if (getListOfLeaf() == null) { | 322 | if (getListOfLeaf() == null) { |
322 | - setListOfLeaf(new LinkedList<YangLeaf<?>>()); | 323 | + setListOfLeaf(new LinkedList<YangLeaf>()); |
323 | } | 324 | } |
324 | 325 | ||
325 | getListOfLeaf().add(leaf); | 326 | getListOfLeaf().add(leaf); |
... | @@ -331,7 +332,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -331,7 +332,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
331 | * @return the list of leaf-list. | 332 | * @return the list of leaf-list. |
332 | */ | 333 | */ |
333 | @Override | 334 | @Override |
334 | - public List<YangLeafList<?>> getListOfLeafList() { | 335 | + public List<YangLeafList> getListOfLeafList() { |
335 | return listOfLeafList; | 336 | return listOfLeafList; |
336 | } | 337 | } |
337 | 338 | ||
... | @@ -340,7 +341,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -340,7 +341,7 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
340 | * | 341 | * |
341 | * @param listOfLeafList the list of leaf-list to set. | 342 | * @param listOfLeafList the list of leaf-list to set. |
342 | */ | 343 | */ |
343 | - private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) { | 344 | + private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
344 | this.listOfLeafList = listOfLeafList; | 345 | this.listOfLeafList = listOfLeafList; |
345 | } | 346 | } |
346 | 347 | ||
... | @@ -350,9 +351,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -350,9 +351,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
350 | * @param leafList the leaf-list to be added. | 351 | * @param leafList the leaf-list to be added. |
351 | */ | 352 | */ |
352 | @Override | 353 | @Override |
353 | - public void addLeafList(YangLeafList<?> leafList) { | 354 | + public void addLeafList(YangLeafList leafList) { |
354 | if (getListOfLeafList() == null) { | 355 | if (getListOfLeafList() == null) { |
355 | - setListOfLeafList(new LinkedList<YangLeafList<?>>()); | 356 | + setListOfLeafList(new LinkedList<YangLeafList>()); |
356 | } | 357 | } |
357 | 358 | ||
358 | getListOfLeafList().add(leafList); | 359 | getListOfLeafList().add(leafList); |
... | @@ -525,7 +526,10 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -525,7 +526,10 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
525 | */ | 526 | */ |
526 | @Override | 527 | @Override |
527 | public void validateDataOnEntry() throws DataModelException { | 528 | public void validateDataOnEntry() throws DataModelException { |
528 | - // TODO auto-generated method stub, to be implemented by parser | 529 | + /* |
530 | + * Module is root in the data model tree, hence there is no entry | ||
531 | + * validation | ||
532 | + */ | ||
529 | } | 533 | } |
530 | 534 | ||
531 | /** | 535 | /** |
... | @@ -535,7 +539,10 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -535,7 +539,10 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
535 | */ | 539 | */ |
536 | @Override | 540 | @Override |
537 | public void validateDataOnExit() throws DataModelException { | 541 | public void validateDataOnExit() throws DataModelException { |
538 | - // TODO auto-generated method stub, to be implemented by parser | 542 | + /* |
543 | + * TODO: perform symbol linking for the imported or included YANG info. | ||
544 | + * TODO: perform symbol resolution for referred YANG entities. | ||
545 | + */ | ||
539 | } | 546 | } |
540 | 547 | ||
541 | /** | 548 | /** |
... | @@ -572,9 +579,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -572,9 +579,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
572 | */ | 579 | */ |
573 | private void addLeavesAttributes() { | 580 | private void addLeavesAttributes() { |
574 | 581 | ||
575 | - List<YangLeaf<?>> leaves = getListOfLeaf(); | 582 | + List<YangLeaf> leaves = getListOfLeaf(); |
576 | if (leaves != null) { | 583 | if (leaves != null) { |
577 | - for (YangLeaf<?> leaf : leaves) { | 584 | + for (YangLeaf leaf : leaves) { |
578 | getFileHandle().addAttributeInfo(leaf.getDataType(), leaf.getLeafName(), false); | 585 | getFileHandle().addAttributeInfo(leaf.getDataType(), leaf.getLeafName(), false); |
579 | } | 586 | } |
580 | } | 587 | } |
... | @@ -584,9 +591,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, | ... | @@ -584,9 +591,9 @@ public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, |
584 | * Adds leaf list's attributes in generated files. | 591 | * Adds leaf list's attributes in generated files. |
585 | */ | 592 | */ |
586 | private void addLeafListAttributes() { | 593 | private void addLeafListAttributes() { |
587 | - List<YangLeafList<?>> leavesList = getListOfLeafList(); | 594 | + List<YangLeafList> leavesList = getListOfLeafList(); |
588 | if (leavesList != null) { | 595 | if (leavesList != null) { |
589 | - for (YangLeafList<?> leafList : leavesList) { | 596 | + for (YangLeafList leafList : leavesList) { |
590 | getFileHandle().addAttributeInfo(leafList.getDataType(), leafList.getLeafName(), true); | 597 | getFileHandle().addAttributeInfo(leafList.getDataType(), leafList.getLeafName(), true); |
591 | } | 598 | } |
592 | } | 599 | } | ... | ... |
... | @@ -92,6 +92,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { | ... | @@ -92,6 +92,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { |
92 | * | 92 | * |
93 | * @return the description. | 93 | * @return the description. |
94 | */ | 94 | */ |
95 | + @Override | ||
95 | public String getDescription() { | 96 | public String getDescription() { |
96 | return description; | 97 | return description; |
97 | } | 98 | } |
... | @@ -101,6 +102,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { | ... | @@ -101,6 +102,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { |
101 | * | 102 | * |
102 | * @param description set the description. | 103 | * @param description set the description. |
103 | */ | 104 | */ |
105 | + @Override | ||
104 | public void setDescription(String description) { | 106 | public void setDescription(String description) { |
105 | this.description = description; | 107 | this.description = description; |
106 | } | 108 | } |
... | @@ -110,6 +112,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { | ... | @@ -110,6 +112,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { |
110 | * | 112 | * |
111 | * @return the reference. | 113 | * @return the reference. |
112 | */ | 114 | */ |
115 | + @Override | ||
113 | public String getReference() { | 116 | public String getReference() { |
114 | return reference; | 117 | return reference; |
115 | } | 118 | } |
... | @@ -119,6 +122,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { | ... | @@ -119,6 +122,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { |
119 | * | 122 | * |
120 | * @param reference the reference to set. | 123 | * @param reference the reference to set. |
121 | */ | 124 | */ |
125 | + @Override | ||
122 | public void setReference(String reference) { | 126 | public void setReference(String reference) { |
123 | this.reference = reference; | 127 | this.reference = reference; |
124 | } | 128 | } |
... | @@ -128,6 +132,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { | ... | @@ -128,6 +132,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { |
128 | * | 132 | * |
129 | * @return returns MUST_DATA | 133 | * @return returns MUST_DATA |
130 | */ | 134 | */ |
135 | + @Override | ||
131 | public ParsableDataType getParsableDataType() { | 136 | public ParsableDataType getParsableDataType() { |
132 | return ParsableDataType.MUST_DATA; | 137 | return ParsableDataType.MUST_DATA; |
133 | } | 138 | } |
... | @@ -137,6 +142,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { | ... | @@ -137,6 +142,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { |
137 | * | 142 | * |
138 | * @throws DataModelException a violation of data model rules. | 143 | * @throws DataModelException a violation of data model rules. |
139 | */ | 144 | */ |
145 | + @Override | ||
140 | public void validateDataOnEntry() throws DataModelException { | 146 | public void validateDataOnEntry() throws DataModelException { |
141 | // TODO auto-generated method stub, to be implemented by parser | 147 | // TODO auto-generated method stub, to be implemented by parser |
142 | } | 148 | } |
... | @@ -146,6 +152,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { | ... | @@ -146,6 +152,7 @@ public class YangMust implements YangDesc, YangReference, Parsable { |
146 | * | 152 | * |
147 | * @throws DataModelException a violation of data model rules. | 153 | * @throws DataModelException a violation of data model rules. |
148 | */ | 154 | */ |
155 | + @Override | ||
149 | public void validateDataOnExit() throws DataModelException { | 156 | public void validateDataOnExit() throws DataModelException { |
150 | // TODO auto-generated method stub, to be implemented by parser | 157 | // TODO auto-generated method stub, to be implemented by parser |
151 | } | 158 | } | ... | ... |
... | @@ -65,6 +65,7 @@ public class YangNameSpace implements Parsable { | ... | @@ -65,6 +65,7 @@ public class YangNameSpace implements Parsable { |
65 | * | 65 | * |
66 | * @return returns NAMESPACE_DATA. | 66 | * @return returns NAMESPACE_DATA. |
67 | */ | 67 | */ |
68 | + @Override | ||
68 | public ParsableDataType getParsableDataType() { | 69 | public ParsableDataType getParsableDataType() { |
69 | return ParsableDataType.NAMESPACE_DATA; | 70 | return ParsableDataType.NAMESPACE_DATA; |
70 | } | 71 | } |
... | @@ -74,6 +75,7 @@ public class YangNameSpace implements Parsable { | ... | @@ -74,6 +75,7 @@ public class YangNameSpace implements Parsable { |
74 | * | 75 | * |
75 | * @throws DataModelException a violation of data model rules. | 76 | * @throws DataModelException a violation of data model rules. |
76 | */ | 77 | */ |
78 | + @Override | ||
77 | public void validateDataOnEntry() throws DataModelException { | 79 | public void validateDataOnEntry() throws DataModelException { |
78 | // TODO auto-generated method stub, to be implemented by parser | 80 | // TODO auto-generated method stub, to be implemented by parser |
79 | 81 | ||
... | @@ -84,6 +86,7 @@ public class YangNameSpace implements Parsable { | ... | @@ -84,6 +86,7 @@ public class YangNameSpace implements Parsable { |
84 | * | 86 | * |
85 | * @throws DataModelException a violation of data model rules. | 87 | * @throws DataModelException a violation of data model rules. |
86 | */ | 88 | */ |
89 | + @Override | ||
87 | public void validateDataOnExit() throws DataModelException { | 90 | public void validateDataOnExit() throws DataModelException { |
88 | // TODO auto-generated method stub, to be implemented by parser | 91 | // TODO auto-generated method stub, to be implemented by parser |
89 | 92 | ... | ... |
utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
0 → 100644
1 | +/*Copyright 2016.year Open Networking Laboratory | ||
2 | + | ||
3 | +Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +you may not use this file except in compliance with the License. | ||
5 | +You may obtain a copy of the License at | ||
6 | + | ||
7 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | + | ||
9 | +Unless required by applicable law or agreed to in writing, software | ||
10 | +distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +See the License for the specific language governing permissions and | ||
13 | +limitations under the License.*/ | ||
14 | +package org.onosproject.yangutils.datamodel; | ||
15 | + | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/*- | ||
19 | + * Reference RFC 6020. | ||
20 | + * | ||
21 | + * The pattern Statement | ||
22 | + * | ||
23 | + * The "pattern" statement, which is an optional sub-statement to the | ||
24 | + * "type" statement, takes as an argument a regular expression string. | ||
25 | + * It is used to restrict the built-in type "string", or types derived | ||
26 | + * from "string", to values that match the pattern. | ||
27 | + * | ||
28 | + * If the type has multiple "pattern" statements, the expressions are | ||
29 | + * ANDed together, i.e., all such expressions have to match. | ||
30 | + * | ||
31 | + * If a pattern restriction is applied to an already pattern-restricted | ||
32 | + * type, values must match all patterns in the base type, in addition to | ||
33 | + * the new patterns. | ||
34 | + * The pattern's sub-statements | ||
35 | + * | ||
36 | + * +---------------+---------+-------------+ | ||
37 | + * | substatement | section | cardinality | | ||
38 | + * +---------------+---------+-------------+ | ||
39 | + * | description | 7.19.3 | 0..1 | | ||
40 | + * | error-app-tag | 7.5.4.2 | 0..1 | | ||
41 | + * | error-message | 7.5.4.1 | 0..1 | | ||
42 | + * | reference | 7.19.4 | 0..1 | | ||
43 | + * +---------------+---------+-------------+ | ||
44 | + */ | ||
45 | +/** | ||
46 | + * Pattern restriction information. The regular expression restriction on string | ||
47 | + * data type. | ||
48 | + */ | ||
49 | +public class YangPatternRestriction { | ||
50 | + | ||
51 | + /** | ||
52 | + * Pattern restriction defined for the current type. | ||
53 | + */ | ||
54 | + private List<String> pattern; | ||
55 | + | ||
56 | + /** | ||
57 | + * Effective pattern restriction that needs inherited from base type. | ||
58 | + */ | ||
59 | + private List<String> basePattern; | ||
60 | + | ||
61 | + /** | ||
62 | + * Default constructor. | ||
63 | + */ | ||
64 | + public YangPatternRestriction() { | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Get the pattern restriction defined for the current type. | ||
69 | + * | ||
70 | + * @return pattern restriction defined for the current type. | ||
71 | + */ | ||
72 | + public List<String> getPattern() { | ||
73 | + return pattern; | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Set the pattern restriction defined for the current type. | ||
78 | + * | ||
79 | + * @param pattern pattern restriction defined for the current type.. | ||
80 | + */ | ||
81 | + public void setPattern(List<String> pattern) { | ||
82 | + this.pattern = pattern; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Get the pattern restriction defined in base type. | ||
87 | + * | ||
88 | + * @return pattern restriction defined in base type. | ||
89 | + */ | ||
90 | + public List<String> getBasePattern() { | ||
91 | + return basePattern; | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * Set the pattern restriction defined in base type. | ||
96 | + * | ||
97 | + * @param basePattern pattern restriction defined in base type. | ||
98 | + */ | ||
99 | + public void setBasePattern(List<String> basePattern) { | ||
100 | + this.basePattern = basePattern; | ||
101 | + } | ||
102 | +} |
1 | +/*Copyright 2016.year Open Networking Laboratory | ||
2 | + | ||
3 | +Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +you may not use this file except in compliance with the License. | ||
5 | +You may obtain a copy of the License at | ||
6 | + | ||
7 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | + | ||
9 | +Unless required by applicable law or agreed to in writing, software | ||
10 | +distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +See the License for the specific language governing permissions and | ||
13 | +limitations under the License.*/ | ||
14 | +package org.onosproject.yangutils.datamodel; | ||
15 | + | ||
16 | +/** | ||
17 | + * Single interval information of a range. | ||
18 | + * | ||
19 | + * @param <T> range type based on the data type. | ||
20 | + */ | ||
21 | +public class YangRangeInterval<T extends Comparable<T>> { | ||
22 | + | ||
23 | + /** | ||
24 | + * Starting value of the range interval. | ||
25 | + */ | ||
26 | + private T startValue; | ||
27 | + | ||
28 | + /** | ||
29 | + * Last value of the range interval. | ||
30 | + */ | ||
31 | + private T endValue; | ||
32 | + | ||
33 | + /** | ||
34 | + * Default constructor. | ||
35 | + */ | ||
36 | + public YangRangeInterval() { | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Get the starting value of the range interval. | ||
41 | + * | ||
42 | + * @return the starting value of the range interval. | ||
43 | + */ | ||
44 | + public T getStartValue() { | ||
45 | + return startValue; | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * Set the starting value of the range interval. | ||
50 | + * | ||
51 | + * @param startValue the starting value of the range interval. | ||
52 | + */ | ||
53 | + public void setStartValue(T startValue) { | ||
54 | + this.startValue = startValue; | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Get the last value of the range interval. | ||
59 | + * | ||
60 | + * @return last value of the range interval. | ||
61 | + */ | ||
62 | + public T getEndValue() { | ||
63 | + return endValue; | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * Set the last value of the range interval. | ||
68 | + * | ||
69 | + * @param endValue last value of the range interval. | ||
70 | + */ | ||
71 | + public void setEndValue(T endValue) { | ||
72 | + this.endValue = endValue; | ||
73 | + } | ||
74 | + | ||
75 | +} |
utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
0 → 100644
1 | +/*Copyright 2016.year Open Networking Laboratory | ||
2 | + | ||
3 | +Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +you may not use this file except in compliance with the License. | ||
5 | +You may obtain a copy of the License at | ||
6 | + | ||
7 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | + | ||
9 | +Unless required by applicable law or agreed to in writing, software | ||
10 | +distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +See the License for the specific language governing permissions and | ||
13 | +limitations under the License.*/ | ||
14 | +package org.onosproject.yangutils.datamodel; | ||
15 | + | ||
16 | +import java.util.LinkedList; | ||
17 | +import java.util.List; | ||
18 | + | ||
19 | +import org.onosproject.yangutils.datamodel.exceptions.DataModelException; | ||
20 | + | ||
21 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
22 | + | ||
23 | +/*- | ||
24 | + * Reference RFC 6020. | ||
25 | + * | ||
26 | + * The range Statement | ||
27 | + * | ||
28 | + * The "range" statement, which is an optional sub-statement to the | ||
29 | + * "type" statement, takes as an argument a range expression string. It | ||
30 | + * is used to restrict integer and decimal built-in types, or types | ||
31 | + * derived from those. | ||
32 | + * | ||
33 | + * A range consists of an explicit value, or a lower-inclusive bound, | ||
34 | + * two consecutive dots "..", and an upper-inclusive bound. Multiple | ||
35 | + * values or ranges can be given, separated by "|". If multiple values | ||
36 | + * or ranges are given, they all MUST be disjoint and MUST be in | ||
37 | + * ascending order. If a range restriction is applied to an already | ||
38 | + * range-restricted type, the new restriction MUST be equal or more | ||
39 | + * limiting, that is raising the lower bounds, reducing the upper | ||
40 | + * bounds, removing explicit values or ranges, or splitting ranges into | ||
41 | + * multiple ranges with intermediate gaps. Each explicit value and | ||
42 | + * range boundary value given in the range expression MUST match the | ||
43 | + * type being restricted, or be one of the special values "min" or | ||
44 | + * "max". "min" and "max" mean the minimum and maximum value accepted | ||
45 | + * for the type being restricted, respectively. | ||
46 | + */ | ||
47 | +/** | ||
48 | + * Ascending range restriction information. | ||
49 | + * | ||
50 | + * @param <T> range type (data type) | ||
51 | + */ | ||
52 | +public class YangRangeRestriction<T extends Comparable<T>> implements YangDesc, YangReference, YangAppErrorInfo { | ||
53 | + | ||
54 | + /** | ||
55 | + * Ascending list of range interval restriction. If the restriction is a | ||
56 | + * single value, the start and end length of the range is same. | ||
57 | + */ | ||
58 | + private List<YangRangeInterval<T>> ascendingRangeIntervals; | ||
59 | + | ||
60 | + /** | ||
61 | + * Textual reference. | ||
62 | + */ | ||
63 | + private String reference; | ||
64 | + | ||
65 | + /** | ||
66 | + * Application's error message, to be used for data error. | ||
67 | + */ | ||
68 | + private String errorMessage; | ||
69 | + | ||
70 | + /** | ||
71 | + * Application's error tag, to be filled in data validation error response. | ||
72 | + */ | ||
73 | + private String errorAppTag; | ||
74 | + | ||
75 | + /** | ||
76 | + * Textual description. | ||
77 | + */ | ||
78 | + private String description; | ||
79 | + | ||
80 | + /** | ||
81 | + * Default constructor. | ||
82 | + */ | ||
83 | + public YangRangeRestriction() { | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * Get the list of range interval restriction in ascending order. | ||
88 | + * | ||
89 | + * @return list of range interval restriction in ascending order. | ||
90 | + */ | ||
91 | + public List<YangRangeInterval<T>> getAscendingRangeIntervals() { | ||
92 | + return ascendingRangeIntervals; | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * Set the list of range interval restriction in ascending order. | ||
97 | + * | ||
98 | + * @param rangeList list of range interval restriction in ascending order. | ||
99 | + */ | ||
100 | + private void setAscendingRangeIntervals(List<YangRangeInterval<T>> rangeList) { | ||
101 | + ascendingRangeIntervals = rangeList; | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Get the minimum valid value as per the restriction. | ||
106 | + * | ||
107 | + * @throws DataModelException data model exception for minimum restriction. | ||
108 | + * | ||
109 | + * @return minimum restricted value. | ||
110 | + */ | ||
111 | + public T getMinRestrictedvalue() throws DataModelException { | ||
112 | + if (getAscendingRangeIntervals() == null) { | ||
113 | + throw new DataModelException("No range restriction info"); | ||
114 | + } | ||
115 | + if (getAscendingRangeIntervals().size() == 0) { | ||
116 | + throw new DataModelException("No range interval info"); | ||
117 | + } | ||
118 | + return getAscendingRangeIntervals().get(0).getStartValue(); | ||
119 | + } | ||
120 | + | ||
121 | + /** | ||
122 | + * Get the maximum valid value as per the restriction. | ||
123 | + * | ||
124 | + * @throws DataModelException data model exception for maximum restriction. | ||
125 | + * | ||
126 | + * @return minimum maximum value. | ||
127 | + */ | ||
128 | + public T getMaxRestrictedvalue() throws DataModelException { | ||
129 | + if (getAscendingRangeIntervals() == null) { | ||
130 | + throw new DataModelException("No range restriction info"); | ||
131 | + } | ||
132 | + if (getAscendingRangeIntervals().size() == 0) { | ||
133 | + throw new DataModelException("No range interval info"); | ||
134 | + } | ||
135 | + return getAscendingRangeIntervals() | ||
136 | + .get(getAscendingRangeIntervals().size() - 1).getEndValue(); | ||
137 | + } | ||
138 | + | ||
139 | + /** | ||
140 | + * Add new interval to extend its range in the last. i.e. newly added | ||
141 | + * interval needs to be bigger than the biggest interval in the list. | ||
142 | + * | ||
143 | + * @param newInterval restricted length interval. | ||
144 | + * @throws DataModelException data model exception for range restriction. | ||
145 | + */ | ||
146 | + public void addLenghtRestrictionInterval(YangRangeInterval<T> newInterval) throws DataModelException { | ||
147 | + | ||
148 | + checkNotNull(newInterval); | ||
149 | + checkNotNull(newInterval.getStartValue()); | ||
150 | + | ||
151 | + if (getAscendingRangeIntervals() == null) { | ||
152 | + /* | ||
153 | + * First interval that is being added, and it must be the smallest | ||
154 | + * interval. | ||
155 | + */ | ||
156 | + setAscendingRangeIntervals(new LinkedList<YangRangeInterval<T>>()); | ||
157 | + getAscendingRangeIntervals().add(newInterval); | ||
158 | + return; | ||
159 | + } | ||
160 | + | ||
161 | + T curMaxvalue = getMaxRestrictedvalue(); | ||
162 | + | ||
163 | + if (newInterval.getStartValue().compareTo(curMaxvalue) != 1) { | ||
164 | + throw new DataModelException( | ||
165 | + "New added range interval is lesser than the old interval(s)"); | ||
166 | + } | ||
167 | + | ||
168 | + getAscendingRangeIntervals() | ||
169 | + .add(getAscendingRangeIntervals().size(), newInterval); | ||
170 | + } | ||
171 | + | ||
172 | + /** | ||
173 | + * Get the textual reference of the length restriction. | ||
174 | + * | ||
175 | + * @return textual reference of the length restriction. | ||
176 | + */ | ||
177 | + @Override | ||
178 | + public String getReference() { | ||
179 | + return reference; | ||
180 | + } | ||
181 | + | ||
182 | + /** | ||
183 | + * Set the textual reference of the length restriction. | ||
184 | + * | ||
185 | + * @param ref textual reference of the length restriction. | ||
186 | + */ | ||
187 | + @Override | ||
188 | + public void setReference(String ref) { | ||
189 | + reference = ref; | ||
190 | + } | ||
191 | + | ||
192 | + /** | ||
193 | + * Get the description of the length restriction. | ||
194 | + * | ||
195 | + * @return description of the length restriction. | ||
196 | + */ | ||
197 | + @Override | ||
198 | + public String getDescription() { | ||
199 | + return description; | ||
200 | + } | ||
201 | + | ||
202 | + /** | ||
203 | + * Set the description of the length restriction. | ||
204 | + * | ||
205 | + * @param desc description of the length restriction. | ||
206 | + */ | ||
207 | + @Override | ||
208 | + public void setDescription(String desc) { | ||
209 | + description = desc; | ||
210 | + | ||
211 | + } | ||
212 | + | ||
213 | + /** | ||
214 | + * Get application's error message, to be used for data error. | ||
215 | + * | ||
216 | + * @return Application's error message, to be used for data error. | ||
217 | + */ | ||
218 | + @Override | ||
219 | + public String getGetErrorMessage() { | ||
220 | + return errorMessage; | ||
221 | + } | ||
222 | + | ||
223 | + /** | ||
224 | + * Set Application's error message, to be used for data error. | ||
225 | + * | ||
226 | + * @param errMsg Application's error message, to be used for data error. | ||
227 | + */ | ||
228 | + @Override | ||
229 | + public void setErrorMessage(String errMsg) { | ||
230 | + errorMessage = errMsg; | ||
231 | + | ||
232 | + } | ||
233 | + | ||
234 | + /** | ||
235 | + * Get application's error tag, to be used for data error. | ||
236 | + * | ||
237 | + * @return application's error tag, to be used for data error. | ||
238 | + */ | ||
239 | + @Override | ||
240 | + public String getGetErrorAppTag() { | ||
241 | + return errorAppTag; | ||
242 | + } | ||
243 | + | ||
244 | + /** | ||
245 | + * Set application's error tag, to be used for data error. | ||
246 | + * | ||
247 | + * @param errTag application's error tag, to be used for data error. | ||
248 | + */ | ||
249 | + @Override | ||
250 | + public void setErrorAppTag(String errTag) { | ||
251 | + errorAppTag = errTag; | ||
252 | + } | ||
253 | +} |
... | @@ -88,6 +88,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { | ... | @@ -88,6 +88,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { |
88 | * | 88 | * |
89 | * @return the description. | 89 | * @return the description. |
90 | */ | 90 | */ |
91 | + @Override | ||
91 | public String getDescription() { | 92 | public String getDescription() { |
92 | return description; | 93 | return description; |
93 | } | 94 | } |
... | @@ -97,6 +98,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { | ... | @@ -97,6 +98,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { |
97 | * | 98 | * |
98 | * @param description set the description. | 99 | * @param description set the description. |
99 | */ | 100 | */ |
101 | + @Override | ||
100 | public void setDescription(String description) { | 102 | public void setDescription(String description) { |
101 | this.description = description; | 103 | this.description = description; |
102 | } | 104 | } |
... | @@ -106,6 +108,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { | ... | @@ -106,6 +108,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { |
106 | * | 108 | * |
107 | * @return the reference. | 109 | * @return the reference. |
108 | */ | 110 | */ |
111 | + @Override | ||
109 | public String getReference() { | 112 | public String getReference() { |
110 | return reference; | 113 | return reference; |
111 | } | 114 | } |
... | @@ -115,6 +118,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { | ... | @@ -115,6 +118,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { |
115 | * | 118 | * |
116 | * @param reference the reference to set. | 119 | * @param reference the reference to set. |
117 | */ | 120 | */ |
121 | + @Override | ||
118 | public void setReference(String reference) { | 122 | public void setReference(String reference) { |
119 | this.reference = reference; | 123 | this.reference = reference; |
120 | } | 124 | } |
... | @@ -124,6 +128,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { | ... | @@ -124,6 +128,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { |
124 | * | 128 | * |
125 | * @return returns REVISION_DATA. | 129 | * @return returns REVISION_DATA. |
126 | */ | 130 | */ |
131 | + @Override | ||
127 | public ParsableDataType getParsableDataType() { | 132 | public ParsableDataType getParsableDataType() { |
128 | return ParsableDataType.REVISION_DATA; | 133 | return ParsableDataType.REVISION_DATA; |
129 | } | 134 | } |
... | @@ -133,6 +138,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { | ... | @@ -133,6 +138,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { |
133 | * | 138 | * |
134 | * @throws DataModelException a violation of data model rules. | 139 | * @throws DataModelException a violation of data model rules. |
135 | */ | 140 | */ |
141 | + @Override | ||
136 | public void validateDataOnEntry() throws DataModelException { | 142 | public void validateDataOnEntry() throws DataModelException { |
137 | // TODO auto-generated method stub, to be implemented by parser | 143 | // TODO auto-generated method stub, to be implemented by parser |
138 | 144 | ||
... | @@ -143,6 +149,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { | ... | @@ -143,6 +149,7 @@ public class YangRevision implements YangDesc, YangReference, Parsable { |
143 | * | 149 | * |
144 | * @throws DataModelException a violation of data model rules. | 150 | * @throws DataModelException a violation of data model rules. |
145 | */ | 151 | */ |
152 | + @Override | ||
146 | public void validateDataOnExit() throws DataModelException { | 153 | public void validateDataOnExit() throws DataModelException { |
147 | // TODO auto-generated method stub, to be implemented by parser | 154 | // TODO auto-generated method stub, to be implemented by parser |
148 | 155 | ... | ... |
utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
0 → 100644
1 | +/*Copyright 2016.year Open Networking Laboratory | ||
2 | + | ||
3 | +Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +you may not use this file except in compliance with the License. | ||
5 | +You may obtain a copy of the License at | ||
6 | + | ||
7 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | + | ||
9 | +Unless required by applicable law or agreed to in writing, software | ||
10 | +distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +See the License for the specific language governing permissions and | ||
13 | +limitations under the License.*/ | ||
14 | +package org.onosproject.yangutils.datamodel; | ||
15 | + | ||
16 | +import java.math.BigInteger; | ||
17 | + | ||
18 | +/*- | ||
19 | + * Reference RFC 6020. | ||
20 | + * | ||
21 | + * A string can be restricted with the "length" and "pattern" statements. | ||
22 | + * | ||
23 | + */ | ||
24 | +/** | ||
25 | + * The restriction for string data type. | ||
26 | + */ | ||
27 | +public class YangStringRestriction { | ||
28 | + | ||
29 | + /*- | ||
30 | + * Reference RFC 6020. | ||
31 | + * The length Statement | ||
32 | + * | ||
33 | + * The "length" statement, which is an optional sub-statement to the | ||
34 | + * "type" statement, takes as an argument a length expression string. | ||
35 | + * It is used to restrict the built-in type "string", or types derived | ||
36 | + * from "string". | ||
37 | + * A "length" statement restricts the number of unicode characters in | ||
38 | + * the string. | ||
39 | + * A length range consists of an explicit value, or a lower bound, two | ||
40 | + * consecutive dots "..", and an upper bound. Multiple values or ranges | ||
41 | + * can be given, separated by "|". Length-restricting values MUST NOT | ||
42 | + * be negative. If multiple values or ranges are given, they all MUST | ||
43 | + * be disjoint and MUST be in ascending order. If a length restriction | ||
44 | + * is applied to an already length-restricted type, the new restriction | ||
45 | + * MUST be equal or more limiting, that is, raising the lower bounds, | ||
46 | + * reducing the upper bounds, removing explicit length values or ranges, | ||
47 | + * or splitting ranges into multiple ranges with intermediate gaps. A | ||
48 | + * length value is a non-negative integer, or one of the special values | ||
49 | + * "min" or "max". "min" and "max" mean the minimum and maximum length | ||
50 | + * accepted for the type being restricted, respectively. An | ||
51 | + * implementation is not required to support a length value larger than | ||
52 | + * 18446744073709551615. | ||
53 | + * The length's sub-statements | ||
54 | + * | ||
55 | + * +---------------+---------+-------------+-----------------+ | ||
56 | + * | substatement | section | cardinality | mapped data type| | ||
57 | + * +---------------+---------+-------------+-----------------+ | ||
58 | + * | description | 7.19.3 | 0..1 | string | | ||
59 | + * | error-app-tag | 7.5.4.2 | 0..1 | string | | ||
60 | + * | error-message | 7.5.4.1 | 0..1 | string | | ||
61 | + * | reference | 7.19.4 | 0..1 | string | | ||
62 | + * +---------------+---------+-------------+-----------------+ | ||
63 | + */ | ||
64 | + /** | ||
65 | + * Length restriction information. | ||
66 | + */ | ||
67 | + private YangRangeRestriction<BigInteger> lengthRestriction; | ||
68 | + | ||
69 | + /** | ||
70 | + * Effective pattern restriction for the type. | ||
71 | + */ | ||
72 | + private YangPatternRestriction patternRestriction; | ||
73 | + | ||
74 | + /** | ||
75 | + * Default constructor. | ||
76 | + */ | ||
77 | + public YangStringRestriction() { | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * Get the length restriction on the string data. | ||
82 | + * | ||
83 | + * @return length restriction on the string data. | ||
84 | + */ | ||
85 | + public YangRangeRestriction<BigInteger> getLengthRestriction() { | ||
86 | + return lengthRestriction; | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Set the length restriction on the string data. | ||
91 | + * | ||
92 | + * @param lengthRestriction length restriction on the string data. | ||
93 | + */ | ||
94 | + public void setLengthRestriction(YangRangeRestriction<BigInteger> lengthRestriction) { | ||
95 | + this.lengthRestriction = lengthRestriction; | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * Get the pattern restriction for the type. | ||
100 | + * | ||
101 | + * @return pattern restriction for the type. | ||
102 | + */ | ||
103 | + public YangPatternRestriction getPatternRestriction() { | ||
104 | + return patternRestriction; | ||
105 | + } | ||
106 | + | ||
107 | + /** | ||
108 | + * Set the pattern restriction for the type. | ||
109 | + * | ||
110 | + * @param patternRestriction pattern restriction for the type. | ||
111 | + */ | ||
112 | + public void setPatternRestriction(YangPatternRestriction patternRestriction) { | ||
113 | + this.patternRestriction = patternRestriction; | ||
114 | + } | ||
115 | +} |
... | @@ -73,7 +73,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; | ... | @@ -73,7 +73,8 @@ import org.onosproject.yangutils.translator.CachedFileHandle; |
73 | /** | 73 | /** |
74 | * Data model node to maintain information defined in YANG sub-module. | 74 | * Data model node to maintain information defined in YANG sub-module. |
75 | */ | 75 | */ |
76 | -public class YangSubModule extends YangNode implements YangLeavesHolder, YangDesc, YangReference, Parsable { | 76 | +public class YangSubModule extends YangNode |
77 | + implements YangLeavesHolder, YangDesc, YangReference, Parsable { | ||
77 | 78 | ||
78 | /** | 79 | /** |
79 | * Name of sub module. | 80 | * Name of sub module. |
... | @@ -114,12 +115,12 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -114,12 +115,12 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
114 | /** | 115 | /** |
115 | * List of leaves at root level in the sub-module. | 116 | * List of leaves at root level in the sub-module. |
116 | */ | 117 | */ |
117 | - private List<YangLeaf<?>> listOfLeaf; | 118 | + private List<YangLeaf> listOfLeaf; |
118 | 119 | ||
119 | /** | 120 | /** |
120 | * List of leaf-lists at root level in the sub-module. | 121 | * List of leaf-lists at root level in the sub-module. |
121 | */ | 122 | */ |
122 | - private List<YangLeafList<?>> listOfLeafList; | 123 | + private List<YangLeafList> listOfLeafList; |
123 | 124 | ||
124 | /** | 125 | /** |
125 | * organization owner of the sub-module. | 126 | * organization owner of the sub-module. |
... | @@ -142,22 +143,31 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -142,22 +143,31 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
142 | private byte version; | 143 | private byte version; |
143 | 144 | ||
144 | /** | 145 | /** |
146 | + * package of the generated java code. | ||
147 | + */ | ||
148 | + private String pkg; | ||
149 | + | ||
150 | + /** | ||
145 | * Create a sub module node. | 151 | * Create a sub module node. |
146 | */ | 152 | */ |
147 | public YangSubModule() { | 153 | public YangSubModule() { |
148 | super(YangNodeType.SUB_MODULE_NODE); | 154 | super(YangNodeType.SUB_MODULE_NODE); |
149 | } | 155 | } |
150 | 156 | ||
151 | - /* (non-Javadoc) | 157 | + /** |
152 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | 158 | + * Get the YANG name of the sub module. |
159 | + * | ||
160 | + * @return YANG name of the sub module | ||
153 | */ | 161 | */ |
154 | @Override | 162 | @Override |
155 | public String getName() { | 163 | public String getName() { |
156 | return name; | 164 | return name; |
157 | } | 165 | } |
158 | 166 | ||
159 | - /* (non-Javadoc) | 167 | + /** |
160 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | 168 | + * Set YANG name of the sub module. |
169 | + * | ||
170 | + * @param subModuleName YANG name of the sub module | ||
161 | */ | 171 | */ |
162 | @Override | 172 | @Override |
163 | public void setName(String subModuleName) { | 173 | public void setName(String subModuleName) { |
... | @@ -293,7 +303,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -293,7 +303,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
293 | * @return the list of leaves. | 303 | * @return the list of leaves. |
294 | */ | 304 | */ |
295 | @Override | 305 | @Override |
296 | - public List<YangLeaf<?>> getListOfLeaf() { | 306 | + public List<YangLeaf> getListOfLeaf() { |
297 | return listOfLeaf; | 307 | return listOfLeaf; |
298 | } | 308 | } |
299 | 309 | ||
... | @@ -302,7 +312,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -302,7 +312,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
302 | * | 312 | * |
303 | * @param leafsList the list of leaf to set. | 313 | * @param leafsList the list of leaf to set. |
304 | */ | 314 | */ |
305 | - private void setListOfLeaf(List<YangLeaf<?>> leafsList) { | 315 | + private void setListOfLeaf(List<YangLeaf> leafsList) { |
306 | listOfLeaf = leafsList; | 316 | listOfLeaf = leafsList; |
307 | } | 317 | } |
308 | 318 | ||
... | @@ -312,9 +322,9 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -312,9 +322,9 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
312 | * @param leaf the leaf to be added. | 322 | * @param leaf the leaf to be added. |
313 | */ | 323 | */ |
314 | @Override | 324 | @Override |
315 | - public void addLeaf(YangLeaf<?> leaf) { | 325 | + public void addLeaf(YangLeaf leaf) { |
316 | if (getListOfLeaf() == null) { | 326 | if (getListOfLeaf() == null) { |
317 | - setListOfLeaf(new LinkedList<YangLeaf<?>>()); | 327 | + setListOfLeaf(new LinkedList<YangLeaf>()); |
318 | } | 328 | } |
319 | 329 | ||
320 | getListOfLeaf().add(leaf); | 330 | getListOfLeaf().add(leaf); |
... | @@ -326,7 +336,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -326,7 +336,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
326 | * @return the list of leaf-list. | 336 | * @return the list of leaf-list. |
327 | */ | 337 | */ |
328 | @Override | 338 | @Override |
329 | - public List<YangLeafList<?>> getListOfLeafList() { | 339 | + public List<YangLeafList> getListOfLeafList() { |
330 | return listOfLeafList; | 340 | return listOfLeafList; |
331 | } | 341 | } |
332 | 342 | ||
... | @@ -335,7 +345,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -335,7 +345,7 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
335 | * | 345 | * |
336 | * @param listOfLeafList the list of leaf-list to set. | 346 | * @param listOfLeafList the list of leaf-list to set. |
337 | */ | 347 | */ |
338 | - private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) { | 348 | + private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
339 | this.listOfLeafList = listOfLeafList; | 349 | this.listOfLeafList = listOfLeafList; |
340 | } | 350 | } |
341 | 351 | ||
... | @@ -345,9 +355,9 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -345,9 +355,9 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
345 | * @param leafList the leaf-list to be added. | 355 | * @param leafList the leaf-list to be added. |
346 | */ | 356 | */ |
347 | @Override | 357 | @Override |
348 | - public void addLeafList(YangLeafList<?> leafList) { | 358 | + public void addLeafList(YangLeafList leafList) { |
349 | if (getListOfLeafList() == null) { | 359 | if (getListOfLeafList() == null) { |
350 | - setListOfLeafList(new LinkedList<YangLeafList<?>>()); | 360 | + setListOfLeafList(new LinkedList<YangLeafList>()); |
351 | } | 361 | } |
352 | 362 | ||
353 | getListOfLeafList().add(leafList); | 363 | getListOfLeafList().add(leafList); |
... | @@ -457,17 +467,16 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -457,17 +467,16 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
457 | // TODO auto-generated method stub, to be implemented by parser | 467 | // TODO auto-generated method stub, to be implemented by parser |
458 | } | 468 | } |
459 | 469 | ||
460 | - /* (non-Javadoc) | 470 | + /** |
461 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry() | 471 | + * Generates java code for sub-module. |
462 | */ | 472 | */ |
463 | @Override | 473 | @Override |
464 | public void generateJavaCodeEntry() { | 474 | public void generateJavaCodeEntry() { |
465 | // TODO Auto-generated method stub | 475 | // TODO Auto-generated method stub |
466 | - | ||
467 | } | 476 | } |
468 | 477 | ||
469 | - /* (non-Javadoc) | 478 | + /** |
470 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit() | 479 | + * Free resources used to generate code. |
471 | */ | 480 | */ |
472 | @Override | 481 | @Override |
473 | public void generateJavaCodeExit() { | 482 | public void generateJavaCodeExit() { |
... | @@ -475,22 +484,24 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes | ... | @@ -475,22 +484,24 @@ public class YangSubModule extends YangNode implements YangLeavesHolder, YangDes |
475 | 484 | ||
476 | } | 485 | } |
477 | 486 | ||
478 | - /* (non-Javadoc) | 487 | + /** |
479 | - * @see org.onosproject.yangutils.datamodel.YangNode#getPackage() | 488 | + * Get the mapped java package. |
489 | + * | ||
490 | + * @return the java package | ||
480 | */ | 491 | */ |
481 | @Override | 492 | @Override |
482 | public String getPackage() { | 493 | public String getPackage() { |
483 | - // TODO Auto-generated method stub | 494 | + return pkg; |
484 | - return null; | ||
485 | } | 495 | } |
486 | 496 | ||
487 | - /* (non-Javadoc) | 497 | + /** |
488 | - * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String) | 498 | + * Set the mapped java package. |
499 | + * | ||
500 | + * @param pakg the package to set | ||
489 | */ | 501 | */ |
490 | @Override | 502 | @Override |
491 | - public void setPackage(String pkg) { | 503 | + public void setPackage(String pakg) { |
492 | - // TODO Auto-generated method stub | 504 | + pkg = pakg; |
493 | - | ||
494 | } | 505 | } |
495 | 506 | ||
496 | @Override | 507 | @Override | ... | ... |
... | @@ -61,7 +61,12 @@ public class YangType<T> implements Parsable { | ... | @@ -61,7 +61,12 @@ public class YangType<T> implements Parsable { |
61 | */ | 61 | */ |
62 | private YangDataTypes dataType; | 62 | private YangDataTypes dataType; |
63 | 63 | ||
64 | - private T dataTypeInfo; | 64 | + /** |
65 | + * Additional information about data type, example restriction info, named | ||
66 | + * values, etc. The extra information is based on the data type. Based on | ||
67 | + * the data type, the extended info can vary. | ||
68 | + */ | ||
69 | + private T dataTypeExtendedInfo; | ||
65 | 70 | ||
66 | /** | 71 | /** |
67 | * Default constructor. | 72 | * Default constructor. |
... | @@ -110,8 +115,8 @@ public class YangType<T> implements Parsable { | ... | @@ -110,8 +115,8 @@ public class YangType<T> implements Parsable { |
110 | * | 115 | * |
111 | * @return the data type meta data. | 116 | * @return the data type meta data. |
112 | */ | 117 | */ |
113 | - public T getDataTypeInfo() { | 118 | + public T getDataTypeExtendedInfo() { |
114 | - return dataTypeInfo; | 119 | + return dataTypeExtendedInfo; |
115 | } | 120 | } |
116 | 121 | ||
117 | /** | 122 | /** |
... | @@ -119,8 +124,8 @@ public class YangType<T> implements Parsable { | ... | @@ -119,8 +124,8 @@ public class YangType<T> implements Parsable { |
119 | * | 124 | * |
120 | * @param dataTypeInfo the meta data to set | 125 | * @param dataTypeInfo the meta data to set |
121 | */ | 126 | */ |
122 | - public void setDataTypeInfo(T dataTypeInfo) { | 127 | + public void setDataTypeExtendedInfo(T dataTypeInfo) { |
123 | - this.dataTypeInfo = dataTypeInfo; | 128 | + this.dataTypeExtendedInfo = dataTypeInfo; |
124 | } | 129 | } |
125 | 130 | ||
126 | /** | 131 | /** |
... | @@ -128,6 +133,7 @@ public class YangType<T> implements Parsable { | ... | @@ -128,6 +133,7 @@ public class YangType<T> implements Parsable { |
128 | * | 133 | * |
129 | * @return returns TYPE_DATA. | 134 | * @return returns TYPE_DATA. |
130 | */ | 135 | */ |
136 | + @Override | ||
131 | public ParsableDataType getParsableDataType() { | 137 | public ParsableDataType getParsableDataType() { |
132 | return ParsableDataType.TYPE_DATA; | 138 | return ParsableDataType.TYPE_DATA; |
133 | } | 139 | } |
... | @@ -137,6 +143,7 @@ public class YangType<T> implements Parsable { | ... | @@ -137,6 +143,7 @@ public class YangType<T> implements Parsable { |
137 | * | 143 | * |
138 | * @throws DataModelException a violation of data model rules. | 144 | * @throws DataModelException a violation of data model rules. |
139 | */ | 145 | */ |
146 | + @Override | ||
140 | public void validateDataOnEntry() throws DataModelException { | 147 | public void validateDataOnEntry() throws DataModelException { |
141 | // TODO auto-generated method stub, to be implemented by parser | 148 | // TODO auto-generated method stub, to be implemented by parser |
142 | 149 | ||
... | @@ -147,6 +154,7 @@ public class YangType<T> implements Parsable { | ... | @@ -147,6 +154,7 @@ public class YangType<T> implements Parsable { |
147 | * | 154 | * |
148 | * @throws DataModelException a violation of data model rules. | 155 | * @throws DataModelException a violation of data model rules. |
149 | */ | 156 | */ |
157 | + @Override | ||
150 | public void validateDataOnExit() throws DataModelException { | 158 | public void validateDataOnExit() throws DataModelException { |
151 | // TODO auto-generated method stub, to be implemented by parser | 159 | // TODO auto-generated method stub, to be implemented by parser |
152 | 160 | ... | ... |
... | @@ -81,10 +81,14 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -81,10 +81,14 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
81 | private YangStatusType status; | 81 | private YangStatusType status; |
82 | 82 | ||
83 | /** | 83 | /** |
84 | - * Derived data type. | 84 | + * Derived data type. The type will be set when the parser detects the type |
85 | + * parsing. Hence it is of raw type and it not know at the time of creation | ||
86 | + * of the object. i.e. in entry parse, it will not be know, in the exit | ||
87 | + * parse we may know the type implicitly based on the restriction. We must | ||
88 | + * know and validate the base built in type, by the linking phase. It is a | ||
89 | + * RAW type and it usage needs to be validate in linking phase. | ||
85 | */ | 90 | */ |
86 | - @SuppressWarnings("rawtypes") | 91 | + private YangType<?> derivedType; |
87 | - private YangType derivedType; | ||
88 | 92 | ||
89 | /** | 93 | /** |
90 | * Units of the data type. | 94 | * Units of the data type. |
... | @@ -92,6 +96,16 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -92,6 +96,16 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
92 | private String units; | 96 | private String units; |
93 | 97 | ||
94 | /** | 98 | /** |
99 | + * YANG base built in data type. | ||
100 | + */ | ||
101 | + private YangDataTypes baseBuiltInType; | ||
102 | + | ||
103 | + /** | ||
104 | + * package of the generated java code. | ||
105 | + */ | ||
106 | + private String pkg; | ||
107 | + | ||
108 | + /** | ||
95 | * Create a typedef node. | 109 | * Create a typedef node. |
96 | */ | 110 | */ |
97 | public YangTypeDef() { | 111 | public YangTypeDef() { |
... | @@ -199,8 +213,7 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -199,8 +213,7 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
199 | * | 213 | * |
200 | * @return the referenced type. | 214 | * @return the referenced type. |
201 | */ | 215 | */ |
202 | - @SuppressWarnings("rawtypes") | 216 | + public YangType<?> getDerivedType() { |
203 | - public YangType getDerivedType() { | ||
204 | return derivedType; | 217 | return derivedType; |
205 | } | 218 | } |
206 | 219 | ||
... | @@ -209,8 +222,7 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -209,8 +222,7 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
209 | * | 222 | * |
210 | * @param derivedType the referenced type. | 223 | * @param derivedType the referenced type. |
211 | */ | 224 | */ |
212 | - @SuppressWarnings("rawtypes") | 225 | + public void setDerivedType(YangType<?> derivedType) { |
213 | - public void setDerivedType(YangType derivedType) { | ||
214 | this.derivedType = derivedType; | 226 | this.derivedType = derivedType; |
215 | } | 227 | } |
216 | 228 | ||
... | @@ -233,6 +245,24 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -233,6 +245,24 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
233 | } | 245 | } |
234 | 246 | ||
235 | /** | 247 | /** |
248 | + * Get the base built in YANG data type. | ||
249 | + * | ||
250 | + * @return base built in YANG data type. | ||
251 | + */ | ||
252 | + public YangDataTypes getBaseBuiltInType() { | ||
253 | + return baseBuiltInType; | ||
254 | + } | ||
255 | + | ||
256 | + /** | ||
257 | + * Set the base built in YANG data type. | ||
258 | + * | ||
259 | + * @param baseBuiltInType base built in YANG data type. | ||
260 | + */ | ||
261 | + public void setBaseBuiltInType(YangDataTypes baseBuiltInType) { | ||
262 | + this.baseBuiltInType = baseBuiltInType; | ||
263 | + } | ||
264 | + | ||
265 | + /** | ||
236 | * Returns the type of the data. | 266 | * Returns the type of the data. |
237 | * | 267 | * |
238 | * @return returns TYPEDEF_DATA | 268 | * @return returns TYPEDEF_DATA |
... | @@ -262,17 +292,20 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -262,17 +292,20 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
262 | // TODO auto-generated method stub, to be implemented by parser | 292 | // TODO auto-generated method stub, to be implemented by parser |
263 | } | 293 | } |
264 | 294 | ||
265 | - /* (non-Javadoc) | 295 | + /** |
266 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | 296 | + * Get the YANG name of the typedef. |
297 | + * | ||
298 | + * @return YANG name of the typedef. | ||
267 | */ | 299 | */ |
268 | @Override | 300 | @Override |
269 | public String getName() { | 301 | public String getName() { |
270 | - // TODO Auto-generated method stub | 302 | + return derivedName; |
271 | - return null; | ||
272 | } | 303 | } |
273 | 304 | ||
274 | - /* (non-Javadoc) | 305 | + /** |
275 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | 306 | + * Set YANG name of the typedef. |
307 | + * | ||
308 | + * @param name YANG name of the typedef. | ||
276 | */ | 309 | */ |
277 | @Override | 310 | @Override |
278 | public void setName(String name) { | 311 | public void setName(String name) { |
... | @@ -280,8 +313,8 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -280,8 +313,8 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
280 | 313 | ||
281 | } | 314 | } |
282 | 315 | ||
283 | - /* (non-Javadoc) | 316 | + /** |
284 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry() | 317 | + * Generate java code snippet corresponding to YANG typedef. |
285 | */ | 318 | */ |
286 | @Override | 319 | @Override |
287 | public void generateJavaCodeEntry() { | 320 | public void generateJavaCodeEntry() { |
... | @@ -289,8 +322,8 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -289,8 +322,8 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
289 | 322 | ||
290 | } | 323 | } |
291 | 324 | ||
292 | - /* (non-Javadoc) | 325 | + /** |
293 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit() | 326 | + * Free resource used for code generation of YANG typedef. |
294 | */ | 327 | */ |
295 | @Override | 328 | @Override |
296 | public void generateJavaCodeExit() { | 329 | public void generateJavaCodeExit() { |
... | @@ -298,30 +331,43 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { | ... | @@ -298,30 +331,43 @@ public class YangTypeDef extends YangNode implements YangCommonInfo, Parsable { |
298 | 331 | ||
299 | } | 332 | } |
300 | 333 | ||
301 | - /* (non-Javadoc) | 334 | + /** |
302 | - * @see org.onosproject.yangutils.datamodel.YangNode#getPackage() | 335 | + * Get the mapped java package. |
336 | + * | ||
337 | + * @return the java package | ||
303 | */ | 338 | */ |
304 | @Override | 339 | @Override |
305 | public String getPackage() { | 340 | public String getPackage() { |
306 | - // TODO Auto-generated method stub | 341 | + return pkg; |
307 | - return null; | ||
308 | } | 342 | } |
309 | 343 | ||
310 | - /* (non-Javadoc) | 344 | + /** |
311 | - * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String) | 345 | + * Set the mapped java package. |
346 | + * | ||
347 | + * @param pakg mapped java package. | ||
312 | */ | 348 | */ |
313 | @Override | 349 | @Override |
314 | - public void setPackage(String pkg) { | 350 | + public void setPackage(String pakg) { |
315 | - // TODO Auto-generated method stub | 351 | + pkg = pakg; |
316 | 352 | ||
317 | } | 353 | } |
318 | 354 | ||
355 | + /** | ||
356 | + * Get the file handle of the cached file used during code generation. | ||
357 | + * | ||
358 | + * @return cached file handle. | ||
359 | + */ | ||
319 | @Override | 360 | @Override |
320 | public CachedFileHandle getFileHandle() { | 361 | public CachedFileHandle getFileHandle() { |
321 | // TODO Auto-generated method stub | 362 | // TODO Auto-generated method stub |
322 | return null; | 363 | return null; |
323 | } | 364 | } |
324 | 365 | ||
366 | + /** | ||
367 | + * Set the file handle to be used used for code generation. | ||
368 | + * | ||
369 | + * @param fileHandle cached file handle. | ||
370 | + */ | ||
325 | @Override | 371 | @Override |
326 | public void setFileHandle(CachedFileHandle fileHandle) { | 372 | public void setFileHandle(CachedFileHandle fileHandle) { |
327 | // TODO Auto-generated method stub | 373 | // TODO Auto-generated method stub | ... | ... |
... | @@ -909,8 +909,8 @@ public interface GeneratedYangListener extends ParseTreeListener { | ... | @@ -909,8 +909,8 @@ public interface GeneratedYangListener extends ParseTreeListener { |
909 | * | 909 | * |
910 | * @param currentContext current context in the parsed tree. | 910 | * @param currentContext current context in the parsed tree. |
911 | */ | 911 | */ |
912 | - void enterInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext | 912 | + void enterInstanceIdentifierSpecification( |
913 | - currentContext); | 913 | + GeneratedYangParser.InstanceIdentifierSpecificationContext currentContext); |
914 | 914 | ||
915 | /** | 915 | /** |
916 | * Exit a parse tree produced by GeneratedYangParser for grammar rule | 916 | * Exit a parse tree produced by GeneratedYangParser for grammar rule | ... | ... |
... | @@ -16,6 +16,8 @@ | ... | @@ -16,6 +16,8 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl; | 17 | package org.onosproject.yangutils.parser.impl; |
18 | 18 | ||
19 | +import java.util.Stack; | ||
20 | + | ||
19 | import org.antlr.v4.runtime.ParserRuleContext; | 21 | import org.antlr.v4.runtime.ParserRuleContext; |
20 | import org.antlr.v4.runtime.tree.ErrorNode; | 22 | import org.antlr.v4.runtime.tree.ErrorNode; |
21 | import org.antlr.v4.runtime.tree.TerminalNode; | 23 | import org.antlr.v4.runtime.tree.TerminalNode; |
... | @@ -23,20 +25,19 @@ import org.onosproject.yangutils.datamodel.YangNode; | ... | @@ -23,20 +25,19 @@ import org.onosproject.yangutils.datamodel.YangNode; |
23 | import org.onosproject.yangutils.parser.Parsable; | 25 | import org.onosproject.yangutils.parser.Parsable; |
24 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangListener; | 26 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangListener; |
25 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; | 27 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; |
26 | - | ||
27 | -import org.onosproject.yangutils.parser.impl.listeners.DefaultListener; | ||
28 | -import org.onosproject.yangutils.parser.impl.listeners.KeyListener; | ||
29 | -import org.onosproject.yangutils.parser.impl.listeners.LeafListListener; | ||
30 | -import org.onosproject.yangutils.parser.impl.listeners.LeafListener; | ||
31 | -import org.onosproject.yangutils.parser.impl.listeners.ListListener; | ||
32 | -import org.onosproject.yangutils.parser.impl.listeners.ContainerListener; | ||
33 | -import org.onosproject.yangutils.parser.impl.listeners.ConfigListener; | ||
34 | -import org.onosproject.yangutils.parser.impl.listeners.ContactListener; | ||
35 | import org.onosproject.yangutils.parser.impl.listeners.BaseFileListener; | 28 | import org.onosproject.yangutils.parser.impl.listeners.BaseFileListener; |
36 | import org.onosproject.yangutils.parser.impl.listeners.BelongsToListener; | 29 | import org.onosproject.yangutils.parser.impl.listeners.BelongsToListener; |
30 | +import org.onosproject.yangutils.parser.impl.listeners.ConfigListener; | ||
31 | +import org.onosproject.yangutils.parser.impl.listeners.ContactListener; | ||
32 | +import org.onosproject.yangutils.parser.impl.listeners.ContainerListener; | ||
33 | +import org.onosproject.yangutils.parser.impl.listeners.DefaultListener; | ||
37 | import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener; | 34 | import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener; |
38 | import org.onosproject.yangutils.parser.impl.listeners.ImportListener; | 35 | import org.onosproject.yangutils.parser.impl.listeners.ImportListener; |
39 | import org.onosproject.yangutils.parser.impl.listeners.IncludeListener; | 36 | import org.onosproject.yangutils.parser.impl.listeners.IncludeListener; |
37 | +import org.onosproject.yangutils.parser.impl.listeners.KeyListener; | ||
38 | +import org.onosproject.yangutils.parser.impl.listeners.LeafListListener; | ||
39 | +import org.onosproject.yangutils.parser.impl.listeners.LeafListener; | ||
40 | +import org.onosproject.yangutils.parser.impl.listeners.ListListener; | ||
40 | import org.onosproject.yangutils.parser.impl.listeners.MandatoryListener; | 41 | import org.onosproject.yangutils.parser.impl.listeners.MandatoryListener; |
41 | import org.onosproject.yangutils.parser.impl.listeners.MaxElementsListener; | 42 | import org.onosproject.yangutils.parser.impl.listeners.MaxElementsListener; |
42 | import org.onosproject.yangutils.parser.impl.listeners.MinElementsListener; | 43 | import org.onosproject.yangutils.parser.impl.listeners.MinElementsListener; |
... | @@ -54,9 +55,6 @@ import org.onosproject.yangutils.parser.impl.listeners.TypeDefListener; | ... | @@ -54,9 +55,6 @@ import org.onosproject.yangutils.parser.impl.listeners.TypeDefListener; |
54 | import org.onosproject.yangutils.parser.impl.listeners.TypeListener; | 55 | import org.onosproject.yangutils.parser.impl.listeners.TypeListener; |
55 | import org.onosproject.yangutils.parser.impl.listeners.UnitsListener; | 56 | import org.onosproject.yangutils.parser.impl.listeners.UnitsListener; |
56 | import org.onosproject.yangutils.parser.impl.listeners.VersionListener; | 57 | import org.onosproject.yangutils.parser.impl.listeners.VersionListener; |
57 | -import org.onosproject.yangutils.parser.impl.parserutils.ListenerError; | ||
58 | - | ||
59 | -import java.util.Stack; | ||
60 | 58 | ||
61 | /** | 59 | /** |
62 | * ANTLR generates a parse-tree listener interface that responds to events | 60 | * ANTLR generates a parse-tree listener interface that responds to events |
... | @@ -72,9 +70,6 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -72,9 +70,6 @@ public class TreeWalkListener implements GeneratedYangListener { |
72 | // Parse tree root node | 70 | // Parse tree root node |
73 | private YangNode rootNode; | 71 | private YangNode rootNode; |
74 | 72 | ||
75 | - // Maintains the state of Exception. | ||
76 | - private ListenerError errorInformation = new ListenerError(); | ||
77 | - | ||
78 | /** | 73 | /** |
79 | * Returns stack of parsable data. | 74 | * Returns stack of parsable data. |
80 | * | 75 | * |
... | @@ -85,15 +80,6 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -85,15 +80,6 @@ public class TreeWalkListener implements GeneratedYangListener { |
85 | } | 80 | } |
86 | 81 | ||
87 | /** | 82 | /** |
88 | - * Returns error information. | ||
89 | - * | ||
90 | - * @return error information object having exception flag and message | ||
91 | - */ | ||
92 | - public ListenerError getErrorInformation() { | ||
93 | - return errorInformation; | ||
94 | - } | ||
95 | - | ||
96 | - /** | ||
97 | * Returns root node. | 83 | * Returns root node. |
98 | * | 84 | * |
99 | * @return rootNode of data model tree. | 85 | * @return rootNode of data model tree. |
... | @@ -120,15 +106,6 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -120,15 +106,6 @@ public class TreeWalkListener implements GeneratedYangListener { |
120 | this.rootNode = rootNode; | 106 | this.rootNode = rootNode; |
121 | } | 107 | } |
122 | 108 | ||
123 | - /** | ||
124 | - * Set listener error information. | ||
125 | - * | ||
126 | - * @param errorInformation error occurred during tree walk. | ||
127 | - */ | ||
128 | - public void setErrorInformation(ListenerError errorInformation) { | ||
129 | - this.errorInformation = errorInformation; | ||
130 | - } | ||
131 | - | ||
132 | @Override | 109 | @Override |
133 | public void enterYangfile(GeneratedYangParser.YangfileContext ctx) { | 110 | public void enterYangfile(GeneratedYangParser.YangfileContext ctx) { |
134 | BaseFileListener.processYangFileEntry(this, ctx); | 111 | BaseFileListener.processYangFileEntry(this, ctx); | ... | ... |
... | @@ -59,15 +59,14 @@ public final class ConfigListener { | ... | @@ -59,15 +59,14 @@ public final class ConfigListener { |
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | - * It is called when parser receives an input matching the grammar | 62 | + * It is called when parser receives an input matching the grammar rule |
63 | - * rule (config), performs validation and updates the data model | 63 | + * (config), performs validation and updates the data model tree. |
64 | - * tree. | ||
65 | * | 64 | * |
66 | * @param listener listener's object. | 65 | * @param listener listener's object. |
67 | * @param ctx context object of the grammar rule. | 66 | * @param ctx context object of the grammar rule. |
68 | */ | 67 | */ |
69 | public static void processConfigEntry(TreeWalkListener listener, | 68 | public static void processConfigEntry(TreeWalkListener listener, |
70 | - GeneratedYangParser.ConfigStatementContext ctx) { | 69 | + GeneratedYangParser.ConfigStatementContext ctx) { |
71 | boolean isConfig = false; | 70 | boolean isConfig = false; |
72 | 71 | ||
73 | // Check for stack to be non empty. | 72 | // Check for stack to be non empty. | ... | ... |
... | @@ -56,26 +56,27 @@ import org.onosproject.yangutils.datamodel.YangTypeDef; | ... | @@ -56,26 +56,27 @@ import org.onosproject.yangutils.datamodel.YangTypeDef; |
56 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; | 56 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
57 | import org.onosproject.yangutils.parser.Parsable; | 57 | import org.onosproject.yangutils.parser.Parsable; |
58 | import org.onosproject.yangutils.parser.ParsableDataType; | 58 | import org.onosproject.yangutils.parser.ParsableDataType; |
59 | -import static org.onosproject.yangutils.parser.ParsableDataType.TYPEDEF_DATA; | ||
60 | -import static org.onosproject.yangutils.parser.ParsableDataType.UNITS_DATA; | ||
61 | -import static org.onosproject.yangutils.parser.ParsableDataType.DEFAULT_DATA; | ||
62 | -import static org.onosproject.yangutils.parser.ParsableDataType.TYPE_DATA; | ||
63 | -import static org.onosproject.yangutils.parser.ParsableDataType.DESCRIPTION_DATA; | ||
64 | -import static org.onosproject.yangutils.parser.ParsableDataType.REFERENCE_DATA; | ||
65 | -import static org.onosproject.yangutils.parser.ParsableDataType.STATUS_DATA; | ||
66 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; | 59 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; |
67 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 60 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
68 | import org.onosproject.yangutils.parser.impl.TreeWalkListener; | 61 | import org.onosproject.yangutils.parser.impl.TreeWalkListener; |
69 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 62 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
63 | + | ||
64 | +import static org.onosproject.yangutils.parser.ParsableDataType.DEFAULT_DATA; | ||
65 | +import static org.onosproject.yangutils.parser.ParsableDataType.DESCRIPTION_DATA; | ||
66 | +import static org.onosproject.yangutils.parser.ParsableDataType.REFERENCE_DATA; | ||
67 | +import static org.onosproject.yangutils.parser.ParsableDataType.STATUS_DATA; | ||
68 | +import static org.onosproject.yangutils.parser.ParsableDataType.TYPEDEF_DATA; | ||
69 | +import static org.onosproject.yangutils.parser.ParsableDataType.TYPE_DATA; | ||
70 | +import static org.onosproject.yangutils.parser.ParsableDataType.UNITS_DATA; | ||
70 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; | 71 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; |
71 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT; | 72 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT; |
72 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage; | 73 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage; |
73 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; | 74 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; |
74 | -import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; | ||
75 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_CARDINALITY; | 75 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_CARDINALITY; |
76 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; | 76 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; |
77 | -import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA; | ||
78 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER; | 77 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER; |
78 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; | ||
79 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA; | ||
79 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty; | 80 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty; |
80 | 81 | ||
81 | /** | 82 | /** |
... | @@ -115,8 +116,8 @@ public final class TypeDefListener { | ... | @@ -115,8 +116,8 @@ public final class TypeDefListener { |
115 | 116 | ||
116 | Parsable curData = listener.getParsedDataStack().peek(); | 117 | Parsable curData = listener.getParsedDataStack().peek(); |
117 | 118 | ||
118 | - if (curData instanceof YangModule | curData instanceof YangSubModule | curData instanceof YangContainer | 119 | + if ((curData instanceof YangModule) | (curData instanceof YangSubModule) | (curData instanceof YangContainer) |
119 | - | curData instanceof YangList) { | 120 | + | (curData instanceof YangList)) { |
120 | /* | 121 | /* |
121 | * TODO YangGrouping, YangRpc, YangInput, YangOutput, Notification. | 122 | * TODO YangGrouping, YangRpc, YangInput, YangOutput, Notification. |
122 | */ | 123 | */ |
... | @@ -150,7 +151,6 @@ public final class TypeDefListener { | ... | @@ -150,7 +151,6 @@ public final class TypeDefListener { |
150 | if (listener.getParsedDataStack().peek() instanceof YangTypeDef) { | 151 | if (listener.getParsedDataStack().peek() instanceof YangTypeDef) { |
151 | listener.getParsedDataStack().pop(); | 152 | listener.getParsedDataStack().pop(); |
152 | } else { | 153 | } else { |
153 | - listener.getErrorInformation().setErrorFlag(true); | ||
154 | throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, TYPEDEF_DATA, | 154 | throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, TYPEDEF_DATA, |
155 | ctx.IDENTIFIER().getText(), EXIT)); | 155 | ctx.IDENTIFIER().getText(), EXIT)); |
156 | } | 156 | } | ... | ... |
1 | -/* | ||
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 | - */ | ||
16 | - | ||
17 | -package org.onosproject.yangutils.parser.impl.parserutils; | ||
18 | - | ||
19 | -/** | ||
20 | - * Error information while doing a listener's based walk is maintained in it. | ||
21 | - */ | ||
22 | -public class ListenerError { | ||
23 | - | ||
24 | - // Maintains the state of exception. | ||
25 | - private boolean errorFlag = false; | ||
26 | - | ||
27 | - // Maintains the reason of exception. | ||
28 | - private String errorMsg; | ||
29 | - | ||
30 | - // Maintains the line number of exception. | ||
31 | - private int lineNumber; | ||
32 | - | ||
33 | - // Maintains the character position in lin of exception. | ||
34 | - private int charPositionInLine; | ||
35 | - | ||
36 | - /** | ||
37 | - * Returns error flag. | ||
38 | - * | ||
39 | - * @return error flag. | ||
40 | - */ | ||
41 | - public boolean isErrorFlag() { | ||
42 | - return errorFlag; | ||
43 | - } | ||
44 | - | ||
45 | - /** | ||
46 | - * Returns reason for error. | ||
47 | - * | ||
48 | - * @return error message | ||
49 | - */ | ||
50 | - public String getErrorMsg() { | ||
51 | - return errorMsg; | ||
52 | - } | ||
53 | - | ||
54 | - /** | ||
55 | - * Returns error line number. | ||
56 | - * | ||
57 | - * @return error line number. | ||
58 | - */ | ||
59 | - public int getLineNumber() { | ||
60 | - return lineNumber; | ||
61 | - } | ||
62 | - | ||
63 | - /** | ||
64 | - * Returns error position in line. | ||
65 | - * | ||
66 | - * @return error character position in line. | ||
67 | - */ | ||
68 | - public int getCharPositionInLine() { | ||
69 | - return charPositionInLine; | ||
70 | - } | ||
71 | - | ||
72 | - /** | ||
73 | - * Set error flag. | ||
74 | - * | ||
75 | - * @param errorFlag error existence flag. | ||
76 | - */ | ||
77 | - public void setErrorFlag(boolean errorFlag) { | ||
78 | - this.errorFlag = errorFlag; | ||
79 | - } | ||
80 | - | ||
81 | - /** | ||
82 | - * Set error message. | ||
83 | - * | ||
84 | - * @param errorMsg reason for error. | ||
85 | - */ | ||
86 | - public void setErrorMsg(String errorMsg) { | ||
87 | - this.errorMsg = errorMsg; | ||
88 | - } | ||
89 | - | ||
90 | - /** | ||
91 | - * Set error line number. | ||
92 | - * | ||
93 | - * @param lineNumber line number of error. | ||
94 | - */ | ||
95 | - public void setLineNumber(int lineNumber) { | ||
96 | - this.lineNumber = lineNumber; | ||
97 | - } | ||
98 | - | ||
99 | - /** | ||
100 | - * Set error character position in line. | ||
101 | - * | ||
102 | - * @param charPositionInLine error character position in line. | ||
103 | - */ | ||
104 | - public void setCharPositionInLine(int charPositionInLine) { | ||
105 | - this.charPositionInLine = charPositionInLine; | ||
106 | - } | ||
107 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -46,7 +46,7 @@ import org.sonatype.plexus.build.incremental.BuildContext; | ... | @@ -46,7 +46,7 @@ import org.sonatype.plexus.build.incremental.BuildContext; |
46 | * in generate-sources requiresDependencyResolution at compile time | 46 | * in generate-sources requiresDependencyResolution at compile time |
47 | */ | 47 | */ |
48 | @Mojo(name = "yang2java", defaultPhase = LifecyclePhase.GENERATE_SOURCES, | 48 | @Mojo(name = "yang2java", defaultPhase = LifecyclePhase.GENERATE_SOURCES, |
49 | -requiresDependencyResolution = ResolutionScope.COMPILE, requiresProject = true) | 49 | + requiresDependencyResolution = ResolutionScope.COMPILE, requiresProject = true) |
50 | public class YangUtilManager extends AbstractMojo { | 50 | public class YangUtilManager extends AbstractMojo { |
51 | 51 | ||
52 | /** | 52 | /** | ... | ... |
... | @@ -16,6 +16,9 @@ | ... | @@ -16,6 +16,9 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.translator.tojava.utils; | 17 | package org.onosproject.yangutils.translator.tojava.utils; |
18 | 18 | ||
19 | +import java.util.List; | ||
20 | +import java.util.SortedSet; | ||
21 | + | ||
19 | import org.onosproject.yangutils.datamodel.YangType; | 22 | import org.onosproject.yangutils.datamodel.YangType; |
20 | import org.onosproject.yangutils.translator.GeneratedFileType; | 23 | import org.onosproject.yangutils.translator.GeneratedFileType; |
21 | import org.onosproject.yangutils.translator.tojava.GeneratedMethodTypes; | 24 | import org.onosproject.yangutils.translator.tojava.GeneratedMethodTypes; |
... | @@ -47,6 +50,17 @@ public final class JavaCodeSnippetGen { | ... | @@ -47,6 +50,17 @@ public final class JavaCodeSnippetGen { |
47 | } | 50 | } |
48 | 51 | ||
49 | /** | 52 | /** |
53 | + * reorder the import list based on the ONOS import rules. | ||
54 | + * | ||
55 | + * @param importInfo the set of classes/interfaces to be imported. | ||
56 | + * @return string of import info. | ||
57 | + */ | ||
58 | + public List<ImportInfo> sortImportOrder(SortedSet<ImportInfo> importInfo) { | ||
59 | + /* TODO: reorder the import list based on the ONOS import rules. */ | ||
60 | + return null; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
50 | * Get the textual java code information corresponding to the import list. | 64 | * Get the textual java code information corresponding to the import list. |
51 | * | 65 | * |
52 | * @param importInfo import info. | 66 | * @param importInfo import info. | ... | ... |
... | @@ -113,7 +113,6 @@ public final class MethodsGenerator { | ... | @@ -113,7 +113,6 @@ public final class MethodsGenerator { |
113 | GeneratedMethodTypes methodTypes, YangType<?> returnType) { | 113 | GeneratedMethodTypes methodTypes, YangType<?> returnType) { |
114 | 114 | ||
115 | if (returnType == null) { | 115 | if (returnType == null) { |
116 | - @SuppressWarnings("rawtypes") | ||
117 | YangType<?> type = new YangType(); | 116 | YangType<?> type = new YangType(); |
118 | type.setDataTypeName(yangName); | 117 | type.setDataTypeName(yangName); |
119 | returnType = type; | 118 | returnType = type; | ... | ... |
... | @@ -62,7 +62,8 @@ public final class FileSystemUtil { | ... | @@ -62,7 +62,8 @@ public final class FileSystemUtil { |
62 | public static void createPackage(String pkg, String pkgInfo) throws IOException { | 62 | public static void createPackage(String pkg, String pkgInfo) throws IOException { |
63 | if (!doesPackageExist(new File(pkg))) { | 63 | if (!doesPackageExist(new File(pkg))) { |
64 | try { | 64 | try { |
65 | - File pack = YangIoUtils.createDirectories(pkg.replace(UtilConstants.PERIOD, UtilConstants.SLASH)); | 65 | + File pack = YangIoUtils |
66 | + .createDirectories(pkg.replace(UtilConstants.PERIOD, UtilConstants.SLASH)); | ||
66 | YangIoUtils.addPackageInfo(pack, pkgInfo, pkg); | 67 | YangIoUtils.addPackageInfo(pack, pkgInfo, pkg); |
67 | } catch (IOException e) { | 68 | } catch (IOException e) { |
68 | throw new IOException("failed to create package-info file"); | 69 | throw new IOException("failed to create package-info file"); | ... | ... |
... | @@ -22,8 +22,8 @@ import org.onosproject.yangutils.parser.exceptions.ParserException; | ... | @@ -22,8 +22,8 @@ import org.onosproject.yangutils.parser.exceptions.ParserException; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * ExpectedException framework can use the Hamcrest matcher's to test | 24 | * ExpectedException framework can use the Hamcrest matcher's to test |
25 | - * custom/extended exceptions. This class extends the type safe matcher to define | 25 | + * custom/extended exceptions. This class extends the type safe matcher to |
26 | - * the custom exception matcher. | 26 | + * define the custom exception matcher. |
27 | */ | 27 | */ |
28 | public final class CustomExceptionMatcher extends TypeSafeMatcher<ParserException> { | 28 | public final class CustomExceptionMatcher extends TypeSafeMatcher<ParserException> { |
29 | 29 | ... | ... |
... | @@ -16,25 +16,24 @@ | ... | @@ -16,25 +16,24 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 27 | import org.onosproject.yangutils.datamodel.YangLeaf; |
28 | +import org.onosproject.yangutils.datamodel.YangLeafList; | ||
29 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 30 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 31 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 32 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 33 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | -import org.onosproject.yangutils.datamodel.YangLeafList; | ||
32 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 34 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
33 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 35 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
34 | 36 | ||
35 | -import java.io.IOException; | ||
36 | -import java.util.ListIterator; | ||
37 | - | ||
38 | import static org.hamcrest.MatcherAssert.assertThat; | 37 | import static org.hamcrest.MatcherAssert.assertThat; |
39 | import static org.hamcrest.core.Is.is; | 38 | import static org.hamcrest.core.Is.is; |
40 | 39 | ||
... | @@ -66,8 +65,8 @@ public class ConfigListenerTest { | ... | @@ -66,8 +65,8 @@ public class ConfigListenerTest { |
66 | YangModule yangNode = (YangModule) node; | 65 | YangModule yangNode = (YangModule) node; |
67 | assertThat(yangNode.getName(), is("Test")); | 66 | assertThat(yangNode.getName(), is("Test")); |
68 | 67 | ||
69 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 68 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
70 | - YangLeaf<?> leafInfo = leafIterator.next(); | 69 | + YangLeaf leafInfo = leafIterator.next(); |
71 | 70 | ||
72 | // Check whether the Config value is set correctly. | 71 | // Check whether the Config value is set correctly. |
73 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 72 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -92,8 +91,8 @@ public class ConfigListenerTest { | ... | @@ -92,8 +91,8 @@ public class ConfigListenerTest { |
92 | YangModule yangNode = (YangModule) node; | 91 | YangModule yangNode = (YangModule) node; |
93 | assertThat(yangNode.getName(), is("Test")); | 92 | assertThat(yangNode.getName(), is("Test")); |
94 | 93 | ||
95 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 94 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
96 | - YangLeaf<?> leafInfo = leafIterator.next(); | 95 | + YangLeaf leafInfo = leafIterator.next(); |
97 | 96 | ||
98 | // Check whether the Config value is set correctly. | 97 | // Check whether the Config value is set correctly. |
99 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 98 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -167,8 +166,8 @@ public class ConfigListenerTest { | ... | @@ -167,8 +166,8 @@ public class ConfigListenerTest { |
167 | assertThat(container.isConfig(), is(true)); | 166 | assertThat(container.isConfig(), is(true)); |
168 | 167 | ||
169 | // Check whether leaf properties as set correctly. | 168 | // Check whether leaf properties as set correctly. |
170 | - ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator(); | 169 | + ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator(); |
171 | - YangLeaf<?> leafInfo = leafIterator.next(); | 170 | + YangLeaf leafInfo = leafIterator.next(); |
172 | 171 | ||
173 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 172 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
174 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 173 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -203,8 +202,8 @@ public class ConfigListenerTest { | ... | @@ -203,8 +202,8 @@ public class ConfigListenerTest { |
203 | assertThat(yangList.isConfig(), is(true)); | 202 | assertThat(yangList.isConfig(), is(true)); |
204 | 203 | ||
205 | // Check whether leaf properties as set correctly. | 204 | // Check whether leaf properties as set correctly. |
206 | - ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator(); | 205 | + ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator(); |
207 | - YangLeaf<?> leafInfo = leafIterator.next(); | 206 | + YangLeaf leafInfo = leafIterator.next(); |
208 | 207 | ||
209 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 208 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
210 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 209 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -234,8 +233,8 @@ public class ConfigListenerTest { | ... | @@ -234,8 +233,8 @@ public class ConfigListenerTest { |
234 | YangModule yangNode = (YangModule) node; | 233 | YangModule yangNode = (YangModule) node; |
235 | assertThat(yangNode.getName(), is("Test")); | 234 | assertThat(yangNode.getName(), is("Test")); |
236 | 235 | ||
237 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 236 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
238 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 237 | + YangLeafList leafListInfo = leafListIterator.next(); |
239 | 238 | ||
240 | // Check whether config value is set correctly. | 239 | // Check whether config value is set correctly. |
241 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 240 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | ... | ... |
... | @@ -16,24 +16,23 @@ | ... | @@ -16,24 +16,23 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 27 | import org.onosproject.yangutils.datamodel.YangLeaf; |
28 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 29 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 30 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 31 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 32 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 33 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
32 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 34 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
33 | 35 | ||
34 | -import java.io.IOException; | ||
35 | -import java.util.ListIterator; | ||
36 | - | ||
37 | import static org.hamcrest.MatcherAssert.assertThat; | 36 | import static org.hamcrest.MatcherAssert.assertThat; |
38 | import static org.hamcrest.core.Is.is; | 37 | import static org.hamcrest.core.Is.is; |
39 | 38 | ||
... | @@ -154,8 +153,8 @@ public class ContainerListenerTest { | ... | @@ -154,8 +153,8 @@ public class ContainerListenerTest { |
154 | assertThat(yangContainer.getReference(), is("\"container reference\"")); | 153 | assertThat(yangContainer.getReference(), is("\"container reference\"")); |
155 | 154 | ||
156 | // Check whether leaf properties as set correctly. | 155 | // Check whether leaf properties as set correctly. |
157 | - ListIterator<YangLeaf<?>> leafIterator = yangContainer.getListOfLeaf().listIterator(); | 156 | + ListIterator<YangLeaf> leafIterator = yangContainer.getListOfLeaf().listIterator(); |
158 | - YangLeaf<?> leafInfo = leafIterator.next(); | 157 | + YangLeaf leafInfo = leafIterator.next(); |
159 | 158 | ||
160 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 159 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
161 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 160 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | ... | ... |
... | @@ -16,25 +16,24 @@ | ... | @@ -16,25 +16,24 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 27 | import org.onosproject.yangutils.datamodel.YangLeaf; |
28 | +import org.onosproject.yangutils.datamodel.YangLeafList; | ||
29 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 30 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 31 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 32 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 33 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | -import org.onosproject.yangutils.datamodel.YangLeafList; | ||
32 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 34 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
33 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 35 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
34 | 36 | ||
35 | -import java.io.IOException; | ||
36 | -import java.util.ListIterator; | ||
37 | - | ||
38 | import static org.hamcrest.MatcherAssert.assertThat; | 37 | import static org.hamcrest.MatcherAssert.assertThat; |
39 | import static org.hamcrest.core.Is.is; | 38 | import static org.hamcrest.core.Is.is; |
40 | 39 | ||
... | @@ -66,8 +65,8 @@ public class DescriptionListenerTest { | ... | @@ -66,8 +65,8 @@ public class DescriptionListenerTest { |
66 | YangModule yangNode = (YangModule) node; | 65 | YangModule yangNode = (YangModule) node; |
67 | assertThat(yangNode.getName(), is("Test")); | 66 | assertThat(yangNode.getName(), is("Test")); |
68 | 67 | ||
69 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 68 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
70 | - YangLeaf<?> leafInfo = leafIterator.next(); | 69 | + YangLeaf leafInfo = leafIterator.next(); |
71 | 70 | ||
72 | // Check whether the description is set correctly. | 71 | // Check whether the description is set correctly. |
73 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 72 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -175,8 +174,8 @@ public class DescriptionListenerTest { | ... | @@ -175,8 +174,8 @@ public class DescriptionListenerTest { |
175 | assertThat(container.getDescription(), is("\"container description\"")); | 174 | assertThat(container.getDescription(), is("\"container description\"")); |
176 | 175 | ||
177 | // Check whether leaf properties as set correctly. | 176 | // Check whether leaf properties as set correctly. |
178 | - ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator(); | 177 | + ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator(); |
179 | - YangLeaf<?> leafInfo = leafIterator.next(); | 178 | + YangLeaf leafInfo = leafIterator.next(); |
180 | 179 | ||
181 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 180 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
182 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 181 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -212,8 +211,8 @@ public class DescriptionListenerTest { | ... | @@ -212,8 +211,8 @@ public class DescriptionListenerTest { |
212 | assertThat(yangList.getDescription(), is("\"list description\"")); | 211 | assertThat(yangList.getDescription(), is("\"list description\"")); |
213 | 212 | ||
214 | // Check whether leaf properties as set correctly. | 213 | // Check whether leaf properties as set correctly. |
215 | - ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator(); | 214 | + ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator(); |
216 | - YangLeaf<?> leafInfo = leafIterator.next(); | 215 | + YangLeaf leafInfo = leafIterator.next(); |
217 | 216 | ||
218 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 217 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
219 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 218 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -243,8 +242,8 @@ public class DescriptionListenerTest { | ... | @@ -243,8 +242,8 @@ public class DescriptionListenerTest { |
243 | YangModule yangNode = (YangModule) node; | 242 | YangModule yangNode = (YangModule) node; |
244 | assertThat(yangNode.getName(), is("Test")); | 243 | assertThat(yangNode.getName(), is("Test")); |
245 | 244 | ||
246 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 245 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
247 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 246 | + YangLeafList leafListInfo = leafListIterator.next(); |
248 | 247 | ||
249 | // Check whether description value is set correctly. | 248 | // Check whether description value is set correctly. |
250 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 249 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | ... | ... |
... | @@ -16,24 +16,23 @@ | ... | @@ -16,24 +16,23 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeafList; | 27 | import org.onosproject.yangutils.datamodel.YangLeafList; |
28 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 29 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 30 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 31 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 32 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 33 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
32 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 34 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
33 | 35 | ||
34 | -import java.io.IOException; | ||
35 | -import java.util.ListIterator; | ||
36 | - | ||
37 | import static org.hamcrest.MatcherAssert.assertThat; | 36 | import static org.hamcrest.MatcherAssert.assertThat; |
38 | import static org.hamcrest.core.Is.is; | 37 | import static org.hamcrest.core.Is.is; |
39 | 38 | ||
... | @@ -48,8 +47,7 @@ public class LeafListListenerTest { | ... | @@ -48,8 +47,7 @@ public class LeafListListenerTest { |
48 | private final YangUtilsParserManager manager = new YangUtilsParserManager(); | 47 | private final YangUtilsParserManager manager = new YangUtilsParserManager(); |
49 | 48 | ||
50 | /** | 49 | /** |
51 | - * Checks all the values of leaf-list sub-statements are set | 50 | + * Checks all the values of leaf-list sub-statements are set correctly. |
52 | - * correctly. | ||
53 | */ | 51 | */ |
54 | @Test | 52 | @Test |
55 | public void processLeafListSubStatements() throws IOException, ParserException { | 53 | public void processLeafListSubStatements() throws IOException, ParserException { |
... | @@ -66,8 +64,8 @@ public class LeafListListenerTest { | ... | @@ -66,8 +64,8 @@ public class LeafListListenerTest { |
66 | YangModule yangNode = (YangModule) node; | 64 | YangModule yangNode = (YangModule) node; |
67 | assertThat(yangNode.getName(), is("Test")); | 65 | assertThat(yangNode.getName(), is("Test")); |
68 | 66 | ||
69 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 67 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
70 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 68 | + YangLeafList leafListInfo = leafListIterator.next(); |
71 | 69 | ||
72 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 70 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); |
73 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 71 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -81,8 +79,8 @@ public class LeafListListenerTest { | ... | @@ -81,8 +79,8 @@ public class LeafListListenerTest { |
81 | } | 79 | } |
82 | 80 | ||
83 | /** | 81 | /** |
84 | - * Checks whether exception is thrown when leaf-list identifier | 82 | + * Checks whether exception is thrown when leaf-list identifier starts with |
85 | - * starts with digit. | 83 | + * digit. |
86 | */ | 84 | */ |
87 | @Test | 85 | @Test |
88 | public void processLeafListInvalidIdentifier() throws IOException, ParserException { | 86 | public void processLeafListInvalidIdentifier() throws IOException, ParserException { |
... | @@ -92,8 +90,7 @@ public class LeafListListenerTest { | ... | @@ -92,8 +90,7 @@ public class LeafListListenerTest { |
92 | } | 90 | } |
93 | 91 | ||
94 | /** | 92 | /** |
95 | - * Checks whether exception is thrown when leaf-list keyword | 93 | + * Checks whether exception is thrown when leaf-list keyword is incorrect. |
96 | - * is incorrect. | ||
97 | */ | 94 | */ |
98 | @Test | 95 | @Test |
99 | public void processLeafListInvalidStatement() throws IOException, ParserException { | 96 | public void processLeafListInvalidStatement() throws IOException, ParserException { |
... | @@ -106,8 +103,8 @@ public class LeafListListenerTest { | ... | @@ -106,8 +103,8 @@ public class LeafListListenerTest { |
106 | } | 103 | } |
107 | 104 | ||
108 | /** | 105 | /** |
109 | - * Checks whether exception is thrown when leaf-list keyword | 106 | + * Checks whether exception is thrown when leaf-list keyword without Left |
110 | - * without Left brace as per grammar. | 107 | + * brace as per grammar. |
111 | */ | 108 | */ |
112 | @Test | 109 | @Test |
113 | public void processLeafListWithoutLeftBrace() throws IOException, ParserException { | 110 | public void processLeafListWithoutLeftBrace() throws IOException, ParserException { |
... | @@ -117,8 +114,8 @@ public class LeafListListenerTest { | ... | @@ -117,8 +114,8 @@ public class LeafListListenerTest { |
117 | } | 114 | } |
118 | 115 | ||
119 | /** | 116 | /** |
120 | - * Checks whether exception is thrown when config statement | 117 | + * Checks whether exception is thrown when config statement cardinality is |
121 | - * cardinality is not as per grammar. | 118 | + * not as per grammar. |
122 | */ | 119 | */ |
123 | @Test | 120 | @Test |
124 | public void processLeafListConfigInvalidCardinality() throws IOException, ParserException { | 121 | public void processLeafListConfigInvalidCardinality() throws IOException, ParserException { |
... | @@ -128,8 +125,8 @@ public class LeafListListenerTest { | ... | @@ -128,8 +125,8 @@ public class LeafListListenerTest { |
128 | } | 125 | } |
129 | 126 | ||
130 | /** | 127 | /** |
131 | - * Checks whether exception is thrown when units statement | 128 | + * Checks whether exception is thrown when units statement cardinality is |
132 | - * cardinality is not as per grammar. | 129 | + * not as per grammar. |
133 | */ | 130 | */ |
134 | @Test | 131 | @Test |
135 | public void processLeafListUnitsInvalidCardinality() throws IOException, ParserException { | 132 | public void processLeafListUnitsInvalidCardinality() throws IOException, ParserException { |
... | @@ -161,8 +158,8 @@ public class LeafListListenerTest { | ... | @@ -161,8 +158,8 @@ public class LeafListListenerTest { |
161 | assertThat(container.getName(), is("valid")); | 158 | assertThat(container.getName(), is("valid")); |
162 | 159 | ||
163 | // Check whether leaf-list properties as set correctly. | 160 | // Check whether leaf-list properties as set correctly. |
164 | - ListIterator<YangLeafList<?>> leafListIterator = container.getListOfLeafList().listIterator(); | 161 | + ListIterator<YangLeafList> leafListIterator = container.getListOfLeafList().listIterator(); |
165 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 162 | + YangLeafList leafListInfo = leafListIterator.next(); |
166 | 163 | ||
167 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 164 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); |
168 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 165 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -198,8 +195,8 @@ public class LeafListListenerTest { | ... | @@ -198,8 +195,8 @@ public class LeafListListenerTest { |
198 | assertThat(yangList.getName(), is("valid")); | 195 | assertThat(yangList.getName(), is("valid")); |
199 | 196 | ||
200 | // Check whether leaf-list properties as set correctly. | 197 | // Check whether leaf-list properties as set correctly. |
201 | - ListIterator<YangLeafList<?>> leafListIterator = yangList.getListOfLeafList().listIterator(); | 198 | + ListIterator<YangLeafList> leafListIterator = yangList.getListOfLeafList().listIterator(); |
202 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 199 | + YangLeafList leafListInfo = leafListIterator.next(); |
203 | 200 | ||
204 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 201 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); |
205 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 202 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | ... | ... |
... | @@ -16,24 +16,23 @@ | ... | @@ -16,24 +16,23 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 27 | import org.onosproject.yangutils.datamodel.YangLeaf; |
28 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 29 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 30 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 31 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 32 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 33 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
32 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 34 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
33 | 35 | ||
34 | -import java.io.IOException; | ||
35 | -import java.util.ListIterator; | ||
36 | - | ||
37 | import static org.hamcrest.MatcherAssert.assertThat; | 36 | import static org.hamcrest.MatcherAssert.assertThat; |
38 | import static org.hamcrest.core.Is.is; | 37 | import static org.hamcrest.core.Is.is; |
39 | 38 | ||
... | @@ -48,8 +47,7 @@ public class LeafListenerTest { | ... | @@ -48,8 +47,7 @@ public class LeafListenerTest { |
48 | private final YangUtilsParserManager manager = new YangUtilsParserManager(); | 47 | private final YangUtilsParserManager manager = new YangUtilsParserManager(); |
49 | 48 | ||
50 | /** | 49 | /** |
51 | - * Checks all the values of leaf sub-statements are set | 50 | + * Checks all the values of leaf sub-statements are set correctly. |
52 | - * correctly. | ||
53 | */ | 51 | */ |
54 | @Test | 52 | @Test |
55 | public void processLeafSubStatements() throws IOException, ParserException { | 53 | public void processLeafSubStatements() throws IOException, ParserException { |
... | @@ -66,8 +64,8 @@ public class LeafListenerTest { | ... | @@ -66,8 +64,8 @@ public class LeafListenerTest { |
66 | YangModule yangNode = (YangModule) node; | 64 | YangModule yangNode = (YangModule) node; |
67 | assertThat(yangNode.getName(), is("Test")); | 65 | assertThat(yangNode.getName(), is("Test")); |
68 | 66 | ||
69 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 67 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
70 | - YangLeaf<?> leafInfo = leafIterator.next(); | 68 | + YangLeaf leafInfo = leafIterator.next(); |
71 | 69 | ||
72 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 70 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
73 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 71 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -81,8 +79,8 @@ public class LeafListenerTest { | ... | @@ -81,8 +79,8 @@ public class LeafListenerTest { |
81 | } | 79 | } |
82 | 80 | ||
83 | /** | 81 | /** |
84 | - * Checks whether exception is thrown when leaf identifier | 82 | + * Checks whether exception is thrown when leaf identifier starts with |
85 | - * starts with digit. | 83 | + * digit. |
86 | */ | 84 | */ |
87 | @Test | 85 | @Test |
88 | public void processLeafInvalidIdentifier() throws IOException, ParserException { | 86 | public void processLeafInvalidIdentifier() throws IOException, ParserException { |
... | @@ -92,8 +90,7 @@ public class LeafListenerTest { | ... | @@ -92,8 +90,7 @@ public class LeafListenerTest { |
92 | } | 90 | } |
93 | 91 | ||
94 | /** | 92 | /** |
95 | - * Checks whether exception is thrown when leaf keyword | 93 | + * Checks whether exception is thrown when leaf keyword is incorrect. |
96 | - * is incorrect. | ||
97 | */ | 94 | */ |
98 | @Test | 95 | @Test |
99 | public void processLeafInvalidStatement() throws IOException, ParserException { | 96 | public void processLeafInvalidStatement() throws IOException, ParserException { |
... | @@ -106,8 +103,8 @@ public class LeafListenerTest { | ... | @@ -106,8 +103,8 @@ public class LeafListenerTest { |
106 | } | 103 | } |
107 | 104 | ||
108 | /** | 105 | /** |
109 | - * Checks whether exception is thrown when leaf keyword | 106 | + * Checks whether exception is thrown when leaf keyword without Left brace |
110 | - * without Left brace as per grammar. | 107 | + * as per grammar. |
111 | */ | 108 | */ |
112 | @Test | 109 | @Test |
113 | public void processLeafWithoutLeftBrace() throws IOException, ParserException { | 110 | public void processLeafWithoutLeftBrace() throws IOException, ParserException { |
... | @@ -117,8 +114,8 @@ public class LeafListenerTest { | ... | @@ -117,8 +114,8 @@ public class LeafListenerTest { |
117 | } | 114 | } |
118 | 115 | ||
119 | /** | 116 | /** |
120 | - * Checks whether exception is thrown when config statement | 117 | + * Checks whether exception is thrown when config statement cardinality is |
121 | - * cardinality is not as per grammar. | 118 | + * not as per grammar. |
122 | */ | 119 | */ |
123 | @Test | 120 | @Test |
124 | public void processLeafConfigInvalidCardinality() throws IOException, ParserException { | 121 | public void processLeafConfigInvalidCardinality() throws IOException, ParserException { |
... | @@ -128,8 +125,8 @@ public class LeafListenerTest { | ... | @@ -128,8 +125,8 @@ public class LeafListenerTest { |
128 | } | 125 | } |
129 | 126 | ||
130 | /** | 127 | /** |
131 | - * Checks whether exception is thrown when mandatory statement | 128 | + * Checks whether exception is thrown when mandatory statement cardinality |
132 | - * cardinality is not as per grammar. | 129 | + * is not as per grammar. |
133 | */ | 130 | */ |
134 | @Test | 131 | @Test |
135 | public void processLeafMandatoryInvalidCardinality() throws IOException, ParserException { | 132 | public void processLeafMandatoryInvalidCardinality() throws IOException, ParserException { |
... | @@ -161,8 +158,8 @@ public class LeafListenerTest { | ... | @@ -161,8 +158,8 @@ public class LeafListenerTest { |
161 | assertThat(container.getName(), is("valid")); | 158 | assertThat(container.getName(), is("valid")); |
162 | 159 | ||
163 | // Check whether leaf properties as set correctly. | 160 | // Check whether leaf properties as set correctly. |
164 | - ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator(); | 161 | + ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator(); |
165 | - YangLeaf<?> leafInfo = leafIterator.next(); | 162 | + YangLeaf leafInfo = leafIterator.next(); |
166 | 163 | ||
167 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 164 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
168 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 165 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -197,8 +194,8 @@ public class LeafListenerTest { | ... | @@ -197,8 +194,8 @@ public class LeafListenerTest { |
197 | assertThat(yangList.getName(), is("valid")); | 194 | assertThat(yangList.getName(), is("valid")); |
198 | 195 | ||
199 | // Check whether leaf properties as set correctly. | 196 | // Check whether leaf properties as set correctly. |
200 | - ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator(); | 197 | + ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator(); |
201 | - YangLeaf<?> leafInfo = leafIterator.next(); | 198 | + YangLeaf leafInfo = leafIterator.next(); |
202 | 199 | ||
203 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 200 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
204 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 201 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | ... | ... |
... | @@ -16,24 +16,23 @@ | ... | @@ -16,24 +16,23 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 27 | import org.onosproject.yangutils.datamodel.YangLeaf; |
28 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 29 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 30 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 31 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 32 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 33 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
32 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 34 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
33 | 35 | ||
34 | -import java.io.IOException; | ||
35 | -import java.util.ListIterator; | ||
36 | - | ||
37 | import static org.hamcrest.MatcherAssert.assertThat; | 36 | import static org.hamcrest.MatcherAssert.assertThat; |
38 | import static org.hamcrest.core.Is.is; | 37 | import static org.hamcrest.core.Is.is; |
39 | 38 | ||
... | @@ -159,8 +158,8 @@ public class ListListenerTest { | ... | @@ -159,8 +158,8 @@ public class ListListenerTest { |
159 | assertThat(yangList.getReference(), is("\"list reference\"")); | 158 | assertThat(yangList.getReference(), is("\"list reference\"")); |
160 | 159 | ||
161 | // Check whether leaf properties as set correctly. | 160 | // Check whether leaf properties as set correctly. |
162 | - ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator(); | 161 | + ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator(); |
163 | - YangLeaf<?> leafInfo = leafIterator.next(); | 162 | + YangLeaf leafInfo = leafIterator.next(); |
164 | 163 | ||
165 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 164 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
166 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 165 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | ... | ... |
... | @@ -16,19 +16,19 @@ | ... | @@ -16,19 +16,19 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangLeaf; | ||
26 | +import org.onosproject.yangutils.datamodel.YangModule; | ||
22 | import org.onosproject.yangutils.datamodel.YangNode; | 27 | import org.onosproject.yangutils.datamodel.YangNode; |
23 | import org.onosproject.yangutils.datamodel.YangNodeType; | 28 | import org.onosproject.yangutils.datamodel.YangNodeType; |
24 | -import org.onosproject.yangutils.datamodel.YangModule; | ||
25 | -import org.onosproject.yangutils.datamodel.YangLeaf; | ||
26 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 29 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
27 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 30 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
28 | 31 | ||
29 | -import java.io.IOException; | ||
30 | -import java.util.ListIterator; | ||
31 | - | ||
32 | import static org.hamcrest.MatcherAssert.assertThat; | 32 | import static org.hamcrest.MatcherAssert.assertThat; |
33 | import static org.hamcrest.core.Is.is; | 33 | import static org.hamcrest.core.Is.is; |
34 | 34 | ||
... | @@ -60,8 +60,8 @@ public class MandatoryListenerTest { | ... | @@ -60,8 +60,8 @@ public class MandatoryListenerTest { |
60 | YangModule yangNode = (YangModule) node; | 60 | YangModule yangNode = (YangModule) node; |
61 | assertThat(yangNode.getName(), is("Test")); | 61 | assertThat(yangNode.getName(), is("Test")); |
62 | 62 | ||
63 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 63 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
64 | - YangLeaf<?> leafInfo = leafIterator.next(); | 64 | + YangLeaf leafInfo = leafIterator.next(); |
65 | 65 | ||
66 | // Check whether the mandatory value is set correctly. | 66 | // Check whether the mandatory value is set correctly. |
67 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 67 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -86,8 +86,8 @@ public class MandatoryListenerTest { | ... | @@ -86,8 +86,8 @@ public class MandatoryListenerTest { |
86 | YangModule yangNode = (YangModule) node; | 86 | YangModule yangNode = (YangModule) node; |
87 | assertThat(yangNode.getName(), is("Test")); | 87 | assertThat(yangNode.getName(), is("Test")); |
88 | 88 | ||
89 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 89 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
90 | - YangLeaf<?> leafInfo = leafIterator.next(); | 90 | + YangLeaf leafInfo = leafIterator.next(); |
91 | 91 | ||
92 | // Check whether the mandatory value is set correctly. | 92 | // Check whether the mandatory value is set correctly. |
93 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 93 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -112,8 +112,8 @@ public class MandatoryListenerTest { | ... | @@ -112,8 +112,8 @@ public class MandatoryListenerTest { |
112 | YangModule yangNode = (YangModule) node; | 112 | YangModule yangNode = (YangModule) node; |
113 | assertThat(yangNode.getName(), is("Test")); | 113 | assertThat(yangNode.getName(), is("Test")); |
114 | 114 | ||
115 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 115 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
116 | - YangLeaf<?> leafInfo = leafIterator.next(); | 116 | + YangLeaf leafInfo = leafIterator.next(); |
117 | 117 | ||
118 | // Check whether the mandatory value is set correctly. | 118 | // Check whether the mandatory value is set correctly. |
119 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 119 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -131,7 +131,8 @@ public class MandatoryListenerTest { | ... | @@ -131,7 +131,8 @@ public class MandatoryListenerTest { |
131 | } | 131 | } |
132 | 132 | ||
133 | /** | 133 | /** |
134 | - * Checks invalid mandatory statement(without statement end) and expects exception. | 134 | + * Checks invalid mandatory statement(without statement end) and expects |
135 | + * exception. | ||
135 | */ | 136 | */ |
136 | @Test | 137 | @Test |
137 | public void processMandatoryWithoutStatementEnd() throws IOException, ParserException { | 138 | public void processMandatoryWithoutStatementEnd() throws IOException, ParserException { |
... | @@ -141,7 +142,8 @@ public class MandatoryListenerTest { | ... | @@ -141,7 +142,8 @@ public class MandatoryListenerTest { |
141 | } | 142 | } |
142 | 143 | ||
143 | /** | 144 | /** |
144 | - * Checks mandatory statement as sub-statement of module and expects exception. | 145 | + * Checks mandatory statement as sub-statement of module and expects |
146 | + * exception. | ||
145 | */ | 147 | */ |
146 | @Test | 148 | @Test |
147 | public void processModuleSubStatementMandatory() throws IOException, ParserException { | 149 | public void processModuleSubStatementMandatory() throws IOException, ParserException { | ... | ... |
... | @@ -16,21 +16,20 @@ | ... | @@ -16,21 +16,20 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
23 | import org.onosproject.yangutils.datamodel.YangLeafList; | 25 | import org.onosproject.yangutils.datamodel.YangLeafList; |
26 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 27 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 28 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 29 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangList; | ||
28 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 30 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
29 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 31 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
30 | 32 | ||
31 | -import java.io.IOException; | ||
32 | -import java.util.ListIterator; | ||
33 | - | ||
34 | import static org.hamcrest.MatcherAssert.assertThat; | 33 | import static org.hamcrest.MatcherAssert.assertThat; |
35 | import static org.hamcrest.core.Is.is; | 34 | import static org.hamcrest.core.Is.is; |
36 | 35 | ||
... | @@ -62,8 +61,8 @@ public class MaxElementsListenerTest { | ... | @@ -62,8 +61,8 @@ public class MaxElementsListenerTest { |
62 | YangModule yangNode = (YangModule) node; | 61 | YangModule yangNode = (YangModule) node; |
63 | assertThat(yangNode.getName(), is("Test")); | 62 | assertThat(yangNode.getName(), is("Test")); |
64 | 63 | ||
65 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 64 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
66 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 65 | + YangLeafList leafListInfo = leafListIterator.next(); |
67 | 66 | ||
68 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 67 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); |
69 | assertThat(leafListInfo.getMaxElelements(), is(3)); | 68 | assertThat(leafListInfo.getMaxElelements(), is(3)); |
... | @@ -93,8 +92,8 @@ public class MaxElementsListenerTest { | ... | @@ -93,8 +92,8 @@ public class MaxElementsListenerTest { |
93 | } | 92 | } |
94 | 93 | ||
95 | /** | 94 | /** |
96 | - * Checks whether exception is thrown when invalid max-elements keyword | 95 | + * Checks whether exception is thrown when invalid max-elements keyword is |
97 | - * is given as input. | 96 | + * given as input. |
98 | */ | 97 | */ |
99 | @Test | 98 | @Test |
100 | public void processMaxElementsInvalidStatement() throws IOException, ParserException { | 99 | public void processMaxElementsInvalidStatement() throws IOException, ParserException { |
... | @@ -106,8 +105,8 @@ public class MaxElementsListenerTest { | ... | @@ -106,8 +105,8 @@ public class MaxElementsListenerTest { |
106 | } | 105 | } |
107 | 106 | ||
108 | /** | 107 | /** |
109 | - * Checks whether exception is thrown when max-elements statement without statement | 108 | + * Checks whether exception is thrown when max-elements statement without |
110 | - * end is given as input. | 109 | + * statement end is given as input. |
111 | */ | 110 | */ |
112 | @Test | 111 | @Test |
113 | public void processMaxElementsWithoutStatementEnd() throws IOException, ParserException { | 112 | public void processMaxElementsWithoutStatementEnd() throws IOException, ParserException { |
... | @@ -145,8 +144,8 @@ public class MaxElementsListenerTest { | ... | @@ -145,8 +144,8 @@ public class MaxElementsListenerTest { |
145 | YangModule yangNode = (YangModule) node; | 144 | YangModule yangNode = (YangModule) node; |
146 | assertThat(yangNode.getName(), is("Test")); | 145 | assertThat(yangNode.getName(), is("Test")); |
147 | 146 | ||
148 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 147 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
149 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 148 | + YangLeafList leafListInfo = leafListIterator.next(); |
150 | 149 | ||
151 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 150 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); |
152 | assertThat(leafListInfo.getMaxElelements(), is(2147483647)); | 151 | assertThat(leafListInfo.getMaxElelements(), is(2147483647)); | ... | ... |
... | @@ -16,21 +16,20 @@ | ... | @@ -16,21 +16,20 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
23 | import org.onosproject.yangutils.datamodel.YangLeafList; | 25 | import org.onosproject.yangutils.datamodel.YangLeafList; |
26 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 27 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 28 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 29 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangList; | ||
28 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 30 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
29 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 31 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
30 | 32 | ||
31 | -import java.io.IOException; | ||
32 | -import java.util.ListIterator; | ||
33 | - | ||
34 | import static org.hamcrest.MatcherAssert.assertThat; | 33 | import static org.hamcrest.MatcherAssert.assertThat; |
35 | import static org.hamcrest.core.Is.is; | 34 | import static org.hamcrest.core.Is.is; |
36 | 35 | ||
... | @@ -62,8 +61,8 @@ public class MinElementsListenerTest { | ... | @@ -62,8 +61,8 @@ public class MinElementsListenerTest { |
62 | YangModule yangNode = (YangModule) node; | 61 | YangModule yangNode = (YangModule) node; |
63 | assertThat(yangNode.getName(), is("Test")); | 62 | assertThat(yangNode.getName(), is("Test")); |
64 | 63 | ||
65 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 64 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
66 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 65 | + YangLeafList leafListInfo = leafListIterator.next(); |
67 | 66 | ||
68 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 67 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); |
69 | assertThat(leafListInfo.getMinElements(), is(3)); | 68 | assertThat(leafListInfo.getMinElements(), is(3)); |
... | @@ -93,8 +92,8 @@ public class MinElementsListenerTest { | ... | @@ -93,8 +92,8 @@ public class MinElementsListenerTest { |
93 | } | 92 | } |
94 | 93 | ||
95 | /** | 94 | /** |
96 | - * Checks whether exception is thrown when invalid min-elements keyword | 95 | + * Checks whether exception is thrown when invalid min-elements keyword is |
97 | - * is given as input. | 96 | + * given as input. |
98 | */ | 97 | */ |
99 | @Test | 98 | @Test |
100 | public void processMinElementsInvalidKeyword() throws IOException, ParserException { | 99 | public void processMinElementsInvalidKeyword() throws IOException, ParserException { |
... | @@ -106,8 +105,8 @@ public class MinElementsListenerTest { | ... | @@ -106,8 +105,8 @@ public class MinElementsListenerTest { |
106 | } | 105 | } |
107 | 106 | ||
108 | /** | 107 | /** |
109 | - * Checks whether exception is thrown when invalid min-elements value | 108 | + * Checks whether exception is thrown when invalid min-elements value is |
110 | - * is given as input. | 109 | + * given as input. |
111 | */ | 110 | */ |
112 | @Test | 111 | @Test |
113 | public void processMinElementsInvalidValue() throws IOException, ParserException { | 112 | public void processMinElementsInvalidValue() throws IOException, ParserException { |
... | @@ -117,8 +116,8 @@ public class MinElementsListenerTest { | ... | @@ -117,8 +116,8 @@ public class MinElementsListenerTest { |
117 | } | 116 | } |
118 | 117 | ||
119 | /** | 118 | /** |
120 | - * Checks whether exception is thrown when min-elements statement without statement | 119 | + * Checks whether exception is thrown when min-elements statement without |
121 | - * end is given as input. | 120 | + * statement end is given as input. |
122 | */ | 121 | */ |
123 | @Test | 122 | @Test |
124 | public void processMinElementsWithoutStatementEnd() throws IOException, ParserException { | 123 | public void processMinElementsWithoutStatementEnd() throws IOException, ParserException { | ... | ... |
... | @@ -16,25 +16,24 @@ | ... | @@ -16,25 +16,24 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 27 | import org.onosproject.yangutils.datamodel.YangLeaf; |
28 | +import org.onosproject.yangutils.datamodel.YangLeafList; | ||
29 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 30 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 31 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 32 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 33 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | -import org.onosproject.yangutils.datamodel.YangLeafList; | ||
32 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 34 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
33 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 35 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
34 | 36 | ||
35 | -import java.io.IOException; | ||
36 | -import java.util.ListIterator; | ||
37 | - | ||
38 | import static org.hamcrest.MatcherAssert.assertThat; | 37 | import static org.hamcrest.MatcherAssert.assertThat; |
39 | import static org.hamcrest.core.Is.is; | 38 | import static org.hamcrest.core.Is.is; |
40 | 39 | ||
... | @@ -66,8 +65,8 @@ public class ReferenceListenerTest { | ... | @@ -66,8 +65,8 @@ public class ReferenceListenerTest { |
66 | YangModule yangNode = (YangModule) node; | 65 | YangModule yangNode = (YangModule) node; |
67 | assertThat(yangNode.getName(), is("Test")); | 66 | assertThat(yangNode.getName(), is("Test")); |
68 | 67 | ||
69 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 68 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
70 | - YangLeaf<?> leafInfo = leafIterator.next(); | 69 | + YangLeaf leafInfo = leafIterator.next(); |
71 | 70 | ||
72 | // Check whether the reference is set correctly. | 71 | // Check whether the reference is set correctly. |
73 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 72 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -174,8 +173,8 @@ public class ReferenceListenerTest { | ... | @@ -174,8 +173,8 @@ public class ReferenceListenerTest { |
174 | assertThat(container.getReference(), is("\"container reference\"")); | 173 | assertThat(container.getReference(), is("\"container reference\"")); |
175 | 174 | ||
176 | // Check whether leaf properties as set correctly. | 175 | // Check whether leaf properties as set correctly. |
177 | - ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator(); | 176 | + ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator(); |
178 | - YangLeaf<?> leafInfo = leafIterator.next(); | 177 | + YangLeaf leafInfo = leafIterator.next(); |
179 | 178 | ||
180 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 179 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
181 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 180 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -211,8 +210,8 @@ public class ReferenceListenerTest { | ... | @@ -211,8 +210,8 @@ public class ReferenceListenerTest { |
211 | assertThat(yangList.getReference(), is("\"list reference\"")); | 210 | assertThat(yangList.getReference(), is("\"list reference\"")); |
212 | 211 | ||
213 | // Check whether leaf properties as set correctly. | 212 | // Check whether leaf properties as set correctly. |
214 | - ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator(); | 213 | + ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator(); |
215 | - YangLeaf<?> leafInfo = leafIterator.next(); | 214 | + YangLeaf leafInfo = leafIterator.next(); |
216 | 215 | ||
217 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 216 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
218 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 217 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -242,8 +241,8 @@ public class ReferenceListenerTest { | ... | @@ -242,8 +241,8 @@ public class ReferenceListenerTest { |
242 | YangModule yangNode = (YangModule) node; | 241 | YangModule yangNode = (YangModule) node; |
243 | assertThat(yangNode.getName(), is("Test")); | 242 | assertThat(yangNode.getName(), is("Test")); |
244 | 243 | ||
245 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 244 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
246 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 245 | + YangLeafList leafListInfo = leafListIterator.next(); |
247 | 246 | ||
248 | // Check whether description value is set correctly. | 247 | // Check whether description value is set correctly. |
249 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 248 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | ... | ... |
... | @@ -16,25 +16,24 @@ | ... | @@ -16,25 +16,24 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
25 | +import org.onosproject.yangutils.datamodel.YangContainer; | ||
26 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 27 | import org.onosproject.yangutils.datamodel.YangLeaf; |
28 | +import org.onosproject.yangutils.datamodel.YangLeafList; | ||
29 | +import org.onosproject.yangutils.datamodel.YangList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 30 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 31 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 32 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
28 | import org.onosproject.yangutils.datamodel.YangStatusType; | 33 | import org.onosproject.yangutils.datamodel.YangStatusType; |
29 | -import org.onosproject.yangutils.datamodel.YangContainer; | ||
30 | -import org.onosproject.yangutils.datamodel.YangList; | ||
31 | -import org.onosproject.yangutils.datamodel.YangLeafList; | ||
32 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 34 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
33 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 35 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
34 | 36 | ||
35 | -import java.io.IOException; | ||
36 | -import java.util.ListIterator; | ||
37 | - | ||
38 | import static org.hamcrest.MatcherAssert.assertThat; | 37 | import static org.hamcrest.MatcherAssert.assertThat; |
39 | import static org.hamcrest.core.Is.is; | 38 | import static org.hamcrest.core.Is.is; |
40 | 39 | ||
... | @@ -66,8 +65,8 @@ public class StatusListenerTest { | ... | @@ -66,8 +65,8 @@ public class StatusListenerTest { |
66 | YangModule yangNode = (YangModule) node; | 65 | YangModule yangNode = (YangModule) node; |
67 | assertThat(yangNode.getName(), is("Test")); | 66 | assertThat(yangNode.getName(), is("Test")); |
68 | 67 | ||
69 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 68 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
70 | - YangLeaf<?> leafInfo = leafIterator.next(); | 69 | + YangLeaf leafInfo = leafIterator.next(); |
71 | 70 | ||
72 | // Check whether the status is set correctly. | 71 | // Check whether the status is set correctly. |
73 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 72 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -92,8 +91,8 @@ public class StatusListenerTest { | ... | @@ -92,8 +91,8 @@ public class StatusListenerTest { |
92 | YangModule yangNode = (YangModule) node; | 91 | YangModule yangNode = (YangModule) node; |
93 | assertThat(yangNode.getName(), is("Test")); | 92 | assertThat(yangNode.getName(), is("Test")); |
94 | 93 | ||
95 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 94 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
96 | - YangLeaf<?> leafInfo = leafIterator.next(); | 95 | + YangLeaf leafInfo = leafIterator.next(); |
97 | 96 | ||
98 | // Check whether the status is set correctly. | 97 | // Check whether the status is set correctly. |
99 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 98 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -118,8 +117,8 @@ public class StatusListenerTest { | ... | @@ -118,8 +117,8 @@ public class StatusListenerTest { |
118 | YangModule yangNode = (YangModule) node; | 117 | YangModule yangNode = (YangModule) node; |
119 | assertThat(yangNode.getName(), is("Test")); | 118 | assertThat(yangNode.getName(), is("Test")); |
120 | 119 | ||
121 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 120 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
122 | - YangLeaf<?> leafInfo = leafIterator.next(); | 121 | + YangLeaf leafInfo = leafIterator.next(); |
123 | 122 | ||
124 | // Check whether the status is set correctly. | 123 | // Check whether the status is set correctly. |
125 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 124 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -184,8 +183,8 @@ public class StatusListenerTest { | ... | @@ -184,8 +183,8 @@ public class StatusListenerTest { |
184 | assertThat(container.getStatus(), is(YangStatusType.OBSOLETE)); | 183 | assertThat(container.getStatus(), is(YangStatusType.OBSOLETE)); |
185 | 184 | ||
186 | // Check whether leaf properties as set correctly. | 185 | // Check whether leaf properties as set correctly. |
187 | - ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator(); | 186 | + ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator(); |
188 | - YangLeaf<?> leafInfo = leafIterator.next(); | 187 | + YangLeaf leafInfo = leafIterator.next(); |
189 | 188 | ||
190 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 189 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
191 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 190 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -221,8 +220,8 @@ public class StatusListenerTest { | ... | @@ -221,8 +220,8 @@ public class StatusListenerTest { |
221 | assertThat(yangList.getStatus(), is(YangStatusType.CURRENT)); | 220 | assertThat(yangList.getStatus(), is(YangStatusType.CURRENT)); |
222 | 221 | ||
223 | // Check whether leaf properties as set correctly. | 222 | // Check whether leaf properties as set correctly. |
224 | - ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator(); | 223 | + ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator(); |
225 | - YangLeaf<?> leafInfo = leafIterator.next(); | 224 | + YangLeaf leafInfo = leafIterator.next(); |
226 | 225 | ||
227 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 226 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
228 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 227 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -252,8 +251,8 @@ public class StatusListenerTest { | ... | @@ -252,8 +251,8 @@ public class StatusListenerTest { |
252 | YangModule yangNode = (YangModule) node; | 251 | YangModule yangNode = (YangModule) node; |
253 | assertThat(yangNode.getName(), is("Test")); | 252 | assertThat(yangNode.getName(), is("Test")); |
254 | 253 | ||
255 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 254 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
256 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 255 | + YangLeafList leafListInfo = leafListIterator.next(); |
257 | 256 | ||
258 | // Check whether status is set correctly. | 257 | // Check whether status is set correctly. |
259 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 258 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | ... | ... |
1 | package org.onosproject.yangutils.parser.impl.listeners; | 1 | package org.onosproject.yangutils.parser.impl.listeners; |
2 | 2 | ||
3 | +import java.io.IOException; | ||
4 | +import java.util.ListIterator; | ||
5 | + | ||
3 | import org.junit.Test; | 6 | import org.junit.Test; |
7 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
4 | import org.onosproject.yangutils.datamodel.YangLeaf; | 8 | import org.onosproject.yangutils.datamodel.YangLeaf; |
9 | +import org.onosproject.yangutils.datamodel.YangLeafList; | ||
5 | import org.onosproject.yangutils.datamodel.YangModule; | 10 | import org.onosproject.yangutils.datamodel.YangModule; |
6 | import org.onosproject.yangutils.datamodel.YangNode; | 11 | import org.onosproject.yangutils.datamodel.YangNode; |
7 | import org.onosproject.yangutils.datamodel.YangNodeType; | 12 | import org.onosproject.yangutils.datamodel.YangNodeType; |
8 | -import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
9 | -import org.onosproject.yangutils.datamodel.YangLeafList; | ||
10 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 13 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
11 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 14 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
12 | 15 | ||
13 | -import java.io.IOException; | ||
14 | -import java.util.ListIterator; | ||
15 | - | ||
16 | import static org.hamcrest.MatcherAssert.assertThat; | 16 | import static org.hamcrest.MatcherAssert.assertThat; |
17 | import static org.hamcrest.core.Is.is; | 17 | import static org.hamcrest.core.Is.is; |
18 | 18 | ||
... | @@ -41,8 +41,8 @@ public class TypeListenerTest { | ... | @@ -41,8 +41,8 @@ public class TypeListenerTest { |
41 | YangModule yangNode = (YangModule) node; | 41 | YangModule yangNode = (YangModule) node; |
42 | assertThat(yangNode.getName(), is("Test")); | 42 | assertThat(yangNode.getName(), is("Test")); |
43 | 43 | ||
44 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 44 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
45 | - YangLeaf<?> leafInfo = leafIterator.next(); | 45 | + YangLeaf leafInfo = leafIterator.next(); |
46 | 46 | ||
47 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 47 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
48 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"hello\"")); | 48 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"hello\"")); |
... | @@ -67,8 +67,8 @@ public class TypeListenerTest { | ... | @@ -67,8 +67,8 @@ public class TypeListenerTest { |
67 | YangModule yangNode = (YangModule) node; | 67 | YangModule yangNode = (YangModule) node; |
68 | assertThat(yangNode.getName(), is("Test")); | 68 | assertThat(yangNode.getName(), is("Test")); |
69 | 69 | ||
70 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 70 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
71 | - YangLeaf<?> leafInfo = leafIterator.next(); | 71 | + YangLeaf leafInfo = leafIterator.next(); |
72 | 72 | ||
73 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 73 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
74 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 74 | assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\"")); |
... | @@ -93,8 +93,8 @@ public class TypeListenerTest { | ... | @@ -93,8 +93,8 @@ public class TypeListenerTest { |
93 | YangModule yangNode = (YangModule) node; | 93 | YangModule yangNode = (YangModule) node; |
94 | assertThat(yangNode.getName(), is("Test")); | 94 | assertThat(yangNode.getName(), is("Test")); |
95 | 95 | ||
96 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 96 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
97 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 97 | + YangLeafList leafListInfo = leafListIterator.next(); |
98 | 98 | ||
99 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 99 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); |
100 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | 100 | assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\"")); | ... | ... |
utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
... | @@ -16,25 +16,24 @@ | ... | @@ -16,25 +16,24 @@ |
16 | 16 | ||
17 | package org.onosproject.yangutils.parser.impl.listeners; | 17 | package org.onosproject.yangutils.parser.impl.listeners; |
18 | 18 | ||
19 | +import java.io.IOException; | ||
20 | +import java.util.ListIterator; | ||
21 | + | ||
19 | import org.junit.Rule; | 22 | import org.junit.Rule; |
20 | import org.junit.Test; | 23 | import org.junit.Test; |
21 | - | ||
22 | import org.junit.rules.ExpectedException; | 24 | import org.junit.rules.ExpectedException; |
23 | import org.onosproject.yangutils.datamodel.YangLeaf; | 25 | import org.onosproject.yangutils.datamodel.YangLeaf; |
26 | +import org.onosproject.yangutils.datamodel.YangLeafList; | ||
24 | import org.onosproject.yangutils.datamodel.YangModule; | 27 | import org.onosproject.yangutils.datamodel.YangModule; |
25 | import org.onosproject.yangutils.datamodel.YangNode; | 28 | import org.onosproject.yangutils.datamodel.YangNode; |
26 | import org.onosproject.yangutils.datamodel.YangNodeType; | 29 | import org.onosproject.yangutils.datamodel.YangNodeType; |
27 | import org.onosproject.yangutils.datamodel.YangStatusType; | 30 | import org.onosproject.yangutils.datamodel.YangStatusType; |
28 | -import org.onosproject.yangutils.datamodel.YangLeafList; | ||
29 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 31 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
30 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | 32 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
31 | 33 | ||
32 | -import java.io.IOException; | ||
33 | -import java.util.ListIterator; | ||
34 | - | ||
35 | import static org.hamcrest.MatcherAssert.assertThat; | 34 | import static org.hamcrest.MatcherAssert.assertThat; |
36 | -import static org.hamcrest.core.Is.is; | ||
37 | import static org.hamcrest.Matchers.nullValue; | 35 | import static org.hamcrest.Matchers.nullValue; |
36 | +import static org.hamcrest.core.Is.is; | ||
38 | 37 | ||
39 | /** | 38 | /** |
40 | * Test cases for units listener. | 39 | * Test cases for units listener. |
... | @@ -64,8 +63,8 @@ public class UnitsListenerTest { | ... | @@ -64,8 +63,8 @@ public class UnitsListenerTest { |
64 | YangModule yangNode = (YangModule) node; | 63 | YangModule yangNode = (YangModule) node; |
65 | assertThat(yangNode.getName(), is("Test")); | 64 | assertThat(yangNode.getName(), is("Test")); |
66 | 65 | ||
67 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 66 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
68 | - YangLeaf<?> leafInfo = leafIterator.next(); | 67 | + YangLeaf leafInfo = leafIterator.next(); |
69 | 68 | ||
70 | // Check whether units value is set correctly. | 69 | // Check whether units value is set correctly. |
71 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 70 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -113,8 +112,8 @@ public class UnitsListenerTest { | ... | @@ -113,8 +112,8 @@ public class UnitsListenerTest { |
113 | YangModule yangNode = (YangModule) node; | 112 | YangModule yangNode = (YangModule) node; |
114 | assertThat(yangNode.getName(), is("Test")); | 113 | assertThat(yangNode.getName(), is("Test")); |
115 | 114 | ||
116 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 115 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
117 | - YangLeaf<?> leafInfo = leafIterator.next(); | 116 | + YangLeaf leafInfo = leafIterator.next(); |
118 | 117 | ||
119 | // Check whether leaf properties is set correctly. | 118 | // Check whether leaf properties is set correctly. |
120 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 119 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
... | @@ -145,8 +144,8 @@ public class UnitsListenerTest { | ... | @@ -145,8 +144,8 @@ public class UnitsListenerTest { |
145 | YangModule yangNode = (YangModule) node; | 144 | YangModule yangNode = (YangModule) node; |
146 | assertThat(yangNode.getName(), is("Test")); | 145 | assertThat(yangNode.getName(), is("Test")); |
147 | 146 | ||
148 | - ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator(); | 147 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
149 | - YangLeaf<?> leafInfo = leafIterator.next(); | 148 | + YangLeaf leafInfo = leafIterator.next(); |
150 | 149 | ||
151 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); | 150 | assertThat(leafInfo.getLeafName(), is("invalid-interval")); |
152 | assertThat(leafInfo.getUnits(), is(nullValue())); | 151 | assertThat(leafInfo.getUnits(), is(nullValue())); |
... | @@ -180,8 +179,8 @@ public class UnitsListenerTest { | ... | @@ -180,8 +179,8 @@ public class UnitsListenerTest { |
180 | YangModule yangNode = (YangModule) node; | 179 | YangModule yangNode = (YangModule) node; |
181 | assertThat(yangNode.getName(), is("Test")); | 180 | assertThat(yangNode.getName(), is("Test")); |
182 | 181 | ||
183 | - ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator(); | 182 | + ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator(); |
184 | - YangLeafList<?> leafListInfo = leafListIterator.next(); | 183 | + YangLeafList leafListInfo = leafListIterator.next(); |
185 | 184 | ||
186 | // Check whether units value is set correctly. | 185 | // Check whether units value is set correctly. |
187 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | 186 | assertThat(leafListInfo.getLeafName(), is("invalid-interval")); | ... | ... |
-
Please register or login to post a comment