Re: [netmod] Using an empty type in a list key

"Sterne, Jason (Nokia - CA)" <jason.sterne@nokia.com> Tue, 06 September 2016 02:50 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 6844A12B08D for <netmod@ietfa.amsl.com>; Mon, 5 Sep 2016 19:50:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.92
X-Spam-Level:
X-Spam-Status: No, score=-6.92 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 FIciEhDPpiju for <netmod@ietfa.amsl.com>; Mon, 5 Sep 2016 19:50:21 -0700 (PDT)
Received: from smtp-us.alcatel-lucent.com (us-hpswa-esg-02.alcatel-lucent.com [135.245.18.30]) (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 68E1C12B108 for <netmod@ietf.org>; Mon, 5 Sep 2016 19:50:21 -0700 (PDT)
Received: from us70uumx4.dmz.alcatel-lucent.com (unknown [135.245.18.16]) by Websense Email Security Gateway with ESMTPS id 30E8138C75C7B for <netmod@ietf.org>; Tue, 6 Sep 2016 02:50:19 +0000 (GMT)
Received: from us70uusmtp4.zam.alcatel-lucent.com (us70uusmtp4.zam.alcatel-lucent.com [135.5.2.66]) by us70uumx4.dmz.alcatel-lucent.com (GMO) with ESMTP id u862oJ1L000725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <netmod@ietf.org>; Tue, 6 Sep 2016 02:50:20 GMT
Received: from US70UWXCHHUB02.zam.alcatel-lucent.com (us70uwxchhub02.zam.alcatel-lucent.com [135.5.2.49]) by us70uusmtp4.zam.alcatel-lucent.com (GMO) with ESMTP id u862oJ2K010149 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for <netmod@ietf.org>; Tue, 6 Sep 2016 02:50:19 GMT
Received: from US70TWXCHMBA11.zam.alcatel-lucent.com ([169.254.5.103]) by US70UWXCHHUB02.zam.alcatel-lucent.com ([135.5.2.49]) with mapi id 14.03.0195.001; Mon, 5 Sep 2016 22:50:19 -0400
From: "Sterne, Jason (Nokia - CA)" <jason.sterne@nokia.com>
To: "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: Using an empty type in a list key
Thread-Index: AdIDDD+zdnreDFObQSq39pPc7YROegE3NrJg
Date: Tue, 06 Sep 2016 02:50:19 +0000
Message-ID: <A125E53CE190A749957C19483DC79F9F5CD14548@US70TWXCHMBA11.zam.alcatel-lucent.com>
References: <A125E53CE190A749957C19483DC79F9F5CD0F6EA@US70TWXCHMBA11.zam.alcatel-lucent.com>
In-Reply-To: <A125E53CE190A749957C19483DC79F9F5CD0F6EA@US70TWXCHMBA11.zam.alcatel-lucent.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [135.5.27.18]
Content-Type: multipart/alternative; boundary="_000_A125E53CE190A749957C19483DC79F9F5CD14548US70TWXCHMBA11z_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/LjjoEaEtzwLOtautmUDG1dT9-ic>
Subject: Re: [netmod] Using an empty type in a list 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: Tue, 06 Sep 2016 02:50:24 -0000

I did manage to find some older posts about empty types in keys. It seems that perhaps YANG 1.1 allows them but they are not actually useful.  I believe perhaps my example below does *not* work as I show and instead every apartment would be required to be a "bis" apartment.  Keys must be present which means the "bis" leaf would always have to be present.

Any confirmation of this would be appreciated.

Regards,
Jason

From: netmod [mailto:netmod-bounces@ietf.org] On Behalf Of Sterne, Jason (Nokia - CA)
Sent: Tuesday, August 30, 2016 18:17
To: netmod@ietf.org
Subject: [netmod] Using an empty type in a list key

Hi all,

I saw the addition of empty types in list keys in YANG 1.1 but had troubles finding more details in the NETMOD list.  Is it discussed in the YANG 1.1 issues page (and if so, where is that now ?  I tried an old link and it didn't work) ?

If I take this example where I have a set of a apartments 1,2,3 but there may also be occasional 'bis' apartments (e.g. 7bis).

list apartment {
    key "number bis";
    leaf number {
        type int16;
    }
    leaf bis {
        type empty;
    }
    leaf description {
         type string;
    }
}

Can I create list entries like this ?

<apartment>
    <number>5</number>
    <description>apartment 5</description>
<apartment>
<apartment>
    <number>8</number>
    <bis/>
    <description>apartment 8bis</description>
<apartment>
<apartment>
    <number>8</number>
    <description>apartment 8</description>
<apartment>

Doesn't the empty type have two states and the absence/presence of the leaf/tag indicates those states ?

I realize that a Boolean type could be used for bis but the use case (a question of preference/style) is that 'bis' is unusual and so it becomes noisy to have to set <bis>false</bis> all the time when creating apartment entries.  It may be useful to only have to specify <bis/> in the rare cases that it is needed.

Regards,
Jason