CiscoDevNet / ydk-gen

Generate model-driven APIs from YANG models
http://ciscodevnet.github.io/ydk-gen/
Apache License 2.0
136 stars 74 forks source link

Issue with generating python bundle from Cisco-IOS XE 1711 yang modules (Cisco-IOS-XE-BGP.yang ) #1051

Closed atarlov closed 2 years ago

atarlov commented 3 years ago

Expected Behavior

I want to generate Cisco IOS-XE 1711 python bundle. The files I am using are from the Yang repository. I'm interested in the BGP configuration.

            "file":[  
              "vendor/cisco/xe/1711/Cisco-IOS-XE-native.yang",
              "vendor/cisco/xe/1711/tailf-common.yang",
              "vendor/cisco/xe/1711/cisco-semver.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-types.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-line.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-features.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-interface-common.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-license.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-parser.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-logging.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ip.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ipv6.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-interfaces.yang",

              "vendor/cisco/xe/1711/tailf-meta-extensions.yang",
              "vendor/cisco/xe/1711/tailf-cli-extensions.yang",

              "vendor/cisco/xe/1711/Cisco-IOS-XE-bgp.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-isis.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ospfv3.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ospf.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ospf-obsolete.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-snmp.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-mpls.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ethernet.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-l2vpn.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-pppoe.yang",           
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ethernet-cfm-efp.yang",
              "vendor/cisco/xe/1711/Cisco-IOS-XE-ethernet-oam.yang",

              "standard/ietf/RFC/ietf-inet-types.yang",
              "standard/ietf/RFC/ietf-yang-types.yang"

Current Behavior

With the provided yang files the generation fails. Part of the Logs are attached.
When I remove the Cisco-IOS-XE-BGP.yang then it succeeds. I compared the latest working BGP module (v16101) and (v1711) and it seems that in the newer ifaces are part of the module. image

When I run the pyang on the module it gives me errors for those interfaces. pyang Cisco-IOS-XE-bgp.yang

isco-IOS-XE-interfaces.yang:2758: error: Cisco-IOS-XE-interfaces:native in the path for Ethernet at Cisco-IOS-XE-bgp.yang:11470 (at Cisco-IOS-XE-interfaces.yang:2754) is not found
Cisco-IOS-XE-interfaces.yang:2765: error: Cisco-IOS-XE-interfaces:native in the path for FastEthernet at Cisco-IOS-XE-bgp.yang:11470 (at Cisco-IOS-XE-interfaces.yang:2761) is not found
Cisco-IOS-XE-interfaces.yang:2765: error: Cisco-IOS-XE-interfaces:native in the path for FastEthernet at Cisco-IOS-XE-bgp.yang:11470 (at Cisco-IOS-XE-interfaces.yang:2761) is not found

Steps to Reproduce

./generate.py --bundle py_sdks/cisco-ios-xe_1711.json

Logs

...
projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2970: Cisco-IOS-XE-interfaces:native in the path for BD-VIF at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-bgp.yang:11470 (at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2966) is not found

projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2970: Cisco-IOS-XE-interfaces:native in the path for BD-VIF at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-bgp.yang:11470 (at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2966) is not found

projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2970: Cisco-IOS-XE-interfaces:native in the path for BD-VIF at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-bgp.yang:11470 (at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2966) is not found

projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2970: Cisco-IOS-XE-interfaces:native in the path for BD-VIF at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-bgp.yang:11470 (at /data/home/j0421/projects/ydk/ydk-gen/gen-api/.cache/models/cisco_ios_xe_17_1_1@17.1.1/Cisco-IOS-XE-interfaces.yang:2966) is not found

System Information

Python 3.6.8 Pyang 1.6 CentOS Linux release 7.7.1908

ygorelik commented 3 years ago

This is Not YDK issue!

The issue appears due to bug in pyang, which is present even in the latest version 2.5.0.

atarlov commented 3 years ago

Hi @ygorelik, I see the new ydk-gen 0.8.6 is GA with pyang version upgraded to 2.5.0. (https://community.cisco.com/t5/yang-tools/ydk-0-8-6-is-now-generally-available/td-p/4477882). In that case probably that new version will not help

ygorelik commented 3 years ago

The pyang upgrade targeted capability for YDK to process and generate API for YANG-1.1 modules. Not all the features of RFC-7950 though were implemented in this release. In order to have full set of YANG-1.1 features the YDK must be upgraded to version 0.9.0.1 or 0.9.1 (coming soon).

ygorelik commented 2 years ago

This is Not YDK issue!

The issue appears due to https://github.com/mbj4668/pyang/issues/729 in pyang, which is present even in the latest version 2.5.0.