Re: [netmod] RFC8526 and 'derived-from-or-self(datastore, "ds:operational")'
Ladislav Lhotka <lhotka@nic.cz> Thu, 15 August 2019 07:30 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 771EF12003E for <netmod@ietfa.amsl.com>; Thu, 15 Aug 2019 00:30:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=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 YjpEbk1k7ox3 for <netmod@ietfa.amsl.com>; Thu, 15 Aug 2019 00:30:45 -0700 (PDT)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 3522C120045 for <netmod@ietf.org>; Thu, 15 Aug 2019 00:30:45 -0700 (PDT)
Received: by trail.lhotka.name (Postfix, from userid 109) id E3A1318201C9; Thu, 15 Aug 2019 09:32:15 +0200 (CEST)
Received: from localhost (nat-1.nic.cz [217.31.205.1]) by trail.lhotka.name (Postfix) with ESMTPSA id EB3A0182004A; Thu, 15 Aug 2019 09:31:54 +0200 (CEST)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Martin Bjorklund <mbj@tail-f.com>, jernej.tuljak@mg-soft.si
Cc: netmod@ietf.org
In-Reply-To: <20190813.114728.2262411490998285952.mbj@tail-f.com>
References: <8e19f280-5b63-c2d4-003b-e5e5370e9ea1@mg-soft.si> <20190813.114728.2262411490998285952.mbj@tail-f.com>
Mail-Followup-To: Martin Bjorklund <mbj@tail-f.com>, jernej.tuljak@mg-soft.si, netmod@ietf.org
Date: Thu, 15 Aug 2019 09:30:21 +0200
Message-ID: <87d0h6x4vm.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/x8dM1ROnT5_3ZQnzlw5lQUcC_VA>
Subject: Re: [netmod] RFC8526 and 'derived-from-or-self(datastore, "ds:operational")'
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
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: Thu, 15 Aug 2019 07:30:48 -0000
Martin Bjorklund <mbj@tail-f.com> writes: > Hi, > > Jernej Tuljak <jernej.tuljak@mg-soft.si> wrote: >> Hi, >> >> I'm trying to determine who is at fault, our YANG validator >> implementation or the module ietf-netconf-nmda in RFC8526 . >> >> There is a "when" expression at line 193 within this module >> >> when 'derived-from-or-self(datastore, "ds:operational") '; >> >> which is under this pseudo-branch within the module: / get-data >> ("rpc") / input ("input") / origin-filters ("choice"). >> >> Our implementation claims that the initial context node of the >> expression does not contain a "datastore" child, resulting in a >> warning for this expression, which seemed like an obvious bug at >> first, but does not anymore. >> >> The accessible tree for this expression is built using the following >> bullet in Section 6.4.1: >> >> o If the XPath expression is defined in a substatement to an "input" >> statement in an "rpc" or "action" statement, the accessible tree >> is the RPC or action operation instance, all state data in the >> server, and the running configuration datastore. The root node >> has top-level data nodes in all modules as children. >> Additionally, for an RPC, the root node also has the node >> representing the RPC operation being defined as a child. The node >> representing the operation being defined has the operation's input >> parameters as children. >> >> >> "origin-filters" for which the "when" expression is defined is clearly >> a substatement to an "input" statement in an "rpc" statement. Pseudo- >> accessible tree below (matches what our implementation does). >> >> <root> >> +- get-data >> +- datastore >> +- // other data node siblings of datastore >> +- // top-level data nodes of all modules The rules may be easier to describe if we define schema root nodes (or similar name) as a special category of schema nodes. It makes sense also because all these schema root nodes have a corresponding instance node in the XPath tree - the invisible XPath root, rpc, input, output and notification. Lada >> >> The initial context node is determined by using the following bullet >> in Section 7.21.5: >> >> o If the "when" statement is a child of a "uses", "choice", or >> "case" statement, then the context node is the closest ancestor >> node to the node with the "when" statement that is also a data >> node. If no such node exists, the context node is the root node. >> The accessible tree is tentatively altered during the processing >> of the XPath expression by removing all instances (if any) of the >> nodes added by the "uses", "choice", or "case" statement. >> >> >> The "when" statement in question is clearly a child of a "choice" >> statement without a data node ancestor. Neither "input" nor "rpc" >> represent data nodes, as per Terminology section: >> >> o data node: A node in the schema tree that can be instantiated in a >> data tree. One of container, leaf, leaf-list, list, anydata, and >> anyxml. >> >> >> To our implementation this means that the initial context node is the >> root node of the accessible tree, not the node that represents the >> "rpc". Therefore the expression is attempting to refer to a node that >> is undefined. It is expecting >> >> when 'derived-from-or-self(get-data/datastore, "ds:operational") '; >> >> or something along those lines instead. >> >> Either way, something doesn't add up between RFC7950 and RFC8526. >> >> There is a suspicious verified RFC7950 errata >> (https://www.rfc-editor.org/errata/eid4794) dealing with initial >> context nodes under augments, but there's nothing for the UCC ("uses", >> "choice", "case") corner case. Perhaps there should be? Should Section >> 7.21.5 say >> >> NEW: >> >> o If the "when" statement is a child of a "uses", "choice", or >> "case" statement, then the context node is the closest ancestor >> node to the node with the "when" statement that is also a data >> node, rpc, action or notification. If no such node exists, the >> context node is the root node. The accessible tree is tentatively >> altered during the processing of the XPath expression by removing >> all instances (if any) of the nodes added by the "uses", >> "choice", or "case" statement. >> >> OLD: >> >> o If the "when" statement is a child of a "uses", "choice", or >> "case" statement, then the context node is the closest ancestor >> node to the node with the "when" statement that is also a data >> node. If no such node exists, the context node is the root node. >> The accessible tree is tentatively altered during the processing >> of the XPath expression by removing all instances (if any) of the >> nodes added by the "uses", "choice", or "case" statement. >> >> ? > > I think this matches the intent. As you note above, since the > accessible tree is: > > <root> > +- get-data > +- datastore > +- // other data node siblings of datastore > +- // top-level data nodes of all modules > > the context node for the "when" statement in the "choice" is supposed > to be "get-data". > > This also makes it consistent with augment: > > augment /get-data/input { > choice origin-filters { > when 'derived-from-or-self(datastore, "ds:operational")'; > ... > } > } > > > > /martin > > _______________________________________________ > netmod mailing list > netmod@ietf.org > https://www.ietf.org/mailman/listinfo/netmod -- Ladislav Lhotka Head, CZ.NIC Labs PGP Key ID: 0xB8F92B08A9F76C67
- [netmod] RFC8526 and 'derived-from-or-self(datast… Jernej Tuljak
- Re: [netmod] RFC8526 and 'derived-from-or-self(da… Martin Bjorklund
- Re: [netmod] RFC8526 and 'derived-from-or-self(da… Ladislav Lhotka