Subject: [netmod] clarification of default values in leaf-list

From: Radek Krejčí <[email-masked]>
Date: Tue, 16 Aug 2016 14:01:00 +0200

Hi all,
I'm not sure what is actually the default value in leaf-list if there are multiple default statements. Is it each of the values defined as default or the set of default values together? My point is, in case of NETCONF with-defaults capability, when the leaf-list instance is supposed to be marked as default (report-all-tagged retrieval mode) - when it contains one of the values defined as default or only when there is a complete set of default values (and in case of user-ordered leaf-list, when they are in correct order)?

Regards,
Radek Krejci

---

From: Martin Bjorklund <[email-masked]>
Date: Tue, 16 Aug 2016 14:36:58 +0200 (CEST)

Radek Krejčí <[email-masked]> wrote:
> Hi all,
> I'm not sure what is actually the default value in leaf-list if there
> are multiple default statements.  Is it each of the values defined as
> default or the set of default values together? My point is, in case of
> NETCONF with-defaults capability, when the leaf-list instance is
> supposed to be marked as default (report-all-tagged retrieval mode) -
> when it contains one of the values defined as default or only when
> there is a complete set of default values (and in case of user-ordered
> leaf-list, when they are in correct order)?

6020bis says:

  If a leaf-list has one or more "default" statement, the leaf-list's
  default values are the values of the "default" statements, and if the
  leaf-list is user-ordered, the default values are used in the order of
  the "default" statements.

Doesn't this answer your questions?

/martin

---

From: Radek Krejčí <[email-masked]>
Date: Tue, 16 Aug 2016 14:54:26 +0200

> Doesn't this answer your questions?

no, it doesn't - the "leaf-list's default values are" indicates that there can be multiple default values for the leaf-list. So each of the default statement defines one of the leaf-list's default values. But the second part refers to the default values to be used together, as a set. I think that it makes better sense to use the leaf-list's default value as a set, but that first sentence confuses me.

Radek

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 16 Aug 2016 17:25:49 +0200

> On 16 Aug 2016, at 14:54, Radek Krejčí <[email-masked]> wrote:
> 

leaf-list foo {
    type string;
    default "zig";
    default "zag";
}

The default content is the sequence of values taken from all "default" statements, i.e. in JSON encoding it is

"foo": ["zig", "zag"]

Lada

> 
> Radek
> 
>> 
>> /martin
> 
> 
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

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

---

From: Andy Bierman <[email-masked]>
Date: Tue, 16 Aug 2016 20:29:56 -0700

On Tue, Aug 16, 2016 at 8:25 AM, Ladislav Lhotka <[email-masked]> wrote:

> > no, it doesn't - the "leaf-list's default values are" indicates that
> there can be multiple default values for the leaf-list. So each of the
> default statement defines one of the leaf-list's default values. But the
> second part refers to the default values to be used together, as a set. I
> think that it makes better sense to use the leaf-list's default value as a
> set, but that first sentence confuses me.
>
> leaf-list foo {
>     type string;
>     default "zig";
>     default "zag";
> }
>
Or the server could return ["zag", "zig"] because this is an ordered-by
system leaf-list.

Let's say the client sets foo to the value "zag".
If the server basic-mode=explicit, then foo = [ "zag" ] and foo is not a
default.
But if the basic-mode=trim, then there was no node created, so foo is still
a default ["zig", "zag"].

Is this correct? What matches the YANG default for this node in
with-defaults trim mode?

1)
   ["zig", "zag"]

2)
   ["zig"] and ["zag"]

Andy

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 17 Aug 2016 08:21:34 +0200

> On 17 Aug 2016, at 05:29, Andy Bierman <[email-masked]> wrote:
> 
> 
> 
> Or the server could return ["zag", "zig"] because this is an ordered-by system leaf-list.

Yes.

> If the server basic-mode=explicit, then foo = [ "zag" ] and foo is not a default.
> Is this correct? What matches the YANG default for this node in with-defaults trim mode?

This is not how I understand it - the default value should be the list en bloc, so if the client sets the value to "zag", the default should be always replaced by the new value ["zag"], which is different from ["zig", "zag"].

But: when we say "client sets", does the edit operation matter? If it is "merge", should the new value be ["zig", "zag"] (= the original default content merged with the new value)?

Lada