corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

Question on submodule belongs-to #58

Closed sindhukothe closed 7 years ago

sindhukothe commented 7 years ago

I am trying to compile openconfig-bgp.yang. https://github.com/openconfig/public/blob/master/release/models/bgp/openconfig-bgp.yang This has two submodules https://github.com/openconfig/public/blob/master/release/models/bgp/openconfig-bgp-common.yang and https://github.com/openconfig/public/blob/master/release/models/bgp/openconfig-bgp-common-multiprotocol.yang both of them "belongs-to" the same module "oc-bgp"

Now, openconfig-bgp-common-multiprotocol.yang includes openconfig-bgp-common.yang As per the spec, this seems to be valid. Section 7.2.2 specifies: A submodule MUST only be included by the module to which it belongs, or by another submodule that belongs to that module.

But the parser throws an error here: ExpressionError: [module(openconfig-bgp)/include(openconfig-bgp-common)/submodule(openconfig-bgp-common)] requested submodule 'openconfig-bgp-common' not belongs-to 'openconfig-bgp-common-multiprotocol'

Please let me know if I am doing something wrong here.

sekur commented 7 years ago

I think you're right. We should allow the submodule to include the other submodule since they both belongs-to the same module.

sekur commented 7 years ago

@sindhukothe - I've commited a fix to this in the develop branch. Please give it a try and let me know if this addresses your issue.

sindhukothe commented 7 years ago

This seems to be fixed. Thank you for your quick support.