Re: [netmod] evaluation of "when" under NMDA

Ladislav Lhotka <lhotka@nic.cz> Tue, 05 December 2017 12:04 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 982CE127286 for <netmod@ietfa.amsl.com>; Tue, 5 Dec 2017 04:04:12 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7
X-Spam-Level:
X-Spam-Status: No, score=-7 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] 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 BKmhrhz6hiHr for <netmod@ietfa.amsl.com>; Tue, 5 Dec 2017 04:04:10 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B7F591243F3 for <netmod@ietf.org>; Tue, 5 Dec 2017 04:04:09 -0800 (PST)
Received: from birdie (unknown [IPv6:2001:1488:fffe:6:1f99:257b:62cc:c0d5]) by mail.nic.cz (Postfix) with ESMTPSA id 3A27C63BD5; Tue, 5 Dec 2017 13:04:08 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1512475448; bh=Z0s7Wb8Jzjc3V5fbenmri7kOcJH1oTS+RTOnp0UbOJo=; h=From:To:Date; b=kUnRE67m7YPURzUQeyDU5xxGMlPJuBPZ42tQnl4jv7ld0hzPOFq3eIPKLlLtqonPv 21Tumofg0uHLrnpSbyJr7jWkXbWh5iE4yAkUk6opDWT3srmwK4xVzFTrCkCC2zdo4f siyReYj49DvG5YLFWp58JzOqBEoewmi6A/OhBRKw=
Message-ID: <1512475448.7827.75.camel@nic.cz>
From: Ladislav Lhotka <lhotka@nic.cz>
To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Cc: NETMOD WG <netmod@ietf.org>
Date: Tue, 05 Dec 2017 13:04:08 +0100
In-Reply-To: <20171205102554.ggiyqj6fx2bhcrvo@elstar.local>
References: <1512404811.1422.63.camel@nic.cz> <20171204.173431.1294203680272812703.mbj@tail-f.com> <1512407158.6635.8.camel@nic.cz> <20171204172247.rj3ilazharvzbyn6@elstar.local> <1512410991.8751.4.camel@nic.cz> <20171204200019.2xvocmusfwfatqav@elstar.local> <1512464587.7827.13.camel@nic.cz> <20171205102554.ggiyqj6fx2bhcrvo@elstar.local>
Organization: CZ.NIC
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.26.2
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.99.2 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/-mqNL4uAoy62t0qLIWratuh8Fnc>
Subject: Re: [netmod] evaluation of "when" under NMDA
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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, 05 Dec 2017 12:04:12 -0000

On Tue, 2017-12-05 at 11:25 +0100, Juergen Schoenwaelder wrote:
> On Tue, Dec 05, 2017 at 10:03:07AM +0100, Ladislav Lhotka wrote:
> > On Mon, 2017-12-04 at 21:00 +0100, Juergen Schoenwaelder wrote:
> > > On Mon, Dec 04, 2017 at 07:09:51PM +0100, Ladislav Lhotka wrote:
> > > > 
> > > > Well, according to draft-ietf-netmod-revised-datastores-07:
> > > > 
> > > >    o  datastore schema: The combined set of schema nodes for all modules
> > > >       supported by a particular datastore, taking into consideration any
> > > >       deviations and enabled features for that datastore.
> > > > 
> > > > And "when" determines whether a given schema node is valid or
> > > > not. So if a schema node is invalid in the schema of <operational>
> > > > but valid in the schema of <intended>, then the former can hardly be
> > > > a superset of the latter.
> > > 
> > > I do not follow your notion of 'schema node is valid or not'. Where is
> > > this concept defined? I think RFC 7950 talks about validation of data
> > 
> > Guess what, this notion is used in the definition of "when" statement (sec.
> > 7.21.5):
> > 
> >    The "when" statement makes its parent data definition statement
> >    conditional.  The node defined by the parent data definition
> >    statement is only valid when the condition specified by the "when"
> >    statement is satisfied. ...
> > 
> > This text clearly talks about a schema node, because it is what data
> > definition
> > statements define.
> 
> This is not how I understand the text. Perhaps a clearer phrasing
> would have been this:
> 
>      The "when" statement makes its parent data definition statement
>      conditional.  A node in the data tree corresponding to the parent
>      data definition statement is only valid when the condition
>      specified by the "when" statement is satisfied. ...

As I wrote, this doesn't work if the parent statement is "augment", "choice" or
"case" - there is then no such node in the data tree.

> 
> For me, the schema is static, the schema does not change with the
> content of the data tree. YANG specifies what a valid data tree is, I
> do not thnk it defines schemas that mutate according to some notion of
> schema validity.
> 
> > > trees against a "schema". Perhaps there are places where the wording
> > > is not clear enough? I know that there are places where the RFC 7950
> > > text says just "node" without being explicit about the distinction
> > > between schema node and corresponding data nodes. If this is an issue
> > 
> > Note that data node is just a special type of schema node (sec. 3).
> 
> Oops, yes I meant 'node in the data tree' or 'data node instance' or
> 'data tree node' (it seems we have no term for this and data node is
> indeed used for a different purpose).
> 
> > > here, we may consider posting erratas to clear things up.
> > 
> > Right, the text above could say "The schema node defined ..." but it can
> > never
> > say "an instance of a data node" because "when" can also be used for
> > "choice",
> > "case" and "augment", and then there is no conditional (parent) instance.
> 
> The first thing is to settle on what the intention of the YANG
> specification was and then we can discuss how to fix any wording
> ambiguities. It seems we do not even agree on the intention so far.

What really matters is that "when" is a part of the constraints that have to be
satisfied in all data trees (per sec. 8.1). This is why DSDL schemas (RFC 6110)
never worked exactly according to RFC 6020 (let alone 7950): in RELAX NG there
is no possibility to evaluate XPath expressions, this has to be done in
Schematron.

Moving "when" to semantic constraints (required only for a valid tree) would IMO
remove a lot of complexity at very little cost. For NMDA in particular it would
mean that "when" is only enforced in <intended>.

Lada

> 
> /js
> 
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67