<?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 Yang modelling error - pyang in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/3953611#M4476</link>
    <description>&lt;P&gt;Dear friends,&lt;/P&gt;&lt;P&gt;I'm a beginner on NSO services modelling and running into an issue while trying to run pyang against a yang file - described in one of the NSO lab guides.&lt;/P&gt;&lt;P&gt;NSO version is 5.1&lt;/P&gt;&lt;P&gt;Pyang 1.5, but also tried 1.7.8 and 2.1. Got the same errors though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module vlan {
  namespace "http://com/example/vlan";
  prefix vlan;

  import ietf-inet-types {
    prefix inet;
  }
  import tailf-ncs {
    prefix ncs;
  }
  import tailf-common{
	prefix tailf;
  }
  description
	"Description...";
	
	revision 2019-11-05 {
		description
		"Initial revision";
	}
	augment /ncs:services{
		  list vlan {
			tailf:info "VLAN Service";
			key name;
			unique vlan-id;

			uses ncs:service-data;
			ncs:servicepoint "vlan";

			leaf name {
			  tailf:info "Service Instance Name";
			  type string;
			}
			leaf vlan-id{
				tailf:info "Unique VLAN ID";
				type uint32{
					range "1..4096";
				}
			}
			list device{
				tailf:info "L3 switch";
				key name;
				leaf name{
					tailf:info "Device name";
					type leafref{
						path "/ncs:devices/ncs:device/ncs:name";
					}
				}
			}
			list interface{
				tailf:info "Ethernet interface";
				key "intf-type intf-id";
				leaf intf-type{
					tailf:info "Ethernet interface type";
					type enumeration{
						enum Ethernet;
						enum FastEthernet;
						enum GigabitEthernet;
					}
				}
				leaf intf-id{
					tailf:info "Ethernet interface ID";
					type string;
				}
			}
		}
	}
}&lt;/PRE&gt;&lt;P&gt;Errors:&lt;/P&gt;&lt;PRE&gt;user@mypc:~/ncs-run/packages$ pyang vlan/src/yang/vlan.yang&lt;BR /&gt;vlan/src/yang/vlan.yang:5: warning: imported module ietf-inet-types not used&lt;BR /&gt;/home/user/nso/src/ncs/yang/ietf-yang-schema-mount.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/ietf-yang-schema-mount.yang:9: error: unexpected keyword "reference"&lt;BR /&gt;/home/user/nso/src/ncs/yang/ietf-yang-schema-mount.yang:15: error: unexpected keyword "reference"&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-cluster.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-common.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-compliance.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-customers.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-devices.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-devices.yang:3707: error: XPath function "derived-from-or-self" is not defined in the XPath context&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-devices.yang:3907: error: XPath function "derived-from-or-self" is not defined in the XPath context&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-java-vm.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-log.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-packages.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-plan.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-python-vm.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-service-progress-monitoring.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-services.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-smart-license.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-snmp-notification-receiver.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-software.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-ssh.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs.yang:2: error: bad value "1.1" (should be version)&lt;/PRE&gt;&lt;P&gt;Any insights will be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andre&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Nov 2019 08:04:27 GMT</pubDate>
    <dc:creator>Andre Castro</dc:creator>
    <dc:date>2019-11-06T08:04:27Z</dc:date>
    <item>
      <title>Yang modelling error - pyang</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/3953611#M4476</link>
      <description>&lt;P&gt;Dear friends,&lt;/P&gt;&lt;P&gt;I'm a beginner on NSO services modelling and running into an issue while trying to run pyang against a yang file - described in one of the NSO lab guides.&lt;/P&gt;&lt;P&gt;NSO version is 5.1&lt;/P&gt;&lt;P&gt;Pyang 1.5, but also tried 1.7.8 and 2.1. Got the same errors though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module vlan {
  namespace "http://com/example/vlan";
  prefix vlan;

  import ietf-inet-types {
    prefix inet;
  }
  import tailf-ncs {
    prefix ncs;
  }
  import tailf-common{
	prefix tailf;
  }
  description
	"Description...";
	
	revision 2019-11-05 {
		description
		"Initial revision";
	}
	augment /ncs:services{
		  list vlan {
			tailf:info "VLAN Service";
			key name;
			unique vlan-id;

			uses ncs:service-data;
			ncs:servicepoint "vlan";

			leaf name {
			  tailf:info "Service Instance Name";
			  type string;
			}
			leaf vlan-id{
				tailf:info "Unique VLAN ID";
				type uint32{
					range "1..4096";
				}
			}
			list device{
				tailf:info "L3 switch";
				key name;
				leaf name{
					tailf:info "Device name";
					type leafref{
						path "/ncs:devices/ncs:device/ncs:name";
					}
				}
			}
			list interface{
				tailf:info "Ethernet interface";
				key "intf-type intf-id";
				leaf intf-type{
					tailf:info "Ethernet interface type";
					type enumeration{
						enum Ethernet;
						enum FastEthernet;
						enum GigabitEthernet;
					}
				}
				leaf intf-id{
					tailf:info "Ethernet interface ID";
					type string;
				}
			}
		}
	}
}&lt;/PRE&gt;&lt;P&gt;Errors:&lt;/P&gt;&lt;PRE&gt;user@mypc:~/ncs-run/packages$ pyang vlan/src/yang/vlan.yang&lt;BR /&gt;vlan/src/yang/vlan.yang:5: warning: imported module ietf-inet-types not used&lt;BR /&gt;/home/user/nso/src/ncs/yang/ietf-yang-schema-mount.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/ietf-yang-schema-mount.yang:9: error: unexpected keyword "reference"&lt;BR /&gt;/home/user/nso/src/ncs/yang/ietf-yang-schema-mount.yang:15: error: unexpected keyword "reference"&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-cluster.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-common.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-compliance.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-customers.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-devices.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-devices.yang:3707: error: XPath function "derived-from-or-self" is not defined in the XPath context&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-devices.yang:3907: error: XPath function "derived-from-or-self" is not defined in the XPath context&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-java-vm.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-log.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-packages.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-plan.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-python-vm.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-service-progress-monitoring.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-services.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-smart-license.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-snmp-notification-receiver.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-software.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs-ssh.yang:2: error: bad value "1.1" (should be version)&lt;BR /&gt;/home/user/nso/src/ncs/yang/tailf-ncs.yang:2: error: bad value "1.1" (should be version)&lt;/PRE&gt;&lt;P&gt;Any insights will be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andre&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 08:04:27 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/3953611#M4476</guid>
      <dc:creator>Andre Castro</dc:creator>
      <dc:date>2019-11-06T08:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Yang modelling error - pyang</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/3954013#M4478</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in theory starting release 1.7 pyang should support YANG 1.1 and so this should not be an issue (essentially this error comes from being check against the re_version regex:&amp;nbsp;&lt;A href="https://github.com/mbj4668/pyang/blob/b7264db134929809c9749aed700f187ee4973482/pyang/syntax.py#L112" target="_blank"&gt;https://github.com/mbj4668/pyang/blob/b7264db134929809c9749aed700f187ee4973482/pyang/syntax.py#L112&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However what could be happening is the following: when you source ncsrc then it inserts pyang version 1.5 in your path (look at `which pyang`) and it won't necessary use the version you have installed on your system but the version that is shipped with NSO.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;user@/tmp$ which pyang
