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

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Thu, 17 August 2017 08:37 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
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 27A3B132418 for <yang-doctors@ietfa.amsl.com>; Thu, 17 Aug 2017 01:37:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, URIBL_BLOCKED=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 TrY17ygHPJYA for <yang-doctors@ietfa.amsl.com>; Thu, 17 Aug 2017 01:37:43 -0700 (PDT)
Received: from atlas5.jacobs-university.de (atlas5.jacobs-university.de [212.201.44.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1EB94132397 for <yang-doctors@ietf.org>; Thu, 17 Aug 2017 01:37:43 -0700 (PDT)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas5.jacobs-university.de (Postfix) with ESMTP id ED96AEC1; Thu, 17 Aug 2017 10:37:41 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas5.jacobs-university.de ([10.70.0.217]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10032) with ESMTP id Ghh0L0Kri874; Thu, 17 Aug 2017 10:37:41 +0200 (CEST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "Jacobs University CA - G01" (verified OK)) by atlas5.jacobs-university.de (Postfix) with ESMTPS; Thu, 17 Aug 2017 10:37:41 +0200 (CEST)
Received: from localhost (demetrius3.jacobs-university.de [212.201.44.48]) by hermes.jacobs-university.de (Postfix) with ESMTP id CAA36200C5; Thu, 17 Aug 2017 10:37:41 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius3.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id 9ombbmK3zVoP; Thu, 17 Aug 2017 10:37:41 +0200 (CEST)
Received: from elstar.local (elstar.jacobs.jacobs-university.de [10.50.231.133]) by hermes.jacobs-university.de (Postfix) with ESMTP id D105B200C3; Thu, 17 Aug 2017 10:37:40 +0200 (CEST)
Received: by elstar.local (Postfix, from userid 501) id C3423404141C; Thu, 17 Aug 2017 10:37:39 +0200 (CEST)
Date: Thu, 17 Aug 2017 10:37:39 +0200
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Jan Lindblad <janl@tail-f.com>
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>
Message-ID: <20170817083739.u4vfbtkm34vf5utw@elstar.local>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Jan Lindblad <janl@tail-f.com>, 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>
References: <BN1PR0201MB0833B05FB5307BDEF2E8E3F5C3820@BN1PR0201MB0833.namprd02.prod.outlook.com> <20170817050647.apfeuvfhfw23ws6n@elstar.local> <BCE95ECB-360D-46E0-B062-371931C0F46A@tail-f.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <BCE95ECB-360D-46E0-B062-371931C0F46A@tail-f.com>
User-Agent: NeoMutt/20170714 (1.8.3)
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/ouUay5hnhFStBN2mYzsIirAWki8>
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:37:46 -0000

On Thu, Aug 17, 2017 at 10:07:44AM +0200, Jan Lindblad wrote:
> >> 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.

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>