cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1436
Views
0
Helpful
5
Replies

ydk-gen generate xe-1612

atarlov
Level 1
Level 1

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 

5 Replies 5

yangorelik
Spotlight
Spotlight

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!

Yan Gorelik
YDK Solutions

I've validated above referenced YANG models in libyang and noted that no errors were found. That means there are bugs in the pyang.

Yan Gorelik
YDK Solutions

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 

 

 

 

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. 

 

 

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.

Yan Gorelik
YDK Solutions