<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to retrieve substatements using Path API? in Tools</title>
    <link>https://community.cisco.com/t5/tools/how-to-retrieve-substatements-using-path-api/m-p/4114165#M1824</link>
    <description>&lt;P&gt;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)?&lt;/P&gt;
&lt;PRE&gt;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)
&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Jul 2020 19:37:17 GMT</pubDate>
    <dc:creator>tadeshpa</dc:creator>
    <dc:date>2020-07-06T19:37:17Z</dc:date>
    <item>
      <title>How to retrieve substatements using Path API?</title>
      <link>https://community.cisco.com/t5/tools/how-to-retrieve-substatements-using-path-api/m-p/4114165#M1824</link>
      <description>&lt;P&gt;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)?&lt;/P&gt;
&lt;PRE&gt;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)
&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jul 2020 19:37:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/how-to-retrieve-substatements-using-path-api/m-p/4114165#M1824</guid>
      <dc:creator>tadeshpa</dc:creator>
      <dc:date>2020-07-06T19:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve substatements using Path API?</title>
      <link>https://community.cisco.com/t5/tools/how-to-retrieve-substatements-using-path-api/m-p/4114315#M1825</link>
      <description>&lt;P&gt;Unfortunately information that you are looking for currently is not available in Python code. It is available only in C++ code, where class &lt;A href="https://github.com/CiscoDevNet/ydk-gen/blob/3edee4610648c3229dbd8f4c51ad7070c2b34f92/sdk/cpp/core/src/path/path_private.hpp#L94" target="_self"&gt;&lt;EM&gt;SchemaNodeImpl&lt;/EM&gt;&lt;/A&gt; holds pointer to Libyang structure &lt;A href="https://netopeer.liberouter.org/doc/libyang/master/group__schematree.html#structlys__node" target="_self"&gt;&lt;EM&gt;lys_node&lt;/EM&gt;&lt;/A&gt;, 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 &lt;A href="https://github.com/CiscoDevNet/ydk-gen/issues" target="_self"&gt;ydk-gen&lt;/A&gt; GitHub.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 02:42:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/how-to-retrieve-substatements-using-path-api/m-p/4114315#M1825</guid>
      <dc:creator>yangorelik</dc:creator>
      <dc:date>2020-07-07T02:42:47Z</dc:date>
    </item>
  </channel>
</rss>

