Subject: Re: [netmod] Questions about how to assign default values with YANG

From: Italo Busi <[email-masked]>
Date: Mon, 8 Mar 2021 20:19:39 +0000

Hi Juergen,

Thanks again for your clear explanation on this topic

I have found a similar but slightly different issue. In this case, a YANG default statement exists in the base module but the intention with the augmentation is to "overwrite" the default value on the basis of another attribute, defined in the module which augments the base module.

For example, I am wondering whether such a code is valid:

module example-base {
  container example {
    leaf foo {
      type uint8;
      default 0;
    }
  }
}

module example-augment {
  import example {
    prefix ex;
  }

  augment "ex:example" {
    leaf bar {
      type empty;
      description
        "When present, the default value for foo is 10.";
    }
  }
}

In this case, when the leaf foo is not configured but the leaf bar is present, the value of foo in the operational datastore should be 10 (rather than 0).

In this case, I think that it would be better/cleaner if the origin is marked as system.

Maybe a better YANG description for bar could be: "When present, the system overrides the default value of foo to 10."

What is your and/or WG opinion?

Thanks again

Italo

> -----Original Message-----
> From: Juergen Schoenwaelder [mailto:[email-masked]]
> Sent: mercoledì 20 gennaio 2021 17:05
> To: Italo Busi <[email-masked]>
> Cc: [email-masked]' <[email-masked]>
> Subject: Re: [netmod] Questions about how to assign default values with
> YANG
>
> On Wed, Jan 20, 2021 at 02:41:39PM +0000, Italo Busi wrote:
> >
> > What about the case the leaf is not conditional (but still mandatory false
> since a YANG default statement is defined)?
> >
> > May the server still decide not to use/implement this leaf in the operational
> datastore?
> >
> > For example, in appendix C.1 of RFC8342, auto-negotiation is enabled by
> default.
> > What should be the behavior of a system which does not implement auto-
> negotiation?
> > Return the value false or no value (in the operational datastore)?
> >
>
> Here are some of the rules I personally like:
>
>  - <operational> is the ground truth about what a system has and does
>  - do not implement leafs that do not apply
>
> Hence, interfaces supporting auto-negotiation have either auto-
> negotiation/enabled = true or auto-negotiation/enabled = false in
> <operational>. And interfaces not supporting auto-negotiation have nothing
> to report about auto-negotiation. Yes, I do not want to see auto-
> negotiation/enabled = false on a loopback interface.
>
> My historic Ethernet interface from the last century would also not report
> auto-negotiation/enabled in <operational>. You may hit applications that love
> to have auto-negotiation/enabled available on all Ethernet interfaces and then
> you end in a debate where the application developers tell you that no
> information in <operational> may have many reasons (instrumentation not
> implemented, access control rules, whatever and by reporting enabled=false
> you do them a favor) but the true answer in such a debate is often that
> modeling things as a boolean is simplistic since there are often more than
> exactly two states (in this case, enabled, disabled, failed, not-available, ...).
> So you settle on blaming the model writer. ;-)
>
> /js
>
> --
> 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/>

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 09 Mar 2021 17:46:43 +0100

> For example, I am wondering whether such a code is valid:

Yes, this is valid, I'd just suggest:

- remove the default statement for "foo", as it may be confusing to both humans and tools

- specify the default (both cases) in the description of "foo"

A similar example is in the module ietf-ipv6-router-advertisements, e.g. leaf "min-rtr-adv-interval":

https://www.rfc-editor.org/rfc/rfc8349.html#section-9.1

Lada

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

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67

---

From: Andy Bierman <[email-masked]>
Date: Tue, 9 Mar 2021 08:58:17 -0800

On Tue, Mar 9, 2021 at 8:46 AM Ladislav Lhotka <[email-masked]>
wrote:

> > I have found a similar but slightly different issue. In this case, a
> YANG default statement exists in the base module but the intention with the
> augmentation is to "overwrite" the default value on the basis of another
> attribute, defined in the module which augments the base module.
> >
I do not agree.
I do not see how the description-stmt for /foo can change the default leaf
processing for /bar

> - remove the default statement for "foo", as it may be confusing to both

sec 7.3.4:

   If the base type has a default value and the new derived type does
   not specify a new default value, the base type's default value is
   also the default value of the new derived type.

