Subject: [netmod] YANG include-stmt

From: Andy Bierman <[email-masked]>
Date: Thu, 19 Aug 2010 09:28:20 -0700

Hi,

I want to clarify which external symbols should be visible in a given [sub]module.

submodule foo {
   belongs-to top { prefix top; }
   include bar;
}

submodule bar {
   belongs-to top { prefix top; }

   container x;
}

submodule baz {
   belongs-to top { prefix top; }
   include foo;

   augment /x {
     leaf y { type int32; }
   }
}

yangdump is complaining that '/x' is not found.
IMO, this is correct, because submodule 'baz' does not
have an 'include bar' statement.  I think pyang is accepting
this as valid YANG.

Which is correct?
I think the YANG spec says an import or include must be present
for every external symbol used, but not sure where.

thanks,
Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 19 Aug 2010 19:17:14 +0200 (CEST)

Hi,

> have an 'include bar' statement.  I think pyang is accepting

I agree with you that baz must include bar.  pyang needs to be fixed.

> for every external symbol used, but not sure where.

Third bullet of 5.1:

   o  For a submodule to reference definitions in a second submodule of
      the same module, the first submodule MUST include the second
      submodule.

/martin

---

From: Andy Bierman <[email-masked]>
Date: Thu, 19 Aug 2010 10:25:26 -0700

>       the same module, the first submodule MUST include the second

Yes -- even though this is not what C programmers expect from #include.
I think that is why the data model author left out the 2nd include.

When include-by-revision is used, this becomes even more important.

Andy