Subject: [netmod] if-feature and default

From: Andy Bierman <[email-masked]>
Date: Sun, 1 Nov 2015 09:16:21 -0800

Hi,

I started a separate thread for this issue.
The current YANG 1.1 text is incomplete wrt/ default-stmt.

  leaf broken {
     type enumeration {
        enum option1 {
           if-feature option1;
        }
        enum option2 {
           if-feature option2;
        }
        enum option3;
     }
     default "option2";
   }

What happens if the server does not advertise the option2 feature?

I see 2 options:
  (A) add text that says a default-stmt MUST NOT include any conditional
      values
  (B) allow if-feature as a sub-statement of the default-stmt

(BTW, customers have asked for (B), so it may be a feature and a bugfix)

Andy

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 2 Nov 2015 09:20:22 +0900

> On 02 Nov 2015, at 02:16, Andy Bierman <[email-masked]> wrote:
> 
> Hi,
> 

or (C) a default statement that specifies a value that's not permitted is an error.

Lada

> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C

---

From: "fengchong (C)" <[email-masked]>
Date: Mon, 2 Nov 2015 00:29:24 +0000

Hi,
   I prefer   A.

  Otherwise, if ‘option1’ is supported, the default value should be ‘option1’ and ‘option2’ is supported ,the default value should be ‘option2’, B cannot express it.

Or more default stmts can be allowed.

  leaf broken {
     type enumeration {
        enum option1 {
           if-feature option1;
        }
        enum option2 {
           if-feature option2;
        }
        enum option3;
     }
     default "option1" {
            if-feature option1;
        }
        default "option2" {
            if-feature option2;
        }
   }

________________________________
冯冲
华为技术有限公司 Huawei Technologies Co., Ltd.
[Company_logo]

Phone:
Fax:
Mobile: 18519117316
Email: [email-masked]
地址：南京市软件大道101号华为南京基地 邮编：210001
Huawei Technologies Co., Ltd.

http://www.huawei.com
________________________________
本邮件及其附件含有华为公司的保密信息，仅限于发送给上面地址中列出的个人或群组。禁
止任何其他人以任何形式使用（包括但不限于全部或部分地泄露、复制、或散发）本邮件中
的信息。如果您错收了本邮件，请您立即电话或邮件通知发件人并删除本邮件！
THis e-mail and its attachments contain confidential information from HUAWEI, which
is intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!
发件人: netmod [mailto:[email-masked]] 代表 Andy Bierman
发送时间: 2015年11月2日 1:16
收件人: [email-masked]
主题: [netmod] if-feature and default

Hi,

  leaf broken {
     type enumeration {
        enum option1 {
           if-feature option1;
        }
        enum option2 {
           if-feature option2;
        }
        enum option3;
     }
     default "option2";
   }

I see 2 options:

Andy

---

From: Andy Bierman <[email-masked]>
Date: Sun, 1 Nov 2015 16:40:24 -0800

> or (C) a default statement that specifies a value that's not permitted is
This does not say anything.
You mean a protocol error somehow or a compiler error?
Only (A) makes it a compiler error.

Andy

---

From: Andy Bierman <[email-masked]>
Date: Sun, 1 Nov 2015 16:44:14 -0800

>    I prefer   A.

This would be OK with me.
That way the default will be safe in all server variants.

Andy

>   Otherwise, if ‘option1’ is supported, the default value should be
> ‘option1’ and ‘option2’ is supported ,the default value should be
> ‘option2’, B cannot express it.
>
>
>
> ------------------------------
>
> 冯冲
> ------------------------------
>
> *发件人:* netmod [mailto:[email-masked]] *代表 *Andy Bierman
> *发送时间:* 2015年11月2日 1:16
> *收件人:* [email-masked]
> *主题:* [netmod] if-feature and default
>
>
>
> Hi,
>
>
>

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 2 Nov 2015 09:48:09 +0900

> On 02 Nov 2015, at 09:40, Andy Bierman <[email-masked]> wrote:
> 
> 
> 

A protocol error - a server that advertises such a data model is broken. A similar situation can happen elsewhere - e.g. an identityref leaf specifies an identity as the default but the server doesn't implement the module where this identity is defined.

Lada

---

From: Andy Bierman <[email-masked]>
Date: Mon, 2 Nov 2015 15:14:05 -0800

On Sun, Nov 1, 2015 at 4:48 PM, Ladislav Lhotka <[email-masked]> wrote:

> A protocol error - a server that advertises such a data model is broken. A
> similar situation can happen elsewhere - e.g. an identityref leaf specifies
> an identity as the default but the server doesn't implement the module
> where this identity is defined.
>
>

So this would be an extremely subtle way of making
a YANG feature mandatory to implement?

Given my long history of gripes about YANG Conformance
(see various versions of that draft and YANG Packages),
I am yet again not very impressed with the conformance
specification mechanisms in YANG.

IMO, (A) is most correct because a YANG module is supposed
to be written without assuming any of the optional features
are really mandatory.  I agree real-world conformance specifications
would require that, but that is not what YANG provides.

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Wed, 04 Nov 2015 17:04:59 +0900 (JST)

Andy Bierman <[email-masked]> wrote:
> IMO, (A) is most correct

+1

/martin