Subject: [netmod] Include question: reference to stuff in the main module

From: Balazs Lengyel <[email-masked]>
Date: Wed, 27 Aug 2008 17:48:30 +0200

Hello,
I wanted to do the following:

module mymod {
   namespace "xxx";
   prefix "model";

   include submodFragment;

   container root {
     uses submodGrouping;
     list mainList {
         key mainId;
         leaf mainId {type string;}
     }
   }
  }

------------------------------------------

submodule submodFragment {
   belongs-to mymod;

   grouping submodGrouping {
     leaf ref2 {
         type keyref {
             path /root/mainList/mainId;
         }
     }
   }
}

This seems to me a perfectly good design pattern:
A main module containing the root and submodules each adding their own stuff.
However this does not work as the submodule does not see /root in the module.
So I had to put the root in a separate root submodule just to be able to include it. This works 
however I have an unneeded extra submodule just to handle the strange behavior of YANG.

Is there a way to make stuff in the module visible in the submodule

Balazs?
_______________________________________________
netmod mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/netmod

---

From: Andy Bierman <[email-masked]>
Date: Wed, 27 Aug 2008 12:05:10 -0700

> I wanted to do the following:

The whole NETMOD architecture is bit fuzzy to me.
We seem to keep backing into an architecture,
as decisions on the details proceed.

You can just define 'root' once, in a root.yang
sub-module, and include it in each fragment sub-module,
but IMO this is not redundant.  In each sub-module,
you state precisely which definitions are visible in
that sub-module (just like a module w/ imports).

IMO, module/sub-module usage is OK the way it is,
where each sub-module can only look down or across
the tree, but not up.

Andy

---

From: Balazs Lengyel <[email-masked]>
Date: Thu, 28 Aug 2008 10:14:35 +0200

Hello,
I am not happy with this situation. I think I would be more happy if everything inside a module 
(including submodules) would just be a flat space, where everyone can see everything.

In some ways we already have that. E.g. While you can not see the root container from 
submodFragment you still can not define another container called root in the submodule. So root 
in the module is mostly invisible.
Balazs

Andy Bierman wrote:
>> So I had to put the root in a separate root submodule just to be able 
>> to include it. This works however I have an unneeded extra submodule 
>> just to handle the strange behavior of YANG.
>>

-- 
Balazs Lengyel                       Ericsson Hungary Ltd.
TSP System Manager
ECN: 831 7320                        Fax: +36 1 4377792
Tel: +36-1-437-7320     email: [email-masked]
_______________________________________________
netmod mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/netmod

---

From: Balazs Lengyel <[email-masked]>
Date: Fri, 29 Aug 2008 11:00:41 +0200

Hello,
What is the reason why a submodule can not see the contents of the containing module? Is it 
just that our current include/import mechanisms don't handle this or is there some deeper 
reason behind it?
Balazs
_______________________________________________
netmod mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/netmod

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 29 Aug 2008 11:07:39 +0200 (CEST)

Balazs Lengyel <[email-masked]> wrote:
> Hello,
>
> What is the reason why a submodule can not see the contents of the
> containing module? Is it just that our current include/import
> mechanisms don't handle this or is there some deeper reason behind
> it?

All definitions you refer to must be resolvable by the compiler (and
reader).  The definitions are made availble by import/include.

/martin