How to retrieve substatements using Path API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 12:37 PM
How can I find the substatements of a schema node? For example, if it is a configuration node or mandatory node? Or in the case of list nodes, how do I find the keys? I the script below, I can find out the keyword and argument for timer, but I can't find out if it is configuration, mandatory, or what the status is (current, deprecated, obsolete)?
from ydk.path import Repository, Capability repo = Repository('/root/ydk-py/cisco-ios-xr/ydk/models/cisco_ios_xr/_yang') root_schema = repo.create_root_schema([]) xpath = "Cisco-IOS-XR-cdp-cfg:cdp/timer" value = "60" cdp = root_schema.create_datanode("Cisco-IOS-XR-cdp-cfg:cdp") timer = cdp.create_datanode("timer", value) timer_schema_node = timer.get_schema_node() timer_statement = timer_schema_node.get_statement() print(timer_statement.keyword, timer_statement.arg)
- Labels:
-
YANG Development Kit (YDK)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 07:42 PM
Unfortunately information that you are looking for currently is not available in Python code. It is available only in C++ code, where class SchemaNodeImpl holds pointer to Libyang structure lys_node, which contains all the information about correspondent YANG model node. New development is required to expose that information in Python code. I suggest to open enhancement request for this new development on ydk-gen GitHub.
YDK Solutions
