<?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 get-schema - nxos - always return module Cisco-NX-OS-device in Tools</title>
    <link>https://community.cisco.com/t5/tools/get-schema-nxos-always-return-module-cisco-nx-os-device/m-p/4553955#M1486</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Cisco 9500v virtual switch in a KVM virtual machine, details from &lt;STRONG&gt;`show version`:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Nexus 9000v is a demo version of the Nexus Operating System

Software
  BIOS: version
  NXOS: version 10.2(2) [Feature Release]
  BIOS compile time:
  NXOS image file is: bootflash:///nxos64-cs.10.2.2.F.bin
  NXOS compile time:  12/14/2021 23:00:00 [12/15/2021 11:59:34]

Hardware
  cisco Nexus9000 C9500v Chassis ("Supervisor Module")
  Intel Core Processor (Skylake, IBRS) with 12273672 kB of memory.
  Processor Board ID 9KFQI9MZKOE
  Device name: switch
  bootflash:    4287040 kB&lt;/PRE&gt;&lt;P&gt;I activated openconfig moduels by running &lt;STRONG&gt;`install activate mtx-openconfig-all`&lt;/STRONG&gt; and I can see lots of openconfig modules in capabilities.&lt;/P&gt;&lt;PRE&gt;$&amp;nbsp;ssh -i netconf -s netconf@192.168.24.21 -p 830 netconf&lt;BR /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&amp;gt;
    &amp;lt;capabilities&amp;gt;
        &amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.0&amp;lt;/capability&amp;gt;
        &amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.1&amp;lt;/capability&amp;gt;
&amp;lt;-- SNIP --&amp;gt;
        &amp;lt;capability&amp;gt;http://openconfig.net/yang/interfaces?revision=2019-11-19&amp;amp;amp;module=openconfig-interfaces&amp;amp;amp;deviations=cisco-nx-openconfig-interfaces-deviations&amp;lt;/capability&amp;gt; 
&amp;lt;-- SNIP --&amp;gt;&lt;BR /&gt;    &amp;lt;/capabilities&amp;gt;
    &amp;lt;session-id&amp;gt;952341788&amp;lt;/session-id&amp;gt;
&amp;lt;/hello&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote this test script to extract module &lt;STRONG&gt;`openconfig-interfaces` &lt;/STRONG&gt;yang document:&lt;/P&gt;&lt;PRE&gt;with manager.connect(**device) as m:
    schema = m.get_schema('openconfig-interfaces')
    with open('/root/netconf-examples/openconfig-interfaces.yang', 'w') as f:
        f.write(schema.data)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code run without error. &lt;STRONG&gt;But&lt;/STRONG&gt;, the resulting yang is not the correct module.&lt;/P&gt;&lt;P&gt;No matter what identified I provide get_schema() it will return the &lt;STRONG&gt;`Cisco-NX-OS-device`&lt;/STRONG&gt; module.&lt;/P&gt;&lt;PRE&gt;$ head -n 8 openconfig-interfaces.yang 
