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.

/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
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to