Subject: [netmod] please clarify the case statement's sub-statements

From: "Fengchong (frank)" <[email-masked]>
Date: Fri, 26 Nov 2021 03:33:22 +0000

Hi folks and martin,
  I’m writing a yang parser. I notice the case statement has no ‘notification’ and ‘action’ sub-statements, but have ‘uses’ sub-statement. And the ‘grouping’ statement has ‘action’ and ‘notification’ sub-statements. If case’s use statement point to a grouping(we assume the grouping has action and notification statements),
The case statement in fact has ‘action’ and ‘notification’ sub-statements(expanded by uses).
  So, why case statement can not support define ‘action’ and ‘notification’ sub-statements directly?

本邮件及其附件含有华为公司的保密信息，仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用（包括但不限于全部或部分地泄露、复制、或散发）本邮件中的信息。如果您错收了本邮件，请您立即电话或邮件通知发件人并删除本邮件！
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!

---

From: Martin Björklund <[email-masked]>
Date: Fri, 26 Nov 2021 08:09:22 +0100 (CET)

Hi,

>   I’m writing a yang parser. I notice the case statement has no ‘notification’ and ‘action’ sub-statements, but have ‘uses’ sub-statement. And the ‘grouping’ statement has ‘action’ and ‘notificatio…

This is not allowed.

Section 7.15 says:

   Since an action cannot be defined at the top level of a module or in
   a "case" statement, it is an error if a grouping that contains an
   action at the top of its node hierarchy is used at the top level of a
   module or in a case definition.

Section 7.16 says:

   Since a notification cannot be defined in a "case" statement, it is
   an error if a grouping that contains a notification at the top of its
   node hierarchy is used in a case definition.

(But see https://github.com/netmod-wg/yang-next/issues/84)

/martin