Re: [netmod] Questions about how to assign default values with YANG
William Lupton <wlupton@broadband-forum.org> Wed, 10 March 2021 15:34 UTC
Return-Path: <wlupton@broadband-forum.org>
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 CB3AC3A1195 for <netmod@ietfa.amsl.com>; Wed, 10 Mar 2021 07:34:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=broadband-forum-org.20150623.gappssmtp.com
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 56sZElcOrVym for <netmod@ietfa.amsl.com>; Wed, 10 Mar 2021 07:34:29 -0800 (PST)
Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id EBC423A118C for <netmod@ietf.org>; Wed, 10 Mar 2021 07:34:28 -0800 (PST)
Received: by mail-ed1-x533.google.com with SMTP id l12so28734901edt.3 for <netmod@ietf.org>; Wed, 10 Mar 2021 07:34:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadband-forum-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=CMiJtJdYOqW6msarcZfHwj9FxiXeLZgMrF7WR+mgzh4=; b=Rf3bdIOXDODUqGqbS8o2juDkhUuDCkUrjS4QhPs7VukB1OxFWhBvKpNHQHC67kDMGe fgz3i5MSJ98XtqAVlT8FOxhBbIACsofdloGCNQ3g8ZkkYvXEmFtoxz8A4HF6D0yP1qAj aOiJ0Q1SjC1qkyK6Yi8B0GrhgAcgspRdlV3aKDrQi93E8NAHTyK0ttOnsbxlbJ8mhR9G g+TCftlII9dAUtH0LAX0Q7VheE3gA7EouiopbPOCCIvO2JfeW+LfQPfiMTv5cWhhKdT7 rG/s0uelLT9pmATUw7LJQRT1anC/CLMGCOcgqPCDlC4s67ZX3EcVYLzHjpKI5ujsVyxu 5sSQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=CMiJtJdYOqW6msarcZfHwj9FxiXeLZgMrF7WR+mgzh4=; b=suUJ0Iv0Kf+GfYSmSjhGu32Ds1r1xNbJSrc6dxfYvlFPz0NS8X5NjWmEv5P5EI69Kn tHeP4Q/A+gamJi9y15o9vkXqD7tufpTumBpbi66VAdxOze0z6V0YDGzKOZ6Q/34YeIFt +BMZcqVVZCj2lSmc15swKxEC7GoU/u1vJfsMnFTBqsh6IuQKReuxR6IXg932afRxZ3TG M/nzlD7GXyecsfrFi/k2Di1EhC5UKUpTzUkDCX+piRbSTJpy67jz8vqY1FJ2x/90na5t ubO77bSqasQJVzmpPM9ohUjrjEo6nerxDO2cNWWKqR2vtkhs1VdxjUiMtess2yzfFpMv 7OjA==
X-Gm-Message-State: AOAM5301rVA4aB7wHURb8jcOSJq2a1AprR20tIrZE7gVX+1cOrajkKkV PiaZ3Mf0+WjTotPAwFIoUFU5kTN6qgrqsEBsq0OQ+g==
X-Google-Smtp-Source: ABdhPJz50F254j1N5Bsek6ZgmSzILWWCIzMfjE9O0iTq3nnLYwkKIxjh4Pmj6cDBKJ7C443upKzDX4AFMRyqQpu+p+w=
X-Received: by 2002:aa7:cb4d:: with SMTP id w13mr3971735edt.249.1615390467230; Wed, 10 Mar 2021 07:34:27 -0800 (PST)
MIME-Version: 1.0
References: <a0c43ab5c3c1463a97a1aa594a80ceee@huawei.com> <20210120094737.g5l5pvfzligahrj6@anna.jacobs.jacobs-university.de> <2384a8f549c94ea0ac46d6c772fbca43@huawei.com> <20210120114446.ovih63db7vmv7c7s@anna.jacobs.jacobs-university.de> <0ed5638881af42148720dd7f4843c3e6@huawei.com> <20210120160517.hsg5dnpidvrprtso@anna.jacobs.jacobs-university.de> <521a9ccd02e14d178a6e62971b4809ea@huawei.com> <20210309195241.k5lfmdnw2zqq6b4o@anna.jacobs.jacobs-university.de> <CABCOCHQkTsToyZ3qW3am41s3m7VLYt=pAdjBMuR0cMCwahbekg@mail.gmail.com> <bbbd4244a0474c48b3fdecb791cb936a@huawei.com> <20210310100058.y7yrbgd6z3rgmo4s@anna.jacobs.jacobs-university.de> <87h7ljfgwp.fsf@nic.cz> <CAEe_xxjce3=bVTbjkzkC62T9Gq+yVat8Fg6CQTomEUeTKQaPLg@mail.gmail.com> <87eegnf3d8.fsf@nic.cz>
In-Reply-To: <87eegnf3d8.fsf@nic.cz>
From: William Lupton <wlupton@broadband-forum.org>
Date: Wed, 10 Mar 2021 15:34:16 +0000
Message-ID: <CAEe_xxh7QA+shW4GoKOYT-Wqsz8e6ksXPd20hNeUnYy+SQn_LQ@mail.gmail.com>
To: William Lupton <wlupton@broadband-forum.org>, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, Italo Busi <Italo.Busi@huawei.com>, "netmod@ietf.org" <netmod@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000f91f2405bd306621"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/xUl_x68vLD-n7H13JGPvQ6H8CPs>
Subject: Re: [netmod] Questions about how to assign default values with YANG
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
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: Wed, 10 Mar 2021 15:34:33 -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 <ladislav.lhotka@nic.cz> wrote: > William Lupton <wlupton@broadband-forum.org> writes: > > > 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. > > 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. > > > > > 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." > > 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 > > > > On Wed, 10 Mar 2021 at 10:21, Ladislav Lhotka <ladislav.lhotka@nic.cz> > > wrote: > > > >> Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> writes: > >> > >> > 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. > >> > >> 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 > >> > >> > > >> > /js > >> > > >> > On Wed, Mar 10, 2021 at 08:54:18AM +0000, Italo Busi wrote: > >> >> 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:andy@yumaworks.com] > >> >> Sent: martedì 9 marzo 2021 21:12 > >> >> To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>; > >> Italo Busi <Italo.Busi@huawei.com>; netmod@ietf.org > >> >> Subject: Re: [netmod] Questions about how to assign default values > with > >> YANG > >> >> > >> >> > >> >> > >> >> On Tue, Mar 9, 2021 at 11:52 AM Juergen Schoenwaelder < > >> j.schoenwaelder@jacobs-university.de<mailto: > >> j.schoenwaelder@jacobs-university.de>> wrote: > >> >> 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. > >> >> > >> >> > >> >> 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. > >> >> > >> >> > >> >> /js > >> >> > >> >> Andy > >> >> > >> >> > >> >> On Mon, Mar 08, 2021 at 08:19:39PM +0000, Italo Busi wrote: > >> >> > 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: > >> j.schoenwaelder@jacobs-university.de<mailto: > >> j.schoenwaelder@jacobs-university.de>] > >> >> > > Sent: mercoledì 20 gennaio 2021 17:05 > >> >> > > To: Italo Busi <Italo.Busi@huawei.com<mailto: > Italo.Busi@huawei.com > >> >> > >> >> > > Cc: 'netmod@ietf.org<mailto:netmod@ietf.org>' <netmod@ietf.org > >> <mailto:netmod@ietf.org>> > >> >> > > 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/> > >> >> > > >> >> > >> >> -- > >> >> 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 > >> >> netmod@ietf.org<mailto:netmod@ietf.org> > >> >> 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 > >> > netmod@ietf.org > >> > https://www.ietf.org/mailman/listinfo/netmod > >> > >> -- > >> Ladislav Lhotka > >> Head, CZ.NIC Labs > >> PGP Key ID: 0xB8F92B08A9F76C67 > >> > >> _______________________________________________ > >> netmod mailing list > >> netmod@ietf.org > >> https://www.ietf.org/mailman/listinfo/netmod > >> > > _______________________________________________ > > netmod mailing list > > netmod@ietf.org > > https://www.ietf.org/mailman/listinfo/netmod > > -- > Ladislav Lhotka > Head, CZ.NIC Labs > PGP Key ID: 0xB8F92B08A9F76C67 >
- [netmod] Questions about how to assign default va… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Juergen Schoenwaelder
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Juergen Schoenwaelder
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Juergen Schoenwaelder
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Andy Bierman
- Re: [netmod] Questions about how to assign defaul… Ladislav Lhotka
- Re: [netmod] Questions about how to assign defaul… Ladislav Lhotka
- Re: [netmod] Questions about how to assign defaul… Andy Bierman
- Re: [netmod] Questions about how to assign defaul… Ladislav Lhotka
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Juergen Schoenwaelder
- Re: [netmod] Questions about how to assign defaul… Andy Bierman
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Juergen Schoenwaelder
- Re: [netmod] Questions about how to assign defaul… Ladislav Lhotka
- Re: [netmod] Questions about how to assign defaul… Andy Bierman
- Re: [netmod] Questions about how to assign defaul… William Lupton
- Re: [netmod] Questions about how to assign defaul… Ladislav Lhotka
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… William Lupton
- Re: [netmod] Questions about how to assign defaul… Andy Bierman
- Re: [netmod] Questions about how to assign defaul… Juergen Schoenwaelder
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Juergen Schoenwaelder
- Re: [netmod] Questions about how to assign defaul… Italo Busi
- Re: [netmod] Questions about how to assign defaul… Andy Bierman