04-03-2017 01:42 AM
Root cause Analysis:
I was facing issues when I tried to compile YDK with augmented ietf_interface values. The issue is with the YDK parsing file. There were 2 issues,
1. The YDK parser file take the base ietf_interface.py file and our augmented ietf file. It then creates a new ietf_interfaces.py file in "_aug_patch" folder with both base ietf and augmented ietf content. While parsing the comment section, the code hits a logic of end of comment (""") in the generated augmented ietf_interfaces.py file. Ideally the logic should have ended comment parsing. But instead the data index is decremented.
file:- __init__.py in ietf folder
if '"""' in patch_lines[idx]):
idx -=2
This was causing the code to access the same index again and again which resulted in the looping. This was causing memory issue.
2. In addition to the looping issue, there was array index out of bound issue. Because of this issue the ietf_interfaces.py was not properly generated in the ietf/_aug_patch folder. IT was giving IndexError.
I have fixed both the issues. It is purely YDK issue. The issue should be fixed in the file ydk-gen/ydkgen/printer/python/init_file_printer.py. I have attached the modified _patch() function.
Solved! Go to Solution.
04-05-2017 08:49 PM
Just to clarify and for future reference,
The issue is about old Python package generated by YDK-GEN before 0.5.4 interfere with new Python package generated after 0.5.4. If you have old Python package generated and installed by YDK-GEN before 0.5.4, and facing similar issue above(error in "_aug_patch"), please uninstall them and regenerate the reinstall using YDK-GEN>=0.5.4:
$ pip list | grep ydk-modelsydk-models-cisco-ios-xr 6.2.1
ydk-models-openconfig 0.1.2
ydk-models-ietf 0.1.1
# ^~~~ if you installed ydk-models-ietf through YDK-GEN<0.5.4,
# and generated then installed new custom package with YANG model augment models
# in this package(for example ietf-interfaces in this case), it might cause
# you trouble, please refresh your environment by removing all of them:
$ pip uninstall ydk-models-cisco-ios-xr ydk-models-ietf ydk-models-openconfig -y
# and regenerate/reinstall them:
ydk-gen $ ./generate.py --bundle profiles/bundles/ietf_0_1_1.json
ydk-gen $ ./generate.py --bundle custom.json
ydk-gen $ pip install gen-api/python/ietf-bundle/dist/ydk*.gz
ydk-gen $ pip install gen-api/python/custom-bundle/dist/ydk*.gz
Apologize for inconvenience.
04-03-2017 01:47 AM
Ravi,
It would be great if you could do a couple of things:
Cheers,
Einar
04-03-2017 11:42 PM
Sorry, just saw this discussion. I checked the init_file_priner.py in current ydk-gen repository this time and found the code causing this issue is being removed after this commit. I think it should be fine if YDK is upgraded to 0.5.4(pip install ydk --upgrade). Let me know if it helps.
04-05-2017 08:49 PM
Just to clarify and for future reference,
The issue is about old Python package generated by YDK-GEN before 0.5.4 interfere with new Python package generated after 0.5.4. If you have old Python package generated and installed by YDK-GEN before 0.5.4, and facing similar issue above(error in "_aug_patch"), please uninstall them and regenerate the reinstall using YDK-GEN>=0.5.4:
$ pip list | grep ydk-modelsydk-models-cisco-ios-xr 6.2.1
ydk-models-openconfig 0.1.2
ydk-models-ietf 0.1.1
# ^~~~ if you installed ydk-models-ietf through YDK-GEN<0.5.4,
# and generated then installed new custom package with YANG model augment models
# in this package(for example ietf-interfaces in this case), it might cause
# you trouble, please refresh your environment by removing all of them:
$ pip uninstall ydk-models-cisco-ios-xr ydk-models-ietf ydk-models-openconfig -y
# and regenerate/reinstall them:
ydk-gen $ ./generate.py --bundle profiles/bundles/ietf_0_1_1.json
ydk-gen $ ./generate.py --bundle custom.json
ydk-gen $ pip install gen-api/python/ietf-bundle/dist/ydk*.gz
ydk-gen $ pip install gen-api/python/custom-bundle/dist/ydk*.gz
Apologize for inconvenience.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide