Each yang module needs to have an unique namespace. After the yang files be compiled and load in confd, I found each node defined in yang schema will have its own namespace which can be different from the namespace defined in yang file if the keyword “grouping” and “uses” be used.
Assuming I have two modules
module b
{
namespace : http://ns/b
grouping g-b {
container b
}
}
module a
{
namespace : http://ns/a
prefix: prefix-a;
uses g-b;
container a1;
}
module c
{
namespace :http://ns/c
augment prefix-a:a1
{
uses g-b;
}
}
Durning running time:
- “container b” directly under module a will have the namespace “http://ns/a”
- “container b” inside the container “prefix-a:a1” will have the namespace “http://ns/c”
So my conclusion is
The nodes namespace depend on where the nodes be instantiated.
Case 1: “container b” is instantiated in module a using keyword “uses”. So it has the namespace “http://ns/a”
Case 2: “container b” is instantiated in module c using keyword “augment” and “uses”. So it has the namespace “http://ns/c”.
I can’t find the reference which explain how the namespace be determined during running time. I wonder whether my conclusion is correct? Any other exception ?
Thanks in advance!