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

Ladislav Lhotka <lhotka@nic.cz> Mon, 12 September 2016 16:23 UTC

Return-Path: <lhotka@nic.cz>
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 2EF5912B109 for <netmod@ietfa.amsl.com>; Mon, 12 Sep 2016 09:23:04 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.508
X-Spam-Level:
X-Spam-Status: No, score=-8.508 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-1.508] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nic.cz
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 ri-nN2MAKV0N for <netmod@ietfa.amsl.com>; Mon, 12 Sep 2016 09:23:02 -0700 (PDT)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 341E812B39A for <netmod@ietf.org>; Mon, 12 Sep 2016 08:35:06 -0700 (PDT)
Received: from [IPv6:2001:718:1a02:1:3d66:d77d:e2ed:637c] (unknown [IPv6:2001:718:1a02:1:3d66:d77d:e2ed:637c]) by mail.nic.cz (Postfix) with ESMTPSA id 8401760999; Mon, 12 Sep 2016 17:35:04 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1473694504; bh=iyVSVFL6vanJl79JGZP0pvxv8jAeSiNtXZIAhK1Q51A=; h=From:Date:To; b=SbzHsI64arwBd2A0etCRbntkPkNqurohUW5Kkl+EQlAxvEOwD2alG0Q/JzZE11Gkv MnGNilYEEV/Pp4DdDQTNpnAni5xoea5+9YIk9v//6nJ3XB+/U6nsSHuNtEM7xr9SzS bngNR97YHizq5mxnjbPFc66feS1JMrCHudUEhTkg=
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <20160912133353.GA40334@elstar.local>
Date: Mon, 12 Sep 2016 17:35:03 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <0FF2F5A0-7E58-41AA-A0FA-463ABE94BE4F@nic.cz>
References: <1526719e-0ce1-6dda-2716-a8b6c8fb313b@nokia.com> <20160912133353.GA40334@elstar.local>
To: Jürgen Schönwälder <j.schoenwaelder@jacobs-university.de>
X-Mailer: Apple Mail (2.3124)
X-Virus-Scanned: clamav-milter 0.98.7 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/ckKWDCcVaPDoACPZ3YYfYeRtD1w>
Cc: netmod@ietf.org
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: Mon, 12 Sep 2016 16:23:04 -0000

> On 12 Sep 2016, at 15:33, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
> 
> Hi,
> 
> I think Section 8.3.3. provides an answer:
> 
>   When datastore processing is complete, the final contents MUST obey
>   all validation constraints.  This validation processing is performed
>   at differing times according to the datastore.  If the datastore is
>   <running/> or <startup/>, these constraints MUST be enforced at the
>   end of the <edit-config> or <copy-config> operation.  If the
>   datastore is <candidate/>, the constraint enforcement is delayed
>   until a <commit> or <validate> operation.

But sec. 8.1 lists "when" conditions among properties that must be true in all data trees, so it can never be false in <candidate/> either.

My answer to Yves' question is that the edit-config has to be applied atomically, and the constraints verified of the final result (a tentative version of "running") in which A is already present, so the edit is accepted.

Note, however, that the "when" expression should be

    when "../A";

The one in the "dummy" module is always false.

Lada

> 
> /js
> 
> On Mon, Sep 12, 2016 at 01:27:52PM +0200, Yves Beauville wrote:
>> Hi,
>> 
>> I am trying to interpret this statement in Section 8.3.1 Payload Parsing of
>> RFC 6020.
>> 
>>   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.
>> 
>> With the context node defined Section 7.19.5. The when Statement
>> 
>>   o  If the context node represents configuration, the tree is the data in
>> the NETCONF datastore where the context node exists. The XPath root node has
>> all top-level configuration data nodes in all modules as children.
>> 
>> I am providing this dummy module to illustrate my question:
>> 
>> module dummy {
>>  namespace "http://dummy.com";
>>  prefix "du";
>> 
>>  container root {
>>    leaf A {
>>      type empty:
>>    }
>>    leaf B {
>>      when "A";
>>      type uint32;
>>    }
>>  }
>> }
>> 
>> And I consider the following <edit-config> request, while A & B do not exist
>> yet in the current datastore.
>> 
>>     <rpc message-id="101"
>>          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
>>       <edit-config>
>>         <target>
>>           <running/>
>>         </target>
>>         <config>
>>           <root xmlns="http://dummy.com">
>>             <A/>
>>             <B>
>>               3
>>             </B>
>>           </dummy>
>>         </config>
>>       </edit-config>
>>     </rpc>
>> 
>> During the parsing of the payload of the <edit-config>, leaf "A" is not yet
>> present in the running datastore. The "when" statement that controls "B"
>> evaluates to false.
>> 
>> Does this mean that the above edit-config request should be rejected with an
>> "unknown-element" error-tag in the rpc-error? Or am I misinterpreting the
>> RFC?
>> 
>> Yves
> 
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org
>> https://www.ietf.org/mailman/listinfo/netmod
> 
> 
> -- 
> 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/>
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C