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

Andy Bierman <andy@yumaworks.com> Mon, 12 September 2016 17:33 UTC

Return-Path: <andy@yumaworks.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 809F4126FDC for <netmod@ietfa.amsl.com>; Mon, 12 Sep 2016 10:33:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.6
X-Spam-Level:
X-Spam-Status: No, score=-2.6 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.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 vfpP1iHV9ZRq for <netmod@ietfa.amsl.com>; Mon, 12 Sep 2016 10:33:35 -0700 (PDT)
Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 83ECD126579 for <netmod@ietf.org>; Mon, 12 Sep 2016 10:33:35 -0700 (PDT)
Received: by mail-wm0-x22e.google.com with SMTP id c131so69818367wmh.0 for <netmod@ietf.org>; Mon, 12 Sep 2016 10:33:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UGsByZWYAw/WO2jq8WryZ6HnIo9nChp6YqeEDfEJVRU=; b=uK2XnJBrVX5UnMZ9/0QAuIuYqBrV22G3bslRc3D428VENvu9rZTu4pJWmQ3rWSkP8s dKIxlnIUQvlabp0qdv/PJ66HStIw49XRAG3F4E6C7RjcOdXw9GeJnYc7J2coqV5IKmjK /hD3vYyO22U9ei68NWy4rInDV5FSkCqJy0/P1oKylYxGMxgqyXnQ29wM0vyAv9Gz7q0K /IS2g5XFN2Aea/WC9YKf7PUu0WweWD0kwYoShefEXtCSPhGRWA9gO3YK4ozYAkRGznIQ sxXJolMuEBxXP7UABuVYsTvu3zLrLONrhS4lnw2sdLFch2KepzXMPm7qRYJKrqEoHV6b 3sIA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UGsByZWYAw/WO2jq8WryZ6HnIo9nChp6YqeEDfEJVRU=; b=lnjJMCtCghnCIKtAI21DNh/pkucb2XDGLPepNswQys3GiGT3oZdzlzAkuHIsDeI6Yj 7xiCCeuHbIcOprLjU3rO22HkLz1IiVlI5wGXhfA8urqQY2Q/odlJMOFZC3Edset9RQTq MSe5yDXG9cHe8Bz6MVF91Em5Y/JQJf+/L2/h396ddOAV1kZ3NYjv7bc6/6GFjdDRTT8e MB0ldzg3WAuwbVQTjMn+RDzAlqQBHhrP4c3TyYH88DbIctH497DQfMPGi3tz3HzNuPsH tePcTqd1SjCIm/z+Zn0jcfKPg4vKUe17PK+hLOiYUaw4whDrrgLJc86JMa7vhHt2nH/t l4kA==
X-Gm-Message-State: AE9vXwMPPCdBu9h7ZTbMuImciO/Rx0dzIbFx/YrEJWx+wDmPMGQCJH4OIwT8JbqpM4ayMWlT7QtwDGgILLHhQw==
X-Received: by 10.28.98.68 with SMTP id w65mr1142779wmb.4.1473701613774; Mon, 12 Sep 2016 10:33:33 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.80.141.78 with HTTP; Mon, 12 Sep 2016 10:33:33 -0700 (PDT)
In-Reply-To: <57D6E1EC.6070606@seguesoft.com>
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>
From: Andy Bierman <andy@yumaworks.com>
Date: Mon, 12 Sep 2016 10:33:33 -0700
Message-ID: <CABCOCHTOgNdZDVBGPfRWNc8EXOq82OyCaggSGdfL=xQL5uDbPw@mail.gmail.com>
To: Xiang Li <xiangli@seguesoft.com>
Content-Type: multipart/alternative; boundary="001a1148c72231f834053c52e5a0"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/ncUVueJNTh0ZcRW6PGvEZNhT6zg>
Cc: "netmod@ietf.org" <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 17:33:37 -0000

On Mon, Sep 12, 2016 at 10:12 AM, Xiang Li <xiangli@seguesoft.com> wrote:

> Hi Andy
>
> On 9/12/2016 11:33 AM, Andy Bierman wrote:
>
>
>
> On Mon, Sep 12, 2016 at 8:35 AM, Ladislav Lhotka < <lhotka@nic.cz>
> lhotka@nic.cz> wrote:
>
>>
>> > 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.
>>
>>
>
> Both these statements seem wrong.
> The "when" statement is applied to candidate.
> It is not deferred at all.
>
> Each tree (candidate, running, startup) can have different contents.
> This will impact the evaluation of when-stmts.  No tree can have any
> nodes that require when-stmt evaluation, and that evaluation result is
> "false".
> (May not be the same result as in other trees)
>
>
> I agree.  RFC7950 section 8.1. "Constraints on Data", there is difference
> between
> "all data trees" and "a valid data tree".
>
> The following properties are true in *all data trees*:
>
> ...  The when statement is listed here
>
>



   o  There MUST be no nodes tagged with "when" present if the "when"
      condition evaluates to "false" in the data tree.


This text seems fine.
I can see how one might be confused by the text in 8.3.3

   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 takes place.

The last sentence refers to the 8.1 para 3 bullet list for a valid data
tree.

The distinction in 8.1 between "all data trees" and a "valid data tree" is
not obvious.
The intent of the former is that the constraint applies immediately (as
part of the
current edit operation).  The text could have been more direct that "all
data trees"
is really the candidate datastore tree.  All other standard data trees are
required
to be valid data trees at all times.



The following properties are true in a *valid data tree*:
>
> ... The must statement is listed here
>
>
>
> -Xiang
>
>
Andy


>
>
>> 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
>>
>>
>
> Andy
>
>
>> >
>> > /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>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/>
>> 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
>>
>>
>>
>>
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org
>> https://www.ietf.org/mailman/listinfo/netmod
>>
>
>
>
> _______________________________________________
> netmod mailing listnetmod@ietf.orghttps://www.ietf.org/mailman/listinfo/netmod
>
>