Re: [netmod] Y09 introduce optional keys

Ladislav Lhotka <lhotka@nic.cz> Wed, 17 September 2014 18:11 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DA7CC1A0787 for <netmod@ietfa.amsl.com>; Wed, 17 Sep 2014 11:11:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.303
X-Spam-Level:
X-Spam-Status: No, score=-2.303 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HELO_EQ_CZ=0.445, HOST_EQ_CZ=0.904, RP_MATCHES_RCVD=-1.652] autolearn=ham
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 vTOwc4muvsdT for <netmod@ietfa.amsl.com>; Wed, 17 Sep 2014 11:11:42 -0700 (PDT)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A8FCE1A0745 for <netmod@ietf.org>; Wed, 17 Sep 2014 11:11:40 -0700 (PDT)
Received: from [10.102.137.35] (rtp-isp-nat1.cisco.com [64.102.254.33]) by mail.nic.cz (Postfix) with ESMTPSA id 1F91E13F8D0; Wed, 17 Sep 2014 20:11:37 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nic.cz; s=default; t=1410977499; bh=aEWs+h8yejzqyTW7DOK4uSwbbQrzEK6PQvDVhpWa3SY=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=S9xUeLuXEwmg9A+43MhG7tdckZRfn2Lh1JTpxpM+4ukpEgSwWhe9mNKjH1HFxBfyb c05D/d5U5wQREIe2stygwwHeyg1ZDov1FvdfOB4FAuReg6CSI+RZj21iOaK1SGKL1h MXQMCRa10Kzp9HKnMvJs3sd8GNWuAjkmOfOjZ01Q=
Content-Type: text/plain; charset="windows-1252"
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <013A9B371AC6DF4C8AD261897D8F243E1141EB64@xmb-aln-x08.cisco.com>
Date: Wed, 17 Sep 2014 14:11:35 -0400
Content-Transfer-Encoding: quoted-printable
Message-Id: <CEEDF625-A071-4167-8A01-6F8B34C7674F@nic.cz>
References: <69AD3EE7-C8A0-4F29-A3E6-260E5B06445C@cisco.com> <5C913F0A-AC7C-4725-BFCE-80C8F5DD30F0@nic.cz> <D03F0D1F.2F67%acee@cisco.com> <013A9B371AC6DF4C8AD261897D8F243E1141EB64@xmb-aln-x08.cisco.com>
To: "Peyman Owladi -X (powladi - Ensoft Ltd at Cisco)" <powladi@cisco.com>
X-Mailer: Apple Mail (2.1878.6)
X-Virus-Scanned: clamav-milter 0.98.1 at mail
X-Virus-Status: Clean
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/p9l_SHZMA0LCYl6sRU4dW_Z8fus
Cc: "netmod@ietf.org" <netmod@ietf.org>
Subject: Re: [netmod] Y09 introduce optional keys
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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, 17 Sep 2014 18:11:46 -0000

Hi Peyman,

I think you are mixing up “choice” as a schema node and the “union” type. In your example there is no amiguity at all.

Lada
 
On 17 Sep 2014, at 10:25, Peyman Owladi -X (powladi - Ensoft Ltd at Cisco) <powladi@cisco.com> wrote:

