Re: [netmod] choice statements and trim vs explicit default handling

"Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com> Wed, 12 April 2017 03:43 UTC

Return-Path: <jason.sterne@nokia.com>
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 1682C1293FD for <netmod@ietfa.amsl.com>; Tue, 11 Apr 2017 20:43:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.911
X-Spam-Level:
X-Spam-Status: No, score=-1.911 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nokia.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 gp4qyLgBob_c for <netmod@ietfa.amsl.com>; Tue, 11 Apr 2017 20:43:18 -0700 (PDT)
Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0130.outbound.protection.outlook.com [104.47.2.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1A846128B88 for <netmod@ietf.org>; Tue, 11 Apr 2017 20:43:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2wgAGLgGNTcT89VJRQE0LB3JUNjJw81OlSYl6byVBhM=; b=MTxiCfVnmYyNIrRMwi0iDlkIie4MOd8icMZZlpJsBa0J+7HiynXBhkDMwTQfOv7jsrSJEgPkTzd0lvrJ7timoCW0N4JuSV0pe9mx6unu9rcpXMyq0kJfvuVZD7TbNaOetpBqULx/7TOfwVaxbV5FZ9jS+4dYc2uC2/uy8RMq/3Q=
Received: from HE1PR07MB0843.eurprd07.prod.outlook.com (10.162.24.16) by HE1PR07MB0842.eurprd07.prod.outlook.com (10.162.24.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.5; Wed, 12 Apr 2017 03:43:15 +0000
Received: from HE1PR07MB0843.eurprd07.prod.outlook.com ([10.162.24.16]) by HE1PR07MB0843.eurprd07.prod.outlook.com ([10.162.24.16]) with mapi id 15.01.1034.008; Wed, 12 Apr 2017 03:43:14 +0000
From: "Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com>
To: Robert Wilton <rwilton@cisco.com>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] choice statements and trim vs explicit default handling
Thread-Index: AdKv6w7/8xX3pfT5TQy0uN4Yo4P2TwB8HnoAAA/IrLA=
Date: Wed, 12 Apr 2017 03:43:14 +0000
Message-ID: <HE1PR07MB084391FD4DD8667A311E2D069B030@HE1PR07MB0843.eurprd07.prod.outlook.com>
References: <HE1PR07MB08433E9459870BCF06F754349B0C0@HE1PR07MB0843.eurprd07.prod.outlook.com> <e77ea6c1-fe1d-f511-9c84-b34b4bd399cb@cisco.com>
In-Reply-To: <e77ea6c1-fe1d-f511-9c84-b34b4bd399cb@cisco.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: cisco.com; dkim=none (message not signed) header.d=none;cisco.com; dmarc=none action=none header.from=nokia.com;
x-originating-ip: [135.245.20.12]
x-microsoft-exchange-diagnostics: 1; HE1PR07MB0842; 7:Ll2EHDvFmMDl2CfmbfVkUh+oiZ+/HGNGU5HZHPMCfkt5RaDec1cJwheDXqIGhsg1BaYd/Ct4CqFlqL+VO94+qH/WfhB7isjeWDIA12W8VpkG2M1Uf2TPZjqnEImPuWHWB9BhRckh0W8JD4Qd6NcVKYogEGqJaB3awvYUfZAABDJvTmYhhmsdkW1L7ig1Ox3JXY5LS00L8A8htpszJbiu+K+d7R4EyP/SlcI/3LYcydV1UC0jV/R0QiHQJ7iIeYrUG61J1IEouLqHXdEM7OJJIs8w2fu08xNYVSB2Wc40sCDhkh2UCo4ZE/3frypEZQCirxZNv6TGeko1475bGPogmg==
x-ms-office365-filtering-correlation-id: 3a26a054-2b8b-4ec2-465c-08d481560ce6
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:HE1PR07MB0842;
x-microsoft-antispam-prvs: <HE1PR07MB0842307680698CACE312BA429B030@HE1PR07MB0842.eurprd07.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(158342451672863)(82608151540597)(95692535739014)(21748063052155);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123564025)(20161123555025)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:HE1PR07MB0842; BCL:0; PCL:0; RULEID:; SRVR:HE1PR07MB0842;
x-forefront-prvs: 027578BB13
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(39850400002)(39410400002)(39840400002)(39400400002)(39450400003)(24454002)(53754006)(50986999)(53936002)(8676002)(8936002)(3280700002)(81166006)(606005)(76176999)(9686003)(2950100002)(33656002)(189998001)(54896002)(2900100001)(55016002)(54356999)(236005)(6306002)(229853002)(6436002)(7906003)(66066001)(7736002)(3660700001)(2501003)(6506006)(5660300001)(7696004)(102836003)(790700001)(6116002)(53546009)(3846002)(25786009)(2906002)(122556002)(74316002)(6246003)(99286003)(86362001)(38730400002)(77096006); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR07MB0842; H:HE1PR07MB0843.eurprd07.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en;
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_HE1PR07MB084391FD4DD8667A311E2D069B030HE1PR07MB0843eurp_"
MIME-Version: 1.0
X-OriginatorOrg: nokia.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2017 03:43:14.6658 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5d471751-9675-428d-917b-70f44f9630b0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB0842
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/k07sfyv9bEYMguqux5V-7i6VqPc>
Subject: Re: [netmod] choice statements and trim vs explicit default handling
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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, 12 Apr 2017 03:43:21 -0000

