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

Andy Bierman <andy@yumaworks.com> Tue, 03 December 2019 16:08 UTC

Return-Path: <andy@yumaworks.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 7169D12006D for <yang-doctors@ietfa.amsl.com>; Tue, 3 Dec 2019 08:08:37 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.com
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 dPUGRDm9Uvku for <yang-doctors@ietfa.amsl.com>; Tue, 3 Dec 2019 08:08:34 -0800 (PST)
Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DC6BF1200A1 for <yang-doctors@ietf.org>; Tue, 3 Dec 2019 08:08:33 -0800 (PST)
Received: by mail-lf1-x12d.google.com with SMTP id q6so3422869lfb.6 for <yang-doctors@ietf.org>; Tue, 03 Dec 2019 08:08:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JCS6c6TIpy5awkpE0jv0YtqLHw5Nnizi16zH9GoJVug=; b=dpOhwyUV7/LclLPD14S7B9ZU8NQgra4+OOcu1pX9Nct/4lAX5zsnMIfgD0D2z0MJMx 9Z5RaztGEaPzccXjQVGLy8OUuc/2HQYiBfOZfzQxjHT8LL3Id1DprojETR2nlypxQtjg R7bBiTkxgw6p+3dy3LvuD4OIADG9wvkgrgABbzudHOKaXmenu+Im7aHsj4uNiTS9mjNG aV/lBVR2LdxVdCnZ6M4p3N2lcQlIivEeKOVPP8raZNDTmIrc8Z/K9/o9AlOrtBWfbDbD juXWE9MmH+PeI5l4uoVwbtyj9N2NfHFtQhMtSBcpEy0gG95We4ShqCcjbmN0bMzEB7W6 hYsg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JCS6c6TIpy5awkpE0jv0YtqLHw5Nnizi16zH9GoJVug=; b=gksn8pDfzZ7uXQeRLPB4IYipmMK3EAGya2G1XA4wpsNABxW5KhUIgLjZ6TmLYMeLy8 U8X1jXunY//mZ0ypSfrekXPk+fNd7JoSBD+UAhtt+nY+2ZujTF+wEdkHufGf8amtS8tc svxj6L5WXK2JZXgsdNLVEPI6YcxH57AhJhS+aeFettJcxN0R/5zKqB0KzXgOC3bckjYR 798kTUDeWGS3eB0DvOObrI4eDc4NNIrfJEWT4rzFg4G3c7uORDbrtsCK7vA0fdszeAxV /E0leMqBDK7Zy+RAK9i7mofsYcci2fbPhCTIglnRc0Q7wcgzbDfUGh8BIF5noOfUFzMO 7yPQ==
X-Gm-Message-State: APjAAAUWapNF5b3DsqAxBqQ4AHr5eP0xdHcCBrs6iCYy1qtY+VOg7bnn pS9BaxjcqoE6o5Sb2Y3hTtFJARW8X6nSKJrVRQRI6Qgm
X-Google-Smtp-Source: APXvYqxj+BKCYyD3Qs9VGdSyKZK1WLxMnjZVnYbQr66nz6qT9EYCKt0u5dx8zD1cme1frJDpMdKXU+gmCl3Crpg2kU8=
X-Received: by 2002:a05:6512:15d:: with SMTP id m29mr2116348lfo.51.1575389311921; Tue, 03 Dec 2019 08:08:31 -0800 (PST)
MIME-Version: 1.0
References: <9e54af2d14f72cfc498fee23987e588e84e59bc5.camel@nic.cz> <MN2PR11MB43663CA34FE4E3B9EDB59578B5420@MN2PR11MB4366.namprd11.prod.outlook.com> <0100016ecc5663e2-05f736ca-1b12-4692-a1f4-5b53d66079cc-000000@email.amazonses.com> <20191203.164529.67194688085153171.mbj@tail-f.com>
In-Reply-To: <20191203.164529.67194688085153171.mbj@tail-f.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Tue, 03 Dec 2019 08:08:20 -0800
Message-ID: <CABCOCHTrt-k=Bc5nAXtE_yJZKVc-x_eAeUJjM_6SRz71ExbsKA@mail.gmail.com>
To: Martin Bjorklund <mbj@tail-f.com>
Cc: Kent Watsen <kent@watsen.net>, YANG Doctors <yang-doctors@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000005208100598cee89d"
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/sJ2OL4BhrFEHjGJ4X344sqALMjw>
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:08:37 -0000

On Tue, Dec 3, 2019 at 7:46 AM Martin Bjorklund <mbj@tail-f.com> wrote:

> Hi,
>
> Kent Watsen <kent@watsen.net> wrote:
> > 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).
>
> I think that NP-containers should be used when they make sense from a
> modelling pow, i.e., to provide structure to the nodes.  In most cases
> such containers are not needed.  I do not agree that it is a good idea
> to put a surrounding container on *all* lists just for the sake of it
> (and eventually I am going to send comments re this and other things
> like naming in your drafts, but not until we have agreement on the
> basics).
>
> > 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").
> >
> > 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.
>
> I know it is common that REST apis are structured like this.  But a
> YANG model is not a defintion for a REST interface; rather, RESTCONF
> is one of many ways to access data modelled in YANG.
>
> A good structure, just like good names, matter, even though we discuss
> programmatic interfaces.
>
>

I agree with Martin about designing for RESTCONF when YANG is used for
several protocols.
(E.g. extra containers could mean extra keywords in the CLI)

A parent container does solve some protocol deficiencies in NETCONF and
RESTCONF
but we should resist strict CLRs and decide each case on its merits.

I am far more concerned about the style of organizing and publishing
groupings instead of accessible objects.
Just try implementing YANG Push/SN and you will see what I mean. The same
groupings used in different
places have different implementation details.  Most of the details are not
explained at all in the YANG object because the
grouping descriptions are intended to be context independent.  The
descriptions in "uses" subtrees in each context
are terse or non-existent.  Perhaps developers will make the same
implementation decisions. Perhaps not.
There are 100s of details spread out in the RFCs outside the YANG objects,
which makes sense for this
protocol and context independent approach, but makes development much more
complex.



> /martin
>
>
Andy


>
>
> > 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
>
> _______________________________________________
> yang-doctors mailing list
> yang-doctors@ietf.org
> https://www.ietf.org/mailman/listinfo/yang-doctors
>