Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get a (*yang.Entry).Dir if the module just augments another module? #143

Open
hellt opened this issue Sep 8, 2020 · 3 comments
Open

Comments

@hellt
Copy link
Contributor

hellt commented Sep 8, 2020

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?

@hellt hellt changed the title how to get a (*yang.Entry).Dir if the module augments another module? how to get a (*yang.Entry).Dir if the module just augments another module? Sep 8, 2020
@hellt
Copy link
Contributor Author

hellt commented Sep 11, 2020

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

@wenovus
Copy link
Collaborator

wenovus commented Sep 14, 2020

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.

@hellt
Copy link
Contributor Author

hellt commented Sep 15, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants