Re: [netmod] mandatory choice with non-presence container case

"Rob Wilton (rwilton)" <rwilton@cisco.com> Mon, 24 June 2019 16:52 UTC

Return-Path: <rwilton@cisco.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 0C97C120645 for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 09:52:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.501
X-Spam-Level:
X-Spam-Status: No, score=-14.501 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com header.b=Is/6p4PI; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=VZCmUDQU
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 xiMORL7wcIGf for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 09:52:39 -0700 (PDT)
Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D961A12063F for <netmod@ietf.org>; Mon, 24 Jun 2019 09:52:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1724; q=dns/txt; s=iport; t=1561395158; x=1562604758; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=CIzYkLoH4oUnPCK/6AuhNFlEDby+q1XfRciAKfw41ss=; b=Is/6p4PIA4RfkiVWlvKor8pnQBET8+ExQ6ggOCzJ5Jqw6QQVZLIT5ebw UxjTZ7aJVSjl2sBb+wgxGt2DSrrL64rlfduXppM2tPcdmSEl3DbaV5LWN cy+yPbbVZmAmisy0hceHHX95OHpOXwGoAcupKgNhuodMzT9JuT+O0Dc9v s=;
IronPort-PHdr: 9a23:JQfUVRXlMiZUI1Z4L1Ji7WiNjGPV8LGuZFwc94YnhrRSc6+q45XlOgnF6O5wiEPSA92J8OpK3uzRta2oGXcN55qMqjgjSNRNTFdE7KdehAk8GIiAAEz/IuTtankgA8VGSFhj13q6KkNSXs35Yg6arw==
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AJAACX/hBd/5BdJa1lGgEBAQEBAgEBAQEHAgEBAQGBUwUBAQEBCwGBQ1ADalUgBAsoCodTA4RSig9Mgg+XOIEugSQDVAkBAQEMAQEYCwoCAQGDekYCgm0jNAkOAQMBAQQBAQIBBW2KNwyFSgEBAQQBARAuAQEsDAsEAgEIEQQBAS8nCx0IAgQBEggagwGBagMdAQIMmC4CgTiIX4IignkBAQWEexiCEQMGgTQBi10XgUA/gVeCTD6CYQEBAgGBYAWDNYImi3aJeJQfCQKCFIZNjTCXR40mhy+PVAIEAgQFAg4BAQWBUDiBWHAVO4JsgkGDcIUUhT9yAQGBJ40nAYEgAQE
X-IronPort-AV: E=Sophos;i="5.63,412,1557187200"; d="scan'208";a="580947414"
Received: from rcdn-core-8.cisco.com ([173.37.93.144]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 24 Jun 2019 16:52:37 +0000
Received: from XCH-RCD-002.cisco.com (xch-rcd-002.cisco.com [173.37.102.12]) by rcdn-core-8.cisco.com (8.15.2/8.15.2) with ESMTPS id x5OGqbUn026079 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 24 Jun 2019 16:52:37 GMT
Received: from xhs-aln-001.cisco.com (173.37.135.118) by XCH-RCD-002.cisco.com (173.37.102.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 24 Jun 2019 11:52:36 -0500
Received: from xhs-rcd-003.cisco.com (173.37.227.248) by xhs-aln-001.cisco.com (173.37.135.118) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 24 Jun 2019 11:52:36 -0500
Received: from NAM02-CY1-obe.outbound.protection.outlook.com (72.163.14.9) by xhs-rcd-003.cisco.com (173.37.227.248) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 24 Jun 2019 11:52:36 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Dku4KSjG9TndJ72QPyxopV6DFeYI7F7q/uIfo1/vfBs=; b=VZCmUDQURPl2PMnzDHvdpzvbRdo+WqQXll8YDj/IGrXJqqsH0XVplgDudpL66SRkuc7i/I+WnP8Ne6CPfaqfoZl84a97xJe32/DsNEHJWTZ04FCvZ6qG9Wms5w+9Ja0YSZ8DOfnubkyNoEfUJsh2Z4H6GK0Iz9JfdyqUg0noDrc=
Received: from BYAPR11MB2631.namprd11.prod.outlook.com (52.135.227.28) by BYAPR11MB3717.namprd11.prod.outlook.com (20.178.238.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Mon, 24 Jun 2019 16:52:35 +0000
Received: from BYAPR11MB2631.namprd11.prod.outlook.com ([fe80::ed99:b6a8:d6fb:5045]) by BYAPR11MB2631.namprd11.prod.outlook.com ([fe80::ed99:b6a8:d6fb:5045%4]) with mapi id 15.20.2008.014; Mon, 24 Jun 2019 16:52:34 +0000
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: Michal Vaško <mvasko@cesnet.cz>, netmod <netmod@ietf.org>
Thread-Topic: [netmod] mandatory choice with non-presence container case
Thread-Index: AQHVKqtqugys5O13IEqCldv9XEhP5qarA/zg
Date: Mon, 24 Jun 2019 16:52:34 +0000
Message-ID: <BYAPR11MB263111549D604096368CC2ABB5E00@BYAPR11MB2631.namprd11.prod.outlook.com>
References: <7797-5d10fc80-6f-35dfff00@18550372>
In-Reply-To: <7797-5d10fc80-6f-35dfff00@18550372>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=rwilton@cisco.com;
x-originating-ip: [173.38.220.41]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 2a8d6c17-bb21-429c-de68-08d6f8c45b62
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:BYAPR11MB3717;
x-ms-traffictypediagnostic: BYAPR11MB3717:
x-ms-exchange-purlcount: 2
x-microsoft-antispam-prvs: <BYAPR11MB37174F8DF114E90E12FA58C0B5E00@BYAPR11MB3717.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-forefront-prvs: 007814487B
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(136003)(346002)(366004)(376002)(13464003)(189003)(199004)(74316002)(26005)(305945005)(186003)(2906002)(11346002)(55016002)(9686003)(68736007)(476003)(8676002)(6246003)(81166006)(486006)(53936002)(5660300002)(3846002)(6116002)(102836004)(6436002)(7736002)(7696005)(66066001)(53546011)(446003)(52536014)(316002)(6306002)(229853002)(478600001)(110136005)(25786009)(73956011)(76116006)(81156014)(8936002)(66446008)(66946007)(66476007)(66556008)(64756008)(6506007)(76176011)(71190400001)(71200400001)(14444005)(14454004)(256004)(99286004)(66574012)(86362001)(33656002)(966005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR11MB3717; H:BYAPR11MB2631.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: F4b7mVMefBVG1bq6ZnUc56L4Sdv7tlSWFpbYbsNKHJiRdS/FL7uD4l4yF9xq1qHn1eBfftKBHMOD0/XfwEKX0tdY8wjKXB2XsGDKK6zcr6i0Jkd02gLl0FSjaZuQDTNCm08k6pa//FjFtgUti7Nxse2O9l/QWQ7VAYTenM6fUzX7EUWCv+tADH9Mf4iSCZG945VeSW9emVU0Xpk1//SxNTFYk4AC2L8DjXXFSqXi/S+ANkyHlganS0ReYb0OX3mHGv+80b5FcbetC/NuNYX19g0aQgvBMIb9m5WblWsZMhugg8OxkFHl3zkGNt5x3+YEHA1BCVdeJKe8Vg/3tRDntGUODfIinOWwF13zY9uSJ2/L1goj1o5Chl0+7Y6SNy5QpmLixxCr7y9qE/Vc9P824kzfcsAEXL7XkP+Lk7Rodvk=
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: 2a8d6c17-bb21-429c-de68-08d6f8c45b62
X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2019 16:52:34.8629 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: rwilton@cisco.com
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3717
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.37.102.12, xch-rcd-002.cisco.com
X-Outbound-Node: rcdn-core-8.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/-6GgAJlt5DqskCWcMEzABsxPHOw>
Subject: Re: [netmod] mandatory choice with non-presence container case
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: Mon, 24 Jun 2019 16:52:41 -0000

Hi Michal,

My thoughts:

According to 7.5.1:

   In the first style, the container has no meaning of its own, existing
   only to contain child nodes.  In particular, the presence of the
   container node with no child nodes is semantically equivalent to the
   absence of the container node.  YANG calls this style a "non-presence
   container".  This is the default style.

Hence your request (because the NP container does not have any children) is equivalent to:

 <TOP>
   <L/>
 </TOP>

which fails the "mandatory" check.

Thanks,
Rob


> -----Original Message-----
> From: netmod <netmod-bounces@ietf.org> On Behalf Of Michal Vaško
> Sent: 24 June 2019 17:39
> To: netmod <netmod@ietf.org>
> Subject: [netmod] mandatory choice with non-presence container case
> 
> Hi,
> I have encountered a situation that I think is not covered by RFC 7950. My
> specific use-case was as follows.
> 
> model:
> 
> container TOP {
>   leaf L {
>     type empty;
>   }
>   choice A {
>     mandatory true;
>     container C;
>   }
> }
> 
> data:
> 
> <TOP>
>   <L/>
>   <C/>
> </TOP>
> 
> Parsing was successful, but printing these data back to XML produced:
> 
> <TOP>
>   <L/>
> </TOP>
> 
> and parsing this correctly failed with missing mandatory choice. According
> to section 7.5.7 [1], I think the C container could be omitted but the
> whole situation does not seem correct. Thank you for any input.
> 
> Regards,
> Michal
> 
> [1] https://tools.ietf.org/html/rfc7950#section-7.5.7
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod