blob: ab84306d9a82bfbb9194170f547be3a5034ffba9 [file] [log] [blame]
Vidyashree Rama49abe712016-02-13 22:22:12 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vidyashree Rama49abe712016-02-13 22:22:12 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.yangutils.parser.impl.listeners;
18
Vinod Kumar S0c330cd2016-02-23 22:36:57 +053019import java.io.IOException;
20import java.util.ListIterator;
Vidyashree Rama49abe712016-02-13 22:22:12 +053021import org.junit.Rule;
22import org.junit.Test;
Vidyashree Rama49abe712016-02-13 22:22:12 +053023import org.junit.rules.ExpectedException;
Vinod Kumar S0c330cd2016-02-23 22:36:57 +053024import org.onosproject.yangutils.datamodel.YangContainer;
Gaurav Agrawal72cd1b72016-06-30 13:28:14 +053025import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
Vidyashree Rama49abe712016-02-13 22:22:12 +053026import org.onosproject.yangutils.datamodel.YangLeaf;
Vinod Kumar S0c330cd2016-02-23 22:36:57 +053027import org.onosproject.yangutils.datamodel.YangLeafList;
28import org.onosproject.yangutils.datamodel.YangList;
Vidyashree Rama49abe712016-02-13 22:22:12 +053029import org.onosproject.yangutils.datamodel.YangModule;
30import org.onosproject.yangutils.datamodel.YangNode;
31import org.onosproject.yangutils.datamodel.YangNodeType;
Vidyashree Rama49abe712016-02-13 22:22:12 +053032import org.onosproject.yangutils.datamodel.YangStatusType;
Vidyashree Rama49abe712016-02-13 22:22:12 +053033import org.onosproject.yangutils.parser.exceptions.ParserException;
34import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
35
Vidyashree Rama49abe712016-02-13 22:22:12 +053036import static org.hamcrest.MatcherAssert.assertThat;
37import static org.hamcrest.core.Is.is;
38
39/**
40 * Test cases for config listener.
41 */
42public class ConfigListenerTest {
43
44 @Rule
45 public ExpectedException thrown = ExpectedException.none();
46
47 private final YangUtilsParserManager manager = new YangUtilsParserManager();
48
49 /**
50 * Checks valid config statement.
51 */
52 @Test
53 public void processConfigTrue() throws IOException, ParserException {
54
55 YangNode node = manager.getDataModel("src/test/resources/ConfigTrue.yang");
56
57 // Check whether the data model tree returned is of type module.
58 assertThat((node instanceof YangModule), is(true));
59
60 // Check whether the node type is set properly to module.
61 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
62
63 // Check whether the module name is set correctly.
64 YangModule yangNode = (YangModule) node;
65 assertThat(yangNode.getName(), is("Test"));
66
Vinod Kumar S0c330cd2016-02-23 22:36:57 +053067 ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
68 YangLeaf leafInfo = leafIterator.next();
Vidyashree Rama49abe712016-02-13 22:22:12 +053069
70 // Check whether the Config value is set correctly.
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053071 assertThat(leafInfo.getName(), is("invalid-interval"));
Vidyashree Rama49abe712016-02-13 22:22:12 +053072 assertThat(leafInfo.isConfig(), is(true));
73 }
74
75 /**
76 * Checks valid config statement.
77 */
78 @Test
79 public void processConfigFalse() throws IOException, ParserException {
80
81 YangNode node = manager.getDataModel("src/test/resources/ConfigFalse.yang");
82
83 // Check whether the data model tree returned is of type module.
84 assertThat((node instanceof YangModule), is(true));
85
86 // Check whether the node type is set properly to module.
87 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
88
89 // Check whether the module name is set correctly.
90 YangModule yangNode = (YangModule) node;
91 assertThat(yangNode.getName(), is("Test"));
92
Vinod Kumar S0c330cd2016-02-23 22:36:57 +053093 ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
94 YangLeaf leafInfo = leafIterator.next();
Vidyashree Rama49abe712016-02-13 22:22:12 +053095
96 // Check whether the Config value is set correctly.
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053097 assertThat(leafInfo.getName(), is("invalid-interval"));
Vidyashree Rama49abe712016-02-13 22:22:12 +053098 assertThat(leafInfo.isConfig(), is(false));
99 }
100
101 /**
102 * Checks invalid config statement and expects parser exception.
103 */
104 @Test
105 public void processConfigWithoutStatementEnd() throws IOException, ParserException {
106 thrown.expect(ParserException.class);
107 thrown.expectMessage("missing ';' at '}'");
108 YangNode node = manager.getDataModel("src/test/resources/ConfigWithoutStatementEnd.yang");
109 }
110
111 /**
112 * Checks invalid config statement and expects parser exception.
113 */
114 @Test
115 public void processConfigInvalidValue() throws IOException, ParserException {
116 thrown.expect(ParserException.class);
Vidyashree Rama8a6b1282016-03-15 10:18:25 +0530117 thrown.expectMessage("YANG file error : config value invalid is not valid.");
Vidyashree Rama49abe712016-02-13 22:22:12 +0530118 YangNode node = manager.getDataModel("src/test/resources/ConfigInvalidValue.yang");
119 }
120
121 /**
122 * Checks invalid config statement and expects parser exception.
123 */
124 @Test
125 public void processConfigEmptyValue() throws IOException, ParserException {
126 thrown.expect(ParserException.class);
Vidyashree Rama8a6b1282016-03-15 10:18:25 +0530127 thrown.expectMessage("no viable alternative at input ';'");
Vidyashree Rama49abe712016-02-13 22:22:12 +0530128 YangNode node = manager.getDataModel("src/test/resources/ConfigEmptyValue.yang");
129 }
130
131 /**
Vidyashree Rama49abe712016-02-13 22:22:12 +0530132 * Checks config statement as sub-statement of container.
133 */
134 @Test
135 public void processContainerSubStatementConfig() throws IOException, ParserException {
136
137 YangNode node = manager.getDataModel("src/test/resources/ContainerSubStatementConfig.yang");
138
139 // Check whether the data model tree returned is of type module.
140 assertThat((node instanceof YangModule), is(true));
141
142 // Check whether the node type is set properly to module.
143 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
144
145 // Check whether the module name is set correctly.
146 YangModule yangNode = (YangModule) node;
147 assertThat(yangNode.getName(), is("Test"));
148
149 // Check whether the config value is set correctly.
150 YangContainer container = (YangContainer) yangNode.getChild();
151 assertThat(container.getName(), is("valid"));
152 assertThat(container.isConfig(), is(true));
153
154 // Check whether leaf properties as set correctly.
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530155 ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
156 YangLeaf leafInfo = leafIterator.next();
Vidyashree Rama49abe712016-02-13 22:22:12 +0530157
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530158 assertThat(leafInfo.getName(), is("invalid-interval"));
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530159 assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
Vidyashree Rama49abe712016-02-13 22:22:12 +0530160 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
161 assertThat(leafInfo.getUnits(), is("\"seconds\""));
162 assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
163 assertThat(leafInfo.isMandatory(), is(true));
164 assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
165 assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
166 }
167
168 /**
169 * Checks config statement as sub-statement of list.
170 */
171 @Test
172 public void processListSubStatementConfig() throws IOException, ParserException {
173
174 YangNode node = manager.getDataModel("src/test/resources/ListSubStatementConfig.yang");
175
176 assertThat((node instanceof YangModule), is(true));
177
178 // Check whether the node type is set properly to module.
179 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
180
181 // Check whether the module name is set correctly.
182 YangModule yangNode = (YangModule) node;
183 assertThat(yangNode.getName(), is("Test"));
184
185 // Check whether the list is child of module and config value is set.
186 YangList yangList = (YangList) yangNode.getChild();
187 assertThat(yangList.getName(), is("valid"));
188 assertThat(yangList.isConfig(), is(true));
189
190 // Check whether leaf properties as set correctly.
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530191 ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
192 YangLeaf leafInfo = leafIterator.next();
Vidyashree Rama49abe712016-02-13 22:22:12 +0530193
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530194 assertThat(leafInfo.getName(), is("invalid-interval"));
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530195 assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
Vidyashree Rama49abe712016-02-13 22:22:12 +0530196 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
197 assertThat(leafInfo.getUnits(), is("\"seconds\""));
198 assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
199 assertThat(leafInfo.isMandatory(), is(true));
200 assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
201 assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
202 }
203
204 /**
205 * Checks valid config statement as sub-statement of leaf-list.
206 */
207 @Test
208 public void processLeafListSubStatementConfig() throws IOException, ParserException {
209
210 YangNode node = manager.getDataModel("src/test/resources/LeafListSubStatementConfig.yang");
211
212 // Check whether the data model tree returned is of type module.
213 assertThat((node instanceof YangModule), is(true));
214
215 // Check whether the node type is set properly to module.
216 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
217
218 // Check whether the module name is set correctly.
219 YangModule yangNode = (YangModule) node;
220 assertThat(yangNode.getName(), is("Test"));
221
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530222 ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
223 YangLeafList leafListInfo = leafListIterator.next();
Vidyashree Rama49abe712016-02-13 22:22:12 +0530224
225 // Check whether config value is set correctly.
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530226 assertThat(leafListInfo.getName(), is("invalid-interval"));
Vidyashree Rama49abe712016-02-13 22:22:12 +0530227 assertThat(leafListInfo.isConfig(), is(true));
228 }
Vidyashree Ramaf4c617c2016-02-24 12:28:22 +0530229
230 /**
231 * Checks config statement's default Value.
232 */
233 @Test
234 public void processConfigDefaultValue() throws IOException, ParserException {
235
236 YangNode node = manager.getDataModel("src/test/resources/ConfigDefaultValue.yang");
237
238 assertThat((node instanceof YangModule), is(true));
239 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
240 YangModule yangNode = (YangModule) node;
241 assertThat(yangNode.getName(), is("Test"));
242
243 // Check whether the config value is set correctly.
244 YangContainer container = (YangContainer) yangNode.getChild();
245 assertThat(container.getName(), is("valid"));
246 assertThat(container.isConfig(), is(true));
247
248 // Check whether leaf properties as set correctly.
249 ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
250 YangLeaf leafInfo = leafIterator.next();
251
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530252 assertThat(leafInfo.getName(), is("invalid-interval"));
Vidyashree Ramaf4c617c2016-02-24 12:28:22 +0530253 assertThat(leafInfo.isConfig(), is(true));
254 }
255
256 /**
257 * Checks whether exception is throw when node's parent config set to false,
258 * no node underneath it can have config set to true.
259 */
260 @Test
261 public void processConfigFalseParentContainerChildLeafList() throws IOException, ParserException {
262 thrown.expect(ParserException.class);
263 thrown.expectMessage("Internal parser error detected: Unhandled parsed data at container \"valid\" after "
264 + "processing.\nError Information: If a container has \"config\" set to \"false\", no node underneath "
265 + "it can have \"config\" set to \"true\".");
266 YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentContainerChildLeafList.yang");
267 }
268
269 /**
270 * Checks whether exception is throw when node's parent config set to false,
271 * no node underneath it can have config set to true.
272 */
273 @Test
274 public void processConfigFalseParentContainerChildLeaf() throws IOException, ParserException {
275 thrown.expect(ParserException.class);
276 thrown.expectMessage("Internal parser error detected: Unhandled parsed data at container \"valid\" after "
277 + "processing.\nError Information: If a container has \"config\" set to \"false\", no node underneath "
278 + "it can have \"config\" set to \"true\".");
279 YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentContainerChildLeaf.yang");
280 }
281
282 /**
283 * Checks whether exception is throw when node's parent config set to false,
284 * no node underneath it can have config set to true.
285 */
286 @Test
287 public void processConfigFalseParentListChildLeafList() throws IOException, ParserException {
288 thrown.expect(ParserException.class);
289 thrown.expectMessage("Internal parser error detected: Unhandled parsed data at list \"valid\" after"
290 + " processing.\nError Information: If a list has \"config\" set to \"false\", no node underneath"
291 + " it can have \"config\" set to \"true\".");
292 YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentListChildLeafList.yang");
293 }
294
295 /**
296 * Checks whether exception is throw when node's parent config set to false,
297 * no node underneath it can have config set to true.
298 */
299 @Test
300 public void processConfigFalseParentListChildLeaf() throws IOException, ParserException {
301 thrown.expect(ParserException.class);
302 thrown.expectMessage("Internal parser error detected: Unhandled parsed data at list \"valid\" after"
303 + " processing.\nError Information: If a list has \"config\" set to \"false\", no node underneath"
304 + " it can have \"config\" set to \"true\".");
305 YangNode node = manager.getDataModel("src/test/resources/ConfigFalseParentListChildLeaf.yang");
306 }
307
308 /**
309 * Checks when config is not specified, the default is same as the parent's schema node's
310 * config statement's value.
311 */
312 @Test
313 public void processNoConfigContainerSubStatementContainer() throws IOException, ParserException {
314
315 YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementContainer.yang");
316
317 assertThat((node instanceof YangModule), is(true));
318 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
319 YangModule yangNode = (YangModule) node;
320 assertThat(yangNode.getName(), is("Test"));
321
322 // Check whether the config value is set correctly.
323 YangContainer container = (YangContainer) yangNode.getChild();
324 assertThat(container.getName(), is("hello"));
325 assertThat(container.isConfig(), is(true));
326
327 YangNode containerNode = container.getChild();
328 assertThat(containerNode instanceof YangContainer, is(true));
329 YangContainer childContainer = (YangContainer) containerNode;
330 assertThat(childContainer.getName(), is("valid"));
331 assertThat(childContainer.isConfig(), is(true));
332 }
333
334 /**
335 * Checks when config is not specified, the default is same as the parent's schema node's
336 * config statement's value.
337 */
338 @Test
339 public void processNoConfigContainerSubStatementLeafList() throws IOException, ParserException {
340
341 YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementLeafList.yang");
342
343 assertThat((node instanceof YangModule), is(true));
344 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
345 YangModule yangNode = (YangModule) node;
346 assertThat(yangNode.getName(), is("Test"));
347
348 // Check whether the config value is set correctly.
349 YangContainer container = (YangContainer) yangNode.getChild();
350 assertThat(container.getName(), is("valid"));
351 assertThat(container.isConfig(), is(true));
352
353 ListIterator<YangLeafList> leafListIterator = container.getListOfLeafList().listIterator();
354 YangLeafList leafListInfo = leafListIterator.next();
355
356 // Check whether config value is set correctly.
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530357 assertThat(leafListInfo.getName(), is("invalid-interval"));
Vidyashree Ramaf4c617c2016-02-24 12:28:22 +0530358 assertThat(leafListInfo.isConfig(), is(true));
359
360 }
361
362 /**
363 * Checks when config is not specified, the default is same as the parent's schema node's
364 * config statement's value.
365 */
366 @Test
367 public void processNoConfigContainerSubStatementLeaf() throws IOException, ParserException {
368
369 YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementLeaf.yang");
370
371 assertThat((node instanceof YangModule), is(true));
372 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
373 YangModule yangNode = (YangModule) node;
374 assertThat(yangNode.getName(), is("Test"));
375
376 // Check whether the config value is set correctly.
377 YangContainer container = (YangContainer) yangNode.getChild();
378 assertThat(container.getName(), is("valid"));
379 assertThat(container.isConfig(), is(true));
380
381 // Check whether leaf properties as set correctly.
382 ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
383 YangLeaf leafInfo = leafIterator.next();
384
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530385 assertThat(leafInfo.getName(), is("invalid-interval"));
Vidyashree Ramaf4c617c2016-02-24 12:28:22 +0530386 assertThat(leafInfo.isConfig(), is(true));
387 }
388
389 /**
390 * Checks when config is not specified, the default is same as the parent's schema node's
391 * config statement's value.
392 */
393 @Test
394 public void processNoConfigContainerSubStatementList() throws IOException, ParserException {
395
396 YangNode node = manager.getDataModel("src/test/resources/NoConfigContainerSubStatementList.yang");
397
398 assertThat((node instanceof YangModule), is(true));
399 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
400 YangModule yangNode = (YangModule) node;
401 assertThat(yangNode.getName(), is("Test"));
402
403 // Check whether the config value is set correctly.
404 YangContainer container = (YangContainer) yangNode.getChild();
405 assertThat(container.getName(), is("hello"));
406 assertThat(container.isConfig(), is(true));
407
408 YangNode listNode = container.getChild();
409 assertThat(listNode instanceof YangList, is(true));
410 YangList childList = (YangList) listNode;
411 assertThat(childList.getName(), is("valid"));
412 assertThat(childList.isConfig(), is(true));
413
414 }
415
416 /**
417 * Checks when config is not specified, the default is same as the parent's schema node's
418 * config statement's value.
419 */
420 @Test
421 public void processNoConfigListSubStatementContainer() throws IOException, ParserException {
422
423 YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementContainer.yang");
424
425 assertThat((node instanceof YangModule), is(true));
426 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
427 YangModule yangNode = (YangModule) node;
428 assertThat(yangNode.getName(), is("Test"));
429
430 // Check whether the config value is set correctly.
431 YangList list1 = (YangList) yangNode.getChild();
432 assertThat(list1.getName(), is("list1"));
433 assertThat(list1.isConfig(), is(true));
434
435 YangNode containerNode = list1.getChild();
436 assertThat(containerNode instanceof YangContainer, is(true));
437 YangContainer childContainer = (YangContainer) containerNode;
438 assertThat(childContainer.getName(), is("container1"));
439 assertThat(childContainer.isConfig(), is(true));
440 }
441
442 /**
443 * Checks when config is not specified, the default is same as the parent's schema node's
444 * config statement's value.
445 */
446 @Test
447 public void processNoConfigListSubStatementLeafList() throws IOException, ParserException {
448
449 YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementLeafList.yang");
450
451 assertThat((node instanceof YangModule), is(true));
452 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
453 YangModule yangNode = (YangModule) node;
454 assertThat(yangNode.getName(), is("Test"));
455
456 // Check whether the config value is set correctly.
457 YangList list1 = (YangList) yangNode.getChild();
458 assertThat(list1.getName(), is("valid"));
459 assertThat(list1.isConfig(), is(true));
460
461 ListIterator<YangLeafList> leafListIterator = list1.getListOfLeafList().listIterator();
462 YangLeafList leafListInfo = leafListIterator.next();
463
464 // Check whether config value is set correctly.
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530465 assertThat(leafListInfo.getName(), is("invalid-interval"));
Vidyashree Ramaf4c617c2016-02-24 12:28:22 +0530466 assertThat(leafListInfo.isConfig(), is(true));
467 }
468
469 /**
470 * Checks when config is not specified, the default is same as the parent's schema node's
471 * config statement's value.
472 */
473 @Test
474 public void processNoConfigListSubStatementLeaf() throws IOException, ParserException {
475
476 YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementLeaf.yang");
477
478 assertThat((node instanceof YangModule), is(true));
479 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
480 YangModule yangNode = (YangModule) node;
481 assertThat(yangNode.getName(), is("Test"));
482
483 // Check whether the config value is set correctly.
484 YangList list1 = (YangList) yangNode.getChild();
485 assertThat(list1.getName(), is("valid"));
486 assertThat(list1.isConfig(), is(true));
487
488 // Check whether leaf properties as set correctly.
489 ListIterator<YangLeaf> leafIterator = list1.getListOfLeaf().listIterator();
490 YangLeaf leafInfo = leafIterator.next();
491
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530492 assertThat(leafInfo.getName(), is("invalid-interval"));
Vidyashree Ramaf4c617c2016-02-24 12:28:22 +0530493 assertThat(leafInfo.isConfig(), is(true));
494 }
495
496 /**
497 * Checks when config is not specified, the default is same as the parent's schema node's
498 * config statement's value.
499 */
500 @Test
501 public void processNoConfigListSubStatementList() throws IOException, ParserException {
502
503 YangNode node = manager.getDataModel("src/test/resources/NoConfigListSubStatementList.yang");
504
505 assertThat((node instanceof YangModule), is(true));
506 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
507 YangModule yangNode = (YangModule) node;
508 assertThat(yangNode.getName(), is("Test"));
509
510 // Check whether the config value is set correctly.
511 YangList list1 = (YangList) yangNode.getChild();
512 assertThat(list1.getName(), is("valid"));
513 assertThat(list1.isConfig(), is(true));
514
515 YangNode listNode = list1.getChild();
516 assertThat(listNode instanceof YangList, is(true));
517 YangList childList = (YangList) listNode;
518 assertThat(childList.getName(), is("list1"));
519 assertThat(childList.isConfig(), is(true));
520 }
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +0530521}