I have seen the debate on the use of prefixes in YANG models, specially as it 
relates to their use when importing a model. I think it would nice to be clear 
on what is required, what is nice, and what is not ok to do. I do not want to 
confuse this discussion with the length of the prefix, which I believe is 
somewhat related but not the same discussion.

RFC 7950 says:

   All prefixes, including the prefix for the module itself, MUST be
   unique within the module or submodule.

This is a requirement, as is clear by the MUST.

Then RFC 7950 says:

   To
   improve readability of YANG modules, the prefix defined by a module
   SHOULD be used when the module is imported, unless there is a
   conflict.

It also says:

   When used inside the "import" statement, the "prefix" statement
   defines the prefix to be used when accessing definitions inside the
   imported module.

Clearly, the scope of the “prefix" statement used with an “import” statement is 
limited to the module where it is imported and does not impact the imported 
module. As such, and because it is a SHOULD and not a MUST, this is a “nice to 
have”  without conflicts, but one would not be wrong using a different prefix 
from the one defined in the imported module. Add to this, most tools, e.g. 
pyang or yanglint do not complain if you do define a different prefix when 
there are no conflicts. I have not seen a problem in the implementation of the 
module when the prefix is different.

RFC 8407 confuses this whole situation by saying:

      The proper module prefix MUST be used for all identifiers imported
      from other modules.

which as written is true for identifiers (but not for other types of 
imports??). Besides, it does not define what is “proper module prefix". In the 
absence of a proper definition, one should follow what RFC 7950 says.

Comments?

Mahesh Jethanandani
[email protected]





_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to