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

Jan Lindblad <janl@tail-f.com> Thu, 17 August 2017 08:07 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 47259132644 for <yang-doctors@ietfa.amsl.com>; Thu, 17 Aug 2017 01:07:50 -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 vXJF73mDPQwz for <yang-doctors@ietfa.amsl.com>; Thu, 17 Aug 2017 01:07:48 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id A4884132397 for <yang-doctors@ietf.org>; Thu, 17 Aug 2017 01:07:48 -0700 (PDT)
Received: from [10.147.40.126] (unknown [173.38.220.53]) by mail.tail-f.com (Postfix) with ESMTPSA id 8A6AE1AE01AA; Thu, 17 Aug 2017 10:07:47 +0200 (CEST)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
From: Jan Lindblad <janl@tail-f.com>
In-Reply-To: <20170817050647.apfeuvfhfw23ws6n@elstar.local>
Date: Thu, 17 Aug 2017 10:07:44 +0200
Cc: "yang-doctors@ietf.org" <yang-doctors@ietf.org>, Norm Strahle <nstrahle@juniper.net>, "Aseem Choudhary (asechoud)" <asechoud@cisco.com>
Content-Transfer-Encoding: quoted-printable
Message-Id: <BCE95ECB-360D-46E0-B062-371931C0F46A@tail-f.com>
References: <BN1PR0201MB0833B05FB5307BDEF2E8E3F5C3820@BN1PR0201MB0833.namprd02.prod.outlook.com> <20170817050647.apfeuvfhfw23ws6n@elstar.local>
To: Ing-Wher Chen <Ing-Wher_Chen@jabil.com>, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
X-Mailer: Apple Mail (2.3273)
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/UZBkI-VfhFndZVq8PP77AxajPIg>
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 08:07:50 -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.

/jan