07-05-2021 01:20 PM
I am trying to generate python code for the 16121 Yang version, but it fails.
https://github.com/YangModels/yang/tree/master/vendor/cisco/xe/16121
I believe it is because of the Cisco-IOS-XE-bgp yang module, which I want to use.
pyang Cisco-IOS-bgp.yang gives me a bunch of errors of missing BD-VIF and so on.
The BGP yang modules changed a lot from the 1693 to the later versions. Do you have any clue how I can fix that and use the native BGP module ?
Cisco-IOS-XE-interfaces.yang:3301: error: Cisco-IOS-XE-interfaces:native in the path for BD-VIF at Cisco-IOS-XE-bgp.yang:11160 (at Cisco-IOS-XE-interfaces.yang:3294) is not found
Cisco-IOS-XE-interfaces.yang:3301: error: Cisco-IOS-XE-interfaces:native in the path for BD-VIF at Cisco-IOS-XE-bgp.yang:11160 (at Cisco-IOS-XE-interfaces.yang:3294) is not found
07-06-2021 10:53 AM
Unfortunately the YANG models have multiple errors. They even cannot pass the pyang validation. You need to work with developers of the models to fix all the errors. Then you will be able to generate API in ydk-gen.
Regarding specific error in Cisco-IOS-XE-interfaces.yang:3301. The model defines:
leaf BD-VIF {
description
"Bridge-Domain Virtual IP interface";
type leafref {
path "/ios:native/ios:interface/ios:BD-VIF/ios:name";
}
}
But the Cisco-IOS-XE-interfaces is a submodule of Cisco-IOS-XE-native, therefore all the nodes in the path must be referenced directly:
path "/native/interface/BD-VIF/name";
This type of error must be fixed in all the submodules of Cisco-IOS-XE-native!
07-06-2021 02:12 PM
I've validated above referenced YANG models in libyang and noted that no errors were found. That means there are bugs in the pyang.
07-08-2021 01:23 AM
Hi Yan,
thanks for the reply and the clarification. Pyang validates the .yang modules. Is there a way to deactivate the validation ?
Is there a double validation if libyang validates again ?
I tried with the newest version of pyang==2.5 and get the same issue. As well if I use the 1711 version. It seems that from 16121 there is an issue with the BGP model.
R,
Assen
07-08-2021 08:20 AM
The strange part for me is that if I use the Native + interfaces module without the BGP(plus includes like ospf) it works.
Only if I add the BGP it fails. I am wondering if it does not make a reference BGP -> to Ifaces -> Native and it breaks.
07-12-2021 01:38 PM
You are correct. The BGP module defines an augment that references interfaces. I believe this case was overlooked in the solution of pyang issue #729, and still needs code correction.
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