[YANGTOOLS-669] [Yang 1.1] Support for "require-instance" in leafref Created: 06/Oct/16  Updated: 10/Apr/22  Resolved: 14/Jul/17

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

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

Operating System: All
Platform: All


Issue Links:
Blocks
blocks YANGTOOLS-355 Milestone: Introduce support for YANG... Resolved
is blocked by YANGTOOLS-664 Extend yang statement parser to suppo... Resolved
is blocked by YANGTOOLS-699 Milestone: [Yang 1.1] Yang model API ... Resolved
External issue ID: 6873

 Comments   
Comment by Martin Ciglan [ 19/Oct/16 ]

RFC7950:

9.9.3. The "require-instance" Statement
The "require-instance" statement, which is a substatement to the
"type" statement, MAY be present if the type is "instance-identifier"
or "leafref". It takes as an argument the string "true" or "false".
If this statement is not present, it defaults to "true".
If "require-instance" is "true", it means that the instance being
referred to MUST exist for the data to be valid. This constraint is
enforced according to the rules in Section 8 of RFC7950.
If "require-instance" is "false", it means that the instance being
referred to MAY exist in valid data.

Comment by Igor Foltin [ 06/Nov/16 ]

API change - https://git.opendaylight.org/gerrit/#/c/47983/

Comment by Igor Foltin [ 21/Dec/16 ]

Implementation - https://git.opendaylight.org/gerrit/#/c/49697/

Comment by Giles Heron [ 14/Jul/17 ]

when mounting XR 6.2.1 in Boron the openconfig-bgp model is mounted correctly.

when mounting XR 6.2.1 in Carbon this fails.

It turns out to be because the model has a leafref with a require-instance under it. This is ambiguous in RFC6020 (YANG 1.0) in that it's not mentioned in the text but is permitted in the ABNF, but is unambiguous in RFC7950 (present in both text and ABNF). The fix was as simple as side-loading a modified model with yang-version set to "1.1".

but WHY OH WHY did you change the code in Carbon to explicitly prevent this from working unless yang-version is set to 1.1? It breaks things that previously worked and it goes against Postel's law.

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