Thanks Rob.

You may be right here but it isn't what I would have expected.  You're saying that any existing config in case bb is removed by the *act* of writing to a leaf of case aa, even if that write (setting some-bool to its default value) results in no config existing in case aa (for 'trim' servers).

If I had a must statement for leaf some-num like this:
                must ". != 55";
and a client sets some-num to 55 I suppose that would clear out (delete) any previous config of some-bool, even though the validate/commit later would fail.  After the failure it is "too late" and some-bool would have already lost its value.  So case bb would be 'selected' even though it is a config that will fail validation.

You mention "would be ignored".  That is true for the particular model I show below, but default values for child nodes under a case don't require a default for the overall choice in order to be relevant.  If I had other leafs in those cases, then the defaults could be used/relevant even without a default for the choice (when another leaf of the same case is configured).  >From 7.9.3. :

    Default values for child nodes under a case are only used if one of
       the nodes under that case is present or if that case is the default
       case.

Rgds,
Jason


From: Robert Wilton [mailto:rwilton@cisco.com]
Sent: Monday, April 10, 2017 5:19
To: Sterne, Jason (Nokia - CA/Ottawa) <jason.sterne@nokia.com>; netmod@ietf.org
Subject: Re: [netmod] choice statements and trim vs explicit default handling


Hi Jason,

Your default statement in your YANG snippet below would be ignored, as per section 7.9.3 of RFC 7950.

But, if you changed your YANG to this:
choice foo {
  default aa;

  case aa {
    leaf some-bool { type Boolean; default "false"; }
  {
  case bb {
    leaf some-num { type int32; }
  }
}


Then answering both (A) and (B): I would assume that setting "some-bool" to "true" or "false" would cause "bb" to be deleted regardless of what default mode the server was using.  If neither some-bool or some-num had been set to an explicit value then some-bool semantically exists with value "false" due to the two default statements.

I might be wrong, but I have always assumed that the with-defaults extension is really concerned with the presentation/encoding of default values, and isn't intended to change the underlying semantics of YANG's handling of default values.

Thanks,
Rob

On 07/04/2017 23:50, Sterne, Jason (Nokia - CA/Ottawa) wrote:
Hi all,

When a server operates in 'trim' mode (rfc6243), setting a leaf to its default value removes it from the config (i.e. it is indistinguishable from the case where that leaf was never configured or the case where that leaf was deleted/removed).

(A)
Does setting a leaf in one case of a choice to its default value (in a 'trim' mode server) cause leafs in other cases to be implicitly deleted ?  I assume not.

For example:

choice foo {
  case aa {
    leaf some-bool { type Boolean; default "false"; }
  {
  case bb {
    leaf some-num { type int32; }
  }
}

If some-num is currently set to 50, and then an edit-config sets some-bool to "false", does that clear the some-num leaf ?
(i.e. does it select case aa ?)

RFC 7950 says: "the creation of a node from one case implicitly deletes all nodes from all other cases".
RFC 6243 section 2.2.3 describes that a leaf set to default (in a trim server) doesn't exist.

(B)
Now how about if the server operates in 'explicit' mode ?  Does setting some-bool to "false" clear some-num ?  I assume it does (but it just seems a little funny that the behavior on this changes between trim and explicit servers).


Regards,
Jason









_______________________________________________

netmod mailing list

netmod@ietf.org<mailto:netmod@ietf.org>

https://www.ietf.org/mailman/listinfo/netmod