sec 7.6.1

   The default value of a leaf is the value that the server uses if the
   leaf does not exist in the data tree.  The usage of the default value
   depends on the leaf's closest ancestor node in the schema tree that
   is not a non-presence container (see Section 7.5.1
<https://tools.ietf.org/html/rfc7950#section-7.5.1>):

   o  If no such ancestor exists in the schema tree, the default value
      MUST be used.

   o  Otherwise, if this ancestor is a case node, the default value MUST
      be used if any node from the case exists in the data tree or the
      case node is the choice's default case, and if no nodes from any
      other case exist in the data tree.

   o  Otherwise, the default value MUST be used if the ancestor node
      exists in the data tree.

> https://www.rfc-editor.org/rfc/rfc8349.html#section-9.1

Andy

> > In this case, when the leaf foo is not configured but the leaf bar is
> present, the value of foo in the operational datastore should be 10 (rather
> than 0).
> >
> > Maybe a better YANG description for bar could be: "When present, the
> system overrides the default value of foo to 10."
> >

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 9 Mar 2021 18:32:24 +0100

On 09. 03. 21 17:58, Andy Bierman wrote:
> 
> 
> On Tue, Mar 9, 2021 at 8:46 AM Ladislav Lhotka <[email-masked]
> <mailto:[email-masked]>> wrote:
> 
>     Italo Busi <[email-masked] <mailto:[email-masked]>>
>     writes:
> 
>     > Hi Juergen,
>     >
>     > I have found a similar but slightly different issue. In this case,
>     a YANG default statement exists in the base module but the intention
>     with the augmentation is to "overwrite" the default value on the
>     basis of another attribute, defined in the module which augments the
>     base module.
>     >
> I do not see how the description-stmt for /foo can change the default
> leaf processing for /bar
> 

Are you saying that the (computed) default values specified in
description strings (as in ietf-ipv6-router-advertisements) are illegal?

Lada

>    is not a non-presence container (see Section 7.5.1 <https://tools.ietf.org/html/rfc7950#section-7.5.1>):
> 
>     <https://www.rfc-editor.org/rfc/rfc8349.html#section-9.1>
> 
>     Lada
> 
> 
> 
> Andy
>  
> 
> 
>     >
>     > module example-base {
>     >   container example {
>     >     leaf foo {
>     >       type uint8;
>     >       default 0;
>     >     }
>     >   }
>     > }
>     >
>     > module example-augment {
>     >   import example {
>     >     prefix ex;
>     >   }
>     >
>     >   augment "ex:example" {
>     >     leaf bar {
>     >       type empty;
>     >       description
>     > In this case, when the leaf foo is not configured but the leaf bar
>     is present, the value of foo in the operational datastore should be
>     10 (rather than 0).
>     >
>     > Maybe a better YANG description for bar could be: "When present,
>     the system overrides the default value of foo to 10."
>     >
>     >> From: Juergen Schoenwaelder
>     [mailto:[email-masked]
>     <mailto:[email-masked]>]
>     >> To: Italo Busi <[email-masked] <mailto:[email-masked]>>
>     >> Cc: [email-masked] <mailto:[email-masked]>' <[email-masked]
>     <mailto:[email-masked]>>
>     >> Fax:   +49 421 200 3103       
>      <https://www.jacobs-university.de/ <https://www.jacobs-university.de/>>
>     >
>     > [email-masked] <mailto:[email-masked]>
>     <https://www.ietf.org/mailman/listinfo/netmod>
> 
>     -- 
>     Ladislav Lhotka
>     Head, CZ.NIC Labs
>     [email-masked] <mailto:[email-masked]>
>     <https://www.ietf.org/mailman/listinfo/netmod>
> 
>

---

From: Andy Bierman <[email-masked]>
Date: Tue, 9 Mar 2021 09:55:21 -0800

> description strings (as in ietf-ipv6-router-advertisements) are illegal?
Of course not.
In this case there MUST NOT be a YANG default-stmt in use for the leaf or
leaf-list.

If the leaf or leaf-list does have a YANG default-stmt that MUST be used,
then
no description-stmt can undo the requirements in 7.6.1

Andy

> >    is not a non-presence container (see Section 7.5.1 <
> https://tools.ietf.org/html/rfc7950#section-7.5.1>):
> >

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 9 Mar 2021 19:01:09 +0100

On 09. 03. 21 18:55, Andy Bierman wrote:
> 
> 
> On Tue, Mar 9, 2021 at 9:32 AM Ladislav Lhotka <[email-masked]
>     > On Tue, Mar 9, 2021 at 8:46 AM Ladislav Lhotka
>     <[email-masked] <mailto:[email-masked]>
>     > <mailto:[email-masked] <mailto:[email-masked]>>>
>     wrote:
>     >
>     >     Italo Busi <[email-masked]
>     <mailto:[email-masked]> <mailto:[email-masked]
>     <mailto:[email-masked]>>>
>     >     writes:
>     >
>     >     > Hi Juergen,
>     >     >
>     >     > Thanks again for your clear explanation on this topic
>     >     >
>     >     > I have found a similar but slightly different issue. In this
>     case,
>     >     >
>     >     > For example, I am wondering whether such a code is valid:
>     >
> In this case there MUST NOT be a YANG default-stmt in use for the leaf
> or leaf-list.
> 
> If the leaf or leaf-list does have a YANG default-stmt that MUST be
> used, then

Isn't it exactly what I was suggesting in my two items? Namely: remove
the "default" statement for "foo" and write this in the description of
"foo":

    The default value is 10 if the "bar" sibling leaf exist,
    and zero otherwise.

Lada

> 
>  
> 
>     Lada
> 
> 
> 
> Andy
>  
> 
>     >
>     >  
>     >
>     >     - remove the default statement for "foo", as it may be
>     confusing to
>     >     both humans and tools
>     >
>     >
>     > sec 7.3.4:
>     >
>     <https://tools.ietf.org/html/rfc7950#section-7.5.1
>     <https://tools.ietf.org/html/rfc7950#section-7.5.1>>):
>     >
>     >     A similar example is in the module
>     ietf-ipv6-router-advertisements,
>     >     e.g. leaf "min-rtr-adv-interval":
>     >
>     >     <https://www.rfc-editor.org/rfc/rfc8349.html#section-9.1
>     <https://www.rfc-editor.org/rfc/rfc8349.html#section-9.1>>
>     >
>     >     Lada
>     >
>     >
>     >
>     > Andy
>     >  
>     >
>     >
>     >     >
>     >     > module example-base {
>     >     >   container example {
>     >     >     leaf foo {
>     >     >       type uint8;
>     >     >       default 0;
>     >     >     }
>     >     >   }
>     >     > }
>     >     >
>     >     > module example-augment {
>     >     >   import example {
>     >     >     prefix ex;
>     >     >   }
>     >     >
>     >     >   augment "ex:example" {
>     >     >     leaf bar {
>     >     >       type empty;
>     >     >       description
>     >     >         "When present, the default value for foo is 10.";
>     >     >     }
>     >     >   }
>     >     > }
>     >     >
>     >     >
>     >     > In this case, when the leaf foo is not configured but the
>     leaf bar
>     >     >
>     >     > In this case, I think that it would be better/cleaner if the
>     >     origin is marked as system.
>     >     >
>     >     > Maybe a better YANG description for bar could be: "When present,
>     >     >
>     >     > What is your and/or WG opinion?
>     >     >
>     >     > Thanks again
>     >     >
>     >     > Italo
>     >     >
>     >     >> -----Original Message-----
>     >     >> From: Juergen Schoenwaelder
>     <mailto:[email-masked]>
>     >     <mailto:[email-masked]
>     <mailto:[email-masked]>>]
>     >     >> Sent: mercoledì 20 gennaio 2021 17:05
>     >     >> To: Italo Busi <[email-masked]
>     <mailto:[email-masked]> <mailto:[email-masked]
>     <mailto:[email-masked]>>>
>     >     >> Cc: [email-masked] <mailto:[email-masked]>
>     <mailto:[email-masked] <mailto:[email-masked]>>' <[email-masked]
>     <mailto:[email-masked]>
>     >     <mailto:[email-masked] <mailto:[email-masked]>>>
>     >     >> Subject: Re: [netmod] Questions about how to assign default
>     >     values with
>     >     >> YANG
>     >     >>
>     >     >> On Wed, Jan 20, 2021 at 02:41:39PM +0000, Italo Busi wrote:
>     >     >> >
>     >     >> > What about the case the leaf is not conditional (but still
>     >     mandatory false
>     >     >> since a YANG default statement is defined)?
>     >     >> >
>     >     >> > May the server still decide not to use/implement this leaf in
>     >     the operational
>     >     >> datastore?
>     >     >> >
>     >     >> > For example, in appendix C.1 of RFC8342, auto-negotiation is
>     >     enabled by
>     >     >> default.
>     >     >> > What should be the behavior of a system which does not
>     >     implement auto-
>     >     >> negotiation?
>     >     >> > Return the value false or no value (in the operational
>     datastore)?
>     >     >> >
>     >     >>
>     >     >> Here are some of the rules I personally like:
>     >     >>
>     >     >>  - <operational> is the ground truth about what a system
>     has and does
>     >     >>  - do not implement leafs that do not apply
>     >     >>
>     >     >> Hence, interfaces supporting auto-negotiation have either auto-
>     >     >> negotiation/enabled = true or auto-negotiation/enabled =
>     false in
>     >     >> <operational>. And interfaces not supporting auto-negotiation
>     >     have nothing
>     >     >> to report about auto-negotiation. Yes, I do not want to see
>     auto-
>     >     >> negotiation/enabled = false on a loopback interface.
>     >     >>
>     >     >> My historic Ethernet interface from the last century would also
>     >     not report
>     >     >> auto-negotiation/enabled in <operational>. You may hit
>     >     applications that love
>     >     >> to have auto-negotiation/enabled available on all Ethernet
>     >     interfaces and then
>     >     >> you end in a debate where the application developers tell
>     you that no
>     >     >> information in <operational> may have many reasons
>     >     (instrumentation not
>     >     >> implemented, access control rules, whatever and by reporting
>     >     enabled=false
>     >     >> you do them a favor) but the true answer in such a debate is
>     >     often that
>     >     >> modeling things as a boolean is simplistic since there are
>     often
>     >     more than
>     >     >> exactly two states (in this case, enabled, disabled, failed,
>     >     not-available, ...).
>     >     >> So you settle on blaming the model writer. ;-)
>     >     >>
>     >     >> /js
>     >     >>
>     >     >> --
>     >     >> 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/
>     <https://www.jacobs-university.de/>
>     <https://www.jacobs-university.de/ <https://www.jacobs-university.de/>>>
>     >     >
>     >     > _______________________________________________
>     >     > netmod mailing list
>     >     > [email-masked] <mailto:[email-masked]>
>     <mailto:[email-masked] <mailto:[email-masked]>>
>     >     > https://www.ietf.org/mailman/listinfo/netmod
>     >     <https://www.ietf.org/mailman/listinfo/netmod
>     <https://www.ietf.org/mailman/listinfo/netmod>>
>     >
>     >     --
>     >     Ladislav Lhotka
>     >     Head, CZ.NIC Labs
>     <mailto:[email-masked] <mailto:[email-masked]>>
>     >     <https://www.ietf.org/mailman/listinfo/netmod
>     <https://www.ietf.org/mailman/listinfo/netmod>>
>     >
>     >

---

From: Italo Busi <[email-masked]>
Date: Tue, 9 Mar 2021 18:45:50 +0000

Lada, Andy,

Thanks for your feedbacks.

If I understand correctly, if the base model and the augmentation model are defined at the same time, we can avoid defining any YANG default statement in the base model and providing a proper description of the desired behavior.

Based on previous discussion with Juergen, I have understood that, in this case, the origin in the operational datastore can be either set to default or to system (Juergen prefers the latter but the former is allowed by section 5.3.4 of RFC8342).

I think this would be the ideal solution, but in practice there are cases where the base model has been written before the augmentation model and/or the author of the base model is not aware of the needs from the author of the augmentation model.

In these cases, the YANG default statement already exists in the base model.

Is it really required to change the base model or could a work-around be found?

In principle, the system has enough information to understand that, if no value for the leaf foo is provided in the intended DS, the value in the applied configuration for the leaf foo should be 10 rather than the value defined in the YANG default statement (i.e., 0).

Based your comments, I think that in this case, the origin in the operational datastore must not be set to default, but I am wondering whether it could be set to system instead. In other words, the applied configuration for foo is provided by the system on the basis of the rules associated with the configuration of bar.

If this is possible, then the issue could be solved without the need to request a change to the base model.

The description in the augmented model needs to be cleaned-up since in my initial mail it was misleading.

Maybe a better alternative could be something like “When bar is present and foo is not configured, the system applies the value 10 to foo rather than its default value.” (it could be further improved).

What do you think?

Italo

From: Andy Bierman [mailto:[email-masked]]
Sent: martedì 9 marzo 2021 17:58
To: Italo Busi <[email-masked]>; Juergen Schoenwaelder <[email-masked]>; [email-masked]
Subject: Re: [netmod] Questions about how to assign default values with YANG

On Tue, Mar 9, 2021 at 8:46 AM Ladislav Lhotka <[email-masked]<mailto:[email-masked]>> wrote:

I do not agree.
I do not see how the description-stmt for /foo can change the default leaf processing for /bar

sec 7.3.4:

sec 7.6.1

   is not a non-presence container (see Section 7.5.1<https://tools.ietf.org/html/rfc7950#section-7.5.1>):

      MUST be used.

      exists in the data tree.

Lada

Andy

>> From: Juergen Schoenwaelder [mailto:[email-masked]<mailto:[email-masked]>]
>> To: Italo Busi <[email-masked]<mailto:[email-masked]>>
>> Cc: [email-masked]<mailto:[email-masked]>' <[email-masked]<mailto:[email-masked]>>
> [email-masked]<mailto:[email-masked]>

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

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Tue, 9 Mar 2021 20:52:41 +0100

Changing the semantics of a definition via augments is bad design.

A system that does not understand the augment will believe the default
is 0. Since there is no way to force an existing implementation to
understand a certain augmentation, different implementation will
rightfully disagree on the default value in effect.

/js

---

From: Andy Bierman <[email-masked]>
Date: Tue, 9 Mar 2021 12:11:30 -0800

> rightfully disagree on the default value in effect.

deviation /ex:example/ex:foo {
    delete {
       default 0;
     }
}

IMO it was a bad idea to say deviations MUST NOT appear in standard modules.
Here is a use-case for it.

The old-client does not know about the new dynamic default but it could know
that the old YANG default is not being used.

Andy

---

From: Italo Busi <[email-masked]>
Date: Wed, 10 Mar 2021 08:54:18 +0000

Andy, Juergen,

I am not sure I understand the issue with a client that does not understand the augment.

When this client writes in the running DS, it will not set the bar attribute (which is also defined in the augment module) and therefore the default value 0 will be applied by the system, as expected by the client.

When this client reads from the operational DS the applied configuration, provided by another client which understands the augment, it will see that the applied configuration for the leaf foo is 10.

This is a valid applied configuration if the other client had explicitly configured the value 10 in the running DS.

The only difference would be that when the value 10 is explicitly configured by the other client the origin is set to intended while when “implicitly” configured using the attribute bar, the origin can be set to system (I think it would not be correct to set the origin to default in this case).

BTW, I agree that this is not the most elegant/clean design and that the best approach would be not to define any default value in the base model. I am just willing to understand if a work-around is possible, without breaking any client, to allow re-using an existing module which has already defined a default value.

Italo

From: Andy Bierman [mailto:[email-masked]]
Sent: martedì 9 marzo 2021 21:12
To: Juergen Schoenwaelder <[email-masked]>; Italo Busi <[email-masked]>; [email-masked]
Subject: Re: [netmod] Questions about how to assign default values with YANG

On Tue, Mar 9, 2021 at 11:52 AM Juergen Schoenwaelder <[email-masked]<mailto:[email-masked]>> wrote:
Changing the semantics of a definition via augments is bad design.

/js

Andy

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Wed, 10 Mar 2021 11:00:58 +0100

A client that has no clue of the annotated leaf can rightfully assume
that the default 0 applies. If another client creates this magic leaf
that changes the default to 10, then there is going to be confusion.

A definition that says 'default 0' says the default is 0. It does not
say the default may be zero or something different depending on
whether the moon shines or other circumstances. I believe you can't
undo a default statement with a description somewhere else.

/js

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 10 Mar 2021 11:21:26 +0100

> undo a default statement with a description somewhere else.

The problem with descriptions is that there seems to be a general agreement that they can somehow supplement the formal YANG statements in specifying the data model. This has no support in RFC 7950 though:

- section 7.21.3 only says that a description is "a human-readable textual
  description of this definition"

- section 8.1 doesn't include constraints specified in descriptions in the
  concept of data tree validity

As a result, data model constraints specified in descriptions is a grey area, and it is totally unclear how far-reaching they can possibly be.

Lada

---

From: Andy Bierman <[email-masked]>
Date: Wed, 10 Mar 2021 06:16:06 -0800

On Wed, Mar 10, 2021 at 12:54 AM Italo Busi <[email-masked]> wrote:

> When this client writes in the running DS, it will not set the bar
> attribute (which is also defined in the augment module) and therefore the
> default value 0 will be applied by the system, as expected by the client.
>
>
>
> When this client reads from the operational DS the applied configuration,
> provided by another client which understands the augment, it will see that
> the applied configuration for the leaf foo is 10.
>
>
>
> This is a valid applied configuration if the other client had explicitly
> configured the value 10 in the running DS.
>
>
>
> The only difference would be that when the value 10 is explicitly
> configured by the other client the origin is set to intended while when
> “implicitly” configured using the attribute bar, the origin can be set to
> system (I think it would not be correct to set the origin to default in
> this case).
>
>
>
> BTW, I agree that this is not the most elegant/clean design and that the
> best approach would be not to define any default value in the base model. I
> am just willing to understand if a work-around is possible, without
> breaking any client, to allow re-using an existing module which has already
> defined a default value.
>

Read sec. 7.6.1 again, especially this part:

   When the default value is in use, the server MUST operationally
   behave as if the leaf was present in the data tree with the default
   value as its value.

Your proposal violates this MUST because the default is in use
according to the rules

Andy

>
>
> *From:* Andy Bierman [mailto:[email-masked]]
> *Sent:* martedì 9 marzo 2021 21:12
> *To:* Juergen Schoenwaelder <[email-masked]>; Italo
> Busi <[email-masked]>; [email-masked]
> *Subject:* Re: [netmod] Questions about how to assign default values with
> YANG
>
>
>
>
>
>
>

---

From: William Lupton <[email-masked]>
Date: Wed, 10 Mar 2021 14:33:48 +0000

Lada, all,

Surely a description is the only way to add a normative requirement that
can't be expressed via YANG statements (including XPath expressions)?

I've always assumed that it's good practice to express what you can using
the modeling language, and then use the description to express any
non-modelable requirements. Obviously there's a problem if the description
conflicts with a modeled requirement (and I think it's also good practice
for the description not to repeat anything that's modeled elsewhere).

I think that RFC 7950 can be interpreted as indicating that the description
is more than just informative. I found this in Section 11, and I take this
to imply that the description defines the semantics of a definition.

A "description" statement may be added or changed without changing the

semantics of the definition.

For example, if a description says this (this is an example from RFC 7950),
then isn't this a _normative_ semantic requirement?

"The amount of local storage that can be used to hold syslog messages."

William

On Wed, 10 Mar 2021 at 10:21, Ladislav Lhotka <[email-masked]>
wrote:

> The problem with descriptions is that there seems to be a general
> agreement that they can somehow supplement the formal YANG statements in
> specifying the data model. This has no support in RFC 7950 though:
>
> As a result, data model constraints specified in descriptions is a grey
> area, and it is totally unclear how far-reaching they can possibly be.
>
> Lada
>
> >
> > /js
> >
> >> When this client reads from the operational DS the applied
> configuration, provided by another client which understands the augment, it
> will see that the applied configuration for the leaf foo is 10.
> >>
> >> This is a valid applied configuration if the other client had
> explicitly configured the value 10 in the running DS.
> >>
> >> BTW, I agree that this is not the most elegant/clean design and that
> the best approach would be not to define any default value in the base
> model. I am just willing to understand if a work-around is possible,
> without breaking any client, to allow re-using an existing module which has
> already defined a default value.
> >>
> >> Italo
> >>
> >> To: Juergen Schoenwaelder <[email-masked]>;
> Italo Busi <[email-masked]>; [email-masked]
> [email-masked]<mailto:
> [email-masked]>> wrote:
> >> > > From: Juergen Schoenwaelder [mailto:
> [email-masked]<mailto:
> [email-masked]>]
> >> > > To: Italo Busi <[email-masked]<mailto:[email-masked]
> >>

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 10 Mar 2021 16:13:55 +0100

> to imply that the description defines the semantics of a definition.

Even then, it is unclear what effects are permitted with this "more than informative". In a previous mail I refered to a standard module having a description that defines a (computed) default. This seems to be acceptable.

But what about simulating a "when" statement for constraints that cannot be expressed via XPath? For example:

  description
    "This leaf is only valid if the value of foo is prime.";

I argued in the past that everything that cannot be expressed formally with YANG statements should be left outside of scope for YANG, at least in terms of data tree validation.

> "The amount of local storage that can be used to hold syslog messages."

Hmm, this seems to state semantics (meaning) of a parameter. What I am talking about are semantic constraints (business rules) that a valid data tree is required to satisfy.

Lada

---

From: Italo Busi <[email-masked]>
Date: Wed, 10 Mar 2021 15:25:13 +0000

Hi Andy,

I see your point,

At the beginning of this thread, I have had a doubt about how to reconcile sec. 7.6.1 of RFC7950 with sec. 5.3 of RFC8342:

   Requests to retrieve nodes from <operational> always return the value
   in use if the node exists, regardless of any default value specified
   in the YANG module.  If no value is returned for a given node, then
   this implies that the node is not used by the device.

My understanding that the client will always get the applied value independently on whether it is 0 or 10 or another value.

Anyway, it seems to me that the issue is mainly about the keyword “default” so let me take a step back and try to define the issue I am trying to solve, without assuming any solution.

What I need is to find a solution that allows a client to request the server to apply the value 10 for the leaf foo in the operational DS without “explicitly” writing the value 10 in the running DS but “implicitly” by writing another leaf bar in the running DS, even if the leaf foo has a YANG default statement defining 0 as its default value.

I think that the NMDA architecture is quite flexible and could be leveraged to resolve this issue.

Stepping away from defining default values, one possibility could be that the applied configuration of the value of foo is defined by the system before applying the intended configuration in the operational DS, as a side effect of applying the configuration of the leaf bar.

Another alternative which is just jumping to my mind, could be that the value of 10 for the leaf foo is set by the system in the intended DS, applying a sort of template. Should in this case the definition of the leaf bar be interpreted as a template configuration or how should the required template configuration be provided?

Could any of this option be used to resolve this issue?

Italo

From: Andy Bierman [mailto:[email-masked]]
Sent: mercoledì 10 marzo 2021 15:16
To: Italo Busi <[email-masked]>
Cc: Juergen Schoenwaelder <[email-masked]>; [email-masked]
Subject: Re: [netmod] Questions about how to assign default values with YANG

On Wed, Mar 10, 2021 at 12:54 AM Italo Busi <[email-masked]<mailto:[email-masked]>> wrote:
Andy, Juergen,

   value as its value.

Your proposal violates this MUST because the default is in use according to the rules

Italo

Andy

From: Andy Bierman [mailto:[email-masked]<mailto:[email-masked]>]
Sent: martedì 9 marzo 2021 21:12
To: Juergen Schoenwaelder <[email-masked]<mailto:[email-masked]>>; Italo Busi <[email-masked]<mailto:[email-masked]>>; [email-masked]<mailto:[email-masked]>
Subject: Re: [netmod] Questions about how to assign default values with YANG

/js

Andy

---

From: William Lupton <[email-masked]>
Date: Wed, 10 Mar 2021 15:34:16 +0000

Thanks Lada. By my last point I just intended to illustrate that
descriptions need to be regarded as normative even if they don't use
normative language.

On Wed, 10 Mar 2021 at 15:13, Ladislav Lhotka <[email-masked]>
wrote:

> Even then, it is unclear what effects are permitted with this "more than
> informative". In a previous mail I refered to a standard module having a
> description that defines a (computed) default. This seems to be acceptable.
>
> I argued in the past that everything that cannot be expressed formally
> with YANG statements should be left outside of scope for YANG, at least in
> terms of data tree validation.
>
> >
> Hmm, this seems to state semantics (meaning) of a parameter. What I am
> talking about are semantic constraints (business rules) that a valid data
> tree is required to satisfy.
>
> Lada
>
> >
> >
> > William
> >
> >> >> The old-client does not know about the new dynamic default but it
> could
> >> know
> a
> is
> the
> >> >> > > Subject: Re: [netmod] Questions about how to assign default
> values
> >> with
> >> >> > > YANG
> >> >> > >
> >> >> > > > May the server still decide not to use/implement this leaf in
> the
> >> operational
> >> >> > > datastore?
> >> >> > > >
> >> >> > > > What should be the behavior of a system which does not
> implement
> >> auto-
> >> >> > > negotiation?
> >> >> > > <operational>. And interfaces not supporting auto-negotiation
> have
> >> nothing
> >> >> > > My historic Ethernet interface from the last century would also
> not
> >> report
> >> >> > > auto-negotiation/enabled in <operational>. You may hit
> applications
> >> that love
> >> >> > > you end in a debate where the application developers tell you
> that
> >> no
> >> >> > > information in <operational> may have many reasons
> (instrumentation
> >> not
> >> >> > > you do them a favor) but the true answer in such a debate is
> often
> >> that

---

From: Andy Bierman <[email-masked]>
Date: Wed, 10 Mar 2021 07:40:33 -0800

> can't be expressed via YANG statements (including XPath expressions)?

description-stmt requirements are normative.
RFC 2119 language applies exactly the same as if it were in some text
section insted of the YANG module.

The issue is that the normative requirements for YANG 1.1 defined in RFC
7950 cannot be
negated by a description-stmt. E.g.

module bad {

    leaf turn-off-mandatory {
        type empty;
        description
           "If this leaf is present then all YANG mandatory-stmts are
ignored throughout this module.";
    }

This may be a valid description-stmt and YANG leaf but any server that
implements it is also
violating MUST requirements in RFC 7950.

Andy

> I think that RFC 7950 can be interpreted as indicating that the
> description is more than just informative. I found this in Section 11, and
> I take this to imply that the description defines the semantics of
> a definition.
>
> For example, if a description says this (this is an example from RFC
> 7950), then isn't this a _normative_ semantic requirement?
>
>> could know
>> is present, the value of foo in the operational datastore should be 10
>> (rather than 0).
>> >> >
>> >> > > Fax:   +49 421 200 3103         <https://www.jacobs-university.de/
>> >
>> >> >
>> >>
>> >> --

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Wed, 10 Mar 2021 17:14:54 +0100

I do not understand where the problem is.

a) If a leaf says my default is 0, then the default is 0 and you can't
   change that by creating other leafs somewhere else that says
   something different.

b) If a leaf says that is has a default value but the value is
   determined in some magic way not defined here, then you can add
   additional leafs that detail the magic for certain contexts

The point is that a) tells clients they can safely assume the default
value is 0 while b) tells clients that they can assume that there is a
default but the exact default value they will not know unless they
understand magic.

If a data model author thought the default is always 0 and later
he/she realizes that in some contexts the default should be something
different, then you have to resolve that by creating new leafs (in the
current version of YANG) or you declares a non-backwards compatible
new version of the definition of the leaf (if the versioning work gets
standardized).

/js

---

From: Italo Busi <[email-masked]>
Date: Wed, 10 Mar 2021 17:34:41 +0000

Juergen,

I think you have got the problem: "a data model author thought the default is always 0 and later he/she realizes that in some contexts the default should be something different"

Unless I am missing something, creating a new leaf (e.g., foo-new) would confuse an existing client.

For example, within the operational DS, the value of foo will be set to 0 (as per YANG default statement) while the value of foo-new will be set to 10, which represents the actual value in use by the system.

Now, the existing client, which is not aware of foo-new, when reading the value of foo in the operational DS will incorrectly think that the actual value in use by the system is 0 rather than 10.

Am I missing anything?

Instead, if we can find a magic way to apply the value 10 to foo within the operational DS, the existing client can read the value of foo in the operational DS and correctly understand that the actual value in use by the system is 10 (even if this is not the default value of foo).

Italo

> Sent: mercoledì 10 marzo 2021 17:15
> Cc: [email-masked]
> The point is that a) tells clients they can safely assume the default value is 0
> while b) tells clients that they can assume that there is a default but the exact
> default value they will not know unless they understand magic.
>
> If a data model author thought the default is always 0 and later he/she
> realizes that in some contexts the default should be something different, then
> you have to resolve that by creating new leafs (in the current version of YANG)
> or you declares a non-backwards compatible new version of the definition of
> the leaf (if the versioning work gets standardized).
>
> /js
>
> > At the beginning of this thread, I have had a doubt about how to reconcile
> sec. 7.6.1 of RFC7950 with sec. 5.3 of RFC8342:
> >
> > My understanding that the client will always get the applied value
> independently on whether it is 0 or 10 or another value.
> >
> > Anyway, it seems to me that the issue is mainly about the keyword “default”
> so let me take a step back and try to define the issue I am trying to solve,
> without assuming any solution.
> >
> > What I need is to find a solution that allows a client to request the server to
> apply the value 10 for the leaf foo in the operational DS without “explicitly”
> writing the value 10 in the running DS but “implicitly” by writing another leaf
> bar in the running DS, even if the leaf foo has a YANG default statement
> defining 0 as its default value.
> >
> > Stepping away from defining default values, one possibility could be that
> the applied configuration of the value of foo is defined by the system before
> applying the intended configuration in the operational DS, as a side effect of
> applying the configuration of the leaf bar.
> >
> > Another alternative which is just jumping to my mind, could be that the
> value of 10 for the leaf foo is set by the system in the intended DS, applying a
> sort of template. Should in this case the definition of the leaf bar be
> interpreted as a template configuration or how should the required template
> configuration be provided?
> >
> > Cc: Juergen Schoenwaelder <[email-masked]<mailto:[email-masked]>>;
> > On Wed, Mar 10, 2021 at 12:54 AM Italo Busi
> <[email-masked]<mailto:[email-masked]<mailto:[email-masked]<mailto:[email-masked]>>> wrote:
> > Andy, Juergen,
> >
> > When this client writes in the running DS, it will not set the bar attribute
> (which is also defined in the augment module) and therefore the default
> value 0 will be applied by the system, as expected by the client.
> >
> > The only difference would be that when the value 10 is explicitly configured
> by the other client the origin is set to intended while when “implicitly”
> configured using the attribute bar, the origin can be set to system (I think it
> would not be correct to set the origin to default in this case).
> >
> > BTW, I agree that this is not the most elegant/clean design and that the best
> approach would be not to define any default value in the base model. I am
> just willing to understand if a work-around is possible, without breaking any
> client, to allow re-using an existing module which has already defined a
> default value.
> >
> >
> > From: Andy Bierman
> > [mailto:[email-masked]<mailto:[email-masked]>]
> > To: Juergen Schoenwaelder
> > <[email-masked]<mailto:j.schoenwaelder@jacobs-un
> > iversity.de>>; Italo Busi
> > <[email-masked]<mailto:[email-masked]<mailto:[email-masked]<mailto:[email-masked]>>>;
> > [email-masked]<mailto:[email-masked]<mailto:[email-masked]<mailto:[email-masked]>>
> > On Tue, Mar 9, 2021 at 11:52 AM Juergen Schoenwaelder
> <[email-masked]<mailto:j.schoenwaelder@jacobs-<mailto:[email-masked]<mailto:[email-masked]>
> university.de>> wrote:
> > could know that the old YANG default is not being used.
> >
> >
> > /js
> >
> > Andy
> >
> >
> > > I have found a similar but slightly different issue. In this case, a YANG
> default statement exists in the base module but the intention with the
> > > In this case, when the leaf foo is not configured but the leaf bar is present,
> the value of foo in the operational datastore should be 10 (rather than 0).
> > >
> > > > [mailto:[email-masked]<mailto:j.schoenwaelde
> > > > [email-masked]<mailto:[email-masked]>>]
> > > > To: Italo Busi
> > > > <[email-masked]<mailto:[email-masked]<mailto:[email-masked]<mailto:[email-masked]>>>
> > > > Cc: [email-masked]<mailto:[email-masked]>'
> > > > <[email-masked]<mailto:[email-masked]<mailto:[email-masked]<mailto:[email-masked]>>>
> > > > <operational>. And interfaces not supporting auto-negotiation have
> > > > nothing to report about auto-negotiation. Yes, I do not want to
> > > > see auto- negotiation/enabled = false on a loopback interface.
> > > >
> > > > not report auto-negotiation/enabled in <operational>. You may hit
> > > > applications that love to have auto-negotiation/enabled available
> > > > on all Ethernet interfaces and then you end in a debate where the
> > > > application developers tell you that no information in
> > > > <operational> may have many reasons (instrumentation not
> > > > implemented, access control rules, whatever and by reporting
> > > > enabled=false you do them a favor) but the true answer in such a
> > > > debate is often that modeling things as a boolean is simplistic since
> there are often more than exactly two states (in this case, enabled, disabled,
> failed, not-available, ...).
> > [email-masked]<mailto:[email-masked]<mailto:[email-masked]<mailto:[email-masked]>>

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Wed, 10 Mar 2021 19:33:38 +0100

> Unless I am missing something, creating a new leaf (e.g., foo-new) would confuse an existing client.

No, it does not confuse the client, the client will ignore it.
 
> For example, within the operational DS, the value of foo will be set to 0 (as per YANG default statement) while the value of foo-new will be set to 10, which represents the actual value in use by t…

Yes, a new implementation will have to declare that it does not
implement foo.
 
> Now, the existing client, which is not aware of foo-new, when reading the value of foo in the operational DS will incorrectly think that the actual value in use by the system is 0 rather than 10.

A client reading <operational> knows the value in use. But clients do
not have to real operational.

> Instead, if we can find a magic way to apply the value 10 to foo within the operational DS, the existing client can read the value of foo in the operational DS and correctly understand that the act…

In general, you can't assume that clients read operational. I can't
judge the specific circumstances but in traditional NC/RC, a default
statement can be interpreted as "assume the default value is in force
if this lead is not configured" (unless the client uses RFC 6243
report-all). If all clients are in an NMDA world, the issue is much
smaller - it is reduced to "does the client believe the server has a
bug or not". But even then, I continue to believe that a leaf changing
the semantics of another leaf is bad design.

