[netmod] RFC8526 and 'derived-from-or-self(datastore, "ds:operational")'

Jernej Tuljak <jernej.tuljak@mg-soft.si> Mon, 12 August 2019 21:50 UTC

Return-Path: <jernej.tuljak@mg-soft.si>
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 860FC120B9C for <netmod@ietfa.amsl.com>; Mon, 12 Aug 2019 14:50:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=mg-soft.si
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 h96nfvN1kTTY for <netmod@ietfa.amsl.com>; Mon, 12 Aug 2019 14:50:19 -0700 (PDT)
Received: from galileo.mg-soft.si (gate.mg-soft.si [212.30.73.66]) by ietfa.amsl.com (Postfix) with ESMTP id 4952E121615 for <netmod@ietf.org>; Mon, 12 Aug 2019 06:04:58 -0700 (PDT)
Received: from [10.0.0.222] (tp-x61t.mg-soft.si [10.0.0.222]) by galileo.mg-soft.si (Postfix) with ESMTP id 0140AC417623 for <netmod@ietf.org>; Mon, 12 Aug 2019 15:04:55 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.10.3 galileo.mg-soft.si 0140AC417623
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mg-soft.si; s=default; t=1565615095; bh=yn3ob8tSIzBPGtBK++FtL/DRtfYNffqDHKDH4bwuVp0=; h=To:From:Subject:Date:From; b=FGF8gfoJ2lCgjPoG8I0WYxgpW6TeOsM4jszqqB9D6bZqJcAsRulcIWVELSrUrX1pe wnOO7NhbXMCxpE7iJfiADFWtDrbZb2j9EKT6jDR6tUCpN2hTIz3T9KNlDI/BlLwEei 8ZZOqyb3JdQtmVJdL3ptMT3rkYgBVLyB/zPrjpK5OE8O6Vqohk2dXnYNJqeG9s5zAR WOFCmQA4D6fC4bgDCWemdEF1rxZa7Mnf6PyLs3xiF7Q8U/qLx9Usj5mZk4FYPvZpra iP367BEGgxZI157paO75G2ubIHpIguptF0CT9Wld1k6S3Zei+mNqT0IfygyXcUKOS8 Smvz5W4U7QRHg==
To: NETMOD Working Group <netmod@ietf.org>
From: Jernej Tuljak <jernej.tuljak@mg-soft.si>
Message-ID: <8e19f280-5b63-c2d4-003b-e5e5370e9ea1@mg-soft.si>
Date: Mon, 12 Aug 2019 15:04:54 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="------------FD25C403F70B60B2C9595A39"
Content-Language: en-US
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/GA-FbYoaDAuSLnVolw8Drt2fcvI>
Subject: [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: Mon, 12 Aug 2019 21:50:23 -0000

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

?

Jernej