Re: [netmod] choice/case in tree diagrams

Vladimir Vassilev <vladimir@transpacket.com> Mon, 05 March 2018 13:14 UTC

Return-Path: <vladimir@transpacket.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 5BDDF12D778 for <netmod@ietfa.amsl.com>; Mon, 5 Mar 2018 05:14:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] 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 q5II2PrSF7fC for <netmod@ietfa.amsl.com>; Mon, 5 Mar 2018 05:14:29 -0800 (PST)
Received: from mail.transpacket.com (s91205186171.blix.com [91.205.186.171]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 077CF120454 for <netmod@ietf.org>; Mon, 5 Mar 2018 05:14:29 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by mail.transpacket.com (Postfix) with ESMTP id E26C62F806BE; Mon, 5 Mar 2018 14:14:26 +0100 (CET)
Received: from mail.transpacket.com ([127.0.0.1]) by localhost (mail.transpacket.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id SQs3rPnBmhxG; Mon, 5 Mar 2018 14:14:26 +0100 (CET)
Received: from localhost (localhost [127.0.0.1]) by mail.transpacket.com (Postfix) with ESMTP id B82182F806C5; Mon, 5 Mar 2018 14:14:26 +0100 (CET)
Received: from mail.transpacket.com ([127.0.0.1]) by localhost (mail.transpacket.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7_bmDgm_hBEY; Mon, 5 Mar 2018 14:14:26 +0100 (CET)
Received: from [192.168.209.122] (s1853520235.blix.com [185.35.202.35]) by mail.transpacket.com (Postfix) with ESMTPSA id 920362F806BE; Mon, 5 Mar 2018 14:14:26 +0100 (CET)
To: netmod@ietf.org, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
References: <20180305.122627.1715904795972526238.mbj@tail-f.com> <20180305125008.sm7izwuic65mhrti@elstar.local>
From: Vladimir Vassilev <vladimir@transpacket.com>
Message-ID: <e65c7b6c-37fa-abbd-b4fd-29d10e7f8437@transpacket.com>
Date: Mon, 05 Mar 2018 14:14:26 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
MIME-Version: 1.0
In-Reply-To: <20180305125008.sm7izwuic65mhrti@elstar.local>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Content-Language: en-US
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/dqpHtOseva800lbgC86JuwWiyBc>
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: Mon, 05 Mar 2018 13:14:31 -0000

On 03/05/2018 01:50 PM, Juergen Schoenwaelder wrote:

> I prefer that the choice/case nodes do not have any flags since they
> are not having a config true/false property on their own. And less
> clutter is better.
'choice' statements have 'config' substatement while 'case' do not. I 
myself figured that out while I was implementing tree diagrams support.

I would prefer the current pyang output and a change to the yang-tree 
document to specify that nodes without config substatement do not have 
<flags>.

Vladimir
>
> /js
>
> On Mon, Mar 05, 2018 at 12:26:27PM +0100, Martin Bjorklund wrote:
>> 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
>>
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org
>> https://www.ietf.org/mailman/listinfo/netmod