ConfD User Community

Will the yang file with "uses" be imported to create the used grouping instance?


#1

If in my a.yang, I have following

 module a {
 grouping a-config
 {
 ...
 }
 uses a-config;
 }

In b.yang
module b {

import a
{
  prefix a;
}


}
In this case, I only imported a.yang to b.yang. But I didn’t do anything else. Will a “a-config” instance be created inside module b ? (my understanding is no)

In other way, If a is a submodule of b and inside b,

include a;

Will a-config instance be created ? (my understanding is yes)

Thanks in advance.


#2

Yes, your understanding is correct. I think this is clear from the definitions of the two statements (RFC 7950):

  • The “import” statement makes definitions from one module available inside another module or submodule. (7.1.5)
  • The “include” statement is used to make content from a submodule available to that submodule’s parent module. (7.1.6)

So import makes the modules definitions available for references from the importing module, include “incorporates the contents of the submodule into the node hierarchy of the module” (as is written further in the RFC).


#3

Ok, I saw the difference : “makes definitions” vs “make content”.
Thank you for confirmation!