[YANGTOOLS-872] require-instance on leafref is always false in YANG 1.0 models Created: 27/Mar/18  Updated: 01/Apr/18  Resolved: 01/Apr/18

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 1.2.1
Fix Version/s: 1.1.4, 1.2.3, 2.0.4

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

Attachments: File example.yang    

 Description   

We have now a device that uses a YANG 1.1 model with require-instance=false on a leafref, so we are trying to make sure that we don't validate this leafref by checking when the LeafrefTypeDefinition.requireInstance() method returns false.

But when we do that, we find that this method returns always false on YANG 1.0 models.   This is wrong, because in YANG 1.0 it should behave always as true (although the keyword did not exist then).   If not, since the parser does not provide input on whether some leaf is coming from a YANG 1.0 or YANG 1.1 model, we can't know whether requireInstance() is false because it was explicitly set as false, or because the keyword didn't exist.

Attached a small model to reproduce: the "reference" leaf in mycontainer has requireInstance() = false.

We are using Nitrogen SR1 at this moment.



 Comments   
Comment by Robert Varga [ 29/Mar/18 ]

https://git.opendaylight.org/gerrit/70201

Comment by Robert Varga [ 01/Apr/18 ]

carbon: https://git.opendaylight.org/gerrit/70216

v1.2.x: https://git.opendaylight.org/gerrit/70215

 

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