[MDSAL-280] Binding v2 generator exception: Failed to find leafref target Created: 31/Jul/17  Updated: 09/Mar/18  Resolved: 14/Aug/17

Status: Resolved
Project: mdsal
Component/s: Binding V2 codegen
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Andrej Záň Assignee: Jie Han
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 8910

 Description   

During generating sources for this model:

module test {

yang-version 1;
namespace "urn:opendaylight:params:xml:ns:yang:test";
prefix "test";

revision "2017-02-24"

{ description "Initial revision of test model."; }

container testContainer {
list testList {
leaf testLeaf {
type enumeration {
enum enum1

{ value 1; }

enum enum2

{ value 2; }

}
}
}
}

notification testLeafrefNotification {
leaf tesLeafref {
type leafref

{ path "/test:testContainer/test:testList/test:testLeaf"; }

}
}

}

The exception is:

[ERROR] yang-to-sources: Unable to generate sources with org.opendaylight.mdsal.binding.javav2.maven.api.gen.plugin.CodeGeneratorImpl generator
java.lang.IllegalArgumentException: Failed to find leafref target: /test:testContainer/test:testList/test:testLeaf in module test (QNameModule

{ns=urn:openda ylight:params:xml:ns:yang:test, rev=2017-02-24}

)
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.opendaylight.mdsal.binding.javav2.generator.yang.types.TypeProviderImpl.provideTypeForLeafref(TypeProviderImpl.java:675)
at org.opendaylight.mdsal.binding.javav2.generator.yang.types.TypeProviderImpl.javaTypeForLeafrefOrIdentityRef(TypeProviderImpl.java:612)
at org.opendaylight.mdsal.binding.javav2.generator.yang.types.TypeProviderImpl.javaTypeForSchemaDefType(TypeProviderImpl.java:440)
at org.opendaylight.mdsal.binding.javav2.generator.yang.types.TypeProviderImpl.javaTypeForSchemaDefinitionType(TypeProviderImpl.java:149)
at org.opendaylight.mdsal.binding.javav2.generator.impl.GenHelperUtil.resolveLeafSchemaNodeAsMethod(GenHelperUtil.java:658)
at org.opendaylight.mdsal.binding.javav2.generator.impl.GenHelperUtil.addSchemaNodeToBuilderAsMethod(GenHelperUtil.java:526)
at org.opendaylight.mdsal.binding.javav2.generator.impl.GenHelperUtil.resolveDataSchemaNodes(GenHelperUtil.java:220)
at org.opendaylight.mdsal.binding.javav2.generator.impl.GenHelperUtil.resolveNotification(GenHelperUtil.java:436)
at org.opendaylight.mdsal.binding.javav2.generator.impl.ModuleToGenType.notificationsToGenType(ModuleToGenType.java:147)
at org.opendaylight.mdsal.binding.javav2.generator.impl.ModuleToGenType.generate(ModuleToGenType.java:54)
at org.opendaylight.mdsal.binding.javav2.generator.impl.BindingGeneratorImpl.generateTypes(BindingGeneratorImpl.java:126)
at org.opendaylight.mdsal.binding.javav2.maven.api.gen.plugin.CodeGeneratorImpl.generateSources(CodeGeneratorImpl.java:77)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.generateSourcesWithOneGenerator(YangToSourcesProcessor.java:333)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.generateSources(YangToSourcesProcessor.java:275)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.execute(YangToSourcesProcessor.java:96)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.conditionalExecute(YangToSourcesProcessor.java:117)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesMojo.execute(YangToSourcesMojo.java:121)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:200)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:196)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[ERROR] yang-to-sources: One or more code generators failed, including failed list(generatorClass=exception)

{org.opendaylight.mdsal.binding.javav2.maven.api.gen.plugin.CodeGeneratorImpl=java.lang.IllegalArgumentException}

This exception is thrown when notification contains leafref to leaf which is enumeration.



 Comments   
Comment by Jie Han [ 03/Aug/17 ]

Fixed by this patch:
https://git.opendaylight.org/gerrit/61085

Comment by Robert Varga [ 14/Aug/17 ]

Carbon: https://git.opendaylight.org/gerrit/61602

Comment by A H [ 14/Aug/17 ]

A patch was submitted to revert the changes and fix this bug in Carbon SR2:

https://git.opendaylight.org/gerrit/#/c/61602

To better assess the impact of this bug and fix, could someone from your team please help us identify the following:
Regression: Is this bug a regression of functionality/performance/feature compared to Carbon?
Severity: Could you elaborate on the severity of this bug? Is this a BLOCKER such that we cannot release Carbon SR2 without it?
Workaround: Is there a workaround such that we can write a release note instead?
Testing: Could you also elaborate on the testing of this patch? How extensively has this patch been tested? Is it covered by any unit tests or system tests?
Impact: Does this fix impact any dependent projects?

Comment by Robert Varga [ 14/Aug/17 ]

Regression:

No.

Severity:

The issue prevents Binding v2 from being adopted by our end users,

Workaround:

None.

Testing:

The patch includes a unit test for the specific failure and has not introduced any detectable regression.

Impact:

The fix for this issue has no effect on downstream projects within the Simultaneous Release. The presence of this issue blocks adoption of a Carbon feature by our end users. Given the timeline (our next Carbon deliverable is SR3 on 11/9), I believe it is crucial we deliver the fix in SR2.

Generated at Wed Feb 07 20:09:21 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.