Re: [yang-doctors] Consistency for naming lists and leaf-lists

"Rob Wilton (rwilton)" <rwilton@cisco.com> Tue, 03 December 2019 16:55 UTC

Return-Path: <rwilton@cisco.com>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BB7C91200DF for <yang-doctors@ietfa.amsl.com>; Tue, 3 Dec 2019 08:55:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.5
X-Spam-Level:
X-Spam-Status: No, score=-14.5 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, 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=NkRpZCSe; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=iKAgrS7E
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 MGI03VW26fB1 for <yang-doctors@ietfa.amsl.com>; Tue, 3 Dec 2019 08:55:16 -0800 (PST)
Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5DEFC12000F for <yang-doctors@ietf.org>; Tue, 3 Dec 2019 08:55:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=20286; q=dns/txt; s=iport; t=1575392116; x=1576601716; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=Fro7Q7S58VTV86LRq8QL0pHI+jAMcu9GTr7Ky5/LaV0=; b=NkRpZCSetjSxy/bCRxXE9GBa+xoVvwtWsFlhnvFsKgCSDqBjHBtuSNk7 TuxDuRjwBv3ju/KkMBmWd52wbOw6pPJbrdnn3P5OYCz7fKGcaZXIG4D03 A3P1XCuYvB2kqqGnmc2EHXJ6LQ+v7Z4XWOJ+F5G/OYPhT1v4s/mlLbb2b A=;
IronPort-PHdr: 9a23:Q4wSMhYQor967z4W/w1Y8gD/LSx94ef9IxIV55w7irlHbqWk+dH4MVfC4el20gebRp3VvvRDjeee87vtX2AN+96giDgDa9QNMn1NksAKh0olCc+BB1f8KavwcC0+AMNEfFRk5Hq8d0NSHZW2ag==
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0ArAAD2kuZd/4ENJK1lGgEBAQEBAQEBAQMBAQEBEQEBAQICAQEBAYFtAgEBAQELAYEbL1AFbFggBAsqCoQhg0YDiniCX5MihGKCUgNUCQEBAQwBASMKAgEBhEACF4F2JDcGDgIDDQEBBAEBAQIBBQRthTcMhVIBAQEBAxIRChMBATcBDwIBBgIRBAEBKwICAjAdCAEBBA4FCBqDAYF5TQMuAQIMlUaQZAKBOIhgdYEygn4BAQWBOQKDSRiCFwMGgTYBjBUagUE/gRFHgU5QLj6CZAEBA4E6KCuCYzKCCiKNOYJlhUwkl0lwCoIuhx6OVpoklwiRXwIEAgQFAg4BAQWBaCOBWHAVO4JsUBEUjGaDc4UUhT90gSiOEYEwAYEPAQE
X-IronPort-AV: E=Sophos;i="5.69,273,1571702400"; d="scan'208,217";a="376304549"
Received: from alln-core-9.cisco.com ([173.36.13.129]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 03 Dec 2019 16:55:14 +0000
Received: from XCH-ALN-015.cisco.com (xch-aln-015.cisco.com [173.36.7.25]) by alln-core-9.cisco.com (8.15.2/8.15.2) with ESMTPS id xB3GtEVh004233 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 3 Dec 2019 16:55:14 GMT
Received: from xhs-aln-002.cisco.com (173.37.135.119) by XCH-ALN-015.cisco.com (173.36.7.25) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 3 Dec 2019 10:55:13 -0600
Received: from xhs-aln-001.cisco.com (173.37.135.118) by xhs-aln-002.cisco.com (173.37.135.119) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 3 Dec 2019 10:55:12 -0600
Received: from NAM04-BN3-obe.outbound.protection.outlook.com (173.37.151.57) by xhs-aln-001.cisco.com (173.37.135.118) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 3 Dec 2019 10:55:12 -0600
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CUq0gx6rU4zV2PccyWXCUk0nT60oAHqzC5HdmJXYHgHbAMObRDk2tEJWmd/J0SisTUvdEF0EP66biI+WsjQUZ4lQ0ur8shTR618ijJI/y+OZJ1YuNm/YI3uRm1lzn+4Q7t/Rs7a8H2a4VGdWp9jP/dBDWbUW/PxsAKTh7D9ww4VIxf8o4g4C1qLfXtctiqwK4/cXByRoio+40YnCyZ744koDcLDYN5KdPCqujmIQvupKd0nXgNrre2YFd6BPmx3Q6dIkpif4Xhu5l6H/krn5rXJni02psYopJ+ApYw+NPI2SpSfOlRyfHdevyfqifB9u8oQ4BRM3MXPzdu3iqwduDQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fro7Q7S58VTV86LRq8QL0pHI+jAMcu9GTr7Ky5/LaV0=; b=T9FdZbeIGtN1M+M2eAR9JQFh0kgmOAl4LdEg04kURjuAS+pN95JbeHqrLwKeqvWja//9N2+FfaP6e0+rkgpczXYA+z4WmDGV9kRC3XLVYh5t1lBDHqHDlOdvCk8E0eOTUytNtAU2/rGeHm0TzPWLN0QrZfQosPnjYRbSTF+8YuU8d3yNVIDm7ZHI0uDvJ848RS0C3+NJuuhzQ+vQXhQ/9JGho4C9QifboeP9CCSkT9QL2O0OF0ZE3z43O4O190yuKWSD7MP84rM9UX6IxUu+go63d40+vYzxK+LfLJ7FPaAIfBYGIrIzpnnecqd0hr+kh0A9JhGZRfyi0RWw4Mcopw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none
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=Fro7Q7S58VTV86LRq8QL0pHI+jAMcu9GTr7Ky5/LaV0=; b=iKAgrS7EcGcEINs9DAKOCaN/ICVuxzkr/K2hqLo/QxIdncs5OKaY+vVXGAoCvPPa8xpEJEe9LzGCzC+vvhK6WSGLrQ9YpduFWx6313pQsXgGmZTJovZDZjjileWu9bNGh3iYoxxb/Ymo0v5iYyZJcLbLvrH+mvN+SwStzJRHoCU=
Received: from MN2PR11MB4366.namprd11.prod.outlook.com (52.135.38.209) by MN2PR11MB3872.namprd11.prod.outlook.com (10.255.180.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.21; Tue, 3 Dec 2019 16:55:11 +0000
Received: from MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::8106:b538:2920:a44f]) by MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::8106:b538:2920:a44f%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 16:55:11 +0000
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: Kent Watsen <kent@watsen.net>
CC: Ladislav Lhotka <lhotka@nic.cz>, "yang-doctors@ietf.org" <yang-doctors@ietf.org>
Thread-Topic: [yang-doctors] Consistency for naming lists and leaf-lists
Thread-Index: AdWmoN+obpgJJ6ZhScC3Y7prdGvzGQCSyRWAAAc6kwAAMUyA0AAHqOIAAACfh6A=
Date: Tue, 03 Dec 2019 16:55:11 +0000
Message-ID: <MN2PR11MB43668F9767A378B614DD69D1B5420@MN2PR11MB4366.namprd11.prod.outlook.com>
References: <MN2PR11MB4366355E6E59D9AFE3F27615B5460@MN2PR11MB4366.namprd11.prod.outlook.com> <20191202.093931.847844329284889456.mbj@tail-f.com> <9e54af2d14f72cfc498fee23987e588e84e59bc5.camel@nic.cz> <MN2PR11MB43663CA34FE4E3B9EDB59578B5420@MN2PR11MB4366.namprd11.prod.outlook.com> <0100016ecc5663e2-05f736ca-1b12-4692-a1f4-5b53d66079cc-000000@email.amazonses.com>
In-Reply-To: <0100016ecc5663e2-05f736ca-1b12-4692-a1f4-5b53d66079cc-000000@email.amazonses.com>
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.46]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: df8a9c39-8d47-402f-78e5-08d778118fc6
x-ms-traffictypediagnostic: MN2PR11MB3872:
x-microsoft-antispam-prvs: <MN2PR11MB38721A9F9314709E59716227B5420@MN2PR11MB3872.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-forefront-prvs: 02408926C4
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(346002)(136003)(376002)(396003)(366004)(51444003)(199004)(189003)(81156014)(25786009)(11346002)(229853002)(316002)(53546011)(6506007)(8676002)(55016002)(81166006)(33656002)(6246003)(54906003)(5660300002)(6916009)(446003)(86362001)(54896002)(52536014)(478600001)(6306002)(9686003)(76116006)(76176011)(7696005)(66476007)(64756008)(9326002)(66446008)(8936002)(256004)(14444005)(71200400001)(6436002)(236005)(186003)(74316002)(71190400001)(966005)(14454004)(606006)(4326008)(66946007)(102836004)(3846002)(26005)(2906002)(6116002)(7736002)(790700001)(99286004)(66556008); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB3872; H:MN2PR11MB4366.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: khJ/g3cZc9e1FPx0zZQULMzYtUGSJwMvs1gFCqvs11KZMHbAZ9JbMJo/aENhp8N2r6NkbgNUQvNcx1q7z1Wh2t90ayp5+KT+9nNho4sBNyHBdOiGeKU5Jbtf3VhEu6zo5Zk07yGyS5oh/0BfF76MNiu2b0LJjHYcleTL6EhZ9QGxp/MB62zSfKVIsqCS0X2NrXo2cp91eBSif6afDm227HoddK0r4EbSGLzZeWRmMuyh5GclUpQY7IyOG3/lJe0XJtN88C4qiNUAWtY93wsDBIojp1lHvDK0zK2ymIwMjmtYD792I+ApWnPBr48deV7FawcxyNQIcL49dbAE/7Iz0PtYrG13oFbyBnqEL1xgRmrnEbUz2mnnYYPVatubKFQOveV1RzU2syJrdgsndb+0jbl8jl8QtzOBrc9ur6YFvvjDM/uUEItHIXkCcSxbIhGB9IgDlQsR4oLDuYIb9fXbt4jMoXTBF2cLKfGuIgohU40=
x-ms-exchange-transport-forked: True
Content-Type: multipart/alternative; boundary="_000_MN2PR11MB43668F9767A378B614DD69D1B5420MN2PR11MB4366namp_"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: df8a9c39-8d47-402f-78e5-08d778118fc6
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 16:55:11.7051 (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: gdLYB70GEYtkeqO2xZFfU4r8nfewCJDVaZWcYl0+RWv1VBPi6IMjNKSjaheCbXlKBSQRJBMALNK3u4lPJefg8g==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3872
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.36.7.25, xch-aln-015.cisco.com
X-Outbound-Node: alln-core-9.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/HC88MkKJmdp8OnQ34GYa0f3H_6M>
Subject: Re: [yang-doctors] Consistency for naming lists and leaf-lists
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Dec 2019 16:55:19 -0000

Hi Kent,

From: Kent Watsen <kent@watsen.net>
Sent: 03 December 2019 15:17
To: Rob Wilton (rwilton) <rwilton@cisco.com>
Cc: Ladislav Lhotka <lhotka@nic.cz>; yang-doctors@ietf.org
Subject: Re: [yang-doctors] Consistency for naming lists and leaf-lists

Hi Rob,


Can't we just say that lists SHOULD NOT be put in their own containers to wrap the list?

If we were to pick a default stance, though I'm hesitant to think we should, I'd recommend the opposite, that containers SHOULD be used to wrap lists (and this strategy is used in all the models in the drafts I'm authoring).
FWIW, this is exactly why I think that we need a default stance.  The YANG models that IETF ends up standardizing are going to end up looking different and inconsistent depending on which YANG Doctor is doing the review.


I feel that this is conceptually more accurate.  That is, what we call a "list" is really a list-element, hence why it should have  singular name.  A wrapping-container, having a plural name, gives it the appearance of it being a collection at first glance (e.g., "/widget" vs. "/widgets/widget").

I don’t think that a YANG list as a list element, I think of it as the thing that represents the entire list (e.g. as it is encoded in CBOR/JSON).  Unfortunately, the different encodings (XML vs JSON/CBOR) end up with different representations on the wire, which probably doesn’t help.  I also think that avoiding unnecessary containers is the better approach.

If we were starting from scratch, with just the JSON/CBOR encodings, or a different XML encoding for lists, then I would have preferred naming the lists in the plural tense, just as I would normally name maps/lists/collections.  And there is part of me that thinks that using plurals might be the right approach going forward … although I suspect that Martin will disagree 😉

But for me, I think that the number one thing is that we are consistent, at least in the mainline case.

Thanks,
Rob



In REST APIs, clients create new list-elements by POST-ing to the parent resource, which acts as the list, supporting query options for sorting, filtering, searching, and pagination.  While it is possible to have heterogeneous contents (i.e., using media-types), it's most common for the contents to be homogeneous.  Any search for "REST API collection best practice" shows this.

The issue we're having is what might be called an "impedance mismatch".  In YANG, the list-element is the "list", but the parent node is rightfully the "collection".

Notably, https://tools.ietf.org/html/draft-ietf-netconf-restconf-collection<https://tools.ietf.org/html/draft-ietf-netconf-restconf-collection-00> effectively bucks REST API best practice, targeting the collection-oriented operations to the "list element" resource.  Accordingly, this resulting RESTCONF API is both asymmetric and different than most other REST APIs.  For example (simplified for brevity):

               To insert a new widget into the collection:

                              POST /widgets

               To get widgets in the collection:

                              GET /widgets/widget?limit=2&offset=3?sort=name?where='foo==bar'

               (both are "collection" operations, but act on different resources)

It is understandable why the "restconf-collection" draft takes the approach it does, it being the logical result of YANG allowing a container to having more than one 'list' descendant.  But, if we were ever to pick that draft up again, or perhaps as part of YANG-next, we could define a "collection" annotation for containers (or a "collection" statement) that would: 1) signal that the container contains exactly one list and 2) allow the list-operations to be targeted to the container resource.

In the meanwhile, while waiting for the "collections" work to be picked up again, I feel that the YANG best practice, if anything, should be to mimic this structure (a container wrapping each list).

Kent