Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.
Expected Behavior
It would be nice to be able to write an application that can talk to multple version of yang models. For example, we are using yang to talk to NCS55A2 devices, and a recent firmware update to one box caused our system to have some devices with an IOS version of 7.0.2 and some to have 7.3.2. These boxes are in different locations around the world, and updating all boxes at the same time is not always feasible.
Using the following commands:
python3 ./generate.py --bundle /cisco-ios-xr-702.json -cpp
python3 ./generate.py --bundle /cisco-ios-xr-732.json -cpp
Where each of the bundles had the following name defined:
"name": "cisco-ios-xr-702",
"name": "cisco-ios-xr-732",
This worked well. After running through the build process, it created separate include paths and .a files to link against for each version. However, the one thing that doesn't work well, if a single source file in our application tries to reference a ydkgen include file from both of the versions that were generated, the build doesn't work due to the #ifndef at the beginning of the file being identical:
% head -n2 ydk_cisco_ios_xr_702/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_L2VPNCFG
% head -n2 ydk_cisco_ios_xr_732/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_L2VPNCFG
If the define in the ydkgen output also included the namespace as well as the name of the file, then both files could correctly be included from the same source file (ie something line this):
% head -n2 ydk_cisco_ios_xr_702/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_702_CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_702_CISCO_IOS_XR_L2VPNCFG
% head -n2 ydk_cisco_ios_xr_732/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_732_CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_732_CISCO_IOS_XR_L2VPNCFG
Current Behavior
Output of ydkgen ifndef at the beinging of each file is always identical no matter with version of the yang models you run it against.
Steps to Reproduce
See the expected behavior section above.
Your Script
Create a source file that includes and tries to use the output from two yang versions of ydkgen.
include <ydk_cisco_ios_xr_702/Cisco_IOS_XR_l2vpn_cfg.hpp>
include <ydk_cisco_ios_xr_732/Cisco_IOS_XR_l2vpn_cfg.hpp>
Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.
Expected Behavior
It would be nice to be able to write an application that can talk to multple version of yang models. For example, we are using yang to talk to NCS55A2 devices, and a recent firmware update to one box caused our system to have some devices with an IOS version of 7.0.2 and some to have 7.3.2. These boxes are in different locations around the world, and updating all boxes at the same time is not always feasible.
We ran ydkgen on the following sents of yang models: https://github.com/YangModels/yang/tree/main/vendor/cisco/xr/702 https://github.com/YangModels/yang/tree/main/vendor/cisco/xr/732
Using the following commands: python3 ./generate.py --bundle/cisco-ios-xr-702.json -cpp
python3 ./generate.py --bundle /cisco-ios-xr-732.json -cpp
Where each of the bundles had the following name defined: "name": "cisco-ios-xr-702", "name": "cisco-ios-xr-732",
This worked well. After running through the build process, it created separate include paths and .a files to link against for each version. However, the one thing that doesn't work well, if a single source file in our application tries to reference a ydkgen include file from both of the versions that were generated, the build doesn't work due to the #ifndef at the beginning of the file being identical:
% head -n2 ydk_cisco_ios_xr_702/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_L2VPNCFG
% head -n2 ydk_cisco_ios_xr_732/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_L2VPNCFG
If the define in the ydkgen output also included the namespace as well as the name of the file, then both files could correctly be included from the same source file (ie something line this):
% head -n2 ydk_cisco_ios_xr_702/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_702_CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_702_CISCO_IOS_XR_L2VPNCFG
% head -n2 ydk_cisco_ios_xr_732/Cisco_IOS_XR_l2vpn_cfg.hpp
ifndef _CISCO_IOS_XR_732_CISCO_IOS_XR_L2VPNCFG
define _CISCO_IOS_XR_732_CISCO_IOS_XR_L2VPNCFG
Current Behavior
Output of ydkgen ifndef at the beinging of each file is always identical no matter with version of the yang models you run it against.
Steps to Reproduce
See the expected behavior section above.
Your Script
Create a source file that includes and tries to use the output from two yang versions of ydkgen.
include <ydk_cisco_ios_xr_702/Cisco_IOS_XR_l2vpn_cfg.hpp>
include <ydk_cisco_ios_xr_732/Cisco_IOS_XR_l2vpn_cfg.hpp>
...
Logs
Compile fails
System Information
gcc