/js

---

From: Italo Busi <[email-masked]>
Date: Wed, 10 Mar 2021 19:24:42 +0000

Hi Jurgen,

Now I can understand your concerns :)

> If all clients are in an
> NMDA world, the issue is much smaller - it is reduced to "does the client
> believe the server has a bug or not". 

Yes, I was assuming that all the clients and the server were NMDA-compliant. It seems worthwhile spelling out this requirement more explicitly when defining the work-around.

I think that the solution would also work if the client and the server follows the guidelines of section 2 of draft-dsdt-nmda-guidelines-01: in this case the behavior of the NMDA module in the running DS would be fully compliant with RFC8342, while the non-NMDA module would be an exact copy of the operational DS (the client needs to read within this module to get the in-use value).

Otherwise, I am not sure how can an non-NMDA client properly operate over an NMDA server: the values reported by the server in the running DS do not necessarily represent the values in use by the system.

> But even then, I continue to believe that
> a leaf changing the semantics of another leaf is bad design.

I agree: I am just looking for a reasonable work-around that could work when it is not possible to remove an existing YANG default statement.

The lesson-learnt from this discussion is that more care has to be taken when defining YANG default statements.

Italo

> Sent: mercoledì 10 marzo 2021 19:34
> > I think you have got the problem: "a data model author thought the default
> is always 0 and later he/she realizes that in some contexts the default should
> be something different"
> >
> > For example, within the operational DS, the value of foo will be set to 0 (as
> per YANG default statement) while the value of foo-new will be set to 10,
> which represents the actual value in use by the system.
> 
> Yes, a new implementation will have to declare that it does not implement
> foo.
> 
> > Now, the existing client, which is not aware of foo-new, when reading the
> value of foo in the operational DS will incorrectly think that the actual value
> in use by the system is 0 rather than 10.
> 
> A client reading <operational> knows the value in use. But clients do not have
> to real operational.
> 
> > Am I missing anything?
> >
> > Instead, if we can find a magic way to apply the value 10 to foo within the
> operational DS, the existing client can read the value of foo in the operational
> DS and correctly understand that the actual value in use by the system is 10
> (even if this is not the default value of foo).
> 
> In general, you can't assume that clients read operational. I can't judge the
> specific circumstances but in traditional NC/RC, a default statement can be
> interpreted as "assume the default value is in force if this lead is not
> configured" (unless the client uses RFC 6243 report-all). If all clients are in an
> NMDA world, the issue is much smaller - it is reduced to "does the client
> believe the server has a bug or not". But even then, I continue to believe that
> a leaf changing the semantics of another leaf is bad design.
> 
> /js
> 
> --

