Open lllyfeng opened 1 year ago
The deviation statements are way too picky. IMO they need to be much more lenient. Agree with this ticket that the statements with defaults should be handled consistently.
IMO, deviate-stmt should be more lenient:
Must Do: complexity: low, bc: medium, importance: high
Importance high.
One more reason because beginner designers always have problems with this issue.
deviate replace should work even if the statement does not yet exist, just as in an
Some statements have default value, such as config/mandatory/min-elements/max-elements/status etc. if these statements are not occur under parent nodes, and should we think the parent nodes have these properties actually? Pyang consider ‘config’ statement always exists. But it don’t consider other properties with default value always exists.
Libyang doesn’t consider any properties with default value always exists.
If you want to change the value of those properties by using deviation, you will find you can’t get successful results from pyang and libyang simultaneously. For example:
If you want to change config property to false. If you define the deviation like below,
You will get an error from libyang for the config statement of target not exists. If you define the deviation like below,
You also get an error from pyang for the config statement of target already exists.
It cause confusion, and need clarify in YANG NEXT.