Closed hyberdk closed 1 year ago
Hi Essen, Simone reached to me regarding your usecase. BGP.YANG imports the Native.YANG per https://github.com/YangModels/yang/blob/main/vendor/cisco/xe/1761/Cisco-IOS-XE-bgp.yang#L26 so recommend to "validate" against the top most model with command like "pyang Cisco-IOS-XE-native.yang" if you really need to. Please work with your vendors TAC as this repo is not monitored.
Hi @jeremycohoe,
thanks for your reply, Im trying to active TAC via one of my technical account guys :-)
Anyways, from my basic understanding Im not sure I follow your logic..
Includes are used to import submodules (to split a large yang-model into different files), in that case it does not make sense to validate the submodule, as it cannot exist without the "parent" module.
Imports on the other hand is to import functionality of an external "root" module to extend your model. The BGP model also uses ietf-inet-types (see this) as in import, but testing this does not really test the BGP model. For me its the same with the Cisco native model, sure BGP uses it, but testing the native does not ensure that BGP is valid. There is no reference in the Cisco-IOS-XE-native model to the Cisco-IOS-XE-bgp..
However that being said.. I think the problem actually exist in the native model and that propagate all the way back to the BGP model (if that makes sense)
but thanks for your feedback, any is welcome :-)
Esben
@hyberdk, I'm afraid that there is a longstanding issue with pyang
not quite understanding the rules of YANG. If you drill down on the first error:
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"
...then you can see that the node being complained about, Cisco-IOS-XE-native::native
is for sure made available to the submodule's namespace using the belongs-to
statement. You might find alternate results with yanglint
, not sure. On Ubuntu you can install yanglint
using apt install yang-tools
. yanglint
is sometimes maintained slightly better in some areas, but no promises!
Cheers,
Einar
BTW, @jeremycohoe is right to say that this repo is not routinely monitored by vendors. We (the vendors) provide this repo as a convenience to developers to try and make all YANG models published across industry available in one place and, yes, if you have issues with a specific vendor's models, then I'm afraid you are best to follow up with the vendor as Jeremy suggested.
Cheers,
Einar
Not an issue that will be resolved here, sorry! Closing for now.
Hi Einar,
thanks for the feedback..
Yeah, pyang seems to have different issues, im also trying yanglint, but its also proving to give errors..
(venv) eslau@N503476:~/repos-wsl/yang/vendor/cisco/xe/1761$ yanglint Cisco-IOS-XE-bgp.yang
libyang err : When condition cyclic dependency on the node "traps". (Schema location "/Cisco-IOS-XE-native:native/snmp-server/Cisco-IOS-XE-snmp:enable/enable-choice/traps/Cisco-IOS-XE-ospfv3:ospfv3-config/errors/enable".)
YANGLINT[E]: Parsing schema module "Cisco-IOS-XE-bgp.yang" failed.
the native model is also acting up..
As background (if other finds this topic), the reason I actually started with pyang was that that is what Cisco is using in their Yang Suite, but I found that YDK-GEN actually seems to be using yanglint. Bottom line is that I cannot validate the model and therefore I cannot convert it into python libs using YDK.
Anyways, thanks to both for your help.. Im now trying to drive the topic using my local Cisco SE
Esben
just an update, if someone finds this.. have a look at mbj4668/pyang#729
Hi all,
Im trying to validate the models in vendor/cisco/xe/17xxx as I would like to build python packages for ydk-gen..
When I use pyang to validate the models, they fail and I cannot figure out what is wrong (im no expert in the area)..
here is an example for "errors" that looks like is related to "Cisco-IOS-XE-interfaces.yang"
repo steps:
here is my output:
Im using the latest pyang code, but it does not make a difference
Any suggestions to what I can do would be really appreciated!
Esben