yanger
yanger copied to clipboard
YANG 1.1 submodules: Relax circular dependency errors.
Background
It is currently not possible to compile models for Nokia SROS using yanger. This is because they typically have multiple submodules belonging to the same module, including each other.
Reproduction
The Nokia SROS Yang models are accessible from github:
url: https://github.com/nokia/7x50_YangModels.git
checkout: sros_20.5.r1
subdir: YANG
cd YANG && yanger nokia-conf.yang
tmp-yang/config/nokia-conf-bmp.yang:12: error: circular dependency for submodule 'nokia-conf-system-security'
tmp-yang/config/nokia-conf-filter.yang:17: error: circular dependency for submodule 'nokia-conf-log'
tmp-yang/config/nokia-conf-filter.yang:19: error: circular dependency for submodule 'nokia-conf-service'
tmp-yang/config/nokia-conf-ipsec.yang:13: error: circular dependency for submodule 'nokia-conf-aaa'
tmp-yang/config/nokia-conf-ipsec.yang:15: error: circular dependency for submodule 'nokia-conf-system'
tmp-yang/config/nokia-conf-ipsec.yang:16: error: circular dependency for submodule 'nokia-conf-system-security'
tmp-yang/config/nokia-conf-isa.yang:14: error: circular dependency for submodule 'nokia-conf-aaa'
tmp-yang/config/nokia-conf-lag.yang:15: error: circular dependency for submodule 'nokia-conf-port'
tmp-yang/config/nokia-conf-lag.yang:16: error: circular dependency for submodule 'nokia-conf-service'
tmp-yang/config/nokia-conf-log.yang:13: error: circular dependency for submodule 'nokia-conf-python'
tmp-yang/config/nokia-conf-openflow.yang:65: warning: the default value for a key leaf is ignored
tmp-yang/config/nokia-conf-port-eth-access.yang:13: error: circular dependency for submodule 'nokia-conf-log'
tmp-yang/config/nokia-conf-port-eth-access.yang:14: error: circular dependency for submodule 'nokia-conf-port'
tmp-yang/config/nokia-conf-port-eth-access.yang:16: error: circular dependency for submodule 'nokia-conf-port-ethernet'
tmp-yang/config/nokia-conf-port-eth-dot1x.yang:12: error: circular dependency for submodule 'nokia-conf-aaa'
tmp-yang/config/nokia-conf-port-eth-dot1x.yang:15: error: circular dependency for submodule 'nokia-conf-system'
tmp-yang/config/nokia-conf-port-eth-network.yang:12: error: circular dependency for submodule 'nokia-conf-log'
tmp-yang/config/nokia-conf-port-ethernet.yang:17: error: circular dependency for submodule 'nokia-conf-log'
tmp-yang/config/nokia-conf-port-sonet.yang:15: error: circular dependency for submodule 'nokia-conf-log'
tmp-yang/config/nokia-conf-port-tdm.yang:14: error: circular dependency for submodule 'nokia-conf-log'
tmp-yang/config/nokia-conf-pw-port.yang:14: error: circular dependency for submodule 'nokia-conf-service'
Proposed change: YANG 1.1 submodules including each other should not cause circular dep errors, but YANG 1.0 submodules should.
Testing
Minimal version of the Nokia YANG models attached and are run as lux tests
RFC Support:
RFC6020 (YANG 1.0):
There MUST NOT be any circular chains of imports or includes. For
example, if submodule "a" includes submodule "b", "b" cannot include
"a".
RFC7950 (YANG 1.1):
o Changed the scoping rules for definitions in submodules. A
submodule can now reference all definitions in all submodules that
belong to the same module, without using the "include" statement.
o For backward compatibility with YANG version 1, a submodule is
allowed to include another submodule belonging to the same module,
but this is not in YANG version 1.1 (see Section 5.1).
o There MUST NOT be any circular chains of imports. For example, if
module "a" imports module "b", "b" cannot import "a".