/usr/local/bin/pyang
user@/tmp$ pyang --version
user@/tmp$ source /var/nso-5.2.1/ncsrc
user@/tmp$ which pyang
/var/nso-5.2.1/bin/pyang
user@/tmp$ pyang --version&lt;BR /&gt;pyang 1.5&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In theory the error reported for yang 1.1 models should not be there in pyang &amp;gt;= 1.7 - regarding why pyang is not changed in newer NSO version have a look at this:&amp;nbsp;&lt;A href="https://www.tail-f.com/alternatives-to-pyang-tool/" target="_blank"&gt;https://www.tail-f.com/alternatives-to-pyang-tool/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 14:05:16 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/3954013#M4478</guid>
      <dc:creator>gmuloche</dc:creator>
      <dc:date>2019-11-06T14:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Yang modelling error - pyang</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/4117956#M5469</link>
      <description>Eventually gave up from version 5.1.. Tried to work back with version 4.7 and worked as expected..</description>
      <pubDate>Mon, 13 Jul 2020 21:13:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/4117956#M5469</guid>
      <dc:creator>Andre Castro</dc:creator>
      <dc:date>2020-07-13T21:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Yang modelling error - pyang</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/4490814#M6625</link>
      <description>&lt;P&gt;Please try under commands on NSO 5.1 version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yanger [yangfilename].yang&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NSO uses yanger to validate yang file for latest nso versions.&lt;/P&gt;
&lt;P&gt;pyang is deprecated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 16:35:13 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/yang-modelling-error-pyang/m-p/4490814#M6625</guid>
      <dc:creator>jaheo</dc:creator>
      <dc:date>2021-10-22T16:35:13Z</dc:date>
    </item>
  </channel>
</rss>

