mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
537 stars 344 forks source link

Definition scope of submodules in YANG 1.1 #323

Open svenefftinge opened 7 years ago

svenefftinge commented 7 years ago

RFC 7950 Section 7.2.2 states:

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.

which differs from what is stated in RFC 6020. Pyang doesn't let me use groupings defined in the module from within a submodule, as it complains with:

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

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" {
   }
}
mbj4668 commented 7 years ago

Yes, this is a known problem. As a workaround, use YANG 1 style include even in 1.1 modules.

mbj4668 commented 4 years ago

See also #194

anukulverma commented 2 years ago

Fix for this issue is available now ?