cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
615
Views
0
Helpful
3
Replies

“Illegal path” when creating bundle model containing grouping with enumeration

Fabio N.
Level 1
Level 1

Hi all,

I was trying to create bundle models from other vendor yang models and realize that with enumeration inside groupings was falling to create the bundles.
So I created I simpler model to test the same case and I still receive “Illegal path” from ydk-gen.
I used pyang and yangvalidator to check the model, and they don’t report errors in this model.
Can anyone help me find out what is this issue?

 

(update) bash-3.2$ cat profiles/bundles/yang/vendor/device.yang
module device {
namespace "urn:vendor.com:mgmt:device";
prefix device;

organization "Test, Inc.";
contact
"test@test.com";
description
"Test Module";

revision 2020-05-22 {
description
"Module created";
reference "ver1.0";
}

grouping interface-speed {
leaf speed {
type enumeration {
enum "1000";
}
description "1Gbps.";
}
description "Interface speed.";
}
container interface {
description
"Configure an interface";
uses interface-speed;
}
}
(update) bash-3.2$
(update) bash-3.2$ cat profiles/bundles/vendor-x-1.0.0.json
{
"name": "vendor",
"version": "1.0.0",
"core_version": "0.7.4",
"author": "Author",
"copyright": "Author",
"description": "Test models for vendor",
"long_description": "test bundle",
"models": {
"description": "test",
"file":[
"profiles/bundles/yang/vendor/device.yang"
]
}
}
(update) bash-3.2$
(update) bash-3.2$ pyang profiles/bundles/yang/vendor/device.yang
(update) bash-3.2$
(update) bash-3.2$ ./generate.py --python --bundle profiles/bundles/vendor-x-1.0.0.json -v
YDKGEN_HOME not set. Assuming current directory is working directory.
Resolving file tmp5lnj4xz4.bundle --> /Users/admin/workspace/update/ydk-gen/gen-api/.cache/bundles
Resolving file device.yang --> /Users/admin/workspace/update/ydk-gen/gen-api/.cache/models/vendor@1.0.0
Parsing file /Users/admin/workspace/update/ydk-gen/gen-api/.cache/models/vendor@1.0.0/device.yang. Module name: device. Revision: None
Copying /Users/admin/workspace/update/ydk-gen/sdk/python/packages to /Users/admin/workspace/update/ydk-gen/gen-api/python/vendor-bundle

Created models archive: /Users/admin/workspace/update/ydk-gen/gen-api/python/vendor-bundle/vendor@1.0.0.tar.gz
Processing 1 of 1 /Users/admin/workspace/update/ydk-gen/gen-api/.cache/models/vendor@1.0.0/device.yang
<pyang.types.EnumTypeSpec object at 0x1048ebdd0>
Traceback (most recent call last):
File "./generate.py", line 492, in <module>
output_directory = (generator.generate(options.bundle))
File "/Users/admin/workspace/update/ydk-gen/ydkgen/__init__.py", line 93, in generate
return self._generate_bundle(description_file)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/__init__.py", line 142, in _generate_bundle
generated_files = self._print_packages(packages, gen_api_root, curr_bundle)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/__init__.py", line 223, in _print_packages
generated_files = ydk_printer.emit(bundle_packages, classes_per_source_file)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/language_bindings_printer.py", line 64, in emit
return self.print_files()
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/python_bindings_printer.py", line 56, in print_files
self._print_modules()
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/python_bindings_printer.py", line 76, in _print_modules
self._print_module(index, package, size)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/python_bindings_printer.py", line 104, in _print_module
self._print_python_module(package, index, self.models_dir, size, sub)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/python_bindings_printer.py", line 160, in _print_python_module
_EmitArgs(self.ypy_ctx, package, extra_args))
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/language_bindings_printer.py", line 97, in print_file
emit_func(emit_args.ctx, emit_args.package, emit_args.extra_args)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/python_bindings_printer.py", line 281, in emit_module
ModulePrinter(ctx, extra_args).print_output(package)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/file_printer.py", line 64, in print_output
self.print_body(packages)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/module_printer.py", line 61, in print_body
self._print_module_classes(package)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/module_printer.py", line 125, in _print_module_classes
[clazz for clazz in package.owned_elements if isinstance(clazz, Class)])
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/file_printer.py", line 64, in print_output
self.print_body(packages)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/class_printer.py", line 49, in print_body
self._print_class(clazz)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/class_printer.py", line 52, in _print_class
self._print_class_header(clazz)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/class_printer.py", line 58, in _print_class_header
self._print_class_docstring(clazz)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/class_printer.py", line 115, in _print_class_docstring
ClassDocstringPrinter(self.ctx).print_output(clazz)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/class_docstring_printer.py", line 46, in print_output
self._print_class_docstring_text(clazz)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/python/class_docstring_printer.py", line 53, in _print_class_docstring_text
class_docstring = get_class_docstring(clazz, 'py')
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/meta_data_util.py", line 90, in get_class_docstring
identity_subclasses=id_subclasses)
File "/Users/admin/workspace/update/ydk-gen/ydkgen/printer/meta_data_util.py", line 410, in get_meta_info_data
raise EmitError('Illegal path')
pyang.error.EmitError: Illegal path
(update) bash-3.2$

 

