Subject: [yang-doctors] YANG usage of top level lists

From: "Joel M. Halpern" <[email-masked]>
Date: Tue, 13 Dec 2016 11:52:16 -0500

I notice that although YANG allows lists directly in modules, I almost 
never see such usage.  Is there a reason that this is avoided?    For 
example, I note that no one seems to have thought it strange that in the 
SUPA model I repeatedly use top level containers with just lists inside 
them, rather than putting the lists directly in the module.  I did that 
because I thought it was necessary.  Is there a reason it is a good 
idea, or should I just put the lists directly in the module?

Thank you,
Joel

---

From: Andy Bierman <[email-masked]>
Date: Tue, 13 Dec 2016 09:00:08 -0800

Hi,

There are a few reasons this practice might be a good idea

1) REST resource model uses a collection of instances which maps
in YANG to a container with a list in it

2) There is no standard way to delete all list instances at once so putting
the
    list in a container allows the container to be deleted and all child
list instances

3) a large number of siblings may impact server performance

Andy

On Tue, Dec 13, 2016 at 8:52 AM, Joel M. Halpern <[email-masked]>
wrote:

> because I thought it was necessary.  Is there a reason it is a good idea,
> or should I just put the lists directly in the module?
>
> Thank you,
> Joel
>
> _______________________________________________
> yang-doctors mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/yang-doctors
>

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 14 Dec 2016 08:10:40 +0100

> idea, or should I just put the lists directly in the module?

XML doesn't have the concept of lists, so in XML encoding it is possible
that list entries are interleaved with other sibling elements. For
example, if we have in YANG

list a { ... }
leaf b { ... }

this is possible in XML encoding:

<a>...</a>
<b>...</b>
<a>...</a>

This may or may not be a problem.

JSON has arrays, so this issue doesn't exist in JSON encoding at all,
and extra containers usually just add an extra hierarchy level.

Lada

-- 
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C