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

Ladislav Lhotka <lhotka@nic.cz> Mon, 02 December 2019 12:06 UTC

Return-Path: <lhotka@nic.cz>
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 3BB1E12022A for <yang-doctors@ietfa.amsl.com>; Mon, 2 Dec 2019 04:06:36 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.997
X-Spam-Level:
X-Spam-Status: No, score=-6.997 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_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nic.cz
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 fwc2PMaHYXzF for <yang-doctors@ietfa.amsl.com>; Mon, 2 Dec 2019 04:06:33 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (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 D715D120255 for <yang-doctors@ietf.org>; Mon, 2 Dec 2019 04:06:32 -0800 (PST)
Received: from birdie (unknown [IPv6:2001:1488:fffe:6:a88f:7eff:fed2:45f8]) by mail.nic.cz (Postfix) with ESMTPSA id 17C28140723 for <yang-doctors@ietf.org>; Mon, 2 Dec 2019 13:06:31 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1575288391; bh=wBWSbqOxZPGQyU2lSS4w64WWNv93bdPyJJzk3VezGcU=; h=From:To:Date; b=WQmb4mklqnmRDT3vbjTCslle8L/DNTUKQZ/Of71AHxUGQvrS1aC3WtkZ4+RrNc3RI t2RyoS6IK8U5HrW5JlyWzXmZCMnzduwRPcvsvhwShtwMINSVSD5quNSmRrdeEmTN7w cIt12DDjx2ZGy33PU/lAqAE1RMRBvk+DjuDxonZo=
Message-ID: <9e54af2d14f72cfc498fee23987e588e84e59bc5.camel@nic.cz>
From: Ladislav Lhotka <lhotka@nic.cz>
To: yang-doctors@ietf.org
Date: Mon, 02 Dec 2019 13:06:30 +0100
In-Reply-To: <20191202.093931.847844329284889456.mbj@tail-f.com>
References: <MN2PR11MB4366355E6E59D9AFE3F27615B5460@MN2PR11MB4366.namprd11.prod.outlook.com> <20191202.093931.847844329284889456.mbj@tail-f.com>
Organization: CZ.NIC
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.100.3 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/DV-FBQrXjM4tn5iQyl9JZdTvUuI>
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: Mon, 02 Dec 2019 12:06:36 -0000

On Mon, 2019-12-02 at 09:39 +0100, Martin Bjorklund wrote:
> Hi,
> 
> "Rob Wilton (rwilton)" <rwilton@cisco.com> wrote:
> > Hi,
> > 
> > Perhaps this has been debated to death, or there is already an
> > agreement, but do we have an agreed consistent approach for
> > naming/containing lists in YANG?
> > 
> > In particular:
> > 
> >   1.  Should the list be enclosed in its own container
> >   (e.g. interfaces/interface)?
> 
> I don't think all lists should be "forced" into either having a
> container or not having a container.  Sometimes it makes sense and
> sometimes it is doesn't.  Proper structure and naming is an art...

I agree but it is also worth noting that in XML representation (unlike JSON and
CBOR) list instances may get interleaved with instances of other data nodes, if
there is no enclosing container.

Lada

> 
> One recommendation is to avoid top-level lists, hence "/interfaces".
> 
> >   2.  Should the name of the list be singular or plural?
> 
> Singular!
> 
> >   3.  Should leaf-lists be treated similarly?
> 
> Singluar name, but enclosing leaf-lists in containers are rarely
> useful.
> 
> >   4.  What if the list is a top level YANG node, does it get put into a
> >   container in that scenario (e.g. network-instances/network-instance)?
> 
> Yes.
> 
> > I think that it would be good if we can have a consistent approach
> > during reviews, perhaps folding into a future update of RFC 8407.
> > 
> > Looking at a couple of the recent models in RFCs, would seem to
> > suggest:
> > 
> >   1.  Top-level data nodes should probably always be containers
> >   2.  Lists don't need to be enclosed in a container (and should not be
> >   top-level data-nodes).
> >   3.  Names of lists and leaf-lists should be singular not plural.
> > 
> > Does that align with other folk's opinions?
> 
> Yes.
> 
> 
> /martin
> 
> _______________________________________________
> yang-doctors mailing list
> yang-doctors@ietf.org
> https://www.ietf.org/mailman/listinfo/yang-doctors
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67