[YANGTOOLS-803] if-feature statements not correctly processed in refine Created: 02/Aug/17  Updated: 10/Apr/22  Resolved: 13/Aug/17

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Peter Verthez Assignee: Peter Kajsa
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: Zip Archive refine.zip    
External issue ID: 8922

 Description   

We have in one of the models of BBF the following case (see the attached model, which is similar but smaller):

augment "/if:interfaces-state/if:interface" {
if-feature availability;
description
"Augment the state data of an interface with operational status
for availability. ";

uses bbf-avail:availability {
refine "availability"

{ description "Operational status defining the availability of an interface."; }

}
}

The "availability" targeted by the refine is a container in the "bbf-avail:availability" grouping, which is marked by "if-feature availability".

Now, if the "availability" feature is not present, and so the "availability" container in the "bbf-avail:availability" is not present, the above refine fails with the following error (the error is not present when the feature is present):

Caused by: java.lang.IllegalArgumentException: Refine target node Relative

{path=[(http://www.example.com/itf-availability?revision=2017-05-05)availability]}

not found. At itf-availability:27:6
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.UsesStatementImpl.performRefine(UsesStatementImpl.java:297)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.UsesStatementImpl.resolveUsesNode(UsesStatementImpl.java:273)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.UsesStatementImpl$Definition$1.apply(UsesStatementImpl.java:113)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.applyAction(ModifierImpl.java:100)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.tryApply(ModifierImpl.java:160)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.tryToProgress(SourceSpecificContext.java:318)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.tryToCompletePhase(SourceSpecificContext.java:296)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.completePhaseActions(BuildGlobalContext.java:359)
... 79 more

However, the refine is also conditional under the same feature (if-feature on the surrounding augment), so this error looks incorrect to us.



 Comments   
Comment by Peter Verthez [ 02/Aug/17 ]

Attachment refine.zip has been added with description: Example model showing the bug

Comment by Peter Kajsa [ 09/Aug/17 ]

master: https://git.opendaylight.org/gerrit/#/c/61377/

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