Suppose I have two modules, I would like to extend one list with new leafs.
module A {
list deviceList {
key name;
leaf name{
}
leaf hostname{
}
}
}
and I would like to augment it to another leaf
module B {
list generalInfo{
key customerName;
leaf customerName{
type string;
}
augment moduleA:deviceList {
leaf ipAddress{
}
}
}
I have done it using grouping and container and list inside but this completely changes our existing structure, I would like to ommit container and grouping if thats possible.
It seems that you want to reuse a part of the schema definition, put it in another place in the schema tree and add a node to it.
You cannot do it the way you tried because the
augment
statement can appear only on the root level or in theuses
statement.You can do that only with a
grouping
but you can omit thecontainer
. Refactor A: define agrouping
that's alist
. Refer to it in B and augment it.Note that if you use the
augment
statement in the module B then it means that any device implementing module B has to also implement module A and its root-levellist deviceList
. See RFC 7950 4.2.8:I am not sure if this is what you want. If not, then move the grouping definition to a module that contains only grouping definitions (without any "data definition statements") and import it from both A and B.