[netmod] choice/case in tree diagrams

Martin Bjorklund <mbj@tail-f.com> Mon, 05 March 2018 11:26 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 A2983129C51 for <netmod@ietfa.amsl.com>; Mon, 5 Mar 2018 03:26:32 -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 VMpim4dNBTa3 for <netmod@ietfa.amsl.com>; Mon, 5 Mar 2018 03:26:31 -0800 (PST)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 59BF912783A for <netmod@ietf.org>; Mon, 5 Mar 2018 03:26:31 -0800 (PST)
Received: from localhost (unknown [173.38.220.45]) by mail.tail-f.com (Postfix) with ESMTPSA id 6EF1C1AE0351 for <netmod@ietf.org>; Mon, 5 Mar 2018 12:26:28 +0100 (CET)
Date: Mon, 05 Mar 2018 12:26:27 +0100 (CET)
Message-Id: <20180305.122627.1715904795972526238.mbj@tail-f.com>
To: netmod@ietf.org
From: Martin Bjorklund <mbj@tail-f.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/iExcrm7eiNgwvW8G5gA3Lo0nwmc>
Subject: [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: Mon, 05 Mar 2018 11:26:33 -0000

Hi,

Lifting this issue to its own thread.

With this snippet:

    choice subnet {
      case prefix-length {
        leaf prefix-length {
          type uint8;
        }
      }
      case netmask {
        leaf netmask {
          type yang:dotted-quad;
        }
      }
    }

pyang prints choice/case nodes like this:

     +--rw (subnet)?
        +--:(prefix-length)
        |  +--rw prefix-length?   uint8
        +--:(netmask)
           +--rw netmask?         yang:dotted-quad

With the syntax defined in the yang-tree document:

  <status>--<flags> <name><opts> <type> <if-features>

it means that the choice node has <flags> just like any other node (in
this case "rw"), but the case node has "" as <flags>, and no space
after the "--".

This is clearly inconsistent, and something needs to be fixed.

The current yang-tree document doesn't say that choice/case should be
treated differently than other nodes.

Alternatives:

  1)  The document is correct, this is a bug in pyang, the output
      should be:

     +--rw (subnet)?
        +--rw :(prefix-length)
        |  +--rw prefix-length?   uint8
        +--rw :(netmask)
           +--rw netmask?         yang:dotted-quad

  2)  Since the choice/case nodes are not present in the data tree,
      they should not have any flags.  The document should be fixed to
      allow empty flags so we have:

     +-- (subnet)?
        +-- :(prefix-length)
        |  +--rw prefix-length?   uint8
        +-- :(netmask)
           +--rw netmask?         yang:dotted-quad


Note that the document is currently in AUTH48.

Something needs to be done in the document though, b/c it shows the
current pyang output in an example.



/martin