cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
408
Views
1
Helpful
3
Replies

Generating yang model with ydk-gen

hyber
Beginner
Beginner

hi all,

Im trying to generate "YDK modules" for an ISR1K router. I have compiled and installed ydk-gen on my ubuntu 22.04 (jammy).

Im trying some bundles examples in the profiles/bundles/cisco-ios-xe-16xxxxx.json, but its not working.. I have been searching a bit it and seem there might be a problem with them, so I though I just try and verify the 17.6.1 models (im running IOS-XE 17.6.5), but pyang is giving errors:

 

 

(ydk_vne) eslau@N503476:~/repos-wsl/ydk-gen/yang-git/yang/vendor/cisco/xe/1761$ pyang Cisco-IOS-XE-native.yang 
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:601): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:1577): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:1580): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:1592): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:1739): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:1742): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:1916): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:2238): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:3940): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:4027): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:4151): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:4445): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:5552): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:5555): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:5568): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:5747): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:5750): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:5937): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2489 (at Cisco-IOS-XE-interfaces.yang:6306): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-interfaces"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1580): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1790): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1793): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1796): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1799): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1802): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1805): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1808): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1811): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1814): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1817): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1820): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1823): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1826): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1829): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1832): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1835): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:1838): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:3144): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:3200): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2440 (at Cisco-IOS-XE-ip.yang:3702): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ip"
Cisco-IOS-XE-native.yang:2462 (at Cisco-IOS-XE-ipv6.yang:447): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ipv6"
Cisco-IOS-XE-native.yang:2462 (at Cisco-IOS-XE-ipv6.yang:471): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-ipv6"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:230): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:239): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:668): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:723): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:855): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:917): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:1115): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:1130): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:1163): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"
Cisco-IOS-XE-native.yang:2759 (at Cisco-IOS-XE-logging.yang:1178): warning: node "Cisco-IOS-XE-native::native" is not found in module "Cisco-IOS-XE-logging"

 

 

I checked out the latest version of https://github.com/YangModels/yang.git and that is the one I am testing against..

Should that not work without errors??

My "pip list" looks like this:

 

 

Package                       Version
----------------------------- --------
alabaster                     0.7.13
Babel                         2.12.1
certifi                       2023.5.7
charset-normalizer            3.1.0
docutils                      0.18.1
gitdb                         4.0.10
GitPython                     3.1.31
idna                          3.4
imagesize                     1.4.1
Jinja2                        3.1.2
lxml                          4.9.2
MarkupSafe                    2.1.3
packaging                     23.1
pip                           22.0.2
pyang                         2.5.3
pybind11                      2.6.2
Pygments                      2.15.1
requests                      2.31.0
rstr                          3.2.1
setuptools                    59.6.0
smmap                         5.0.0
snowballstemmer               2.2.0
Sphinx                        6.2.1
sphinx-rtd-theme              1.2.2
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jquery          4.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
urllib3                       2.0.3
wheel                         0.40.0
ydk                           0.8.6.5

 

 

I tried to generate it anyway with: "./generate.py --bundle profiles/bundles/cisco-ios-xe_17.6.1_isr1k.json" (see attached), but its just giving a bunch of errors (including the one that pyang gives) and exits with

"The models supplied to the YDK generator are invalid. Please make sure the models are valid by compiling the models together using pyang. Please run "pyang *.yang" in the models directory, make sure there are no errors and then try running the generator again. If there are model errors, please fix the errors by editing the model, contacting the model owner or deleting the model from the list of models to generate the YDK bindings for."

Any pointers to what I can do? I really wanted to give YDK a try..

Ps. I grabbed all the yang files from the "capability-isr1k.xml" file in the 1761 folder of the model, not sure if I can just do that

Thanks for your help.

Esben

 

 

3 Replies 3

I wonder if this is the same issue? https://community.cisco.com/t5/tools/installing-ydk-models-cisco-ios-xr/m-p/4279417/highlight/true#M1367

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hi @bigevilbeard, it does look like a similar problem. but actually it looks like @yangorelik found that the problem was an issue in the yang model itself.

I had similar issues installing ydk-gen, but I managed to get it working, so now im trying to generate the models as I need newer than 16.9.3 which has a pre-compiled package. But so far not much luck.

Esben

so after a lot (a lot lot) of testing and searching forums and such... I think I nailed it down to a few things..

1. pyang is buggy, it finds problems in the yang models that does not exist.. dont use that one!

2. libyang is better and better maintained.. libyang is actually what ydk-gen uses in the background, so that is good!

long story short, I managed to get ydk-gen to compile a version of the 17.6.1 model.. The model file that I am using is this one: https://github.com/hyberdk/ydk-gen/blob/564cce740975f61fcba4cf211ec10e7738db64de/profiles/bundles/cisco-ios-xe_17.6.1-native.json

Note that I am using a modified version of the yang model git repo as I had to fix/workaround several issues to make it pass the yanglint/libyang linting process..

Esben

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: