Re: [netmod] uses and augment

Martin Bjorklund <mbj@tail-f.com> Wed, 22 March 2017 20:24 UTC

Return-Path: <mbj@tail-f.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 B1C8312894A for <netmod@ietfa.amsl.com>; Wed, 22 Mar 2017 13:24:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.902
X-Spam-Level:
X-Spam-Status: No, score=-1.902 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.001, SPF_PASS=-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 FIAyVXIP76HW for <netmod@ietfa.amsl.com>; Wed, 22 Mar 2017 13:24:12 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 81848128BB6 for <netmod@ietf.org>; Wed, 22 Mar 2017 13:24:12 -0700 (PDT)
Received: from localhost (h-148-188.a165.priv.bahnhof.se [176.10.148.188]) by mail.tail-f.com (Postfix) with ESMTPSA id 92F231AE05F8; Wed, 22 Mar 2017 21:24:11 +0100 (CET)
Date: Wed, 22 Mar 2017 21:24:11 +0100
Message-Id: <20170322.212411.1191940569571241434.mbj@tail-f.com>
To: worley@ariadne.com
Cc: netmod@ietf.org
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <87shm5rwuq.fsf@hobgoblin.ariadne.com>
References: <87shm5rwuq.fsf@hobgoblin.ariadne.com>
X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/O1FzfP4fhPsbWX6vWxt1dX67sjA>
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: Wed, 22 Mar 2017 20:24:16 -0000

worley@ariadne.com (Dale R. Worley) wrote:
> I've got a couple of questions about the interaction of "uses" and
> "augment".  I hope that these have straightforward answers that the old
> hands can tell me easily enough.
> 
> 1. Augmenting a grouping
> 
> 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.

[...]

> 2.  "augment" as a substatement of "uses"
> 
> In section 7.17:
> 
>    The "augment" statement allows a module or submodule ...  to add to
>    the nodes from a grouping in a "uses" statement.
> 
> When I first read this, I took it to mean that an "augment" substatement
> adds a peer node to the set of nodes 'from a grouping in a "uses"
> statement'.  But I suspect that it is intended to mean that an "augment"
> only adds nodes *under* one of the nodes from the grouping.  There's an
> ambiguity that could be fixed by better wording.

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

> 7.17 also says:
> 
>    If the "augment" statement is a substatement to the
>    "uses" statement, the descendant form (defined by the rule
>    "descendant-schema-nodeid" in Section 14) MUST be used.
> 
> My understanding is that "descendant-schema-nodeid" is an XPath
> expression, and that the "context node" for its evaluation is the node
> to which the "uses" statement adds nodes -- but that doesn't seem to be
> stated anywhere.

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


/martin



> (Those last two I should have caught in my Gen-ART review!)
> 
> Thanks for any information,
> 
> Dale
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>