goyang
goyang copied to clipboard
how to get a (*yang.Entry).Dir if the module just augments another module?
Hi *, I have problems understanding how one can get a directory structure of a module which augments another one.
Consider a module like that
module test {
namespace "test";
prefix test;
import conf {
prefix c;
revision-date 2019-01-01;
}
augment /c:configuration {
uses mygroup;
}
grouping mygroup {
container main {
// contents
}
This module solely augments /c:configuration
by using a grouping defined inside of it.
The issue I experience is that when I do e := yang.ToEntry(ms.Modules[mn])
for that module, the *yang.Entry
structure has an empty Dir
field.
The question is: how to get the directory of such modules?
Maybe someone knows which direction should I dig? So far I resorted to pyang to extract paths, but that would be awesome if the same modules could be handled by goyang
It looks like the reason is because once augments are applied, they are removed from Entry.Augments
during Modules.Process
. This doesn't seem to be the right thing to do.
Would having the entries accessible under Entry.Augments
be sufficient for your needs? Entry.Dir
is only populated if there is actually data residing in the module, instead of just being declared within an augment or grouping statement.
@wenovus I saw the same, the Augments field gets emptied on a successful augmentation processing.
Having Entry.Augments
to be walkable in a way that Dir is would help.
On the other hand I will check if the module X that module Y augments starts to contain the Dir structure under the paths that were augmented.