blob: 368d5f900e0f2375bf7bb13ad0384268f77e6b6a [file] [log] [blame]
janani be18b5342016-07-13 21:06:41 +05301/*
2 * Copyright 2016-present 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
17package org.onosproject.yangutils.plugin.manager;
18
19import org.junit.Rule;
20import org.junit.Test;
21import org.junit.rules.ExpectedException;
22import org.onosproject.yangutils.datamodel.YangAtomicPath;
23import org.onosproject.yangutils.datamodel.YangContainer;
24import org.onosproject.yangutils.datamodel.YangInput;
25import org.onosproject.yangutils.datamodel.YangLeaf;
26import org.onosproject.yangutils.datamodel.YangLeafList;
27import org.onosproject.yangutils.datamodel.YangLeafRef;
28import org.onosproject.yangutils.datamodel.YangList;
29import org.onosproject.yangutils.datamodel.YangModule;
30import org.onosproject.yangutils.datamodel.YangNode;
31import org.onosproject.yangutils.datamodel.YangNodeType;
32import org.onosproject.yangutils.datamodel.YangPathArgType;
33import org.onosproject.yangutils.datamodel.YangPathOperator;
34import org.onosproject.yangutils.datamodel.YangPathPredicate;
35import org.onosproject.yangutils.datamodel.YangRelativePath;
36import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
37import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
38import org.onosproject.yangutils.linker.exceptions.LinkerException;
39import org.onosproject.yangutils.parser.exceptions.ParserException;
40import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
41
42import java.io.IOException;
43import java.util.Iterator;
44import java.util.List;
45import java.util.ListIterator;
46
47import static org.hamcrest.MatcherAssert.assertThat;
48import static org.hamcrest.core.Is.is;
49import static org.hamcrest.core.IsNull.nullValue;
50
51/**
52 * Test cases for testing leafref intra file linking.
53 */
54public class IntraFileLeafrefLinkingTest {
55
56 @Rule
57 public ExpectedException thrown = ExpectedException.none();
58
59 private final YangUtilsParserManager manager = new YangUtilsParserManager();
60
61 /**
62 * Checks self resolution when leafref under module refers to leaf in container.
63 */
64 @Test
65 public void processSelfResolutionWhenLeafrefReferToContainerLeaf()
66 throws IOException, ParserException {
67
68 YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToContainerLeaf.yang");
69
70 // Check whether the data model tree returned is of type module.
71 assertThat((node instanceof YangModule), is(true));
72
73 // Check whether the node type is set properly to module.
74 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
75
76 // Check whether the module name is set correctly.
77 YangModule yangNode = (YangModule) node;
78 assertThat(yangNode.getName(), is("ietf-network"));
79
80 ListIterator<YangLeaf> leafIterator;
81 YangLeaf leafInfo;
82
83 leafIterator = yangNode.getListOfLeaf().listIterator();
84 leafInfo = leafIterator.next();
85
86 // Check whether the information in the leaf is correct.
87 assertThat(leafInfo.getName(), is("network-ref"));
88 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
89 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
90 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
91
92 // Check whether leafref type got resolved.
93 assertThat(leafref.getResolvableStatus(),
94 is(ResolvableStatus.RESOLVED));
95
96 // Check the effective type for the leaf.
97 assertThat(leafref.getEffectiveDataType().getDataType(),
98 is(YangDataTypes.UINT8));
99 }
100
101 /**
102 * Checks self resolution when leafref under module refers to leaf in input of rpc.
103 */
104 @Test
105 public void processSelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc()
106 throws IOException, ParserException {
107
108 YangNode node = manager
109 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInModuleReferToLeafInInputOfRpc.yang");
110
111 // Check whether the data model tree returned is of type module.
112 assertThat((node instanceof YangModule), is(true));
113
114 // Check whether the node type is set properly to module.
115 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
116
117 // Check whether the module name is set correctly.
118 YangModule yangNode = (YangModule) node;
119 assertThat(yangNode.getName(), is("ietf-network"));
120
121 ListIterator<YangLeaf> leafIterator;
122 YangLeaf leafInfo;
123
124 leafIterator = yangNode.getListOfLeaf().listIterator();
125 leafInfo = leafIterator.next();
126
127 // Check whether the information in the leaf is correct.
128 assertThat(leafInfo.getName(), is("network-ref"));
129 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
130 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
131 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
132
133 // Check whether leafref type got resolved.
134 assertThat(leafref.getResolvableStatus(),
135 is(ResolvableStatus.RESOLVED));
136
137 // Check the effective type for the leaf.
138 assertThat(leafref.getEffectiveDataType().getDataType(),
139 is(YangDataTypes.UINT8));
140 }
141
142 /**
143 * Checks self resolution when leafref under module refers to grouping rpc with input as name.
144 * Rpc has input child also. So here the node search must be done by taking input node.
145 */
146 @Test
147 public void processSelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc()
148 throws IOException, ParserException {
149
150 YangNode node = manager
151 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpc.yang");
152
153 // Check whether the data model tree returned is of type module.
154 assertThat((node instanceof YangModule), is(true));
155
156 // Check whether the node type is set properly to module.
157 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
158
159 // Check whether the module name is set correctly.
160 YangModule yangNode = (YangModule) node;
161 assertThat(yangNode.getName(), is("ietf-network"));
162
163 ListIterator<YangLeaf> leafIterator;
164 YangLeaf leafInfo;
165
166 leafIterator = yangNode.getListOfLeaf().listIterator();
167 leafInfo = leafIterator.next();
168
169 // Check whether the information in the leaf is correct.
170 assertThat(leafInfo.getName(), is("network-ref"));
171 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
172 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
173 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
174
175 // Check whether leafref type got resolved.
176 assertThat(leafref.getResolvableStatus(),
177 is(ResolvableStatus.RESOLVED));
178
179 // Check the effective type for the leaf.
180 assertThat(leafref.getEffectiveDataType().getDataType(),
181 is(YangDataTypes.UINT8));
182 }
183
184 /**
185 * Checks self resolution when leafref under module refers to grouping under module.
186 * Grouping/typedef cannot be referred.
187 */
188 @Test
189 public void processSelfResolutionWhenLeafrefInModuleReferToGrouping()
190 throws IOException, ParserException {
191
192 thrown.expect(LinkerException.class);
193 thrown.expectMessage(
194 "YANG file error: The target node of leafref is invalid.");
195 YangNode node = manager
196 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInModuleReferToGroupingInModule.yang");
197 }
198
199 /**
200 * Checks self resolution error scenerio where leafref is without path.
201 */
202 @Test
203 public void processSelfResolutionWhenLeafrefDoesntHavePath()
204 throws IOException, ParserException {
205
206 thrown.expect(ParserException.class);
207 thrown.expectMessage(
208 "YANG file error : a type leafref must have one path statement.");
209 YangNode node = manager
210 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefDoesntHavePath.yang");
211 }
212
213 /**
214 * Checks self resolution when leafref under module refers to invalid node.
215 * Inter file linking also has to be done to know the error message.
216 */
217 @Test
218 public void processSelfResolutionWhenLeafrefInModuleReferToInvalidNode()
219 throws IOException, ParserException {
220
221 YangNode node = manager
222 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInModuleReferToInvalidNode.yang");
223 // Check whether the data model tree returned is of type module.
224 assertThat((node instanceof YangModule), is(true));
225
226 // Check whether the node type is set properly to module.
227 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
228
229 // Check whether the module name is set correctly.
230 YangModule yangNode = (YangModule) node;
231 assertThat(yangNode.getName(), is("ietf-network"));
232
233 ListIterator<YangLeaf> leafIterator;
234 YangLeaf leafInfo;
235
236 leafIterator = yangNode.getListOfLeaf().listIterator();
237 leafInfo = leafIterator.next();
238
239 // Check whether the information in the leaf is correct.
240 assertThat(leafInfo.getName(), is("network-ref"));
241 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
242 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
243 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
244
245 // Check whether leafref type got intra file resolved.
246 assertThat(leafref.getResolvableStatus(),
247 is(ResolvableStatus.INTRA_FILE_RESOLVED));
248 }
249
250 /**
251 * Checks self resolution when leafref under module refers to invalid node.
252 * Inter file linking also has to be done to know the error message.
253 */
254 @Test
255 public void processSelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion()
256 throws IOException, ParserException {
257
258 YangNode node = manager.getDataModel(
259 "src/test/resources/SelfResolutionWhenLeafrefIsInDeepTreeAndLeafIsInModuleWithReferredTypeUnion.yang");
260 // Check whether the data model tree returned is of type module.
261 assertThat((node instanceof YangModule), is(true));
262
263 // Check whether the node type is set properly to module.
264 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
265
266 // Check whether the module name is set correctly.
267 YangModule yangNode = (YangModule) node;
268 assertThat(yangNode.getName(), is("Test"));
269
270 YangContainer containerParent = (YangContainer) yangNode.getChild().getChild().getChild();
271 ListIterator<YangLeaf> leafIterator;
272 YangLeaf leafInfo;
273
274 leafIterator = containerParent.getListOfLeaf().listIterator();
275 leafInfo = leafIterator.next();
276
277 // Check whether the information in the leaf is correct.
278 assertThat(leafInfo.getName(), is("name"));
279 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
280 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
281 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
282
283 // Check whether leafref type got resolved.
284 assertThat(leafref.getResolvableStatus(),
285 is(ResolvableStatus.RESOLVED));
286
287 // Check the effective type for the leaf.
288 assertThat(leafref.getEffectiveDataType().getDataType(),
289 is(YangDataTypes.UNION));
290 }
291
292 /**
293 * Checks self resolution when leafref of leaf-list under module refers to leaf in container.
294 */
295 @Test
296 public void processSelfResolutionWhenLeafrefReferToContainerLeafList()
297 throws IOException, ParserException {
298
299 YangNode node = manager
300 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToContainerLeafList.yang");
301
302 // Check whether the data model tree returned is of type module.
303 assertThat((node instanceof YangModule), is(true));
304
305 // Check whether the node type is set properly to module.
306 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
307
308 // Check whether the module name is set correctly.
309 YangModule yangNode = (YangModule) node;
310 assertThat(yangNode.getName(), is("ietf-network"));
311
312 ListIterator<YangLeafList> leafListIterator;
313 YangLeafList leafListInfo;
314
315 leafListIterator = yangNode.getListOfLeafList().listIterator();
316 leafListInfo = leafListIterator.next();
317
318 // Check whether the information in the leaf is correct.
319 assertThat(leafListInfo.getName(), is("network-ref"));
320 assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
321 assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
322 YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
323
324 // Check whether leafref type got resolved.
325 assertThat(leafref.getResolvableStatus(),
326 is(ResolvableStatus.RESOLVED));
327
328 // Check the effective type for the leaf.
329 assertThat(leafref.getEffectiveDataType().getDataType(),
330 is(YangDataTypes.UINT8));
331 }
332
333 /**
334 * Checks self resolution when leafref of leaf-list under module refers to leaf-list in input of rpc.
335 */
336 @Test
337 public void processSelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc()
338 throws IOException, ParserException {
339
340 YangNode node = manager
341 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInModuleReferToLeafListInInputOfRpc.yang");
342
343 // Check whether the data model tree returned is of type module.
344 assertThat((node instanceof YangModule), is(true));
345
346 // Check whether the node type is set properly to module.
347 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
348
349 // Check whether the module name is set correctly.
350 YangModule yangNode = (YangModule) node;
351 assertThat(yangNode.getName(), is("ietf-network"));
352
353 ListIterator<YangLeafList> leafListIterator;
354 YangLeafList leafListInfo;
355
356 leafListIterator = yangNode.getListOfLeafList().listIterator();
357 leafListInfo = leafListIterator.next();
358
359 // Check whether the information in the leaf is correct.
360 assertThat(leafListInfo.getName(), is("network-ref"));
361 assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
362 assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
363 YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
364
365 // Check whether leafref type got resolved.
366 assertThat(leafref.getResolvableStatus(),
367 is(ResolvableStatus.RESOLVED));
368
369 // Check the effective type for the leaf.
370 assertThat(leafref.getEffectiveDataType().getDataType(),
371 is(YangDataTypes.UINT8));
372 }
373
374 /**
375 * Checks self resolution when leafref of leaf-list under module refers to invalid node.
376 * Inter file linking also has to be done to know the error message.
377 */
378 @Test
379 public void processSelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration()
380 throws IOException, ParserException {
381
382 YangNode node = manager.getDataModel(
383 "src/test/resources/" +
384 "SelfResolutionWhenLeafrefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang");
385 // Check whether the data model tree returned is of type module.
386 assertThat((node instanceof YangModule), is(true));
387
388 // Check whether the node type is set properly to module.
389 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
390
391 // Check whether the module name is set correctly.
392 YangModule yangNode = (YangModule) node;
393 assertThat(yangNode.getName(), is("Test"));
394
395 YangContainer containerParent = (YangContainer) yangNode.getChild().getChild().getChild();
396 ListIterator<YangLeafList> leafListListIterator;
397 YangLeafList leafListInfo;
398
399 leafListListIterator = containerParent.getListOfLeafList().listIterator();
400 leafListInfo = leafListListIterator.next();
401
402 // Check whether the information in the leaf is correct.
403 assertThat(leafListInfo.getName(), is("name"));
404 assertThat(leafListInfo.getDataType().getDataTypeName(), is("leafref"));
405 assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
406 YangLeafRef leafref = (YangLeafRef) (leafListInfo.getDataType().getDataTypeExtendedInfo());
407
408 // Check whether leafref type got resolved.
409 assertThat(leafref.getResolvableStatus(),
410 is(ResolvableStatus.RESOLVED));
411
412 // Check the effective type for the leaf.
413 assertThat(leafref.getEffectiveDataType().getDataType(),
414 is(YangDataTypes.ENUMERATION));
415 }
416
417 /**
418 * Checks the error scenerio when the referred node is not a leaf or leaf-list.
419 */
420 @Test
421 public void processSelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList()
422 throws IOException, ParserException {
423
424 YangNode node = manager
425 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefDoesNotReferToLeafOrLeafList.yang");
426
427 // Check whether the data model tree returned is of type module.
428 assertThat((node instanceof YangModule), is(true));
429
430 // Check whether the node type is set properly to module.
431 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
432
433 // Check whether the module name is set correctly.
434 YangModule yangNode = (YangModule) node;
435 assertThat(yangNode.getName(), is("ietf-network"));
436
437 ListIterator<YangLeaf> leafIterator;
438 YangLeaf leafInfo;
439
440 //YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
441 leafIterator = yangNode.getListOfLeaf().listIterator();
442 leafInfo = leafIterator.next();
443
444 // Check whether the information in the leaf is correct under grouping.
445 assertThat(leafInfo.getName(), is("network-ref"));
446 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
447 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
448 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
449
450 assertThat(leafref.getResolvableStatus(),
451 is(ResolvableStatus.INTRA_FILE_RESOLVED));
452 }
453
454 /**
455 * Checks self resolution when leafref of leaf-list under module refers to leaf in container.
456 */
457 @Test
458 public void processSelfResolutionWhenLeafrefInTypedefReferToContainer()
459 throws IOException, ParserException {
460
461 YangNode node = manager
462 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInTypedefReferToContainer.yang");
463
464 // Check whether the data model tree returned is of type module.
465 assertThat((node instanceof YangModule), is(true));
466
467 // Check whether the node type is set properly to module.
468 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
469
470 // Check whether the module name is set correctly.
471 YangModule yangNode = (YangModule) node;
472 assertThat(yangNode.getName(), is("ietf-network"));
473
474 YangContainer yangContainer = (YangContainer) yangNode.getChild();
475 ListIterator<YangLeaf> leafIterator;
476 YangLeaf leafInfo;
477 leafIterator = yangContainer.getListOfLeaf().listIterator();
478 leafInfo = leafIterator.next();
479
480 // Check whether the information in the leaf is correct under grouping.
481 assertThat(leafInfo.getName(), is("network-id"));
482 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
483
484 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
485
486 // Check whether leafref type got resolved.
487 assertThat(leafref.getResolvableStatus(),
488 is(ResolvableStatus.RESOLVED));
489
490 // Check the effective type for the leaf.
491 assertThat(leafref.getEffectiveDataType().getDataType(),
492 is(YangDataTypes.UINT8));
493 }
494
495 /**
496 * Checks self resolution when leafref of leaf-list under module refers to leaf-list in input of rpc.
497 */
498 @Test
499 public void processSelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc()
500 throws IOException, ParserException {
501
502 YangNode node = manager.getDataModel(
503 "src/test/resources/SelfResolutionWhenLeafrefInTypedefModuleReferToLeafListInInputOfRpc.yang");
504
505 // Check whether the data model tree returned is of type module.
506 assertThat((node instanceof YangModule), is(true));
507
508 // Check whether the node type is set properly to module.
509 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
510
511 // Check whether the module name is set correctly.
512 YangModule yangNode = (YangModule) node;
513 assertThat(yangNode.getName(), is("ietf-network"));
514
515 YangInput yangInput = (YangInput) yangNode.getChild().getChild();
516
517 ListIterator<YangLeafList> leafListIterator;
518 YangLeafList yangLeafListInfo;
519 leafListIterator = yangInput.getListOfLeafList().listIterator();
520 yangLeafListInfo = leafListIterator.next();
521
522 // Check whether the information in the leaf is correct under grouping.
523 assertThat(yangLeafListInfo.getName(), is("network-id"));
524 assertThat(yangLeafListInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
525
526 YangLeafRef leafref = (YangLeafRef) (yangLeafListInfo.getDataType().getDataTypeExtendedInfo());
527
528 // Check whether leafref type got resolved.
529 assertThat(leafref.getResolvableStatus(),
530 is(ResolvableStatus.RESOLVED));
531
532 // Check the effective type for the leaf.
533 assertThat(leafref.getEffectiveDataType().getDataType(),
534 is(YangDataTypes.UINT8));
535 }
536
537 /**
538 * Checks self resolution when leafref of leaf-list under module refers to invalid node.
539 * Inter file linking also has to be done to know the error message.
540 */
541 @Test
542 public void processSelfResolutionWhenLeafrefInTypedefIsInDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration()
543 throws IOException, ParserException {
544
545 YangNode node = manager.getDataModel(
546 "src/test/resources/" +
547 "SelfResolutionWhenLeafrefInTypedefIs" +
548 "InDeepTreeAndLeafListIsInModuleWithReferredTypeEnumeration.yang");
549 // Check whether the data model tree returned is of type module.
550 assertThat((node instanceof YangModule), is(true));
551
552 // Check whether the node type is set properly to module.
553 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
554
555 // Check whether the module name is set correctly.
556 YangModule yangNode = (YangModule) node;
557 assertThat(yangNode.getName(), is("Test"));
558
559 YangContainer yangContainer = (YangContainer) yangNode.getChild().getChild().getChild().getNextSibling();
560
561 ListIterator<YangLeaf> leafIterator;
562 YangLeaf yangLeafInfo;
563 leafIterator = yangContainer.getListOfLeaf().listIterator();
564 yangLeafInfo = leafIterator.next();
565
566 // Check whether the information in the leaf is correct under grouping.
567 assertThat(yangLeafInfo.getName(), is("interval"));
568 assertThat(yangLeafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
569
570 YangLeafRef leafref = (YangLeafRef) (yangLeafInfo.getDataType().getDataTypeExtendedInfo());
571
572 // Check whether leafref type got resolved.
573 assertThat(leafref.getResolvableStatus(),
574 is(ResolvableStatus.RESOLVED));
575
576 // Check the effective type for the leaf.
577 assertThat(leafref.getEffectiveDataType().getDataType(),
578 is(YangDataTypes.ENUMERATION));
579 }
580
581 /**
582 * Checks self resolution when grouping and uses are siblings.
583 * Grouping followed by uses.
584 */
585 @Test
586 public void processSelfResolutionWhenLeafrefRefersAnotherLeafref()
587 throws IOException, ParserException {
588
589 YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToAnotherLeafref.yang");
590 // Check whether the data model tree returned is of type module.
591 assertThat((node instanceof YangModule), is(true));
592
593 // Check whether the node type is set properly to module.
594 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
595
596 // Check whether the module name is set correctly.
597 YangModule yangNode = (YangModule) node;
598 assertThat(yangNode.getName(), is("ietf-network"));
599
600 ListIterator<YangLeaf> leafIterator;
601 YangLeaf leafInfo;
602
603 //YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
604 leafIterator = yangNode.getListOfLeaf().listIterator();
605 leafInfo = leafIterator.next();
606
607 // Check whether the information in the leaf is correct under grouping.
608 assertThat(leafInfo.getName(), is("network-ref"));
609 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
610 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
611 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
612
613 assertThat(leafref.getResolvableStatus(),
614 is(ResolvableStatus.RESOLVED));
615
616 assertThat(leafref.getEffectiveDataType().getDataType(),
617 is(YangDataTypes.UINT8));
618 }
619
620 /**
621 * Checks self resolution when leafref refers to many other leafref.
622 */
623 @Test
624 public void processSelfResolutionWhenLeafrefReferToMultipleLeafref()
625 throws IOException, ParserException {
626
627 YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToMultipleLeafref.yang");
628 // Check whether the data model tree returned is of type module.
629 assertThat((node instanceof YangModule), is(true));
630
631 // Check whether the node type is set properly to module.
632 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
633
634 // Check whether the module name is set correctly.
635 YangModule yangNode = (YangModule) node;
636 assertThat(yangNode.getName(), is("Test"));
637
638 YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
639 YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
640
641 ListIterator<YangLeaf> leafIterator;
642 YangLeaf leafInfo;
643
644 leafIterator = containerInList.getListOfLeaf().listIterator();
645 leafInfo = leafIterator.next();
646
647 // Check whether the information in the leaf is correct under grouping.
648 assertThat(leafInfo.getName(), is("remove"));
649 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
650 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
651 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
652
653 assertThat(leafref.getResolvableStatus(),
654 is(ResolvableStatus.RESOLVED));
655
656 assertThat(leafref.getEffectiveDataType().getDataType(),
657 is(YangDataTypes.ENUMERATION));
658 }
659
660 /**
661 * Checks self resolution when grouping and uses are siblings.
662 * Grouping followed by uses.
663 */
664 @Test
665 public void processSelfResolutionWhenLeafrefRefersAnotherDerivedType()
666 throws IOException, ParserException {
667
668 YangNode node = manager
669 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToAnotherDerivedType.yang");
670 // Check whether the data model tree returned is of type module.
671 assertThat((node instanceof YangModule), is(true));
672
673 // Check whether the node type is set properly to module.
674 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
675
676 // Check whether the module name is set correctly.
677 YangModule yangNode = (YangModule) node;
678 assertThat(yangNode.getName(), is("ietf-network"));
679
680 ListIterator<YangLeaf> leafIterator;
681 YangLeaf leafInfo;
682
683 //YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling();
684 leafIterator = yangNode.getListOfLeaf().listIterator();
685 leafInfo = leafIterator.next();
686
687 // Check whether the information in the leaf is correct under grouping.
688 assertThat(leafInfo.getName(), is("network-ref"));
689 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
690 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
691 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
692
693 assertThat(leafref.getResolvableStatus(),
694 is(ResolvableStatus.RESOLVED));
695
696 assertThat(leafref.getEffectiveDataType().getDataType(),
697 is(YangDataTypes.DERIVED));
698 }
699
700 /**
701 * Checks self resolution when leafref refers to many other leafref.
702 */
703 @Test
704 public void processSelfResolutionWhenLeafrefReferToMultipleTypedef()
705 throws IOException, ParserException {
706
707 YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToMultipleTypedef.yang");
708 // Check whether the data model tree returned is of type module.
709 assertThat((node instanceof YangModule), is(true));
710
711 // Check whether the node type is set properly to module.
712 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
713
714 // Check whether the module name is set correctly.
715 YangModule yangNode = (YangModule) node;
716 assertThat(yangNode.getName(), is("Test"));
717
718 YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
719 YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
720
721 ListIterator<YangLeaf> leafIterator;
722 YangLeaf leafInfo;
723
724 leafIterator = containerInList.getListOfLeaf().listIterator();
725 leafInfo = leafIterator.next();
726
727 // Check whether the information in the leaf is correct under grouping.
728 assertThat(leafInfo.getName(), is("remove"));
729 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
730 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
731 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
732
733 assertThat(leafref.getResolvableStatus(),
734 is(ResolvableStatus.RESOLVED));
735
736 assertThat(leafref.getEffectiveDataType().getDataType(),
737 is(YangDataTypes.DERIVED));
738 }
739
740 /**
741 * Checks self resolution when leafref refers to many other leaf with derived type
742 * which in turn referring to another leaf.
743 */
744 @Test
745 public void processSelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref()
746 throws IOException, ParserException {
747
748 YangNode node = manager.getDataModel(
749 "src/test/resources/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafref.yang");
750 // Check whether the data model tree returned is of type module.
751 assertThat((node instanceof YangModule), is(true));
752
753 // Check whether the node type is set properly to module.
754 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
755
756 // Check whether the module name is set correctly.
757 YangModule yangNode = (YangModule) node;
758 assertThat(yangNode.getName(), is("Test"));
759
760 YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
761 YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
762
763 ListIterator<YangLeaf> leafIterator;
764 YangLeaf leafInfo;
765
766 leafIterator = containerInList.getListOfLeaf().listIterator();
767 leafInfo = leafIterator.next();
768
769 // Check whether the information in the leaf is correct under grouping.
770 assertThat(leafInfo.getName(), is("remove"));
771 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
772 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
773 YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
774
775 assertThat(leafref.getResolvableStatus(),
776 is(ResolvableStatus.RESOLVED));
777
778 assertThat(leafref.getEffectiveDataType().getDataType(),
779 is(YangDataTypes.ENUMERATION));
780 }
781
782 /**
783 * Checks self resolution when leafref under module refers to leaf in container with relative path.
784 */
785 @Test
786 public void processSelfResolutionWhenLeafrefReferToContainerLeafRelPath()
787 throws IOException, ParserException {
788
789 YangNode node = manager
790 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToContainerLeafRelPath.yang");
791
792 // Check whether the data model tree returned is of type module.
793 assertThat((node instanceof YangModule), is(true));
794
795 // Check whether the node type is set properly to module.
796 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
797
798 // Check whether the module name is set correctly.
799 YangModule yangNode = (YangModule) node;
800 assertThat(yangNode.getName(), is("ietf-network"));
801
802 ListIterator<YangLeaf> leafIterator;
803 YangLeaf leafInfo;
804
805 leafIterator = yangNode.getListOfLeaf().listIterator();
806 leafInfo = leafIterator.next();
807
808 // Check whether the information in the leaf is correct.
809 assertThat(leafInfo.getName(), is("network-ref"));
810 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
811 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
812 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
813
814 // Check whether leafref type got resolved.
815 assertThat(leafref.getResolvableStatus(),
816 is(ResolvableStatus.RESOLVED));
817
818 // Check the effective type for the leaf.
819 assertThat(leafref.getEffectiveDataType().getDataType(),
820 is(YangDataTypes.UINT8));
821 }
822
823 /**
824 * Checks self resolution when leafref under module refers to grouping rpc with input as name.
825 * Rpc has input child also. So here the node search must be done by taking input node using relative path.
826 */
827 @Test
828 public void processSelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath()
829 throws IOException, ParserException {
830
831 YangNode node = manager.getDataModel(
832 "src/test/resources/SelfResolutionWhenLeafrefInModuleReferToGroupingWithInputInRpcRelPath.yang");
833
834 // Check whether the data model tree returned is of type module.
835 assertThat((node instanceof YangModule), is(true));
836
837 // Check whether the node type is set properly to module.
838 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
839
840 // Check whether the module name is set correctly.
841 YangModule yangNode = (YangModule) node;
842 assertThat(yangNode.getName(), is("ietf-network"));
843
844 ListIterator<YangLeaf> leafIterator;
845 YangLeaf leafInfo;
846
847 leafIterator = yangNode.getListOfLeaf().listIterator();
848 leafInfo = leafIterator.next();
849
850 // Check whether the information in the leaf is correct.
851 assertThat(leafInfo.getName(), is("network-ref"));
852 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
853 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
854 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
855
856 // Check whether leafref type got resolved.
857 assertThat(leafref.getResolvableStatus(),
858 is(ResolvableStatus.RESOLVED));
859
860 // Check the effective type for the leaf.
861 assertThat(leafref.getEffectiveDataType().getDataType(),
862 is(YangDataTypes.UINT8));
863 }
864
865 /**
866 * Checks self resolution when leafref under module refers to invalid root node with relative path.
867 */
868 @Test
869 public void processSelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath()
870 throws IOException, ParserException {
871
872 thrown.expect(LinkerException.class);
873 thrown.expectMessage(
874 "YANG file error: The target node of leafref is invalid.");
875 YangNode node = manager
876 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInModuleReferToInvalidRootNodeRelPath.yang");
877 }
878
879 /**
880 * Checks self resolution when leafref under module refers to invalid node.
881 * Inter file linking also has to be done to know the error message with relative path.
882 */
883 @Test
884 public void processSelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath()
885 throws IOException, ParserException {
886
887 YangNode node = manager
888 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInModuleReferToInvalidNodeRelPath.yang");
889 // Check whether the data model tree returned is of type module.
890 assertThat((node instanceof YangModule), is(true));
891
892 // Check whether the node type is set properly to module.
893 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
894
895 // Check whether the module name is set correctly.
896 YangModule yangNode = (YangModule) node;
897 assertThat(yangNode.getName(), is("ietf-network"));
898
899 ListIterator<YangLeaf> leafIterator;
900 YangLeaf leafInfo;
901
902 leafIterator = yangNode.getListOfLeaf().listIterator();
903 leafInfo = leafIterator.next();
904
905 // Check whether the information in the leaf is correct.
906 assertThat(leafInfo.getName(), is("network-ref"));
907 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
908 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
909 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
910
911 // Check whether leafref type got intra file resolved.
912 assertThat(leafref.getResolvableStatus(),
913 is(ResolvableStatus.INTRA_FILE_RESOLVED));
914 }
915
916 /**
917 * Checks self resolution when leafref of leaf-list under module refers to leaf in container with relative path.
918 */
919 @Test
920 public void processSelfResolutionWhenLeafrefInTypedefReferToContainerRelPath()
921 throws IOException, ParserException {
922
923 YangNode node = manager
924 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefInTypedefReferToContainerRelPath.yang");
925
926 // Check whether the data model tree returned is of type module.
927 assertThat((node instanceof YangModule), is(true));
928
929 // Check whether the node type is set properly to module.
930 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
931
932 // Check whether the module name is set correctly.
933 YangModule yangNode = (YangModule) node;
934 assertThat(yangNode.getName(), is("ietf-network"));
935 ListIterator<YangLeaf> leafIterator;
936 YangLeaf leafInfo;
937 YangContainer yangContainer = (YangContainer) yangNode.getChild();
938 leafIterator = yangContainer.getListOfLeaf().listIterator();
939 leafInfo = leafIterator.next();
940
941 // Check whether the information in the leaf is correct under grouping.
942 assertThat(leafInfo.getName(), is("network-id"));
943 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
944
945 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
946
947 // Check whether leafref type got resolved.
948 assertThat(leafref.getResolvableStatus(),
949 is(ResolvableStatus.RESOLVED));
950
951 // Check the effective type for the leaf.
952 assertThat(leafref.getEffectiveDataType().getDataType(),
953 is(YangDataTypes.UINT8));
954 }
955
956 /**
957 * Checks self resolution when leafref refers to many other leafref with relative path.
958 */
959 @Test
960 public void processSelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath()
961 throws IOException, ParserException {
962
963 YangNode node = manager
964 .getDataModel("src/test/resources/SelfResolutionWhenLeafrefReferToMultipleLeafrefRelPath.yang");
965 // Check whether the data model tree returned is of type module.
966 assertThat((node instanceof YangModule), is(true));
967
968 // Check whether the node type is set properly to module.
969 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
970
971 // Check whether the module name is set correctly.
972 YangModule yangNode = (YangModule) node;
973 assertThat(yangNode.getName(), is("Test"));
974
975 YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
976 YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
977
978 ListIterator<YangLeaf> leafIterator;
979 YangLeaf leafInfo;
980
981 leafIterator = containerInList.getListOfLeaf().listIterator();
982 leafInfo = leafIterator.next();
983
984 // Check whether the information in the leaf is correct under grouping.
985 assertThat(leafInfo.getName(), is("remove"));
986 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
987 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
988 YangLeafRef leafref = (YangLeafRef) (leafInfo.getDataType().getDataTypeExtendedInfo());
989
990 assertThat(leafref.getResolvableStatus(),
991 is(ResolvableStatus.RESOLVED));
992
993 assertThat(leafref.getEffectiveDataType().getDataType(),
994 is(YangDataTypes.ENUMERATION));
995 }
996
997 /**
998 * Checks self resolution when leafref refers to many other leaf with derived type
999 * which in turn referring to another leaf with relative type.
1000 */
1001 @Test
1002 public void processSelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType()
1003 throws IOException, ParserException {
1004
1005 YangNode node = manager.getDataModel(
1006 "src/test/resources/SelfResolutionWhenLeafrefReferToDerivedTypeReferringToLeafWithLeafrefRelType.yang");
1007 // Check whether the data model tree returned is of type module.
1008 assertThat((node instanceof YangModule), is(true));
1009
1010 // Check whether the node type is set properly to module.
1011 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
1012
1013 // Check whether the module name is set correctly.
1014 YangModule yangNode = (YangModule) node;
1015 assertThat(yangNode.getName(), is("Test"));
1016
1017 YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
1018 YangContainer containerInList = (YangContainer) containerInModule.getChild().getChild();
1019
1020 ListIterator<YangLeaf> leafIterator;
1021 YangLeaf leafInfo;
1022
1023 leafIterator = containerInList.getListOfLeaf().listIterator();
1024 leafInfo = leafIterator.next();
1025
1026 // Check whether the information in the leaf is correct under grouping.
1027 assertThat(leafInfo.getName(), is("remove"));
1028 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
1029 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
1030 YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
1031
1032 assertThat(leafref.getResolvableStatus(),
1033 is(ResolvableStatus.RESOLVED));
1034
1035 assertThat(leafref.getEffectiveDataType().getDataType(),
1036 is(YangDataTypes.ENUMERATION));
1037 }
1038
1039 /**
1040 * Checks the valid scenerios of path argument having proper setters.
1041 */
1042 @Test
1043 public void processPathArgumentStatement()
1044 throws IOException, ParserException {
1045
1046 YangNode node = manager.getDataModel("src/test/resources/PathListener.yang");
1047 // Check whether the data model tree returned is of type module.
1048 assertThat((node instanceof YangModule), is(true));
1049
1050 // Check whether the node type is set properly to module.
1051 assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
1052
1053 // Check whether the module name is set correctly.
1054 YangModule yangNode = (YangModule) node;
1055 assertThat(yangNode.getName(), is("PathListener"));
1056 YangList listInModule = (YangList) yangNode.getChild();
1057
1058 YangContainer containerInModule = (YangContainer) yangNode.getChild().getNextSibling();
1059 ListIterator<YangLeaf> leafIterator;
1060 YangLeaf leafInfo;
1061
1062 YangLeaf leafNameInList = listInModule.getListOfLeaf().listIterator().next();
1063
1064 leafIterator = containerInModule.getListOfLeaf().listIterator();
1065 leafInfo = leafIterator.next();
1066
1067 // Check whether the information in the leaf is correct under grouping.
1068 assertThat(leafInfo.getName(), is("ifname"));
1069 assertThat(leafInfo.getDataType().getDataTypeName(), is("leafref"));
1070 assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
1071 YangLeafRef leafref = (YangLeafRef) leafInfo.getDataType().getDataTypeExtendedInfo();
1072 assertThat(leafref.getPathType(), is(YangPathArgType.RELATIVE_PATH));
1073
1074 YangRelativePath relativePathForName = leafref.getRelativePath();
1075 assertThat(relativePathForName.getAncestorNodeCount(), is(2));
1076 List<YangAtomicPath> absPathForName = relativePathForName.getAtomicPathList();
1077 Iterator<YangAtomicPath> absPathIteratorForName = absPathForName.listIterator();
1078 YangAtomicPath abspathForName = absPathIteratorForName.next();
1079 assertThat(abspathForName.getNodeIdentifier().getName(), is("interface"));
1080 assertThat(abspathForName.getNodeIdentifier().getPrefix(), is("test"));
1081 YangAtomicPath abspath1 = absPathIteratorForName.next();
1082 assertThat(abspath1.getNodeIdentifier().getName(), is("name"));
1083 assertThat(abspath1.getNodeIdentifier().getPrefix(), is("test"));
1084
1085 YangLeaf leafInfo1 = leafIterator.next();
1086 // Check whether the information in the leaf is correct under grouping.
1087 assertThat(leafInfo1.getName(), is("status"));
1088 assertThat(leafInfo1.getDataType().getDataTypeName(), is("leafref"));
1089 assertThat(leafInfo1.getDataType().getDataType(), is(YangDataTypes.LEAFREF));
1090
1091 YangLeafRef leafref1 = (YangLeafRef) leafInfo1.getDataType().getDataTypeExtendedInfo();
1092 assertThat(leafref1.getPathType(), is(YangPathArgType.ABSOLUTE_PATH));
1093
1094 List<YangAtomicPath> absolutePathList = leafref1.getAtomicPath();
1095 Iterator<YangAtomicPath> absPathIterator = absolutePathList.listIterator();
1096 YangAtomicPath abspath = absPathIterator.next();
1097 assertThat(abspath.getNodeIdentifier().getName(), is("interface"));
1098 assertThat(abspath.getNodeIdentifier().getPrefix(), is("test"));
1099
1100 List<YangPathPredicate> pathPredicateList = abspath.getPathPredicatesList();
1101 Iterator<YangPathPredicate> pathPredicate = pathPredicateList.listIterator();
1102 YangPathPredicate pathPredicate1 = pathPredicate.next();
1103 assertThat(pathPredicate1.getNodeIdentifier().getName(), is("name"));
1104 assertThat(pathPredicate1.getNodeIdentifier().getPrefix(), nullValue());
1105 assertThat(pathPredicate1.getRightRelativePath().getAncestorNodeCount(), is(1));
1106 assertThat(pathPredicate1.getPathOperator(), is(YangPathOperator.EQUALTO));
1107 assertThat(pathPredicate1.getRightRelativePath().getAtomicPathList().listIterator().next().getNodeIdentifier()
1108 .getName(), is("ifname"));
1109 YangAtomicPath abspath2 = absPathIterator.next();
1110 assertThat(abspath2.getNodeIdentifier().getName(), is("admin-status"));
1111 assertThat(abspath2.getNodeIdentifier().getPrefix(), is("test"));
1112
1113 assertThat(pathPredicate1.getLeftAxisNode(), is(leafNameInList));
1114 assertThat(pathPredicate1.getRightAxisNode(), is(leafInfo));
1115 }
1116}