> Hi Lada,
> 
> I had posted an example previously (which I suggested in one of the calls should be added as a note for Y09) -- reproduced here. In this case a "choice" doesn't solve the problem, as there are a set of overlapping identifiers which are actually used as the key.
> 
> ======
> A list entry may have a key which is a union; i.e. it is indexed by a single value which is one of multiple types. However, a YANG union is not always sufficient to model a choice between a set of types.
> 
> Take the following case for example:
> 
> choice maintenance-domain-identifier {
>  leaf host { type inet:host; }
>  leaf id   { type hex-string; }
>  leaf name { type string; }
> }
> 
> These strings can be overlapping, so this cannot be represented as a union.
> ======
> 
> There was a discussion of other solutions which involved more controversial extensions to the language (Y53, rejected) -- but it can be solved with Y09 by making each leaf an optional key.
> 
> Thanks,
> Peyman
> 
>> -----Original Message-----
>> From: netmod [mailto:netmod-bounces@ietf.org] On Behalf Of Acee Lindem
>> (acee)
>> Sent: 17 September 2014 15:07
>> To: Ladislav Lhotka
>> Cc: netmod@ietf.org
>> Subject: Re: [netmod] Y09 introduce optional keys
>> 
>> Hi Lada,
>> This might be just what we need - I¹ll discuss with the model authors.
>> The
>> other alternative is to allow all three metrics and use the most specific
>> specification. In any case, it appears that we are not dependent on
>> optional keys.
>> Thanks,
>> Acee
>> 
>> On 9/17/14, 9:49 AM, "Ladislav Lhotka" <lhotka@nic.cz> wrote:
>> 
>>> 
>>> On 16 Sep 2014, at 15:44, Acee Lindem (acee) <acee@cisco.com> wrote:
>>> 
>>>> Hi,
>>>> In the ISIS model, we are looking for a construct where an ISIS
>>>> interface attribute applies to level-1, level-2, or both. If it applies
>>>> to both, that is the only metric that is specified. If you specify
>>>> different metrics for level-1 and level-2 both can be specified. The
>>>> snipers below are what we have been discussing. However, it is not
>>>> really correct. Since if you specify a metric for ³all-levels², you
>>>> shouldn¹t specify anything else in the list. The suggestion was that an
>>>> optional key could handle this. The alternative would be to have a
>>>> ³metric², ³level-1-metric², and ³level-2-metric².
>>> 
>>> It seems a solution can be to use choice. It would allow to specify
>>> either one parameter to be used by both (all) levels, or a list of
>>> level-specific parameters, but not both. Something like
>>> 
>>> choice metric {
>>> leaf metric { Š }
>>> list level-metric {
>>>   key level;
>>>   leaf level { Š }
>>>   leaf metric { Š }
>>> }
>>> }
>>> 
>>> Would it make sense?
>>> 
>>> Lada
>>> 
>>> 
>>>> 
>>>> grouping interface-level-options {
>>>>    leaf level {
>>>>      type enumeration {
>>>>        enum "level-1" {
>>>>          description
>>>>            "ISIS level 1";
>>>>        }
>>>>        enum "level-2" {
>>>>          description
>>>>            "ISIS level-2";
>>>>        }
>>>>        enum "level-all" {
>>>>          description
>>>>            "All ISIS levels";
>>>>        }
>>>>   }
>>>>   default "level-all";
>>>>      description
>>>>        "Specify ISIS level for the interface command.";
>>>>    }
>>>>    description
>>>>      "ISIS interface level option.²;
>>>> }
>>>> 
>>>> list isis-metric {
>>>>       key "level";
>>>>        description "ISIS interface metric";
>>>>         leaf value {
>>>>                type uint32;
>>>>                description "ISIS metric value";
>>>>         }
>>>>         uses interface-level-options;
>>>> }
>>>> 
>>>> 
>>>> Thanks,
>>>> Acee
>>>> Andy Bierman <andy at yumaworks.com
>>>>> wrote:
>>>>> On Thu, Sep 4, 2014 at 12:21 PM, Martin Bjorklund <mbj at
>>>> tail-f.com
>>>>> wrote:
>>>>> 
>>>>>> David Reid <reid at
>>>> snmp.com
>>>>> wrote:
>>>>>>>> Here is a proposal for how to introduce optional keys.
>>>>>>> 
>>>>>>> Adding optional keys seems like a pretty major new feature for
>>>>>>> a .1 release. Most of the other issues are fixes or
>>>> clarifications.
>>>>>>> Is the benefit worth the cost?
>>>>>> 
>>>>>> I don't think the cost is that high.  With YANG 1.0, people are
>>>> forced
>>>>>> to use awkward workarounds, and/or vendor-specific extensions to
>>>>>> support a use case that seems to be natural in many circumstances.
>>>>>> Thus, I think it is better to support this natively.
>> (Incidentally,
>>>>>> just today I got a question from someone involved in the broadband
>>>>>> forum work why YANG doesn't support optional keys).
>>>>>> 
>>>>>> 
>>>>> 
>>>>> I think the implementation impact is significant, but the feature
>>>> could be
>>>>> useful.
>>>>> The protocol complexity increase is worse that the compiler.
>>>>> What about adding optional keys to an existing entry?
>>>>> IMO this cannot be supported with either RESTCONF or NETCONF.
>>>>> The request will be seen by the server as a create, merge, or
>> replace
>>>> on
>>>>> a new resource instance.
>>>> 
>>>> Right, and I think this is ok.  In general it would be nice with a
>>>> 'rename' operation in the protocols, but that is a different issue.
>>>> 
>>>> 
>>>> /martin
>>>> 
>>>> 
>>>> _______________________________________________
>>>> netmod mailing list
>>>> netmod@ietf.org
>>>> https://www.ietf.org/mailman/listinfo/netmod
>>> 
>>> --
>>> Ladislav Lhotka, CZ.NIC Labs
>>> PGP Key ID: E74E8C0C
>>> 
>>> 
>>> 
>>> 
>> 
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org
>> https://www.ietf.org/mailman/listinfo/netmod
> 

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