- 1) What is the difference (or relationship) between profiles and bundles? Its not clear to me the difference in these from the explanation on Github.
- 2) If I just have a set of yang files in a directory and I want to build the SDK for those what would the sample profile or bundle JSON file look like?
Sorry for the confusing explanation about the difference between profile and bundles in GitHub.
For the first question,
The YDK profile package combines the generated APIs(language bindings like ydk-py before version 0.5.0) with runtime core library(such as CRUDService and CodecService). And the YDK bundle package separate the generated APIs from the runtime core library.
So, if you are using YDK generated using `--profile` option, by using:
$ pip install <ydk-gen-home>/gen-api/python/dist/ydk*.tar.gz
You are good to go.
And, if you are using YDK generated using `--bundle` option, you need to generate and install YDK runtime core library before you install bundle package:
$ python generate.py --core
$ pip install <ydk-gen-home>/gen-api/python/ydk/dist/ydk*.tar.gz
$ python generate.py --python --bundle <path-to-profile-file>
$ pip install <ydk-gen-home>/gen-api/python/<path-to-bundle-directory>/dist/ydk*.tar.gz
And if you want to install another bundle package, write a profile file for this bundle package, generate it and install:
$ python generate.py --python --bundle <path-to-another-profile-file>
$ pip install <ydk-gen-home>/gen-api/python/<path-to-another-bundle-directory>/dist/ydk*.tar.gz
Those two bundle packages are Python namespace packages, and if you check pip installed pacakges, you will find those entries:
To unintall bundle packages:
$ pip uninstall ydk-models-<bundle-package-name>
We try to use this approach to add flexibility to YDK, so you could install/uninstall/organize your YDK packages.
If you want to use a local YANG directory to generate YDK, please make sure all the YANG files and its dependency modules are been added to that directory(use "$ pyang *.yang" in that directory and no errors) and write a profile file like:
"/<path-relative-to-ydk-gen-home>" // <-- please make sure the leading slash is there.
The syntax for bundle package is the same.
We have example JSON files under <ydk-gen-home>/profiles. And if you want to add remote GitHub repositories to your JSON file(such as example files under <ydk-gen-home>/profiles/ydk) or add dependencies for your bundle packages in pip(such as example files under <ydk-gen-home>/profile/bundles), feel free to check them.
- Tried running one of the samples and it errors out. Any idea what’s happening.
(mypython) $ python generate.py --python --profile profiles/test/ydktest.json
Traceback (most recent call last):
File "generate.py", line 278, in
File "/home/gibson/PythonProjects/ydk-gen/ydkgen/__init__.py", line 82, in generate
File "/home/gibson/PythonProjects/ydk-gen/ydkgen/__init__.py", line 107, in generateprofile
api_pkgs = self._get_api_pkgs(resolved_models_dir)
File "/home/gibson/PythonProjects/ydk-gen/ydkgen/__init__.py", line 164, in getapi_pkgs
modules = pyang_builder.parse_and_return_modules()
File "/home/gibson/PythonProjects/ydk-gen/ydkgen/builder/_pyang_model_builder.py", line 53, in parse_and_return_modules
File "/home/gibson/PythonProjects/ydk-gen/ydkgen/builder/_pyang_model_builder.py", line 259, in validatepyang_modules
If you want to try a profile, I'd suggest you use the ydk-0.4.2 profile.
$ python generate.py --python --profile profiles/ydk/ydk_0_4_2.json -v
It seems like the models in your directory are not complete, please use additional verbose option '-v' to populate pyang errors. We use ydktest.json in development and ydk_0_4_2.json to generate ydk-py(0.4.2). Maybe you could reset your git repository to master HEAD, and regenerate it.
- It is still failing, so I completely removed ydk-gen and started from scratch. Checked the starting environment (pip list) and also checked for the dependencies (yum list). Then cloned the repository, ran the install.sh script, and tried to build one of the canned profiles (ydktest.json). It failed the same way. What is wrong.
In the last line just before Python trackback, pyang complains about:
/tmp/tmp8R7obx.firstname.lastname@example.org:337: the value "[u'auto-sense-speed']" does not match its base type - bit not defined for the default value
It seems like this error causes ydk-gen to throw exception and exit execution, and I was able to reproduce this issue on my Mac with pyang 1.7.
Maybe you could try to downgrade pyang to 1.6(maybe your system has pyang 1.7 installed, but as specified in requirements.txt, ydk-gen needs pyang 1.6. Sorry, we might need to update install.sh):
$ pip install pyang==1.6
And try to regenerate the package.
- One more question: Is there any plan to add RESTCONF support? Seems that shouldn't be hard to add!
Yes! RESTCONF is on our roadmap.