Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YANGJSON tool running error: cannot find certain module while it indeedly exists #219

Open
XingZhao-CATR opened this issue Mar 29, 2017 · 0 comments
Labels
bug YangOpenApiTool Generates OpenAPI Spec (JSON) from UML XMI model files

Comments

@XingZhao-CATR
Copy link
Contributor

XingZhao-CATR commented Mar 29, 2017

When I try to generate JSON file from Tapi yang file, pyang -swagger tool reports the following errors:

pyang -f swagger -o D:/YANG0329/tapi-topology.json D:/YANG0329/TapiTopology.yang
D:/YANG0329/TapiTopology.yang:4: error: module "Tapi" not found in search path
D:/YANG0329/TapiTopology.yang:593 (at D:/YANG0329/TapiTopology.yang:32): error: the key "localId" does not reference an existing leaf
D:/YANG0329/TapiTopology.yang:593 (at D:/YANG0329/TapiTopology.yang:104): error: th e key "uuid" does not reference an existing leaf
D:/YANG0329/TapiTopology.yang:593 (at D:/YANG0329/TapiTopology.yang:160): error: th e key "uuid" does not reference an existing leaf
D:/YANG0329/TapiTopology.yang:593 (at D:/YANG0329/TapiTopology.yang:166): error: th e key "uuid" does not reference an existing leaf
D:/YANG0329/TapiTopology.yang:593 (at D:/YANG0329/TapiTopology.yang:226): error: th e key "localId" does not reference an existing leaf
Traceback (most recent call last):
File "/usr/bin/pyang", line 4, in
import('pkg_resources').run_script('pyang==1.7', 'pyang')
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 729, in r un_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 1642, in run_script
exec(code, namespace, namespace)
File "/usr/lib/python2.7/site-packages/pyang-1.7-py2.7.egg/EGG-INFO/scripts/pyang ", line 434, in
run()
File "/usr/lib/python2.7/site-packages/pyang-1.7-py2.7.egg/EGG-INFO/scripts/pyang ", line 408, in run
emit_obj.emit(ctx, modules, fd)
File "/usr/lib/python2.7/site-packages/pyang-1.7-py2.7.egg/pyang/plugins/swagger. py", line 98, in emit
emit_swagger_spec(ctx, modules, fd, ctx.opts.path)
File "/usr/lib/python2.7/site-packages/pyang-1.7-py2.7.egg/pyang/plugins/swagger. py", line 142, in emit_swagger_spec
referenced_types = findTypedefs(ctx, module, models, referenced_types)
File "/usr/lib/python2.7/site-packages/pyang-1.7-py2.7.egg/pyang/plugins/swagger. py", line 292, in findTypedefs
findTypedefs(ctx, module, child.i_children, referenced_types)
File "/usr/lib/python2.7/site-packages/pyang-1.7-py2.7.egg/pyang/plugins/swagger. py", line 292, in findTypedefs
findTypedefs(ctx, module, child.i_children, referenced_types)
File "/usr/lib/python2.7/site-packages/pyang-1.7-py2.7.egg/pyang/plugins/swagger. py", line 282, in findTypedefs
models = [type for type in subm.i_typedefs.values() if str(type.arg) == str(att ribute.arg.split(':')[-1]) and type.arg not in [element.arg for element in referenc ed_types]]
AttributeError: 'NoneType' object has no attribute 'i_typedefs'

Please help find the reason, thanks. And the weird thing is the tool says the following error:

D:/YANG0329/TapiTopology.yang:4: error: module "Tapi" not found in search path

While Tapi indeedly exists in the path as shown in the left figure. Tapi.yang is transformed successfully but the other yang files are all failed.
snipaste20170329_103858

@XingZhao-CATR XingZhao-CATR added bug YangOpenApiTool Generates OpenAPI Spec (JSON) from UML XMI model files labels Mar 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug YangOpenApiTool Generates OpenAPI Spec (JSON) from UML XMI model files
Projects
None yet
Development

No branches or pull requests

1 participant