Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
4231
Description
I am trying to mount a Netconf device that has an YANG file that uses augmentation under "uses" clause. The YANG snippet looks like this.
augment /if:interfaces/interfaces-bridge:bridge {
uses firewall-if-parameters
{
augment firewall {
leaf-list l2
}
}
}
Note that there are two augmentation targets here. Yang tools fails to handle this condition. It is doing an unsafe type cast while handling the augmentations under "uses" clause.
If I manually take out the uses augment as pasted below, this file is parsed properly and device is mounted.
================= Section which YANG tools fails to parse.
augment firewall {
leaf-list l2
}
}
================
I think the issue is YANG tools may be handling the direct uses augmentation well but if this augmentation comes under another augmentation as specified in the snippet, it is having issues.
The issue is in the resolveUsesAugment method of java file YangParserImpl.java.
Please note that this happens in both Helium and Lithium.
Stack trace is below:
java.lang.ClassCastException: org.opendaylight.yangtools.yang.parser.builder.impl.AugmentationSchemaBuilderImpl cannot be cast to org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.resolveUsesAugment(YangParserImpl.java:954)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.resolveUses(YangParserImpl.java:1157)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.resolveUsesForNodes(YangParserImpl.java:1126)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.build(YangParserImpl.java:709)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.buildModules(YangParserImpl.java:335)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at org.opendaylight.yangtools.yang.parser.repo.SharedSchemaContextFactory$2.apply(SharedSchemaContextFactory.java:106)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at org.opendaylight.yangtools.yang.parser.repo.SharedSchemaContextFactory$2.apply(SharedSchemaContextFactory.java:68)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:859)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:293)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:150)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:106)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:170)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.Futures.transform(Futures.java:613)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.Futures.transform(Futures.java:565)[135:com.google.guava:14.0.1]
at org.opendaylight.yangtools.yang.parser.repo.SharedSchemaContextFactory.createSchemaContext(SharedSchemaContextFactory.java:142)[160:org.opendaylight.yangtools.yang-parser-impl:0.6.6.Helium-SR4]
at org.opendaylight.controller.sal.connect.netconf.NetconfDevice$RecursiveSchemaSetup.setUpSchema(NetconfDevice.java:318)[270:org.opendaylight.controller.sal-netconf-connector:1.1.4.Helium-SR4]
at org.opendaylight.controller.sal.connect.netconf.NetconfDevice$RecursiveSchemaSetup.access$1000(NetconfDevice.java:288)[270:org.opendaylight.controller.sal-netconf-connector:1.1.4.Helium-SR4]
at org.opendaylight.controller.sal.connect.netconf.NetconfDevice$RecursiveSchemaSetup$1.onFailure(NetconfDevice.java:334)[270:org.opendaylight.controller.sal-netconf-connector:1.1.4.Helium-SR4]
at com.google.common.util.concurrent.Futures$4.run(Futures.java:1140)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:293)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:150)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:106)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:170)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.ForwardingListenableFuture.addListener(ForwardingListenableFuture.java:47)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1152)[135:com.google.guava:14.0.1]
at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1088)[135:com.google.guava:14.0.1]
at org.opendaylight.controller.sal.connect.netconf.NetconfDevice$RecursiveSchemaSetup.setUpSchema(NetconfDevice.java:349)[270:org.opendaylight.controller.sal-netconf-connector:1.1.4.Helium-SR4]
at org.opendaylight.controller.sal.connect.netconf.NetconfDevice$RecursiveSchemaSetup.run(NetconfDevice.java:303)[270:org.opendaylight.controller.sal-netconf-connector:1.1.4.Helium-SR4]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_79]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_79]