netmod-wg / yang-next

Feature requests for future versions of YANG
6 stars 0 forks source link

Clarify the meaning of properties which have default value #115

Open lllyfeng opened 1 year ago

lllyfeng commented 1 year ago

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:

leaf foo {
   type int8;
}

If you want to change config property to false. If you define the deviation like below,

deviation /foo {
    deviate replace {
          config false;
    }
}

You will get an error from libyang for the config statement of target not exists. If you define the deviation like below,

deviation /foo {
    deviate add{
          config false;
    }
}

You also get an error from pyang for the config statement of target already exists.

It cause confusion, and need clarify in YANG NEXT.

jovatn commented 12 months ago

I agree. Today it seems impossible to form such deviate statement, and simultaneously comply with tools using libyang and pyang respectively. See pyang and libyang discussion threads.

abierman commented 2 months 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

BalazsLengyel commented 1 month ago

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