<?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 Re: decode identityref with wrong namespace/module? in Tools</title>
    <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494789#M3022</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you also enable logging (&lt;A href="http://ydk.cisco.com/py/docs/introduction.html#logging"&gt;see this&lt;/A&gt;) and provide the logs from your script? I'm interested in seeing the payloads being created by YDK (if any)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have some example scripts, which do the similar thing as your yang model, which have been tested and known to work without problems. See &lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/blob/master/samples/basic/crud/models/openconfig/openconfig-bgp/nc-create-oc-bgp-41-ydk.py#L47"&gt;this one for&lt;/A&gt; example. Corresponding yang file is &lt;A href="https://github.com/openconfig/public/blob/2bac0d2884ec7d362d3be0bfd2e22b228669f77f/release/models/bgp/openconfig-bgp-types.yang#L75"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jun 2017 17:34:42 GMT</pubDate>
    <dc:creator>abhirame</dc:creator>
    <dc:date>2017-06-21T17:34:42Z</dc:date>
    <item>
      <title>decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494786#M3019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using YDK-gen and YDK-py (R0.5.5), I built and installed a private YANG file with its own namespace to supplement &lt;A href="http://ydk.cisco.com/py/docs/gen_doc_1ee9a2e45e34409e346af89ac6c21f2d186be338.html#ydk.models.openconfig.openconfig_terminal_device.TerminalDevice.LogicalChannels.Channel.Config.trib_protocol"&gt;trib-protocol&lt;/A&gt; (of type identityref) in openconfig-terminal-device. But YDK-py fails to decode trib-protocol from a NETCONF message such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;&amp;lt;terminal-device xmlns="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://openconfig.net/yang/terminal-device" rel="nofollow" target="_blank"&gt;http://openconfig.net/yang/terminal-device&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;...&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;lt;config&amp;gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;lt;index&amp;gt;101020411&amp;lt;/index&amp;gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN&gt;&amp;lt;trib-protocol xmlns="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://my.com/yang/my-openconfig-exttypes" rel="nofollow" target="_blank"&gt;http://my.com/yang/my-openconfig-exttypes&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;PROT_UNASSIGNED&amp;lt;/trib-protocol&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;lt;/config&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at YDK implementation, when trying to resolve/decode an identityref, it ignores the namespace (my-openconfig-exttypes) with trib-protocol and uses "open-terminal-device" from its root node instead. This seems to be a bug?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 14:34:48 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494786#M3019</guid>
      <dc:creator>yung.hsu</dc:creator>
      <dc:date>2017-06-20T14:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494787#M3020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Yung,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you provide your yang file and your script as this will help in debugging this issue?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 17:34:46 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494787#M3020</guid>
      <dc:creator>abhirame</dc:creator>
      <dc:date>2017-06-20T17:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494788#M3021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" data-avatarid="-1" data-userid="329030" data-username="abhirame" href="https://community.cisco.com/people/abhirame"&gt;abhirame&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Not sure how much this will help you since the effort is in setting up a device that gives the right response. &lt;/P&gt;&lt;P&gt;The yang file is simple and it looks like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;module my-openconfig-exttypes {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; yang-version "1";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&lt;SPAN&gt;&amp;nbsp; namespace "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://my.com/yang/my-openconfig-exttypes" rel="nofollow" target="_blank"&gt;http://my.com/yang/my-openconfig-exttypes&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; prefix "my-oc-exttypes";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; import openconfig-transport-types { prefix oc-opt-types; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; organization "My";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; contact "My Optical Networks";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; description "For debug/testing only";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; &lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; identity PROT_UNASSIGNED {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base oc-opt-types:TRIBUTARY_PROTOCOL_TYPE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; description "No protocol specified";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #666699;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;The script basically does this: &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;term = TerminalDevice() &lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;devices = crud.read(provider, term, only_config=True)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;It will be easier if you find an existing device that does something similar with identityref.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jun 2017 18:44:54 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494788#M3021</guid>
      <dc:creator>yung.hsu</dc:creator>
      <dc:date>2017-06-20T18:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494789#M3022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you also enable logging (&lt;A href="http://ydk.cisco.com/py/docs/introduction.html#logging"&gt;see this&lt;/A&gt;) and provide the logs from your script? I'm interested in seeing the payloads being created by YDK (if any)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have some example scripts, which do the similar thing as your yang model, which have been tested and known to work without problems. See &lt;A href="https://github.com/CiscoDevNet/ydk-py-samples/blob/master/samples/basic/crud/models/openconfig/openconfig-bgp/nc-create-oc-bgp-41-ydk.py#L47"&gt;this one for&lt;/A&gt; example. Corresponding yang file is &lt;A href="https://github.com/openconfig/public/blob/2bac0d2884ec7d362d3be0bfd2e22b228669f77f/release/models/bgp/openconfig-bgp-types.yang#L75"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 17:34:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494789#M3022</guid>
      <dc:creator>abhirame</dc:creator>
      <dc:date>2017-06-21T17:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494790#M3023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yung, were you able to get those logs?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jun 2017 15:34:51 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494790#M3023</guid>
      <dc:creator>saalvare</dc:creator>
      <dc:date>2017-06-28T15:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494791#M3024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I don't have much time to do this. But let me cut down the chase and explain where I believe the trouble is. Consider _bind_to_object_helper() method in providers/_decoder.py. It has the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;for member in entity_members:&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; module_name = member.module_name&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nmsp = _yang_ns._namespaces[module_name]&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tag_name = '{' + nmsp + '}' + member.name&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rt = [rt for rt in root.getchildren() if rt.tag == tag_name]&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It tries to extract members from encoded XML using their namespace according to their modules/Yang. But this does not work for member of identityref (think of it as a typed "pointer") that may not assume its defined namespace (i.e., "base" type). From the example in my original question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;trib-protocol xmlns="&lt;A class="jive-link-external-small" href="http://my.com/yang/my-openconfig-exttypes" rel="nofollow" target="_blank"&gt;http://my.com/yang/my-openconfig-exttypes&lt;/A&gt;"&amp;gt;PROT_UNASSIGNED&amp;lt;/trib-protocol&amp;gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As shown, this instance of trib-protocol is an identityref of a "derived" namespace (not defined in the module/Yang). In current YDK (0.5.5) implementation, this encoded trib-protocol will be ignored since its tag name does not meet the search criteria. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jun 2017 22:02:43 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494791#M3024</guid>
      <dc:creator>yung.hsu</dc:creator>
      <dc:date>2017-06-28T22:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494792#M3025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree that this is a bug in how we handle identity values. The XML namespace issues around identities are a bit of a pain. Unless we already have, we should raise an issue to address this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Einar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2017 09:45:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494792#M3025</guid>
      <dc:creator>einarnn</dc:creator>
      <dc:date>2017-06-29T09:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: decode identityref with wrong namespace/module?</title>
      <link>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494793#M3026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! Just want to confirm that you have compiled your module "&lt;SPAN style="color: #666699; font-family: arial; font-size: 12px;"&gt;my-openconfig-exttypes.yang"&lt;/SPAN&gt; as part of your ydk bundle using ydk-gen. If you have done so and are still seeing the issue, I agree with Einar that it is bug and an issue needs to be filed on &lt;A href="https://github.com/CiscoDevNet/ydk-gen/issues" title="https://github.com/CiscoDevNet/ydk-gen/issues"&gt;Issues · CiscoDevNet/ydk-gen · GitHub&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jun 2017 16:06:52 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/decode-identityref-with-wrong-namespace-module/m-p/3494793#M3026</guid>
      <dc:creator>abhirame</dc:creator>
      <dc:date>2017-06-29T16:06:52Z</dc:date>
    </item>
  </channel>
</rss>

