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

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Tue, 09 March 2021 19:52 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 CE34E3A08B0 for <netmod@ietfa.amsl.com>; Tue, 9 Mar 2021 11:52:47 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.7
X-Spam-Level:
X-Spam-Status: No, score=-1.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=fail (1024-bit key) reason="fail (body has been altered)" 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 pyIKuViNx97b for <netmod@ietfa.amsl.com>; Tue, 9 Mar 2021 11:52:45 -0800 (PST)
Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) (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 6796C3A08AA for <netmod@ietf.org>; Tue, 9 Mar 2021 11:52:45 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E2Sk2DaOdl1h5bkdK2QfS2T/iPzo9vAOnuQjjRfMNC5fOl+PpINwUn9uvs3YXYte9sPUZ99Ir0sTt4i6HOwdsELWpuHI+oYDc+zn/TAjB4ChLGjjkF9gT2/niQryvTnl1r0wOLKvU8UuOGtgJSltehq/S3PhiJBu/oOIru2OavmqmUXhnJ6VVV5qkK7IseJg221ELk26JzCWPU8bprGzA6Ttat/6uZOJTUeonK02biUzOTNlgZznGXzXVl3Gk+ViYHjx4R86Sw27F3u0ZWdtl7if9d1ba7SclPvnvsUrw4HznPfyqxWUDXuT27UDpgWF8jlLf8ofSsYiySiHgVN6ew==
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=4uZepd94h2zbnypo+0IKSpBqdZdYujkyRH+wkO95908=; b=MQ4cA6luZ8s8hVYXRxaSqZmUx6Kr1pPGc8h6WH/PLHVu31Xq6LKFtqitcco2d1vSLQQSp17edIZ2gNeszvaMKF5suVoDdAGzzjLSykUVOINvVkWJ+/8Ztp2FbpQo17+GS72QZPmHn4v9v/L9S4NgC2mVn46jMuLzDzCcJ1PNSqq24OnF71arto0nw6k2hmWq56lrjbrhgQvBtG3ULbnvzhewMvET6tBCzvKFt7OCGYLNhwkZmNhdw4gBIPrufSq4zJrOli/qzuiSiWybZ8MbJmgSSMYhYX3rT6zIhaDyE0JvhBCnDKMPLOFPmugG6GDpTewp31Cg6oiyJ9/NpUkdkw==
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=4uZepd94h2zbnypo+0IKSpBqdZdYujkyRH+wkO95908=; b=aC984fGHhEDfW5V5uj3VSA4RZ+OB1DfFNpnpQrTDJfCQ4Zb/iUUFJFYgKcOF3mwStn+AOdI/eJh/3PEGnpaYoR9mVm4AqyZJg/2gBm+TwIRZC3PnWv6xxln1bzz+6QRG0F3BeJqg4jySLcyAxHekbtbfM/dAM1hvuFvlprmdoC8=
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 AM8P190MB0884.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:1d4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Tue, 9 Mar 2021 19:52:42 +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.027; Tue, 9 Mar 2021 19:52:42 +0000
Date: Tue, 09 Mar 2021 20:52:41 +0100
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Italo Busi <Italo.Busi@huawei.com>
Cc: "'netmod@ietf.org'" <netmod@ietf.org>
Message-ID: <20210309195241.k5lfmdnw2zqq6b4o@anna.jacobs.jacobs-university.de>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Italo Busi <Italo.Busi@huawei.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>
Content-Type: text/plain; charset="iso-8859-1"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <521a9ccd02e14d178a6e62971b4809ea@huawei.com>
X-Originating-IP: [212.201.44.244]
X-ClientProxiedBy: AM0PR10CA0042.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::22) 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 AM0PR10CA0042.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:150::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 19:52:42 +0000
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: b97363db-0049-4ce0-5c32-08d8e334e6ed
X-MS-TrafficTypeDiagnostic: AM8P190MB0884:
X-MS-Exchange-Transport-Forked: True
X-Microsoft-Antispam-PRVS: <AM8P190MB08840D522E223275968A6E1DDE929@AM8P190MB0884.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: oPzyjbGZCrlxXUDUBqfcii0bz3PSsmdEcN5Bu0g6W38NnKEtbnJ+6UuQ81KHuhMNNkLrDPhtFHtI5DU3jXQ4idx1RA+KXnqkQLKzlyGd4m+Ss/Q2+9rVcerkErSQBKMxt8vBzJmIWLbiNV8t2pm9X3gg0XoZpuwyFdaxsfEdCo/weiISWzxlcvxuduiMT8wwcrpr+MJfS39EvVRuhTZlL7P32duoc0dWdm7QJID59SSqAorUFnS/7rk2ZONUx+SF4daI956udmOpDR2uOxMKBGa0UQgYGN49bKwNz53Cejo6dWmNHENeE6br5wAeLjyBrMsPlyKviK05yQ9Iqew5D0zoaNrg92e6A8GnKkjA8g8HYSYvNlkfqaRjanModYwpQ74g5YVBZEbizA+DbWlnjH1LIgp8j8GNI0D1HeoVJLGMWMIPBoFiA8c21DOMTAEt8JqETmllRNL0OxUlX3Nxiv+WjNepo2xPnToSrCoJpupoH6kAwOqHLushcF50MPvgE5tD8w2sJ2vhU1ZXh2P7utIUT2VHnBuBLl9Z5DELaYXs7cl7t+1fr/dS73onZL6UgP62xFBa/C8FTwmmUhzCEtfukpui0VdGT/VwS6HOGeY=
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:(366004)(83380400001)(2906002)(956004)(6916009)(3450700001)(8676002)(4326008)(6486002)(86362001)(16526019)(66476007)(8936002)(1076003)(26005)(498600001)(186003)(53546011)(6496006)(52116002)(5660300002)(66946007)(66556008); DIR:OUT; SFP:1101;
X-MS-Exchange-AntiSpam-MessageData: E/iOt3cM0ggPGJGbbu4CknTZKXu3UFZwY5slkh4N8p0BuVdP37kpz8eaLiRQbCHDRV0RIkGz2oRLakF99aJ7+USaYlszlgeJnxPB80t2JxzCEuRCUjVMKCgOmZw+fLHQNkBr512RG65Mdv12BALdW4/wesGdyMz9j1pS7Rzcmx26easHK1yNPp+Vjqx9W2oWX11gkYg+gLcnbPJpZ8Ey2iKh9B7NyoFGiPRvyJUzYOZjLZnZk+vE+Lues+FO6wXsUUZDrgllPkIhGkJIwH3P3kaRzcv2H+jEjSB7tRwNeCaZDT+LqzfI+i5MPmZr7UK1dXqI8Pf0BbYfrvWZwzV3rpyPVATfQRpKmD/Gm5VXFbyWQbIs6jnWs2m0cm27hwf45PuVuDcmXfEC8Tk5kIHblKjJv1T2pxIfVbv4mlEt1QROwH3vzZsDeL2cR2QugAr1EVvh3mmIDL3jYEWpx2/IdEDJmjm1Syd82Ql+QjwvvOU70ipTyRBgCT3AS61kobZupQ1a7UJmazbNOprPovcMSYxOF/PHfQYCjLHW2Iy/r9ehU4KjGEvhN54w1DH2oFZSme5wczbrzWqEmTNYvUW2MMZq4U8fJ8oLzpeKKc3Y8KeJqg/9s08adF2FmdccafMSDmjii8gNzGm2bZBdIf8p13GNutWLku6xR70JHSqfj/8X7bEfvGBsRDeG5LJc2MAwN/gQBHkF4yo9OdSlv0aV6CSOubr0pbXiEwO/sshvEhAJ368+QScw+FjK3vhYCES0U68wyZHeTAUd1iCM9cKgjiRngrka1GVQv/N6vT1JlUoigaWrida2k7ZeO2WDOrMzyXYOY9USVId/7/X9Rf+ikhb7HqbWPeswU1QAcF8V9i91SuKH+6RItghKRGhMM3zp6VN4cG0K2V1peRdj/NaR07hHu9Uh7j7aGRYSDAs5BgLJXyaLaWSUCF0yTEmP4/O+Fse4+e+SCJupd+uNGm99XPI5a7rVmbZJfs3uXA1VJXzqnPGHOEviFVtU8/hxWBNsyUrah9tnHgy/anoUXL/1j1Q8UlrGdm2oOjzcoTKse3f1Xm5FSHsqkikDML94XtKir9c6ss+AFRayhU960rY86rFg0x9FpB08Lcjo/bBLMY00pUD/ZP7ZVdMKnoRQ9ORdjNo+8SlQJUdzNmbn5RymY3+ajIxq4UaHlRf4ataXZComJyjnOYdj1xuhXtS88qJ/aitfuFAxlJNHdFxdPDZVgh7kbM1mHDLR/cjVj/7GoA5cK+btvin8fWIvRl/aJxGol+jaNOpQFi6UNLqlqUPxQAChLK3UVtZBJyIm9InaQG2bGuzLw5etXxEdd78CJs0b
X-OriginatorOrg: jacobs-university.de
X-MS-Exchange-CrossTenant-Network-Message-Id: b97363db-0049-4ce0-5c32-08d8e334e6ed
X-MS-Exchange-CrossTenant-AuthSource: AM0P190MB0641.EURP190.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2021 19:52:42.6090 (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: sIrXr9Pn1egVh8aZSIv/0a8ebkavKz9XbnQRZ1lSN5VvVYpBa0B6evsVzu7ArYyAdnDMZwspsi0qpV1TiSiNES4h2Q1u56BdjUDrqs4LQPs=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P190MB0884
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/G_gyg5y0RqMt7XbHkK1fDKUepxs>
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: Tue, 09 Mar 2021 19:52:48 -0000

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

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]
> > Sent: mercoledì 20 gennaio 2021 17:05
> > To: Italo Busi <Italo.Busi@huawei.com>
> > Cc: 'netmod@ietf.org' <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/>