[YANGTOOLS-841] SchemaContextUtil.findNodeInSchemaContext does not consider actions and nested notifications Created: 25/Oct/17  Updated: 10/Apr/22  Resolved: 04/Jan/18

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: 2.0.0, 1.2.1
Fix Version/s: 1.2.2, 2.0.1

Type: Bug Priority: Medium
Reporter: Marek Gradzki Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks MDSAL-300 Binding V1 fails when action input is... Resolved
Cloners
is cloned by MDSAL-300 Binding V1 fails when action input is... Resolved

 Description   

Yangtools fails to parse following augmentation present in
ietf-mpls@2017-07-02.yang:

augment
"/rt:routing-state/rt:ribs/rt:rib/rt:active-route/rt:input"

{ description "This augment adds the input parameter of the 'active-route' action."; uses nhlfe-contents; }

augment "/rt:routing-state/rt:ribs/rt:rib/rt:active-route/"
+ "rt:output/rt:route"

{ description "This augment adds the destination prefix to the reply of the 'active-route' action."; uses nhlfe-contents; }

where active-route is defined as(ietf-routing@2016-08-18.yang):

action active-route {
description
"Return the active RIB route that is used for the
destination address.

Address family specific modules MUST augment input
parameters with a leaf named 'destination-address'.";
output {

container route {
description
"The active RIB route for the specified destination.

If no route exists in the RIB for the destination
address, no output is returned.

Address family specific modules MUST augment this
container with appropriate route contents.";
container next-hop

{ description "Route's next-hop attribute."; uses next-hop-state-content; }

uses route-metadata;
}
}
}

with following exception:
[ERROR] Failed to parse YANG from source SourceSpecificContext [source=META-INF/yang/ietf-mpls@2017-07-02.yang, current=EFFECTIVE_MODEL, finished=FULL_DECLARATION]: Augment target 'Absolute

{path=[(urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)routing-state, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)ribs, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)rib, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)active-route, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)input]}

' not found [at META-INF/yang/ietf-mpls@2017-07-02.yang:366:2]
[ERROR] yang-to-sources: Unable to parse yang files from /home/m/hc2vpp/mpls/api/src/main/yang
org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException: Some of EFFECTIVE_MODEL modifiers for statements were not resolved.
[...]
Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Augment target 'Absolute

{path=[(urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)routing-state, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)ribs, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)rib, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)active-route, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)input]}

' not found [at META-INF/yang/ietf-mpls@2017-07-02.yang:366:2]
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.AugmentStatementImpl$Definition$1.prerequisiteFailed(AugmentStatementImpl.java:187)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.failModifier(ModifierImpl.java:87)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:341)
... 35 more



 Comments   
Comment by Marek Gradzki [ 25/Oct/17 ]

Models can be found at :
https://github.com/ietf-mpls-yang/te

Comment by Robert Varga [ 26/Dec/17 ]

Is this reproducible with 1.2.x or 2.0.0?

Comment by Marek Gradzki [ 02/Jan/18 ]

I was able to reproduce it using 1.2.1:

https://gerrit.fd.io/r/#/c/9917/

Console output:

https://jenkins.fd.io/job/honeycomb-verify-master-ubuntu1604/610/io.fd.honeycomb$yangtools822/console

 

 

Comment by Robert Varga [ 02/Jan/18 ]

This works reliably in 2.0.0.

Comment by Robert Varga [ 02/Jan/18 ]

And this is not a yangtools issue, as it resolves everything just fine. Console output above clearly indicates this MDSAL code generator throwing the exception:

 
java.lang.IllegalArgumentException: augment target not found: AbsoluteSchemaPath{path=[(urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)routing-state, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)ribs, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)rib, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)active-route, (urn:ietf:params:xml:ns:yang:ietf-routing?revision=2016-08-18)input]}
at org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl.augmentationToGenTypes(BindingGeneratorImpl.java:843)
at org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl.allAugmentsToGenTypes(BindingGeneratorImpl.java:425)
at org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl.generateTypes(BindingGeneratorImpl.java:262)

Comment by Robert Varga [ 02/Jan/18 ]

This is binding V1 + YANG 1.1 action – this was never advertised as working. Do V2 bindings trigger the same error?

Comment by Marek Gradzki [ 02/Jan/18 ]

Thanks for info! Is it possible to fix it in 1.2.x?

If not, Honeycomb will probably have to wait for 2.0.0 adoption by core ODL projects (oxygen?).

Comment by Marek Gradzki [ 02/Jan/18 ]

Sorry, I missed your previous comment. Never tried V2 bindings.

Comment by Robert Varga [ 02/Jan/18 ]

This is coming back to yangtools, SchemaContextUtil.findDataSchemaNode(SchemaContext,SchemaPath), which is not considering actions nor nested notifications.

Comment by Robert Varga [ 02/Jan/18 ]

Nitrogen: https://git.opendaylight.org/gerrit/66829

Comment by Marek Gradzki [ 04/Jan/18 ]

It looks like MDSAL code generator needs fix as well to resolve original issue.

Here is stack trace (can be reproduced using https://gerrit.fd.io/r/#/c/9917/2  + https://git.opendaylight.org/gerrit/66829 ):

[ERROR] yang-to-sources: Unable to generate sources with org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl generator
java.lang.NullPointerException: Target type not yet generated: RPC input input
    at org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl.augmentationToGenTypes(BindingGeneratorImpl.java:851)
    at org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl.allAugmentsToGenTypes(BindingGeneratorImpl.java:425)
    at org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl.generateTypes(BindingGeneratorImpl.java:262)
    at org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl.generateSources(CodeGeneratorImpl.java:63)
    at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.generateSourcesWithOneGenerator(YangToSourcesProcessor.java:335)
    at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.generateSources(YangToSourcesProcessor.java:277)
    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:122)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] yang-to-sources: One or more code generators failed, including failed list(generatorClass=exception) {org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl=java.lang.NullPointerException}

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