[YANGTOOLS-583] Error when augmenting a mandatory node on a container in the same module Created: 12/Feb/16 Updated: 10/Apr/22 Resolved: 11/Mar/16 |
|
| 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 |
||
| Attachments: |
|
| External issue ID: | 5335 |
| Description |
|
In one of the proposed BBF (Broadband Forum) models we are getting an error during parsing, which is, according to us a bug in the YANG parser. We are using the Lithium release currently (the original one, not one of the SRs). I'm not allowed to attach the BBF model here, but I've reproduced the bug with a dummy model based on the example jukebox model, which I'm attaching here. The situation is:
When we parse this via the YANG parser, we are getting the following error: Error in module 'jukebox-cd-sub' at line 27: Error in augment parsing: cannot augment mandatory node number-of-cds According to us, and the people in the BBF working group, the given augment should be allowed. In the RFC it says: But here the target node is in the same module (the augment is in a submodule of that module, but we assume that should not matter). Also, according to the spirit of the RFC, the fact that the "cdcapable" container is a container with presence, makes that this is a safe augmentation which can't give a problem in clients that don't use the jukebox-cd module (the case of a container without presence is also not forbidden by the letter of the RFC, but could indeed pose a problem for such clients). Is our understanding correct, so that this is a bug in yang-tools? |
| Comments |
| Comment by Peter Verthez [ 12/Feb/16 ] |
|
Attachment yangs.tgz has been added with description: Example model |
| Comment by Robert Varga [ 12/Feb/16 ] |
|
Since the augment is within the same module, I think this is a bug. Can you check if this is reproducible with Beryllium RC3 and/or Lithium SR3, please? |
| Comment by Peter Verthez [ 12/Feb/16 ] |
|
I encountered the same bug in Lithium SR3 (which is why we didn't upgrade to it yet). I'll try Beryllium RC3. |
| Comment by Peter Verthez [ 12/Feb/16 ] |
|
I couldn't find Beryllium RC3 in the Nexus repositories of Opendaylight, so I tried with RC2.2. But this is apparently not backward compatible with Lithium (some classes are not found), so it would require changes in our application. So I couldn't test with that. |
| Comment by Igor Foltin [ 22/Feb/16 ] |
|
The first part of the augment target path in submodule jukebox-cd-sub |
| Comment by Peter Verthez [ 29/Feb/16 ] |
|
According to me the RFC defines the target node as the node to which new nodes are added (first paragraph in section 7.15 in the YANG RFC). And it then gives the constraint on the target node, not on any of its parent nodes. Can you give a reference in the RFC that supports your statement? |
| Comment by Tony Tkacik [ 29/Feb/16 ] |
|
Hi, yes you are correct that YANG does not explicit mention this situation (augmenting augmentation) but according to the rule you cited Following would be incorrect: augment "/other:module" { container foo { } and alternative writing of same would be correct: augment "/other:module" { augment "/other:module/foo" { } In draft-netmod-rfc6020bis addition of mandatory nodes via augment was allowed given that Could you open this issue on ietf-netmod mailing list? So we can get also opiniion from YANG authors? |
| Comment by Peter Verthez [ 29/Feb/16 ] |
|
That example does not correspond to what I reported. It is rather: augment "/other:module" { container foo { } But I will send a mail on the ietf-netmod mailing list. |
| Comment by Peter Verthez [ 01/Mar/16 ] |
|
See the answer from the ietf-netmod mailing list here: |
| Comment by Tony Tkacik [ 01/Mar/16 ] |
|
Ok, I added reasoning based on discussions, why such augment should be allowed: Section 7.15 (https://tools.ietf.org/html/rfc6020#section-7.15) > If the target node is in another module, then nodes added by the Section 3.1 (https://tools.ietf.org/html/rfc6020#section-3.1) > A mandatory node is one of: > o A list or leaf-list node with a "min-elements" statement with a Section 3.1 lists presence container as not mandatory node, Indeed this is bug, which affects Lithium, Beryllium and Boron. |
| Comment by Peter Kajsa [ 08/Mar/16 ] |
| Comment by Robert Varga [ 09/Mar/16 ] |
|
Master merged, needs manual cherry-pick to beryllium. |
| Comment by Peter Kajsa [ 09/Mar/16 ] |
|
fix stable/beryllium: https://git.opendaylight.org/gerrit/#/c/35985/ |