draft-ietf-softwire-yang authors,

Per and I have been investigating the YANG compilation error for this document.
See http://www.claise.be/IETFYANGPageCompilation.html:

   [email protected]:215: error: a 'default' value cannot
   be given when 'mandatory' is "true"

The error refers to:

  container port-set {
      description
        "For Lightweight 4over6, the default value
        of offset should be 0, to configure one contiguous
        port range.";
      uses port-set {
        refine psid-offset {
          default "0";                   <=========
        }
      }



  grouping port-set {
    description
      "Use the PSID algorithm to represent a range of transport layer
      ports.";
    leaf psid-offset {
      type uint8 {
        range 0..16;
      }
      mandatory true;               <==== If I remove this line, it works fine.
      description
        "The number of offset bits. In Lightweight 4over6, the default
        value is 0 for assigning one contiguous port range. In MAP-E/T,
        the default value is 6, which excludes system ports by default
        and assigns distributed port ranges. If the this parameter is
        larger than 0, the value of offset MUST be greater than 0.";
    }

You can refine-add/modify a default, but the result must be valid YANG,
and 6020 7.6.4 (and draft-ietf-netmod-rfc6020bis-14) says

   The "default" statement MUST NOT be present on nodes where
   "mandatory" is true.

I.e. if you want to refine-add a default to a mandatory leaf, you must
also refine-remove the mandatory-ness:

       refine psid-offset {
         default "0";
         mandatory false;
       }

(Having a default on a mandatory leaf doesn't make sense, since it can
never take effect - you are required to configure a value for the leaf.)

Regards, Per and Benoit

_______________________________________________
Softwires mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/softwires

Reply via email to