On Thu, Mar 23, 2017 at 08:50:48PM -0400, Dale R. Worley wrote: > Martin Bjorklund <[email protected]> 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.
But this is an assumption and it is not generally true. [...] > 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. There may be cases where this may appear useful but I see also cases where people will get largely suprised by the result if such wildcard augmentations would be possible. > > 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. I wrote 'name in the data tree' and I meant 'name in the schema tree' (sorry). Augments apply to something that has a name in the schema tree, groupings do not have that. The "grouping" statement is not a data definition statement and, as such, does not define any nodes in the schema tree. > 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. Yes. > 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. Yes. This is how things were defined. /js -- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany Fax: +49 421 200 3103 <http://www.jacobs-university.de/> _______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
