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

Robert Wilton <rwilton@cisco.com> Mon, 10 April 2017 09:19 UTC

Return-Path: <rwilton@cisco.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 94571128C83 for <netmod@ietfa.amsl.com>; Mon, 10 Apr 2017 02:19:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.522
X-Spam-Level:
X-Spam-Status: No, score=-14.522 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.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 N5O_N4l0rvLC for <netmod@ietfa.amsl.com>; Mon, 10 Apr 2017 02:19:23 -0700 (PDT)
Received: from aer-iport-2.cisco.com (aer-iport-2.cisco.com [173.38.203.52]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5317E129435 for <netmod@ietf.org>; Mon, 10 Apr 2017 02:19:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=14680; q=dns/txt; s=iport; t=1491815962; x=1493025562; h=subject:to:references:from:message-id:date:mime-version: in-reply-to; bh=jxUQLZHDoGwqs13M9P9BiXVajEi3Stt0sGLAE/1Jnts=; b=IpLVRLBsWbLiraSEIpuLb18rNBaOWMWcYFrEDNmmpZXt/PPvjnx2HL7l x3Vnwl1oGoXhJQ+20ZWwt/mWW8ERXSpyi1Pz9+U955hxLLcmQoJ61WYAL 7n/7PfJAUIglHasH2yA9pwtq7kxFJD3l4jNqSqC3GOpKa9nW7Id0Bukjq Y=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AEAQBITetY/xbLJq1cGQEBAQEBAQEBAQEBBwEBAQEBgm6BRoELjXlzkE6QI4U0gg8hAQqFLkoChB0YAQIBAQEBAQEBayiFFgEBAQMBAStBGwsYLicwBgEMBgIBAYoLDqscK4ozAQEBAQEBAQEBAQEBAQEBAQEBAQEBGAWGUIIFgmuEQIV7BZx7klmKZIZdi2SIHB84gQUlFggYFUGGWz81iV8BAQE
X-IronPort-AV: E=Sophos;i="5.37,181,1488844800"; d="scan'208,217";a="651025163"
Received: from aer-iport-nat.cisco.com (HELO aer-core-2.cisco.com) ([173.38.203.22]) by aer-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2017 09:19:20 +0000
Received: from [10.63.23.150] (dhcp-ensft1-uk-vla370-10-63-23-150.cisco.com [10.63.23.150]) by aer-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id v3A9JK7b031557; Mon, 10 Apr 2017 09:19:20 GMT
To: "Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com>, "netmod@ietf.org" <netmod@ietf.org>
References: <HE1PR07MB08433E9459870BCF06F754349B0C0@HE1PR07MB0843.eurprd07.prod.outlook.com>
From: Robert Wilton <rwilton@cisco.com>
Message-ID: <e77ea6c1-fe1d-f511-9c84-b34b4bd399cb@cisco.com>
Date: Mon, 10 Apr 2017 10:19:20 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <HE1PR07MB08433E9459870BCF06F754349B0C0@HE1PR07MB0843.eurprd07.prod.outlook.com>
Content-Type: multipart/alternative; boundary="------------413474B8C063605D96E06924"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/bJJw7hOL1nTVZruuh0i3EyZcQas>
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: Mon, 10 Apr 2017 09:19:24 -0000

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
> https://www.ietf.org/mailman/listinfo/netmod