[netmod] Choice Case vs Container+When in RFC7950

Qin Wu <bill.wu@huawei.com> Tue, 02 April 2019 01:14 UTC

Return-Path: <bill.wu@huawei.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CFF66120086 for <netmod@ietfa.amsl.com>; Mon, 1 Apr 2019 18:14:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7L95JIOm7YKC for <netmod@ietfa.amsl.com>; Mon, 1 Apr 2019 18:14:01 -0700 (PDT)
Received: from huawei.com (lhrrgout.huawei.com [185.176.76.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9E85D12006E for <netmod@ietf.org>; Mon, 1 Apr 2019 18:14:00 -0700 (PDT)
Received: from LHREML714-CAH.china.huawei.com (unknown [10.201.108.37]) by Forcepoint Email with ESMTP id 3F81289DD041019119E9 for <netmod@ietf.org>; Tue, 2 Apr 2019 02:13:58 +0100 (IST)
Received: from NKGEML414-HUB.china.huawei.com (10.98.56.75) by LHREML714-CAH.china.huawei.com (10.201.108.37) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 2 Apr 2019 02:13:57 +0100
Received: from NKGEML513-MBX.china.huawei.com ([169.254.1.144]) by nkgeml414-hub.china.huawei.com ([10.98.56.75]) with mapi id 14.03.0415.000; Tue, 2 Apr 2019 09:13:52 +0800
From: Qin Wu <bill.wu@huawei.com>
To: "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: Choice Case vs Container+When in RFC7950
Thread-Index: AdTo8QMC1h13IRxeSvK6A0rP45BuGg==
Date: Tue, 2 Apr 2019 01:13:52 +0000
Message-ID: <B8F9A780D330094D99AF023C5877DABAA48CDC7A@nkgeml513-mbx.china.huawei.com>
Accept-Language: zh-CN, en-US
Content-Language: zh-CN
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.134.31.203]
Content-Type: multipart/alternative; boundary="_000_B8F9A780D330094D99AF023C5877DABAA48CDC7Ankgeml513mbxchi_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/jeaSov46qumgS5zCAqxTt0d2NHw>
Subject: [netmod] Choice Case vs Container+When in RFC7950
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 02 Apr 2019 01:14:03 -0000

Hi, Folks:
Choice case seems interchangeable with Container+when, here is the example of Choice case
     container system {
       description
         "Contains various system parameters.";
       choice services {
         description
           "Configure externally available services.";
         case ssh {
           description
             "SSH service-specific configuration.";
           // more leafs, containers, and stuff here...
         }
         case tls {
           description
             "TLS service-specific configuration.";
           // more leafs, containers, and stuff here...
         }
       }
     }
I think it can be replaced with container+when representation as follows:
    container system {
       description
         "Contains various system parameters.";
       container services {
         description
           "Configure externally available services.";
         leaf transport {
           enum ssh {
            description
             "ssh";
          }
           enum tls {
           description
            "tls";
          }
         }
         container "ssh" {
           when "../transport=ssh" {
            description
            "active only when the transport is ssh";
           }
           description
             "SSH service-specific configuration.";
           // more leafs, containers, and stuff here...
         }
         container "tls" {
           when "../transport=tls" {
            description
            "active only when the transport is tls";
           }
           description
             "TLS service-specific configuration.";
           // more leafs, containers, and stuff here...
         }
       }
     }
However I didn't see any guidance on when to use Choice case or when to use Container+when?
Any thought about this?

-Qin