module Cisco-NX-OS-device {
    yang-version 1;
    namespace "http://cisco.com/ns/yang/cisco-nx-os-device";
    prefix top;
    organization "Cisco Systems, Inc.";
    contact " Cisco Systems, Inc., Customer Service, Postal: 170 W Tasman Drive, San Jose, CA 95134, Tel: +1 800 553-NETS, e-mail: cs-yang@cisco.com";
    description "NXOS Device YANG Model";
    reference "101c510e055a9240f03d2219ab4f027848e946d4";&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- If I give it an invalid module identifier, `RPCError: Identifier is not valid` is raised.&lt;/P&gt;&lt;P&gt;&amp;nbsp;- All valid identifier the returned yang document is always the &lt;STRONG&gt;`Cisco-NX-OS-device`&lt;/STRONG&gt; module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Other operations using `openconfig-interfaces` such as retrieving and setting configuration works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is the device returning the &lt;U&gt;incorrect&lt;/U&gt; yang documents?&lt;/P&gt;&lt;P&gt;Is there anything I may have missed to configure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Feb 2022 22:50:27 GMT</pubDate>
    <dc:creator>hjensas</dc:creator>
    <dc:date>2022-02-16T22:50:27Z</dc:date>
    <item>
      <title>get-schema - nxos - always return module Cisco-NX-OS-device</title>
      <link>https://community.cisco.com/t5/tools/get-schema-nxos-always-return-module-cisco-nx-os-device/m-p/4553955#M1486</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Cisco 9500v virtual switch in a KVM virtual machine, details from &lt;STRONG&gt;`show version`:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Nexus 9000v is a demo version of the Nexus Operating System

Software
  BIOS: version
  NXOS: version 10.2(2) [Feature Release]
  BIOS compile time:
  NXOS image file is: bootflash:///nxos64-cs.10.2.2.F.bin
  NXOS compile time:  12/14/2021 23:00:00 [12/15/2021 11:59:34]

Hardware
  cisco Nexus9000 C9500v Chassis ("Supervisor Module")
  Intel Core Processor (Skylake, IBRS) with 12273672 kB of memory.
  Processor Board ID 9KFQI9MZKOE
  Device name: switch
  bootflash:    4287040 kB&lt;/PRE&gt;&lt;P&gt;I activated openconfig moduels by running &lt;STRONG&gt;`install activate mtx-openconfig-all`&lt;/STRONG&gt; and I can see lots of openconfig modules in capabilities.&lt;/P&gt;&lt;PRE&gt;$&amp;nbsp;ssh -i netconf -s netconf@192.168.24.21 -p 830 netconf&lt;BR /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&amp;gt;
    &amp;lt;capabilities&amp;gt;
        &amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.0&amp;lt;/capability&amp;gt;
        &amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.1&amp;lt;/capability&amp;gt;
&amp;lt;-- SNIP --&amp;gt;
        &amp;lt;capability&amp;gt;http://openconfig.net/yang/interfaces?revision=2019-11-19&amp;amp;amp;module=openconfig-interfaces&amp;amp;amp;deviations=cisco-nx-openconfig-interfaces-deviations&amp;lt;/capability&amp;gt; 
&amp;lt;-- SNIP --&amp;gt;&lt;BR /&gt;    &amp;lt;/capabilities&amp;gt;
    &amp;lt;session-id&amp;gt;952341788&amp;lt;/session-id&amp;gt;
&amp;lt;/hello&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote this test script to extract module &lt;STRONG&gt;`openconfig-interfaces` &lt;/STRONG&gt;yang document:&lt;/P&gt;&lt;PRE&gt;with manager.connect(**device) as m:
    schema = m.get_schema('openconfig-interfaces')
    with open('/root/netconf-examples/openconfig-interfaces.yang', 'w') as f:
        f.write(schema.data)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code run without error. &lt;STRONG&gt;But&lt;/STRONG&gt;, the resulting yang is not the correct module.&lt;/P&gt;&lt;P&gt;No matter what identified I provide get_schema() it will return the &lt;STRONG&gt;`Cisco-NX-OS-device`&lt;/STRONG&gt; module.&lt;/P&gt;&lt;PRE&gt;$ head -n 8 openconfig-interfaces.yang 
module Cisco-NX-OS-device {
    yang-version 1;
    namespace "http://cisco.com/ns/yang/cisco-nx-os-device";
    prefix top;
    organization "Cisco Systems, Inc.";
    contact " Cisco Systems, Inc., Customer Service, Postal: 170 W Tasman Drive, San Jose, CA 95134, Tel: +1 800 553-NETS, e-mail: cs-yang@cisco.com";
    description "NXOS Device YANG Model";
    reference "101c510e055a9240f03d2219ab4f027848e946d4";&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- If I give it an invalid module identifier, `RPCError: Identifier is not valid` is raised.&lt;/P&gt;&lt;P&gt;&amp;nbsp;- All valid identifier the returned yang document is always the &lt;STRONG&gt;`Cisco-NX-OS-device`&lt;/STRONG&gt; module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Other operations using `openconfig-interfaces` such as retrieving and setting configuration works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is the device returning the &lt;U&gt;incorrect&lt;/U&gt; yang documents?&lt;/P&gt;&lt;P&gt;Is there anything I may have missed to configure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 22:50:27 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/get-schema-nxos-always-return-module-cisco-nx-os-device/m-p/4553955#M1486</guid>
      <dc:creator>hjensas</dc:creator>
      <dc:date>2022-02-16T22:50:27Z</dc:date>
    </item>
  </channel>
</rss>

