Re: [netmod] uses and augment

worley@ariadne.com (Dale R. Worley) Fri, 24 March 2017 00:50 UTC

Return-Path: <worley@alum.mit.edu>
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 0DFD1129B10 for <netmod@ietfa.amsl.com>; Thu, 23 Mar 2017 17:50:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.934
X-Spam-Level:
X-Spam-Status: No, score=-1.934 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_SOFTFAIL=0.665] autolearn=no 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 0D1KQeeXkmJz for <netmod@ietfa.amsl.com>; Thu, 23 Mar 2017 17:50:51 -0700 (PDT)
Received: from resqmta-ch2-09v.sys.comcast.net (resqmta-ch2-09v.sys.comcast.net [IPv6:2001:558:fe21:29:69:252:207:41]) (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 82453124B0A for <netmod@ietf.org>; Thu, 23 Mar 2017 17:50:51 -0700 (PDT)
Received: from resomta-ch2-09v.sys.comcast.net ([69.252.207.105]) by resqmta-ch2-09v.sys.comcast.net with SMTP id rDQwcHyt6Qe9crDRKcp01D; Fri, 24 Mar 2017 00:50:50 +0000
Received: from hobgoblin.ariadne.com ([24.60.114.4]) by resomta-ch2-09v.sys.comcast.net with SMTP id rDRJc07ymjCS0rDRKcDFaF; Fri, 24 Mar 2017 00:50:50 +0000
Received: from hobgoblin.ariadne.com (hobgoblin.ariadne.com [127.0.0.1]) by hobgoblin.ariadne.com (8.14.7/8.14.7) with ESMTP id v2O0omFQ003369 for <netmod@ietf.org>; Thu, 23 Mar 2017 20:50:48 -0400
Received: (from worley@localhost) by hobgoblin.ariadne.com (8.14.7/8.14.7/Submit) id v2O0omCi003366; Thu, 23 Mar 2017 20:50:48 -0400
X-Authentication-Warning: hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f
From: worley@ariadne.com
To: netmod@ietf.org
In-Reply-To: <20170322.212411.1191940569571241434.mbj@tail-f.com>
Sender: worley@ariadne.com
Date: Thu, 23 Mar 2017 20:50:48 -0400
Message-ID: <87y3vvpkev.fsf@hobgoblin.ariadne.com>
X-CMAE-Envelope: MS4wfMgZ9arm099Yizk5yNZQyVPrIGdgOGi+NpqCJ52L0gud3XK98nC1dFFNxYMgaHR4bSCLjzTaUAyabyS79wcgdf+J/gOsDx74oUd+LuDtgga6x+vjEMFD lNBwRY00cX6xiJcRiXeqpYAZ+twGAI0/GjMIpKxZpVE9PA9cl5AdDMce
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/gvTxEmOtpmsJIPmTJ85hbONQXfc>
Subject: Re: [netmod] uses and augment
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: Fri, 24 Mar 2017 00:50:53 -0000

Martin Bjorklund <mbj@tail-f.com> writes:
>> I notice that "augment" is not allowed to target a "grouping", despite
>> that naively seems to be an operation that a module designer might like
>> to do.  I expect that there is a reason why this is not allowed.
>
> There were lots of debate over this one when we first designed YANG.
> The main reason for not allowing this is that it can easily have
> unintended consequences.  Module A uses a grouping G b/c it fits the
> purpose.  Later someone augments G with some nodes; at this point it
> is not at all clear that the additional nodes are suitable for module
> A.

True...  But assuming that the grouping G has clean semantics, it
corresponds to some facility in the device, which in some way or another
appears in multiple places in the device's data model.  And a module
that augments G adds semantics about that facility, and would only be
implemented by a device for which the facility uniformly has that
additional semantics.  So it would be suitable for every place where the
grouping is used.

It seems like this consideration applies to the "Yang mount" facility
also -- if a module A augments another module B, and module B is mounted
in several places in the full data model, then all the instances of
module B will be augmented.

> Ok.  Well, if you want to add a sibling node to the nodes in the
> grouping it is trivial:
>
>   grouping foo {
>     leaf a { ... }
>   }
>
>   uses foo;
>   leaf b { ... }
>
> gives you:
>
>    leaf a { ... }
>    leaf b { ... }

Of course, that works.  But what I'm considering is a modification of
the grouping which implicitly applies to all "uses" of that grouping --
because you don't want to have duplicate declarations of the added nodes
in every place the grouping is used.

> Well, the syntax of descendant-schema-nodeid looks like an XPath path
> expression in abbreviated form, but it is not defined in terms of
> XPath, hence there is no text about any XPath context.  See also
> section 6.5

OK, "context node" isn't the right term, but the idea still applies --
if the schema node identifier is descendant, the starting point for
reckoning the descending path has to be specified.

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> writes:
> On Wed, Mar 22, 2017 at 02:26:53PM -0400, Dale R. Worley wrote:
> This is not at all clear. You only import 'foo' - so why would the
> augment of /foo:target (which is not exactly defined either) done in
> 'bar' apply to uses foo:target in baz?

I'd say because that's what one would expect "augmenting" of a grouping
to mean.  Again, it looks like there will be similar behavior in "Yang
mount".

> Augments are restricted to things that have a well defined name in the
> data tree because this makes it clear what is being augmented. One
> would have to create additional language constructs to make
> augmentations of groupings work.

It's clear that *groupings* have well-defined names, because "uses"
statements can refer to them.  RFC 7950 section 7.13 isn't particularly
clear about how the argument string of the statement is to be
interpreted, but going back over 7950, I'm getting the idea that the
names of groupings are not descendant-schema-nodeid's, that is, named
based on where the grouping statement sits in the syntactic hierarchy,
but are in a separate namespace which is flat regarding equality and
inequality comparisons, but has elaborate scoping rules regarding which
groupings are visible in which locations.

OK, that clarifies why you can't apply "augment" to a grouping --
groupings (and thus the things defined within them) don't have names
that can be expressed by descendant-schema-nodeid's.

Dale