Re: [netmod] Yang 1.1 change: Allow type "empty" in a key.

Ladislav Lhotka <lhotka@nic.cz> Wed, 15 February 2017 10:39 UTC

Return-Path: <lhotka@nic.cz>
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 ADFCB1294D8 for <netmod@ietfa.amsl.com>; Wed, 15 Feb 2017 02:39:40 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7
X-Spam-Level:
X-Spam-Status: No, score=-7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-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=nic.cz
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 ZVnGTEZwjoC2 for <netmod@ietfa.amsl.com>; Wed, 15 Feb 2017 02:39:39 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id AC41C1294E1 for <netmod@ietf.org>; Wed, 15 Feb 2017 02:39:38 -0800 (PST)
Received: from [IPv6:2001:718:1a02:1:20d1:e797:6a9f:dc8f] (unknown [IPv6:2001:718:1a02:1:20d1:e797:6a9f:dc8f]) by mail.nic.cz (Postfix) with ESMTPSA id C6B7F60153; Wed, 15 Feb 2017 11:39:36 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1487155176; bh=L5bOgwIX/MBx2QDXpg62QpxhgcbrAa0fDDWEP7w0Qew=; h=From:Date:To; b=TYFmOWkRRoAydJy5Ftdvec0ozFX5W1UT+3hRVdt+HhYQSMwyJS2SgnV4FGsnnmsHd r8JvRdvFJGhYbOgbjqKQL9vEgm3WQ/6b2a6cDeMluNOkjo6BAzukMNAYUroZayDfPw A72NjVdoz9/UYMH+PRnMjQWVTt1sdPHsD6e8MsV0=
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <106501d28774$a0b5a2a0$e220e7e0$@mg-soft.si>
Date: Wed, 15 Feb 2017 11:39:42 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <C3D06898-E9AF-4AB1-9982-146550E4A6E2@nic.cz>
References: <1487080134376.87476@cisco.com> <1487105934602.29661@Aviatnet.com> <106501d28774$a0b5a2a0$e220e7e0$@mg-soft.si>
To: Jernej Tuljak <jernej.tuljak@mg-soft.si>
X-Mailer: Apple Mail (2.3259)
X-Virus-Scanned: clamav-milter 0.99.2 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/G0N7Y0vs9i3PGlj8cRvHCVKbdYw>
Cc: "Igor Foltin -X (ifoltin - PANTHEON TECHNOLOGIES at Cisco)" <ifoltin@cisco.com>, "Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco)" <mciglan@cisco.com>, netmod@ietf.org
Subject: Re: [netmod] Yang 1.1 change: Allow type "empty" in a key.
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.17
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, 15 Feb 2017 10:39:40 -0000

> On 15 Feb 2017, at 11:16, Jernej Tuljak <jernej.tuljak@mg-soft.si> wrote:
> 
> Plus, "empty keys" were aready allowed in YANG 1.

Well, keys with "empty" type were not allowed. What you are saying is that the same (dubious) effect can be achieved in other ways that were permitted in YANG 1. Note also that while if in XML encoding an empty leaf and a leaf containing string of length 0 look the same, in JSON encoding they are different:

"first": [null]

versus

"first": ""

>  
> module empty-key {
>   namespace "org:example:empty-key";
>   prefix "ek";
>  
>   container stuff {
>     list item {
>       key "first second";
>       leaf first {
>         type string {
>           length 0;
>         }
>       }
>       leaf second {
>         type string {
>           pattern '.{0}';
>         }
>       }
>     }
>   }
> }
>  
> Therefore this change removed a redundant (perhaps even broken) rule.

Agreed.

Lada

>  
> https://www.ietf.org/mail-archive/web/netmod/current/msg16763.html
> Jernej
>  
> From: netmod [mailto:netmod-bounces@ietf.org] On Behalf Of Alex Campbell
> Sent: Tuesday, February 14, 2017 9:59 PM
> To: Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco) <mciglan@cisco.com>
> Cc: Igor Foltin -X (ifoltin - PANTHEON TECHNOLOGIES at Cisco) <ifoltin@cisco.com>; netmod@ietf.org
> Subject: Re: [netmod] Yang 1.1 change: Allow type "empty" in a key.
>  
> Hi,
>  
> It means exactly what the summary says. In YANG 1.0 (RFC 6020) we have:
>    A leaf that is part of the key can be of any built-in or derived
>    type, except it MUST NOT be the built-in type "empty".
> and in YANG 1.1 (RFC 7950) we have:
>    A leaf that is part of the key can be of any built-in or
>    derived type.
> 
> In YANG 1.1, leaves of type "empty" are not disallowed from being keys.
> 
> Note that since leaves of type "empty" only convey information through their presence or absence, and since
> key leaves must always be present, key leaves of type "empty" convey no useful information.
>  
> Alex
>  
>  
> From: netmod <netmod-bounces@ietf.org> on behalf of Martin Ciglan -X (mciglan - PANTHEON TECHNOLOGIES at Cisco) <mciglan@cisco.com>
> Sent: Wednesday, 15 February 2017 2:48 a.m.
> To: netmod@ietf.org
> Cc: Igor Foltin -X (ifoltin - PANTHEON TECHNOLOGIES at Cisco)
> Subject: [netmod] Yang 1.1 change: Allow type "empty" in a key.
>  
> Hi all
>  
> Yang 1.1 change:  Allow type "empty" in a key.
> 
> What is the meaning of this change? We're interested from implementation point of view.
>  
>   Thanks
>  
>        Martin
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67