Subject: [netmod] effect of include in a submodule

From: Michal Vaško <[email-masked]>
Date: Fri, 11 Dec 2015 10:22:23 +0100

Hi,
I want to make sure I understand the effect of including a submodule in another submodule (of the same belongs-to parent, naturally).

RFC 6020 sec. 7.1.6 says:

"When a module includes a submodule, it incorporates the contents of
the submodule into the node hierarchy of the module.  When a
submodule includes another submodule, the target submodule's
definitions are made available to the current submodule."

>From the first sentence I understand that include in a module has the effect of both the definitions (typedefs, indentities, ..., as defined in the bullets in the sec. 7.1.5) and the data (containers, lists, and the rest) being part of the module. This means one can refer in the module to both the definitions and the data from the submodule without using any prefix or the prefix of the module. From the second sentence I gather that including a submodule2 in submodule1 makes only the definitions from submodule2 available in submodule1 and they can be referred to without any prefix or the belongs-to prefix from submodule1. My understanding of the second sentence is supported by the first sentence of the sec. 7.1.5:

"The "import" statement makes definitions from one module available
inside another module or submodule."

With import you make only the definitions available and the import prefix must be specified to use them.

My actual question then is, does the effect of include in a submodule differ from the effect of include in a module? Is it actually an import (but you cannot import a submodule) in the former, while a C-style #include in the latter? Thank you.

Regards,
Michal Vasko

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 11 Dec 2015 10:50:49 +0100

Hi Michal,

submodule stuff was considerably simplified in draft-ietf-netmod-rfc6020bis, I think it would be better to use the new logic everywhere. Essentially, in YANG 1.1 includes are only effective in the main module, and the result is the same as if the submodule definition were placed in the main module, so they can be used in the main module and all submodules without further includes.

Lada

> On 11 Dec 2015, at 10:22, Michal Vaško <[email-masked]> wrote:
> 
> Hi,
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C