yang 1.1 - submodule augmenting submodule
The following example appeared in #193. IMO it is valid, but pyang cannot find the node /x-b:configs:
$ cat x-base.yang
module x-base {
yang-version 1.1;
namespace "http://example.com/x-base";
prefix x-b;
include x-base2;
include x-profiles;
}
$ cat x-base2.yang
submodule x-base2 {
yang-version 1.1;
belongs-to x-base {
prefix x-b;
}
container configs {
container profiles {
}
}
}
$ cat x-profiles.yang
submodule x-profiles {
yang-version 1.1;
belongs-to x-base {
prefix x-b;
}
augment "/x-b:configs/x-b:profiles" {
list profile {
key name;
leaf name {
type string;
}
}
}
}
$ pyang x-base.yang
x-profiles.yang:6: error: node x-base::configs is not found
This error depends on the yang version? I only asking because in this example you are using yang-version 1.1 but by reading RFC6020 section-7.15 I think it should also work in yang-version 1.
No, in YANG 1.0 submodule x-profiles needs to include x-base2 in order to see its augment target
/x-b:configs/x-b:profiles
Yes you are right. In my case I was trying to augment from submodule_a a container defined in a grouping in submodule_b which grouping is then used by the main module. Rereading the augment statement definition in RFC6020 I think this is not allowed, because basically it is an augment from a submodule to its main module.
Modified the example above:
$ cat x-base.yang
module x-base {
yang-version 1;
namespace "http://example.com/x-base";
prefix x-b;
include x-base2;
include x-profiles;
container x-setting {
uses x-base2-setting;
}
}
$ cat x-base2.yang
submodule x-base2 {
yang-version 1;
belongs-to x-base {
prefix x-b;
}
grouping x-base2-setting {
container configs {
container profiles {
}
}
}
}
$ cat x-profiles.yang
submodule x-profiles {
yang-version 1;
belongs-to x-base {
prefix x-b;
}
include x-base2;
augment "/x-b:x-setting/x-b:configs/x-b:profiles" {
list profile {
key name;
leaf name {
type string;
}
}
}
}
$ pyang x-base.yang
x-profiles.yang:7: error: node x-base::x-setting is not found
Could you confirm if my interpretation is correct?
In YANG 1.0, a submodule cannot augment nodes in the main module. In 1.1 this should be OK.
Thanks for the clarification.
See also #323