Re: [netmod] 'when' statement in edit-config payload parsing

Vladimir Vassilev <vladimir@transpacket.com> Tue, 13 September 2016 11:19 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 D0D6512B311 for <netmod@ietfa.amsl.com>; Tue, 13 Sep 2016 04:19:06 -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 0NMGj8JEmXVe for <netmod@ietfa.amsl.com>; Tue, 13 Sep 2016 04:19:05 -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 CC4F312B30B for <netmod@ietf.org>; Tue, 13 Sep 2016 04:19:04 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by mail.transpacket.com (Postfix) with ESMTP id BD05713E1389; Tue, 13 Sep 2016 13:19:02 +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 Se-RtijJdiGz; Tue, 13 Sep 2016 13:19:02 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1]) by mail.transpacket.com (Postfix) with ESMTP id 9194613E24C0; Tue, 13 Sep 2016 13:19:02 +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 GLNMGKWRwOw3; Tue, 13 Sep 2016 13:19:02 +0200 (CEST)
Received: from [192.168.209.141] (s1853520235.blix.com [185.35.202.35]) by mail.transpacket.com (Postfix) with ESMTPSA id 6EC8113E1389; Tue, 13 Sep 2016 13:19:02 +0200 (CEST)
Message-ID: <57D7E0A6.6020806@transpacket.com>
Date: Tue, 13 Sep 2016 13:19:02 +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: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, netmod@ietf.org
References: <1526719e-0ce1-6dda-2716-a8b6c8fb313b@nokia.com> <20160912133353.GA40334@elstar.local> <0FF2F5A0-7E58-41AA-A0FA-463ABE94BE4F@nic.cz> <CABCOCHRGvzMtAYv9M-gL7_f8HbZhWWppPSYrvnoY_F_R8y5HSA@mail.gmail.com> <57D6E1EC.6070606@seguesoft.com> <CABCOCHTOgNdZDVBGPfRWNc8EXOq82OyCaggSGdfL=xQL5uDbPw@mail.gmail.com> <1cd5b1e3-4440-2635-c809-c709dcc6efd3@nokia.com> <D56F657D-1569-4E1C-937C-5FF4DEF53BF0@nic.cz> <20160913082526.GB44726@elstar.local> <57D7D7FF.9040603@transpacket.com> <20160913105710.GA44963@elstar.local>
In-Reply-To: <20160913105710.GA44963@elstar.local>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/J-QCc9wcZcP9SBWF1zNS3NYiSiY>
Subject: Re: [netmod] 'when' statement in edit-config payload parsing
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: Tue, 13 Sep 2016 11:19:07 -0000


On 09/13/2016 12:57 PM, Juergen Schoenwaelder wrote:
> On Tue, Sep 13, 2016 at 12:42:07PM +0200, Vladimir Vassilev wrote:
>> On 09/13/2016 10:25 AM, Juergen Schoenwaelder wrote:
>>> On Tue, Sep 13, 2016 at 09:34:33AM +0200, Ladislav Lhotka wrote:
>>>>> On 13 Sep 2016, at 09:01, Yves Beauville <yves.beauville@nokia.com> wrote:
>>>>>
>>>>> Both RFC 6020 and RFC 7950 are providing the same requirement in section 'Payload Parsing':
>>>>>     o  If data for a node tagged with "when" is present, and the "when" condition evaluates to "false", the server MUST reply with an "unknown-element" error-tag in the rpc-error.
>>>> This section seems confusing. It makes no sense to evaluate "when" or "must" on the contents of a protocol message such as edit-config because accessible trees for XPath evaluations are defined in sec. 6.4.1 in terms of datastores and "all state data".
>>>>
>>> I agree that this bullet in section 8.3.1 looks odd. Perhaps Martin
>>> recalls why this was written in the first place?
>>>
>>> /js
>>>
>>>
>> IMO it is that bullet that sets apart 'when' from 'must' statements. With
>> the current text 'when' statements should be evaluated along with
>> 'range',..., 'if-feature' etc. 8.3.1 specified validation statements upon
>> every <edit-config> while 'must' statements should be evaluated only upon
>> <commit> along with the rest of "description" statement validation checks
>> done. The designer should take care to not specify 'when' statements that
>> hinder incremental editing of the 'candidate' configuration.
>>
>> I use 'when' statements in models utilizing lists often with 'identity'
>> leafs in the parent chain of data nodes and only testing for the values of
>> those 'identity' leafs or the keys. Anything else IMO requires 'must'
>> statements with proper dedicated error messages. Following this rule
>> prevents situations where you need to have a single <edit-config> creating
>> multiple leafs with complicated dependency to satisfy the 'when' statements.
>>
>> Probably a clarification that the 'when' statement should evaluate to 'true'
>> after the <edit-config> is applied (e.g. to a copy of the edited
>> configuration for example) and not based only on the data content of the
>> <edit-config> RPC is what is needed.
> I am wondering in which cases this is useful. Consider a candidate
> datastore - why would a 'when' expression have to true after each
> edit? Why do we force clients to send edits in such a way that 'when'
> expressions are true after each edit?
For example command line <TAB> completion in /interfaces/interface can 
evaluate all 'when' statements in child data nodes and augmentations and 
come up with relevant list of container and leaf child completions based 
on the already created /interfaces/interface/type (same applies for the 
options a user is presented with in a GUI after specifying the 'name' 
and 'type' of the interface). It is the same with 'if-feature' 
evaluations. The 'must' statements however can be more complicated since 
they are only checked when the interactive incremental edit process is 
complete and <commit> is attempted.

The usability of that is somewhat dependent on users not getting too 
creative with 'when' statements. In that case it will be hard to see why 
certain leafs and containers can not be created. Not even upon 'commit' 
since "unknown-element" is all the user gets. Carefully reading the 
models is the only solution in that case.

Vladimir