cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1350
Views
2
Helpful
3
Replies

Native NX-OS support in YDK 0.7.2

saalvare
Cisco Employee
Cisco Employee

ydk-white-256.png

Since its introduction, YDK has supported Cisco NX-OS devices through OpenConfig models.  Starting with version 0.7.2, YDK supports the new NX-OS model bundle which is available in all the currently supported languages (Python, C++ and Go).

You can now automate the configuration of NX-OS platforms using all the options available in its native YANG model and still benefit from simpler and more powerful model-driven programmability through:

  • Model, protocol, encoding and transport abstraction:  No need to be a YANG expert, no need to code protocol, encoding or transport specifics.
  • Built-in validation: Automatically validate data (config or operational) against the data model without having to code any validation logic.

If you're new to YDK, you may want to read our introductory blog or watch the NANOG 68 introduction to model-driven SDKs.  You can also take a look at YDK and Model-Driven Programmability with Python (BRKDEV-2632) if you have access to the Cisco Live on-demand library.

Looking for more resources?  Visit YDK.io

Happy coding!

3 Replies 3

Cathal Mooney
Level 1
Level 1

Thanks for this!

I'm new to YDK and after struggling a bit have managed to get it installed on Ubuntu 18.04 (tip install from source).

Are there any example scripts (like say the 'hello world') that operate using this module?  I've had some difficulty getting it going.

Right now I can see that my script connects, but it does not seem to like the data that comes back from Cisco_NX_OS_device.System().  Error message like this right now:

ydk.errors.YModelError:  Value "0" does not satisfy the constraint "1..100" (range, length, or pattern). Path: /Cisco-NX-OS-device:System/ch-items/lcslot-items/LCSlot-list[id='1']/lc-items/splc-items/id

I'm on 7.0-3-I7-3, 93180YC-EX device.  The Yang model in ~/.ydk is for 7.0-3-I7-3, (for some reason I had to manually download there to make it work).  If I query manually I can see the '0' being returned at this location:

<rpc-reply message-id="urn:uuid:dbcba8f4-e23a-4277-8a58-16d8689d2c20" xmlns:vlan_mgr_cli="http://www.cisco.com/nxos:1.0:vlan_mgr_cli" xmlns:nfcli="http://www.cisco.com/nxos:1.0:nfcli" xmlns:nxos="http://www.cisco.com/nxos:1.0" xmlns:if="http://www.cisco.com/nxos:1.0:if_manager" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

  <data>

    <System xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">

      <ch-items>

        <lcslot-items>

          <LCSlot-list>

            <id>1</id>

            <lc-items>

              <splc-items>

                <id>0</id>

              </splc-items>

            </lc-items>

          </LCSlot-list>

        </lcslot-items>

      </ch-items>

    </System>

  </data>

</rpc-reply>

Hi,

You need to copy the yang model(s) to ~/.ydk for now as get-schema RPC of ietf-netconf-monitoring is not yet supported. I think this should be supported soon.

Also, this validation error is a known issue. The XML returned by the device does not match YANG model. To work around this, you could edit the YANG model in ~/.ydk and change the range from

1..100

to

0..100

Many thanks for your response Abhirame.

I did actually edit the YANG model manually, but it hit a similar error with something else.  But thank you for the confirmation, now that I know that is what it is I will persevere, as long as there are not too many manual edits required I should be ok.

Best,

Cathal.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: