<?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: pyang : Misleading yang error in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/pyang-misleading-yang-error/m-p/3909065#M4181</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;PRE&gt;$ pyang -p /var/opt/ncs/packages/cisco-iosxr/src/yang testservice.yang&lt;/PRE&gt;
I got following error message:
&lt;PRE&gt;testservice/src/yang/testservice.yang:83: error: tailf-ned-cisco-ios-xr:interface in the path for TenGigE at testservice/src/yang/testservice.yang:79 is not found&lt;/PRE&gt;
&lt;P&gt;I cannot understand, why pyang throw an error for &lt;STRONG&gt;testservice/src/yang/testservice.yang:83&lt;/STRONG&gt;.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;As a general comment, please note that NSO does NOT use pyang internally, and the pyang tool is not officially supported in any capacity. If you must use pyang, please use the opensource version at&amp;nbsp;&lt;A href="https://github.com/mbj4668/pyang" target="_blank"&gt;https://github.com/mbj4668/pyang&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;NSO uses a tool called "yanger" internally, to validate and compile yang models. It is released with NSO, and if you have "ncs" in your path, you should have "yanger" in your path too. So, just use "yanger -p ... &amp;lt;module_name&amp;gt;", just like with pyang.&lt;/P&gt;
&lt;P&gt;Now, coming to the specific error message in this issue, pyang says that it cannot find the node "tailf-ned-cisco-ios-xr:interface" under "ncs:config", in the provided models (yanger will give the same error). You should provide the 'device-compiled' models, and not the native models in the ned. So, change your path to&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/var/opt/ncs/packages/cisco-iosxr/src/ncsc-out/modules/yang&lt;/PRE&gt;
&lt;P&gt;The modules under $(NED_DIR)/src/yang are the native modules. Those under $(NED_DIR)/src/ncsc-out/modules/yang are the 'augmented' modules, where the native modules are augmented under the "ncs" namespace. So, here is where pyang/yanger can find the NED specific nodes under "ncs:config".&lt;/P&gt;
&lt;P&gt;/Ram&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Aug 2019 09:36:54 GMT</pubDate>
    <dc:creator>ramkraja</dc:creator>
    <dc:date>2019-08-16T09:36:54Z</dc:date>
    <item>
      <title>pyang : Misleading yang error</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/pyang-misleading-yang-error/m-p/3908668#M4178</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;I tried to validate my yang model of my ncs service by pyang.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$ pyang -p /var/opt/ncs/packages/cisco-iosxr/src/yang testservice.yang&lt;/PRE&gt;&lt;P&gt;I got following error message:&lt;/P&gt;&lt;PRE&gt;testservice/src/yang/testservice.yang:13: warning: imported module ietf-inet-types not used
testservice/src/yang/testservice.yang:83: error: tailf-ned-cisco-ios-xr:interface in the path for TenGigE at testservice/src/yang/testservice.yang:79 is not found&lt;/PRE&gt;&lt;P&gt;for following yang model:&lt;/P&gt;&lt;PRE&gt;module testservice{

namespace "http://example.com/testservice";
prefix testservice;

import ietf-inet-types {
  prefix inet;
}&lt;BR /&gt;
import tailf-common {
  prefix tailf;
}&lt;BR /&gt;
import tailf-ncs {
   prefix ncs;
}&lt;BR /&gt;
import tailf-ned-cisco-ios-xr {
   prefix cisco-ios-xr;
}&lt;BR /&gt;
[..] 
list devices {
    key device;
    leaf device {
      type leafref {
        path "/ncs:devices/ncs:device/ncs:name";
      }
    }

    leaf-list TenGigE {
      type leafref { path "deref(../device)/../ncs:config/cisco-ios-xr:interface/cisco-ios-xr:TenGigE/cisco-ios-xr:id"; }
    }
}&lt;BR /&gt;&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;I cannot understand, why pyang throw an error for &lt;STRONG&gt;testservice/src/yang/testservice.yang:83&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Inside NCS,&amp;nbsp; I got a autocomplete for the defined yang path:&lt;/P&gt;&lt;PRE&gt;admin@ncs% set services testservice devices device1 TenGigE TenGigE [&lt;BR /&gt;Possible completions:&lt;BR /&gt;0/0/1/0 ** DESCRIPTION ***&lt;BR /&gt;0/0/1/1 ** DESCRIPTION  ***&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NCS-Version:&lt;/STRONG&gt;&amp;nbsp;4.7.2.1&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NED-name:&lt;/STRONG&gt; cisco-iosxr&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NED-version:&lt;/STRONG&gt; 7.10.1&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 14:42:51 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/pyang-misleading-yang-error/m-p/3908668#M4178</guid>
      <dc:creator>DTtb</dc:creator>
      <dc:date>2019-08-15T14:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: pyang : Misleading yang error</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/pyang-misleading-yang-error/m-p/3909065#M4181</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;PRE&gt;$ pyang -p /var/opt/ncs/packages/cisco-iosxr/src/yang testservice.yang&lt;/PRE&gt;
I got following error message:
&lt;PRE&gt;testservice/src/yang/testservice.yang:83: error: tailf-ned-cisco-ios-xr:interface in the path for TenGigE at testservice/src/yang/testservice.yang:79 is not found&lt;/PRE&gt;
&lt;P&gt;I cannot understand, why pyang throw an error for &lt;STRONG&gt;testservice/src/yang/testservice.yang:83&lt;/STRONG&gt;.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;As a general comment, please note that NSO does NOT use pyang internally, and the pyang tool is not officially supported in any capacity. If you must use pyang, please use the opensource version at&amp;nbsp;&lt;A href="https://github.com/mbj4668/pyang" target="_blank"&gt;https://github.com/mbj4668/pyang&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;NSO uses a tool called "yanger" internally, to validate and compile yang models. It is released with NSO, and if you have "ncs" in your path, you should have "yanger" in your path too. So, just use "yanger -p ... &amp;lt;module_name&amp;gt;", just like with pyang.&lt;/P&gt;
&lt;P&gt;Now, coming to the specific error message in this issue, pyang says that it cannot find the node "tailf-ned-cisco-ios-xr:interface" under "ncs:config", in the provided models (yanger will give the same error). You should provide the 'device-compiled' models, and not the native models in the ned. So, change your path to&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/var/opt/ncs/packages/cisco-iosxr/src/ncsc-out/modules/yang&lt;/PRE&gt;
&lt;P&gt;The modules under $(NED_DIR)/src/yang are the native modules. Those under $(NED_DIR)/src/ncsc-out/modules/yang are the 'augmented' modules, where the native modules are augmented under the "ncs" namespace. So, here is where pyang/yanger can find the NED specific nodes under "ncs:config".&lt;/P&gt;
&lt;P&gt;/Ram&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 09:36:54 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/pyang-misleading-yang-error/m-p/3909065#M4181</guid>
      <dc:creator>ramkraja</dc:creator>
      <dc:date>2019-08-16T09:36:54Z</dc:date>
    </item>
  </channel>
</rss>