(update) bash-3.2$ pip list
Package Version
----------------------------- -----------
alabaster 0.7.12
Babel 2.8.0
certifi 2020.4.5.1
chardet 3.0.4
docutils 0.16
gitdb 4.0.5
GitPython 3.1.2
idna 2.9
imagesize 1.2.0
Jinja2 2.11.2
lxml 4.5.1
MarkupSafe 1.1.1
packaging 20.4
pip 20.0.2
pyang 2.2.1
pybind11 2.5.0
Pygments 2.6.1
pyparsing 2.4.7
pytz 2020.1
requests 2.23.0
rstr 2.2.6
setuptools 45.2.0
six 1.15.0
smmap 3.0.4
snowballstemmer 2.0.0
Sphinx 3.0.3
sphinx-rtd-theme 0.4.3
sphinxcontrib-applehelp 1.0.2
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 1.0.3
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.4
urllib3 1.25.9
wheel 0.34.2
ydk 0.8.4
ydk-models-cisco-ios-xr 6.6.3
ydk-models-ietf 0.1.5.post2
ydk-models-openconfig 0.1.8
(update) bash-3.2$

1 Accepted Solution

Accepted Solutions

Hi Fabio

The root cause of the issue is that you use pyang version 2.2.1, but YDK is built around version 1.6, which is one of the requirements. In order to install correct python environment:

cd ydk-gen
# enable virtual environment if applicable
[sudo] pip install -r requirements.txt

 

Yan Gorelik
YDK Solutions

View solution in original post

3 Replies 3

yangorelik
Spotlight
Spotlight

Hi Fabio

Unfortunately I could not reproduce your issue.

(venv) Yakovs-Air:ydk-gen ygorelik$ ./generate.py --python --bu scripts/profile/vendor-x.json -v
YDKGEN_HOME not set. Assuming current directory is working directory.
Resolving file tmp127xznhs.bundle --> /Users/ygorelik/ydk-gen/gen-api/.cache/bundles
Resolving file device.yang --> /Users/ygorelik/ydk-gen/gen-api/.cache/models/vendor@1.0.0
Parsing file /Users/ygorelik/ydk-gen/gen-api/.cache/models/vendor@1.0.0/device.yang. Module name: device. Revision: None
Copying /Users/ygorelik/ydk-gen/sdk/python/packages to /Users/ygorelik/ydk-gen/gen-api/python/vendor-bundle

Created models archive: /Users/ygorelik/ydk-gen/gen-api/python/vendor-bundle/vendor@1.0.0.tar.gz
Processing 1 of 1 /Users/ygorelik/ydk-gen/gen-api/.cache/models/vendor@1.0.0/device.yang
    Printing python module /Users/ygorelik/ydk-gen/gen-api/python/vendor-bundle/ydk/models/vendor/device.py

