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

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Wed, 10 March 2021 10:01 UTC

Return-Path: <J.Schoenwaelder@jacobs-university.de>
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 B49A73A20C7 for <netmod@ietfa.amsl.com>; Wed, 10 Mar 2021 02:01:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=jacobsuniversity.onmicrosoft.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 XScVg98W0pzu for <netmod@ietfa.amsl.com>; Wed, 10 Mar 2021 02:01:09 -0800 (PST)
Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20078.outbound.protection.outlook.com [40.107.2.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 179E83A20C5 for <netmod@ietf.org>; Wed, 10 Mar 2021 02:01:08 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOficUk2Bg2qYRm7eQqfu5Cjlc1dpaDW6jp+t3OUqZm7ad285hGwWENL2cX5Rae7Bzqj0BCMHS3Sc3n40Tg9KP6C0gxzaJm+aC9Ua8lnn9aEVxcAVi6P9p1S67A9IH5slnPeBHzdVEysmFa7S1wca0W22EUsYvkdjdBEr0g75Rr616MWP/NsspSuOCSkwGs2obZtiTGhIOozerR/1rC3he6pdMEtOzqwBv6BQNHwAtoXsDyislQkoIgW8xP4Dd7N/3l5LTeNyuVTSqQh5jkcgDmy3FkjqGZ88QeMRczdwWjo/4Ya8o2I1Yj2TxFNNqBwIlXg+UaRStBptTYWqyL8bA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T2Kpm4NmjWBCDjf5X8vSiBEg9QzKgCEGG+FXaMI1my4=; b=LQ5EJJx6A1yer7zbtcBkEH0QrhF4CWUJakIXFYVcet+OjQngXnLebxGbu+gtnoaOguCeZY2r1XN2zF29cZq5SaLpFH9xGUCG3QTQGrBhwyfeRWwD3JK65IFbudwrgkRfhThMAXO6lgH16gV+rRLgwsY5vmLVtQuh1UtCAId5xn5d+6NkNR2Q4llicJE6A1j+IuAIUIG1qFyVSeF7eQlnsGtpqquJIOYP6ftHL9dnbWLkmaE6mLrNP2yRR4Y6MG9yChfQqIihhOeAOsZXhegduDvgz7y5oKilMfp6eoygS16cPBFdvUKXKpHhvfdvTcrxNW/9J97N7jIhtbX/xmFgQg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jacobs-university.de; dmarc=pass action=none header.from=jacobs-university.de; dkim=pass header.d=jacobs-university.de; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jacobsuniversity.onmicrosoft.com; s=selector2-jacobsuniversity-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T2Kpm4NmjWBCDjf5X8vSiBEg9QzKgCEGG+FXaMI1my4=; b=O//NG9ZPW6/igyOYK3u67rCLZ4Tbd3NmviuvCwzrw+WqrRWaKk+1Fr+rqafT/KGkr0iJKvwRHQ+I2X1ZdamQPhBlYh/INovf/wowuF9ww5Iy/o3eZuTOMTxEko0B0Fzi2bb/7VKCWHtJ+PFOLNlx4rpor1zxAdEp/Q8NrctOIB4=
Authentication-Results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=jacobs-university.de;
Received: from AM0P190MB0641.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:194::23) by AM0P190MB0578.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:1a1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.29; Wed, 10 Mar 2021 10:01:01 +0000
Received: from AM0P190MB0641.EURP190.PROD.OUTLOOK.COM ([fe80::e8a2:9886:8dfa:41c6]) by AM0P190MB0641.EURP190.PROD.OUTLOOK.COM ([fe80::e8a2:9886:8dfa:41c6%4]) with mapi id 15.20.3912.030; Wed, 10 Mar 2021 10:01:01 +0000
Date: Wed, 10 Mar 2021 11:00:58 +0100
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Italo Busi <Italo.Busi@huawei.com>
Cc: 'Andy Bierman' <andy@yumaworks.com>, "netmod@ietf.org" <netmod@ietf.org>
Message-ID: <20210310100058.y7yrbgd6z3rgmo4s@anna.jacobs.jacobs-university.de>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Italo Busi <Italo.Busi@huawei.com>, 'Andy Bierman' <andy@yumaworks.com>, "netmod@ietf.org" <netmod@ietf.org>
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>
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <bbbd4244a0474c48b3fdecb791cb936a@huawei.com>
X-Originating-IP: [212.201.44.244]
X-ClientProxiedBy: AM0PR04CA0024.eurprd04.prod.outlook.com (2603:10a6:208:122::37) To AM0P190MB0641.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:194::23)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from localhost (212.201.44.244) by AM0PR04CA0024.eurprd04.prod.outlook.com (2603:10a6:208:122::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Wed, 10 Mar 2021 10:01:00 +0000
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: db608112-c637-4e29-0d63-08d8e3ab68b3
X-MS-TrafficTypeDiagnostic: AM0P190MB0578:
X-MS-Exchange-Transport-Forked: True
X-Microsoft-Antispam-PRVS: <AM0P190MB057837BEF6F27C2CE8C21029DE919@AM0P190MB0578.EURP190.PROD.OUTLOOK.COM>
X-MS-Oob-TLC-OOBClassifiers: OLM:10000;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: XkHe3bkJVmbWcseBUZJuermp/l2PrSLQD2UnW1tdjih0j+06bueReXDDm3EhAm391oSFz9fsO1DXs/bLipHFiOTtg4q9dwH/on5eBZFL/5xgsZtuI6brTxJyMxwmDyWjiGDkejNoN1bGmpuOi8tmyMdjY9NS3p+azBI5w/y+oBuUylXTkHPiUuEx3C+zDGsEWuH3RTv6189PCwNZb3zSOzHHSd1aUAAjIMRNnAGa8dA1sHBsJyox6H/v1JacrCxBXnIDsWd+b4oT9W2rgitdjx1g7z04iLF5BPe3lbVtCBv/Cthp4e9iFgtcflQF2jv7M8vp2iQG/grw6oMGN6WbLEtgiiSzqQ3bu9fiJyd8hDjnWod/GIYr12moRs10Vdd9oh77FaAOcibHgem84iZhslwexSWPTELWBToknOpIg8HRoscHOK6gzw6VPri2MTsC8VLa3hiLHm0BEARYj6RjV8AfjXdY3HI4OmyA+ycFlYzNhKhgdf4y4LBrmu6YSayiiTMoowjno9V6wfN8gAw56fd/51+Qd+z6o0Op1terGXPujL2niI9jMNEYI+49L8rmTkFxGs5TqiJ8BRGtwXMKGs4be7cWz+kBlSPbLccDFJg=
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0P190MB0641.EURP190.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(346002)(136003)(396003)(366004)(39830400003)(376002)(316002)(6486002)(186003)(26005)(53546011)(16526019)(966005)(8936002)(786003)(2906002)(1076003)(83380400001)(3450700001)(66946007)(66476007)(66556008)(478600001)(6916009)(956004)(5660300002)(8676002)(52116002)(54906003)(86362001)(4326008)(6496006); DIR:OUT; SFP:1101;
X-MS-Exchange-AntiSpam-MessageData: zNNC5c2k94OB6wwAcE0R34zQV06KL2seHy7Vkb0XzKq2D2rbkXo62DmeAtYb6VjjrUKhNsFbJ558/jOj/zhxNRj/xRjx0yGFGXPiDxQiARduz8ziFeAJpP3dWbM2J6b91goh2fm7fyuQPrHslJmOumcmCoUz4vfQCx3tAvCiX2CVs8YKvq/LtlVTQG7fPQ/N/bgqvGFjxLKvdoU1/m6eRI1f8zuOdfXljckmB0Au/XdO3m6AD34mCE9zKaVHnk6cwEhZCZZMsVOpuJ9pMGbCpo6w3T8iuyoWRd/tfyDDMJxOdKwcnAcA9Q0MoUZggdTh7YyadHq9ZiZJTBmitdpV/gbDszozdSGALQNl7Nwjnqe8NrqpQ8wyQanLm8nAdIfdgub7KcTofMtczKDS5Wu1zuSDfyQhtk2mLXqMQeqQirSMymta9Mx5PWFrY2vXxn2e8CATVaoCy6c42BH1UJlTd8dy6LGZqUgkieyYm6CfBMD4T5PJ1625Lqd01+jSyoAZzKZPMBw5Q/oTtdMy5WzGKUu/NhWkdldHlPDz9HPobkTE07jRk6ZAwnOFm75lMpmj2MGdHwIjcPccXq6E5i6A4WnFXLzst5rgn0CaNH5FM1gWKy53OaAuXs3XdWgXrFkJ+wIElCzgozdV8Ai40WB1QTepuJuO7QHcuJSu47d1Z6dtvhp9gMHJ85L1oL5tX6rqrInktDE6fKePn/OlB87G2senBI1Hi3xKIKPxUNAypwF8U1Rc/DdBza+a91baKINputdH3XTycHop2LQlFNOZVFr79Nv9ioCPYu63TxE3lPQY+HZ+q7p0rb6JtWJlFY7AEgCtUJ/z7hKQcuWQwmB0gOQQ6nrMZe29ua0SLa75p9puACfV11rMrGnJch59JvWhqYKGnrhiWr0zKlDGKy2eDuDYWCOwoilOuLOUHixR5HVaE3X4GBlQFA3iUP7Vn/8336uuej+FQa9OrukfzNulj9ORKr/luvwRcBNUn6Q7HyyA9sDXmg5TQFftMvFiaUKUsLiqESVG3yENH2B8td2hX5h1PT74DqYCiLXEjKSBbDH3GWWOU3H+fP5NdCa3HUdy6+KPUyn28Gr1yWP23OdO/JoC29M3j3o1XPLVJbv8FYxO6CCIgkRZDbXfA4hv8IIzNIubgeexPB6LcR1j2wzFnTO4lp8Dt8h/7VkdJxEaKtdjGgM2DOOglVGFEq4+pyg7LmARqjneiVaKfDduq1+TiUL+KX4CgudmTXwOK7ON1sEy/CH+Ev3qJ8DSSnWgQbnVm1gweTQN2x+u92XWQr49dPJRUoFyeejAp/1bfQBUvdElHtrCx524Tt5TuwNJNQC+
X-OriginatorOrg: jacobs-university.de
X-MS-Exchange-CrossTenant-Network-Message-Id: db608112-c637-4e29-0d63-08d8e3ab68b3
X-MS-Exchange-CrossTenant-AuthSource: AM0P190MB0641.EURP190.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2021 10:01:01.4914 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: f78e973e-5c0b-4ab8-bbd7-9887c95a8ebd
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: iyKzW2tYJZdu7f26IpfByoGLUg+ghPyqFh3zSzTOO9tyt51OrtFCykI4mMXsskRQOCcoH9ql87He5Ohn2GDzuws+/k/og8/TPJzf+sthTLk=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P190MB0578
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/qG2RVssJmkGuXYCGWeXX_hHaGfw>
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 10:01:12 -0000

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

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/>