Re: [netmod] How to constrain a leaf to a read-only list of supported values?

Vladimir Vassilev <vladimir@transpacket.com> Wed, 31 August 2016 12:16 UTC

Return-Path: <vladimir@transpacket.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 13E6112B029 for <netmod@ietfa.amsl.com>; Wed, 31 Aug 2016 05:16:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, 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 ZlHuGybmGgb3 for <netmod@ietfa.amsl.com>; Wed, 31 Aug 2016 05:16:01 -0700 (PDT)
Received: from mail.transpacket.com (s91205186171.blix.com [91.205.186.171]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5BA8F12D0BB for <netmod@ietf.org>; Wed, 31 Aug 2016 05:16:01 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by mail.transpacket.com (Postfix) with ESMTP id 801ED1422757; Wed, 31 Aug 2016 14:15:59 +0200 (CEST)
Received: from mail.transpacket.com ([127.0.0.1]) by localhost (mail.transpacket.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id m4wWr16dTbyz; Wed, 31 Aug 2016 14:15:59 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1]) by mail.transpacket.com (Postfix) with ESMTP id 5C1341422756; Wed, 31 Aug 2016 14:15:59 +0200 (CEST)
Received: from mail.transpacket.com ([127.0.0.1]) by localhost (mail.transpacket.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id QYyxLnhZE2pS; Wed, 31 Aug 2016 14:15:59 +0200 (CEST)
Received: from [192.168.209.141] (s1853520235.blix.com [185.35.202.35]) by mail.transpacket.com (Postfix) with ESMTPSA id 34F2D1422754; Wed, 31 Aug 2016 14:15:59 +0200 (CEST)
Message-ID: <57C6CA8E.4030101@transpacket.com>
Date: Wed, 31 Aug 2016 14:16:14 +0200
From: Vladimir Vassilev <vladimir@transpacket.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0
MIME-Version: 1.0
To: Ladislav Lhotka <lhotka@nic.cz>, netmod@ietf.org
References: <dfae1556-110d-5c29-d556-5fdc391c1637@ericsson.com> <251BF209-A065-4208-8085-A2A1726FFB27@tail-f.com> <79de91b0-7084-401c-6967-23519b511c4a@ericsson.com> <57C69F18.7000006@transpacket.com> <D9BD63DB-4F89-4C2B-94D8-5E66ACAFBD9A@nic.cz>
In-Reply-To: <D9BD63DB-4F89-4C2B-94D8-5E66ACAFBD9A@nic.cz>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/tbxWxUY5-Mm2NeBI4XFo7y0FAoc>
Subject: Re: [netmod] How to constrain a leaf to a read-only list of supported values?
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, 31 Aug 2016 12:16:03 -0000

On 08/31/2016 12:38 PM, Ladislav Lhotka wrote:
>> On 31 Aug 2016, at 11:10, Vladimir Vassilev <vladimir@transpacket.com> wrote:
>>
>> If you design your models using identityref and define the identities in separate modules e.g. compression-zip.yang, compression-gzip.yang, etc. you can just chose not to load the particular YANG models containing the identities not supported when your device starts.
> Right, and I have proposed this approach several times in the past. However, some people prefer that the modules defining identities mirror IANA and similar registries. In the case of iana-interface-types it also means that implementations have to deal with obsolete, obscure and experimental interface types that happen to be in the IANA registry but nobody will ever want to use.
>
> Lada
+1

The 275 identities defined in iana-if-type.yang appearing as possible 
/interfaces/interface/type tab completion options in a YANG aware cli or 
drop-down menu in gui is annoying and stands out as an obvious problem.

It is not late to split the file. No standard RFC YANG model includes 
iana-if-type.yang yet. The actually referenced identities in current 
drafts is less then 16 (grep-ing in my known YANG model archive) 
{ethernetCsmacd, l2vlan, ieee8023adLag, ifPwType, pos, atm, 
atmSubInterface, sonet, otnOtu, frameRelay, bridge, macSecControlledIF, 
fastdsl}

If not single instance per file maybe dividing the file into categories 
so if your device is atm aware you import iana-if-type-atm.yang and get 
{atm, atmSubInterface}.

However we can probably agree the iana-if-type.yang exception is not a 
valid excuse for new models like the one in the example where there are 
3 compression methods to not modularize the identity definitions into 
separate files and not load identities the implementation does not 
support but instead resolve to workaround solutions.

Vladimir