CiscoDevNet / ydk-gen

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

YDK-gen to provide a way to recover the default value of a leaf programmatically #1025

Open valeriodigregorio opened 4 years ago

valeriodigregorio commented 4 years ago

Expected Behavior

In example for Python I can see that Cisco_IOS_XE_wireless_wlan_cfg.WlanCfgData.WlanCfgEntries.WlanCfgEntry.__doc__ contains indication of default value for each leaf:

            .. attribute:: wpa1_enabled

                Configures WPA1 support
                **type**\: bool

                **default value**\: false

I would expect the user to be able to programmatically recover that value, in example like:

Cisco_IOS_XE_wireless_wlan_cfg.WlanCfgData.WlanCfgEntries.WlanCfgEntry.get_yang_default_value("wpa1_enabled")

That should also return the right type and eventually support enums.

Note that querying some devices via Netconf may not return indication of config/oper for leafs that are set to a default value.

Current Behavior

It's impossible to recover the default value programmatically.

Steps to Reproduce

Try to print the default value of a leaf.

Your Script

There's no way to do this.

Logs

N/A

System Information

YDK 0.8.4