Reputation: 81
The first module contains this:
module a
{
namespace "my:namespace";
prefix a;
grouping mygrouping
{
container firstcontainer {
list modules {
leaf firstmodule;
leaf secondmodule;
}
}
}
}
Now I want to augment it in the second module as follows:
module b
{
namespace "my:namespace";
prefix a;
import b {
prefix b;
}
augment "/b:mygrouping/b:firstcontainer/b:modules"{
leaf thirdmodule;
}
}
This does not work, apparently because a grouping cannot be augmented. But there must be a way, since what I really want to extend is the list, not the grouping itself.
Is there another way to have the intended result using another way ?
Upvotes: 1
Views: 2108
Reputation: 663
https://datatracker.ietf.org/doc/html/rfc7950#section-7.12
7.13. The "uses" Statement
The **"uses" statement is used to reference a "grouping" definition**.
It takes one argument, which is the name of the grouping.
The **effect of a "uses" reference to a grouping is that the nodes
defined by the grouping are copied into the current schema tree and
are then updated according to the "refine" and "augment" statements**.
The identifiers defined in the grouping are not bound to a namespace
until the contents of the grouping are added to the schema tree via a
"uses" statement that does not appear inside a "grouping" statement,
at which point they are bound to the namespace of the current module.
Upvotes: 0
Reputation: 176
Augmenting a grouping is only possible when 'using' that grouping.
For example:
uses a:mygrouping {
augment firstcontainer/modules {
leaf thirdmodule {...}
}
}
So this would need to be done every time the grouping is 'used'. YANG doesn't provide a way to augment a grouping abstractly, you can only do it on a per 'uses' basis.
Upvotes: 3