Re: [netmod] Guideline on modeling including features and phased support by a device

Robert Wilton <rwilton@cisco.com> Tue, 06 March 2018 09:37 UTC

Return-Path: <rwilton@cisco.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 CD96112704A for <netmod@ietfa.amsl.com>; Tue, 6 Mar 2018 01:37:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.51
X-Spam-Level:
X-Spam-Status: No, score=-14.51 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com
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 rBybhxBux-QE for <netmod@ietfa.amsl.com>; Tue, 6 Mar 2018 01:37:47 -0800 (PST)
Received: from aer-iport-1.cisco.com (aer-iport-1.cisco.com [173.38.203.51]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 04EDE124D37 for <netmod@ietf.org>; Tue, 6 Mar 2018 01:37:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=22850; q=dns/txt; s=iport; t=1520329067; x=1521538667; h=subject:to:references:from:message-id:date:mime-version: in-reply-to; bh=UnbFFb3JrsmRjGh4/hEBDaJ5B/zQPwllx7qr7f11rf0=; b=EYElK3x3Cuq6GZRS3gE57A1ZcV/miSFhbZ9h3256LuMgCJc8QaOfI1nz B+SELZspdHBA0wr1jP07QnPwxPi8xNlhUXkBtwQPYvD42Ef3uBDdST+8r A42twFtbnA0CgW2J6/pPC5xrKmM5dhL97HyRgKIcnAISzcScEZ/DxUA18 E=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0ByAQBhYJ5a/xbLJq1dGQEBAQEBAQEBAQEBAQcBAQEBAYJaRYEXcCiObI8GgRaUNIIVChgBCoQ+TwKDGzYWAQIBAQEBAQECayeFIwEBAQMBAQErQRsLGCAOJzAGAQwGAgEBF4R4CBCrCiaETIN2giaFLYQFgg+BdoEOgyMLAQGBW4YDBI18jGsJkHgHiRSFZIp7ToYNgS4lCCkmgSwzGggbFTqCQwmCWoFlQDeMbQEBAQ
X-IronPort-AV: E=Sophos;i="5.47,430,1515456000"; d="scan'208,217";a="2455877"
Received: from aer-iport-nat.cisco.com (HELO aer-core-2.cisco.com) ([173.38.203.22]) by aer-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2018 09:37:45 +0000
Received: from [10.63.23.110] (dhcp-ensft1-uk-vla370-10-63-23-110.cisco.com [10.63.23.110]) by aer-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id w269bii6011474; Tue, 6 Mar 2018 09:37:44 GMT
To: "Bogaert, Bart (Nokia - BE/Antwerp)" <bart.bogaert@nokia.com>, "netmod@ietf.org" <netmod@ietf.org>
References: <AM4PR07MB1716E07EE14F80BA7094C0DD94DA0@AM4PR07MB1716.eurprd07.prod.outlook.com>
From: Robert Wilton <rwilton@cisco.com>
Message-ID: <9b0efc1c-675a-5cc6-3ab3-e6bae2481a78@cisco.com>
Date: Tue, 06 Mar 2018 09:37:44 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
MIME-Version: 1.0
In-Reply-To: <AM4PR07MB1716E07EE14F80BA7094C0DD94DA0@AM4PR07MB1716.eurprd07.prod.outlook.com>
Content-Type: multipart/alternative; boundary="------------2AA988A7AA4CE689CE435087"
Content-Language: en-US
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/dDHXTiY374gDAqnfdq29cSPYnm0>
Subject: Re: [netmod] Guideline on modeling including features and phased support by a device
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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: Tue, 06 Mar 2018 09:37:50 -0000

Hi Bart,

I think that the best solution to problem is perhaps to avoid it 
altogether.  I.e. I don't think that the only-if-feature leaf should be 
marked mandatory.  Instead, it would be better to define a sensible 
default value/behaviour if the leaf is absent even when the feature is 
supported.

Alternatively, you can simulate something similar to an if-feature 
statement by using a when or must expression instead that is predicated 
on a leaf that the client must explicitly set to enable the feature, 
giving control back to the client.

E.g. something along the lines of ...

leaf enable-super-feature {
   if-feature test-feature;
   type boolean;
   default "false";
}

...

       leaf only-if-feature {

         when '/enable-super-feature = "true"';

         type string;

         mandatory true;

       }

It would be interesting if you have a concrete example where neither of 
the above suggestions would work or be appropriate.

Thanks,
Rob


On 05/03/2018 09:25, Bogaert, Bart (Nokia - BE/Antwerp) wrote:
>
> Hi,
>
> We have a question with respect to YANG models using features.  Assume 
> that a part of the model is defined under a feature and that this 
> feature-dependent part defines a leaf as mandatory.
>
> module servers {
>
>   namespace "http://www.example.com/servers";
>
>   prefix servers;
>
>   import ietf-inet-types {
>
>     prefix inet;
>
>   }
>
>   revision 2018-03-01 {
>
>     description
>
>        "Initial version.";
>
>   }
>
>   feature test-feature {
>
>     description "testing feature";
>
>   }
>
>   container servers {
>
>     list server {
>
>       key name;
>
>       max-elements 64;
>
>       leaf name {
>
>         type string;
>
>       }
>
>       leaf ip {
>
>         type inet:ip-address;
>
>         mandatory true;
>
>       }
>
>       leaf port {
>
>         type inet:port-number;
>
>         mandatory true;
>
>       }
>
>       leaf only-if-feature {
>
>         if-feature test-feature;
>
>         type string;
>
>         mandatory true;
>
>       }
>
>     }
>
>   }
>
> }
>
> Now assume that we have a device that implements the model step-wise 
> by first not supporting this feature and in a sub-sequent release by 
> supporting this feature (and uses a persistent running datastore).  
> The question arising now is how to deal with this mandatory leaf?  
> Normally this can only be configured by a client, meaning that without 
> any “help”, the NC server will not be able to startup with the data 
> contained in the device’s persistent datastore unless a value is set 
> for the mandatory leaf that now becomes available as a result of 
> supporting the feature.
>
> When modeling as follows it seems the NC server can start with the 
> model supporting the feature that was not supported before:
>
> module servers {
>
>   namespace "http://www.example.com/servers";
>
>   prefix servers;
>
>   import ietf-inet-types {
>
>     prefix inet;
>
>   }
>
>   revision 2018-03-01 {
>
>     description
>
>        "Initial version.";
>
>   }
>
>   feature test-feature {
>
>     description "testing feature";
>
>   }
>
>   container servers {
>
>     list server {
>
>       key name;
>
>       max-elements 64;
>
>       leaf name {
>
>         type string;
>
>       }
>
>       leaf ip {
>
>         type inet:ip-address;
>
>         mandatory true;
>
>       }
>
>       leaf port {
>
>         type inet:port-number;
>
>         mandatory true;
>
>       }
>
>       container only-if-feature {
>
>         presence "see if this helps";
>
>         if-feature test-feature;
>
>         leaf only-if-feature {
>
>           type string;
>
>           mandatory true;
>
>         }
>
>       }
>
>     }
>
>   }
>
> }
>
> Are recommendations or guidelines in place to deal with this?
>
> Regards, Bart
>
>
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod