What is different of include and import?

At RFC6020, include and import is different.
However, i can’t understand the difference between the two.

Would you explain it and give me some examples?

thanks you.

Both the YANG 1.0 and 1.1 RFCs provide an include/import example.

From the YANG 1.1 RFC, the include/import example:
The included submodule:
The imported ietf-yang-types YANG module:

One clarification in addition to the YANG RFC 7950 description that may be helpful is that “include” is just a way to structure a YANG module where the submodule(s) will belong to the same namespace.

When you import, you are making definitions from another YANG module with a different namespace available for use with a prefix in front of the definition.

If your definition is defined in the same namespace but in a YANG submodule that belongs-to the YANG module that include it, a prefix is obviously not needed.

If you prefer a ConfD example, see for example:
examples.confd/linuxcfg/ietf_routing/ietf-ipv6-unicast-routing.yang that include the ietf-ipv6-router-advertisements.yang submodule.

1 Like