mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
537 stars 344 forks source link

JSONXSL plugin needs a valid module #336

Open sidheshdivekar29 opened 7 years ago

sidheshdivekar29 commented 7 years ago

Hi, Am trying to get json from openconfig-bgp and seeing "JSONXSL plugin needs a valid module" error with "-f jsonxsl" argument. Its able to create tree without any issue.

-f tree option:= /workspace/public/release/models/bgp$ pyang -f tree openconfig-bgp.yang -p openconfig-bgp-types.yang openconfig-bgp-policy.yang openconfig-bgp-peer-group.yang openconfig-bgp-neighbor.yang openconfig-bgp-global.yang openconfig-bgp-errors.yang openconfig-bgp-common.yang openconfig-bgp-common-structure.yang openconfig-bgp-common-multiprotocol.yang openconfig-extensions.yang openconfig-routing-policy.yang openconfig-yang-types.yang openconfig-policy-types.yang openconfig-types.yang openconfig-inet-types.yang openconfig-interfaces.yang -o bgp-tree.txt

-f jsonxsl option:= ~/workspace/public/release/models/bgp$ pyang -f jsonxsl openconfig-bgp.yang -p openconfig-bgp-types.yang openconfig-bgp-policy.yang openconfig-bgp-peer-group.yang openconfig-bgp-neighbor.yang openconfig-bgp-global.yang openconfig-bgp-errors.yang openconfig-bgp-common.yang openconfig-bgp-common-structure.yang openconfig-bgp-common-multiprotocol.yang openconfig-extensions.yang openconfig-routing-policy.yang openconfig-yang-types.yang openconfig-policy-types.yang openconfig-types.yang openconfig-inet-types.yang openconfig-interfaces.yang JSONXSL plugin needs a valid module

llhotka commented 7 years ago

I cannot reproduce this problem with the latest development version pyang and openconfig modules from GitHub. The -f jsonxsl option gives the XSL stylesheet.

llhotka commented 6 years ago

Can you try to isolate the problem, i.e. try to split the data model into smaller chunks and see where the problem happens?

torokati44 commented 6 years ago

I don't know If this has anything to do with you issue, but I got the same error from jsonxml when I tried to generate an .xsl file from a .yang file, and there were some imports for which the .yang file was not found. If these were direct imports, the error message was helpful:

error: module "foo-bar" not found in search path

Once I resolved these modules (acquired the corresponding .yang files), the missing module error went away, but the JSONXSL plugin needs a valid module error, and nothing more, stayed.

Then I tried to convert one of these direct dependencies (foo-bar.yang), and then I got reports of more unresolved modules. Upon resolving those too, the .xsl generation from foo-bar.yang was successful. Doing the same for the whole import tree manually eventually resolved the error for me even for the original file.

It seems that unresolved imports are not reported if they are indirect, only if they are direct. Or maybe all error reports are suppressed that originate from processing imported modules, not just unresolved indirect imports?