running sdist
running egg_info
creating ydk_models_vendor.egg-info
writing ydk_models_vendor.egg-info/PKG-INFO
writing dependency_links to ydk_models_vendor.egg-info/dependency_links.txt
writing namespace_packages to ydk_models_vendor.egg-info/namespace_packages.txt
writing requirements to ydk_models_vendor.egg-info/requires.txt
writing top-level names to ydk_models_vendor.egg-info/top_level.txt
writing manifest file 'ydk_models_vendor.egg-info/SOURCES.txt'
reading manifest file 'ydk_models_vendor.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'ydk_models_vendor.egg-info/SOURCES.txt'
running check
creating ydk-models-vendor-1.0.0
creating ydk-models-vendor-1.0.0/ydk
creating ydk-models-vendor-1.0.0/ydk/models
creating ydk-models-vendor-1.0.0/ydk/models/vendor
creating ydk-models-vendor-1.0.0/ydk/models/vendor/_yang
creating ydk-models-vendor-1.0.0/ydk_models_vendor.egg-info
copying files to ydk-models-vendor-1.0.0...
copying MANIFEST.in -> ydk-models-vendor-1.0.0
copying README.md -> ydk-models-vendor-1.0.0
copying setup.cfg -> ydk-models-vendor-1.0.0
copying setup.py -> ydk-models-vendor-1.0.0
copying ydk/__init__.py -> ydk-models-vendor-1.0.0/ydk
copying ydk/models/__init__.py -> ydk-models-vendor-1.0.0/ydk/models
copying ydk/models/vendor/__init__.py -> ydk-models-vendor-1.0.0/ydk/models/vendor
copying ydk/models/vendor/_yang_ns.py -> ydk-models-vendor-1.0.0/ydk/models/vendor
copying ydk/models/vendor/device.py -> ydk-models-vendor-1.0.0/ydk/models/vendor
copying ydk/models/vendor/_yang/device.yang -> ydk-models-vendor-1.0.0/ydk/models/vendor/_yang
copying ydk_models_vendor.egg-info/PKG-INFO -> ydk-models-vendor-1.0.0/ydk_models_vendor.egg-info
copying ydk_models_vendor.egg-info/SOURCES.txt -> ydk-models-vendor-1.0.0/ydk_models_vendor.egg-info
copying ydk_models_vendor.egg-info/dependency_links.txt -> ydk-models-vendor-1.0.0/ydk_models_vendor.egg-info
copying ydk_models_vendor.egg-info/namespace_packages.txt -> ydk-models-vendor-1.0.0/ydk_models_vendor.egg-info
copying ydk_models_vendor.egg-info/requires.txt -> ydk-models-vendor-1.0.0/ydk_models_vendor.egg-info
copying ydk_models_vendor.egg-info/top_level.txt -> ydk-models-vendor-1.0.0/ydk_models_vendor.egg-info
Writing ydk-models-vendor-1.0.0/setup.cfg
creating dist
Creating tar archive
removing 'ydk-models-vendor-1.0.0' (and everything under it)

Successfully created source distribution at /Users/ygorelik/ydk-gen/gen-api/python/vendor-bundle/dist

=================================================
Successfully generated Python YDK vendor bundle package at /Users/ygorelik/ydk-gen/gen-api/python/vendor-bundle
Please refer to the README for information on how to install the package in your environment

Code generation completed successfully!  Manual installation required!

Total time taken:  0 seconds

Something wrong must be with your environment or profile.

Yan Gorelik
YDK Solutions

Hi Fabio

The root cause of the issue is that you use pyang version 2.2.1, but YDK is built around version 1.6, which is one of the requirements. In order to install correct python environment:

cd ydk-gen
# enable virtual environment if applicable
[sudo] pip install -r requirements.txt

 

Yan Gorelik
YDK Solutions

Hi Yan,

thank you for your help.
Rebuild my environment and now it´s working.

Regards,
Fabio
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: