Using grouping from module in submodule

Hi,

I wanted to use a grouping in a submodule that is defined in its module. At least pyang complains:

foosub.yang:6: error: grouping "mygrouping" not found in module foosub

Is it a bug in pyang or is this not allowed? I couldn’t find something in the spec.
Here is are the boiled down yang files:

module foo {
   yang-version 1.1;
   namespace "foo:bar";
   prefix x;
   include foosub;

   grouping mygrouping {
       container c12 {
       }
   }    
}

and

submodule foosub {
   yang-version 1.1;
   belongs-to foo {
       prefix "fooprefix";
   }
   uses "fooprefix:mygrouping" {
   }
}

It works if I put the grouping into the submodule and the uses statement into the module.

Thank you!

A submodule cannot use types or groupings defined in a parent module.
This is based on the RFC 6020.

Thanks for the quick response. In RFC 7950 Section 7.2.2 it says:

The mandatory “prefix” substatement assigns a prefix for the module
to which the submodule belongs. All definitions in the module that
the submodule belongs to and all its submodules can be accessed by
using the prefix.

Isn’t a grouping a definition? Could you point me to the section in the spec you are referring to?

I noticed the same section in RFC 6020 reads:

The mandatory “prefix” substatement assigns a prefix for the module
to which the submodule belongs. All definitions in the local
submodule and any included submodules can be accessed by using the
prefix.

So it seems like it should be supported in version 1.1 but not in version 1.
So I guess it is a bug in pyang. Thank you!

I believe the pyang packaged with ConfD does not support YANG 1.1 yet, but the open source version at https://github.com/mbj4668/pyang does have support for YANG 1.1, although there are some comments about possible incomplete submodule support. You may want to give that a try if you weren’t already using that. If you have an problem still with the open source version, open an issue in GitHub.

I was already working with the latest version of pyang and already filed an issue (#323).
Thanks!