[MDSAL-713] Do not use CopyableNode.isAugmenting() Created: 08/Dec/21  Updated: 07/Sep/23

Status: In Review
Project: mdsal
Component/s: Binding codegen, Binding runtime
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Medium
Reporter: Robert Varga Assignee: Samuel Schneider
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Binding Damage

 Description   

CopyableNode is on its way out, yet we are using it in a few places related to codegen and binding runtime.

Audit the users and replace use of this method with something reasonable.



 Comments   
Comment by Šimon Ukuš [ 31/May/23 ]

choice statements:

##1. case.yang

...
      container locks {
          choice lock-type {
              case partial-lock {
                  list partial-lock {
                      key lock-id;
                      leaf lock-id {
                          type uint32;
                      }
                      leaf-list select {
                          type string;
                          min-elements 1;
                      }
                      leaf-list locked-node {
                          type string;
                      }
                  }
              }
          }
      }
...

##2. augment-case.yang

...
import case { prefix cc; }

augment "cc:locks/cc:lock-type" {
    case autonomous-lock {
        container autonomous-def {
            leaf lock-id {
                type int32;
            }
            leaf lock-time {
                type uint32;
            }
        }
    }
    case anonymous-lock {
        leaf lock-time {
            type uint32;
        }
    }
    leaf leaf-aug-case {
        type string;
    }
}
...

The EffectiveStatement s in the case module, that were introduced via augmentation in the augment-case module are being reported as isAugmenting() == true (expected behaviour). Also, the leafs that are within those case statements are isAugmenting() == true, except for one. Although the shorthand case (not explicitly written in the yang file) is isAugmenting() == true, its child (leaf: leaf-aug-case) reports isAugmenting() == false

Comment by Robert Varga [ 05/Jun/23 ]

Seems legit, can you create a minimal reproducer unit test in yangtools' yang-parser-rfc7950, please?

Comment by Šimon Ukuš [ 06/Jun/23 ]

Test, reproducing this behavior, created and available here: https://git.opendaylight.org/gerrit/c/yangtools/+/106388

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