cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1898
Views
0
Helpful
1
Replies

Cant Connect NX-OS to OpenDayLight via NETCONF

hi, i follow the step on cisco learning labs Cisco DevNet Learning Labs to active the NETCONF on NX-OS. and its successful.

this is my output of getting list of YANG Files.

root@client:/python# ssh -p 830 admin@10.200.200.19 -s netconf

User Access Verification

Password:

<?xml version="1.0" encoding="UTF-8"?>

<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

    <capabilities>

        <capability>urn:ietf:params:netconf:base:1.0</capability>

        <capability>urn:ietf:params:netconf:base:1.1</capability>

        <capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability>

        <capability>urn:ietf:params:netconf:capability:rollback-on-error:1.0</capability>

        <capability>http://openconfig.net/yang/interfaces?revision=2016-05-26&module=openconfig-interfaces</capability>

        <capability>http://openconfig.net/yang/interfaces/ip?revision=2016-05-26&module=openconfig-if-ip</capability>

        <capability>http://openconfig.net/yang/local-routing?revision=2016-05-11&module=openconfig-local-routing</capability>

        <capability>http://openconfig.net/yang/vlan?revision=2016-05-26&module=openconfig-vlan</capability>

        <capability>http://www.cisco.com/yang/nxos-dev/top?revision=2017-02-17&module=top</capability>

    </capabilities>

    <session-id>227117149</session-id>

</hello>

]]>]]>

and this is my python files to get all the list, its working

from ncclient import manager

def get_capabilities(host, port, user, pwd):

    with manager.connect(host=host, port=port, username=user, password=pwd, hostkey_verify=False, device_params={'name': 'nexus'}) as m:

        capabilities =  m.server_capabilities

    return capabilities

def print_capabilities(c):

    file = open ("capability-nx-os.txt","w")

    for line in c:

        file.writelines(line+"\n")

x = get_capabilities ("10.200.200.19","830","admin","Tanjung814")

a = print_capabilities(x)

but when i try to get the YANG Files directly from the NX-OS devices, its cannot. this is my python files.

from ncclient import manager

import xml.etree.ElementTree as ET

m = manager.connect(host='10.200.200.19', port=830, username='admin',

                    password='Tanjung814', device_params={'name': 'nexus'})

schema = m.get_schema('openconfig-vlan')

xml_et = ET.fromstring(schema.xml)

yang = list(xml_et)[0].text

with open('openconfig-vlan.yang', 'w') as f:

     f.write(yang)

when running the files.

root@client:/python/nx-os# python getyang.py

Traceback (most recent call last):

  File "getyang.py", line 8, in <module>

    schema = m.get_schema('openconfig-vlan')

  File "/usr/local/lib/python2.7/dist-packages/ncclient/manager.py", line 162, in wrapper

    return self.execute(op_cls, *args, **kwds)

  File "/usr/local/lib/python2.7/dist-packages/ncclient/manager.py", line 232, in execute

    raise_mode=self._raise_mode).request(*args, **kwds)

  File "/usr/local/lib/python2.7/dist-packages/ncclient/operations/retrieve.py", line 129, in request

    return self._request(node)

  File "/usr/local/lib/python2.7/dist-packages/ncclient/operations/rpc.py", line 337, in _request

    raise self._reply.error

ncclient.operations.rpc.RPCError: Invalid or unsupported operation tag

root@client:/python/nx-os#

this error happen to when i try to connect NX-OS directly to OpenDayLight. the ODL cant download the YANG Files store in the NX-OS to the OpenDayLight cache/scheme folder. i try on SR1000V this script working. i dont know why this error on NX-OS. thanks

1 Reply 1

eckelcu
Cisco Employee
Cisco Employee

See discussion of same topic at Cant Get YANG Files on NX-OS