Re: [yang-doctors] question regarding conditional/optional statements

Jan Lindblad <janl@tail-f.com> Thu, 17 August 2017 11:02 UTC

Return-Path: <janl@tail-f.com>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0BE4D124207 for <yang-doctors@ietfa.amsl.com>; Thu, 17 Aug 2017 04:02:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, 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 OiuzJyEGeAL2 for <yang-doctors@ietfa.amsl.com>; Thu, 17 Aug 2017 04:02:49 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 7C4761200B9 for <yang-doctors@ietf.org>; Thu, 17 Aug 2017 04:02:49 -0700 (PDT)
Received: from [10.147.40.126] (unknown [173.38.220.53]) by mail.tail-f.com (Postfix) with ESMTPSA id 6B5C21AE01AA; Thu, 17 Aug 2017 13:02:47 +0200 (CEST)
From: Jan Lindblad <janl@tail-f.com>
Message-Id: <6991455A-91A6-42A6-86A6-F19A95BCD133@tail-f.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_86244D9D-2716-4083-95B8-D084D70E055F"
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
Date: Thu, 17 Aug 2017 13:02:44 +0200
In-Reply-To: <20170817083739.u4vfbtkm34vf5utw@elstar.local>
Cc: Ing-Wher Chen <Ing-Wher_Chen@jabil.com>, "yang-doctors@ietf.org" <yang-doctors@ietf.org>, Norm Strahle <nstrahle@juniper.net>, "Aseem Choudhary (asechoud)" <asechoud@cisco.com>
To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
References: <BN1PR0201MB0833B05FB5307BDEF2E8E3F5C3820@BN1PR0201MB0833.namprd02.prod.outlook.com> <20170817050647.apfeuvfhfw23ws6n@elstar.local> <BCE95ECB-360D-46E0-B062-371931C0F46A@tail-f.com> <20170817083739.u4vfbtkm34vf5utw@elstar.local>
X-Mailer: Apple Mail (2.3273)
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/a9lEQj15psr3dgaaWv-cl45F-0U>
Subject: Re: [yang-doctors] question regarding conditional/optional statements
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 17 Aug 2017 11:02:52 -0000

>>>> Hello YANG doctors,
>>>> 
>>>> We wish to define a YANG model with several counters.  The counters that we wish to model are the union of all the counters supported by our sample of vendors.  This means that the model will define some counters supported by both vendor_1 and vendor_2 (or more), but some counters will be supported only by one of the vendors.  We would like the model to allow each vendor to indicate the counters it supports.
>>>> 
>>>> We can think of 3 approaches below, and would like your feedback regarding which approach we should choose.  We're also open to suggestions of other approaches.
>>>> 
>>>> Option 1: Define an optional feature (if-feature) for each counter.
>>>> 
>>>> Option 2: Define a leaf of the type bits, where each bit indicates that a particular counter is supported.
>>>> 
>>>> Option 3: Define a leaf of the type integer, where each bit in the integer indicates that a particular counter is supported.
>>>> 
>>> 
>>> Let me add:
>>> 
>>> Option 4: Vendors publish deviations that document how they deviate from
>>> the standard.
>>> 
>>> Advantage: This is the standard approach built into the language to document
>>> how an implementation deviates from a standard.
>>> 
>>> Disadvantage: Vendors do not like to document deviations, hence they
>>> like to see every little counter as a feature.
>> 
>> Disadvantage (fundamental) with deviations: Application developers who are adopting standard YANG models (yay!) as their southbound interface have no way of knowing which deviations vendors will release on their devices. So their applications will typically fail when things they count on isn't supported or is supported differently. When standard YANG models have if-feature statements, reasonably prudent application developers will build applications prepared for the case that some information might not be there. 
>> 
>> Conclusion: deviations are very bad (ambush) for the uptake of standard YANG models.
>> 
>> 
>> Option 5: Let each implementation return the data it supports without any content declaration
>> 
>> Since this is optional operational data, it's formally up to the application to simply return any collected data it has and skip any other leafs.
>> 
>> Advantage: Dead simple to understand for server and client alike, and zero complication on the YANG level. IMO cleaner and clearer than options 2, 3, 4. Even if any of the options 2-4 were implemented, the client would still have to be prepared to not receive any particular leaf since they are all optional. If I implemented the client, I probably wouldn't even bother to read that bit mask/whatever.
>> 
>> Disadvantage: Application developers will have no way of knowing a priori which data may arrive from a particular server. If this is important, option 1 would clearly be better.
>> 
> 
> I fail to see why #5 is any better than #4.
> 
> I believe a feature for every counter is a misuse of YANG feature
> statements, it will get horribly ugly. I recently observe an increase
> of feature statement usage in order to accomodate server
> implementations and the ultimate solution is a feature statement for
> every leaf, list, rpc, action, notification and perhaps even certain
> value sets. This is ridiculous, but a feature for every counter is
> getting damn close to it.

Agreed, but "a feature for every counter" is option #1. There are no if-features in option #5, there's only reliance on leafs being optional and abstention from inventing local protocols based on the description field.

The problem with #4 is that many clients faithfully implementing applications based on the advertised, standard model will break. To fix the breakage requires after the fact programmer intervention. Not very software-defined. The long term effect is that application developers ignore standard models since custom adaptation to each device's implementation is required anyway, if deviations are used more than very occasionally.

/jan