Subject: [Softwires] draft-ietf-softwire-yang: YANG compilation issues

From: Benoit Claise <[email-masked]>
Date: Wed, 31 Aug 2016 12:59:49 +0200

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-masked]: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

---

From: Linhui Sun <[email-masked]>
Date: Thu, 1 Sep 2016 14:18:27 +0800

Hi Benoit and Per,

Thanks for the info, we will correct this in the next version.

Best,
Linhui

2016-08-31 18:59 GMT+08:00 Benoit Claise <[email-masked]>:

> [email-masked]:215: error: a 'default' value cannot be
> given when 'mandatory' is "true"
>
> The error refers to:
>
>   container port-set {
>       description
> _______________________________________________
> Softwires mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/softwires
>
>