Re: [netmod] choice/case in tree diagrams

Martin Bjorklund <mbj@tail-f.com> Tue, 06 March 2018 09:47 UTC

Return-Path: <mbj@tail-f.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 0D838127078 for <netmod@ietfa.amsl.com>; Tue, 6 Mar 2018 01:47:16 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.911
X-Spam-Level:
X-Spam-Status: No, score=-1.911 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] 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 QyRvcxyBuqAV for <netmod@ietfa.amsl.com>; Tue, 6 Mar 2018 01:47:14 -0800 (PST)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 64E5E127076 for <netmod@ietf.org>; Tue, 6 Mar 2018 01:47:14 -0800 (PST)
Received: from localhost (unknown [173.38.220.45]) by mail.tail-f.com (Postfix) with ESMTPSA id 81F831AE0339; Tue, 6 Mar 2018 10:47:13 +0100 (CET)
Date: Tue, 06 Mar 2018 10:47:11 +0100 (CET)
Message-Id: <20180306.104711.1679438839200955433.mbj@tail-f.com>
To: mjethanandani@gmail.com
Cc: j.schoenwaelder@jacobs-university.de, netmod@ietf.org
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <3338E375-31AB-4064-8A83-88410776E40F@gmail.com>
References: <20180305.152602.113020152789243398.mbj@tail-f.com> <20180305.152754.1045464928563003353.mbj@tail-f.com> <3338E375-31AB-4064-8A83-88410776E40F@gmail.com>
X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/hInbzRjsPW1lOBV2-47xOXK-leI>
Subject: Re: [netmod] choice/case in tree diagrams
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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, 06 Mar 2018 09:47:16 -0000

Mahesh Jethanandani <mjethanandani@gmail.com> wrote:
> 
> 
> > On Mar 5, 2018, at 6:27 AM, Martin Bjorklund <mbj@tail-f.com> wrote:
> > 
> > Martin Bjorklund <mbj@tail-f.com <mailto:mbj@tail-f.com>> wrote:
> >> Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
> >>> On Mon, Mar 05, 2018 at 02:54:18PM +0100, Martin Bjorklund wrote:
> >>>>> 
> >>>>> So it seems the running code got it right. ;-)
> >>>> 
> >>>> As the author of that code, I think that was purely by accident...
> >>>> 
> >>>> But I'm not convinced it is the correct solution.  We have one example
> >>>> in the other thread where someone was confused by the "rw" flag and
> >>>> thought that it implied that the node would be present in the data
> >>>> tree.
> >>>> 
> >>> 
> >>> So what does rw mean?
> >>> 
> >>> (i)  The schema node has a rw property.
> >>> (ii) The schema node can be instantiated and the instantiated data
> >>> node
> >>>     has a rw property.
> >>> 
> >>> I think it is difficult to have both at the same time. If the tree is
> >>> a representation of schema nodes, then (i) seems to make more
> >>> sense. That said, the explanation in 2.6 is somewhat vague since it
> >>> says 'data' and not 'nodes' (like everywhere else):
> >>> 
> >>> OLD:
> >>> 
> >>>       <flags> is one of:
> >>>         rw  for configuration data
> >>>         ro  for non-configuration data, output parameters to rpcs
> >>>             and actions, and notification parameters
> >>> 
> >>> NEW:
> >>> 
> >>>       <flags> is one of:
> >>>         rw  for configuration data nodes
> >>>         ro  for non-configuration data nodes, output parameters to rpcs
> >>>             and actions, and notification parameters
> >> 
> >> I think this is ok.  But that means that we also have to add:
> >> 
> >>           --  for a choice or case node
> >> 
> >> But in order to be consistent, we should probably have:
> >> 
> >>           --  for a choice, case, input or output node
> > 
> > Whoops, it shouldn't be "--".  Somehow we should say that no flags are
> > used for choice,case,input,output.
> 
> I would agree, as having choice/case statements represented as schema
> nodes is not only confusing in the tree diagram

Well, choice and case *are* schema nodes.  They are printed within
parentheses, which may give you a hint that they are not data nodes
and thus not visible in the payload.

The tree diagram is intended as a compact, easy-to-read representation
of the structure of the YANG module.  They will not contain all
details needed to produce good examples.


/martin

, but also confusing
> when constructing an example. The tree diagram represents it as a
> node, where one would put it in the example, but validation complained
> about it (not being a node).
> 
> > 
> > 
> > /martin
> > 
> > 
> >> 
> >> 
> >> This means that the correct tree syntax for choice and case will be:
> >> 
> >>     +-- (subnet)?
> >>        +-- :(prefix-length)
> >>        |  +--rw prefix-length?   uint8
> >>        +-- :(netmask)
> >>           +--rw netmask?         yang:dotted-quad
> >> 
> >> 
> >> /martin
> >> 
> >> 
> >>> The document (as far as I searched for it) does not clearly say that
> >>> 'node' means 'schema node'. In hindsight, it might have been useful to
> >>> explicitely import terminology from RFC 7950 and to use it carefully
> >>> (RFC 7950 has 'schema node' and 'data node' but here we largely talk
> >>> about 'nodes' - and my assumption is that this means 'schema nodes'.)
> >> 
> >> _______________________________________________
> >> netmod mailing list
> >> netmod@ietf.org
> >> https://www.ietf.org/mailman/listinfo/netmod
> >> 
> > 
> > _______________________________________________
> > netmod mailing list
> > netmod@ietf.org <mailto:netmod@ietf.org>
> > https://www.ietf.org/mailman/listinfo/netmod
> > <https://www.ietf.org/mailman/listinfo/netmod>
> Mahesh Jethanandani
> mjethanandani@gmail.com
>