---

From: Andy Bierman <[email-masked]>
Date: Wed, 10 Mar 2021 11:46:29 -0800

On Wed, Mar 10, 2021 at 11:24 AM Italo Busi <[email-masked]> wrote:

> Yes, I was assuming that all the clients and the server were
> NMDA-compliant. It seems worthwhile spelling out this requirement more
> explicitly when defining the work-around.
>
> I think that the solution would also work if the client and the server
> follows the guidelines of section 2 of draft-dsdt-nmda-guidelines-01: in
> this case the behavior of the NMDA module in the running DS would be fully
> compliant with RFC8342, while the non-NMDA module would be an exact copy of
> the operational DS (the client needs to read within this module to get the
> in-use value).
>
> Otherwise, I am not sure how can an non-NMDA client properly operate over
> an NMDA server: the values reported by the server in the running DS do not
> necessarily represent the values in use by the system.
>
> I agree: I am just looking for a reasonable work-around that could work
> when it is not possible to remove an existing YANG default statement.
>
Or the lesson could be that the concept and implementation of YANG module
conformance
is still "under construction". You want to deviate from the old conformance
and
require a new conformance instead.

In SMIv2, model conformance can be per use-case, not just per-module
and explicit conformance statements are used, instead of conformance
implied by the
YANG statements themselves.

In this case, conformance to the new module is desired (without the YANG
default)
instead of conformance to the old module (with the YANG default). A server
cannot
advertise both modules, unless it also declares that it deviates from the
old module conformance.
(deviate delete default)

A new client finds the new module + the old module + the deviation.
An old client finds the old module and the deviation (if YANG compliant).
An old client thinks the server is deviating from the old module conformance
(because that is exactly what is happening).

Andy

> > > Unless I am missing something, creating a new leaf (e.g., foo-new)
> would
> > confuse an existing client.
> >
> judge the