cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1255
Views
0
Helpful
7
Replies

NetConf Getconfig error

Derek Peterson
Level 1
Level 1

Received the following error when running the below code and not sure how to troubleshoot it or see if it's a known bug on the code level I'm running on the switch or YDK library (any pointers on where to look for open bugs would be appreciated too).  

Error:

>>> native_model = netconf_service.get_config(nd_provider, Datastore.running)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dpeterson/NetAutomation/lib/python3.6/site-packages/ydk/services/netconf_service.py", line 108, in get_config
return _ns_get(provider, source, read_filter, self._ns.get_config)
File "/home/dpeterson/NetAutomation/lib/python3.6/site-packages/ydk/services/netconf_service.py", line 153, in _ns_get
return _read_entities(provider, get_config=is_config)
File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/home/dpeterson/NetAutomation/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error
_raise(_exc)
File "/home/dpeterson/NetAutomation/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 54, in _raise
exec("raise exc from None")
File "<string>", line 1, in <module>
ydk.errors.YCoreError: Couldn't fetch child entity 'cisco-ospf:redistribution' in parent /ietf-routing:routing/routing-instance[name='default']/routing-protocols/routing-protocol[type='ietf-ospf:ospfv2'][name='1']/ietf-ospf:ospf/instance[af='ietf-routing:ipv4']

 

Code:

 

from ydk.providers import NetconfServiceProvider
from ydk.services import NetconfService, Datastore
from ydk.models.cisco_ios_xe import Cisco_IOS_XE_native \
as xe_native
#
import json
import yaml


class network_device(object):
# The class "constructor" - It's actually an initializer
def __init__(self, hostname, ssh_port = 22, yang_port = 830, username = "dnac_admin", password = "******"):
self.hostname = hostname
self.ssh_port = ssh_port
self.yang_port = yang_port
self.username = username
self.password = password
self.protocol = "ssh"


device = network_device("172.19.247.222")
nd_provider = NetconfServiceProvider(address=device.hostname,
port=device.yang_port,
username=device.username,
password=device.password,
protocol = device.protocol)
netconf_service = NetconfService()
test = netconf_service.get_config(nd_provider, Datastore.running)

 

 

7 Replies 7

yangorelik
Spotlight
Spotlight
Could you please enable debug logging (see on ydk-gen github), repeat the test, and attach it to the post.
Yan Gorelik
YDK Solutions

Attached is the output I got, hopefully this fits the bill for what your looking for.  Thanks.

 

One follow up item, removing the ospf process allowed me to successfully get the config via Netconf.

I found this error in the log:

Data is invalid according to the yang model. Libyang error: Invalid keyword "[1-9][0-9]{1,2}|[1-9])\.\.(409[0-4]|"".
Data is invalid according to the yang model. Libyang error: Module "openconfig-vlan-types" parsing failed.

This error points to a bug in third party library libyang, which I have fixed yesterday. In order to get the fix you need recompile libydk and reinstall core components. Here is simplified procedure:

git clone -b 0.8.4 https://github.com/CiscoDevNet/ydk-gen.git
cd ydk-gen
./generate.py --core --cpp -is
./generate.py --core --python -is

 

Yan Gorelik
YDK Solutions

I'll try and get that going a little later today or tomorrow and validate the fix, thank you.  Out of curiosity (and not meaning to dogpile) but I will occasionally receive a segmentation fault when connecting to a switch.  It will typically clear out and I can't find a rhyme or reason but it seams like it's almost like the switch has to wake up or something and then it starts working.  I know that doesn't help but is it a known instance and possibly related to this library? Last couple of lines I see before error shown below.  If this is a separate topic just let me know and I'll create another post accordingly, thanks.

 

Going into child routing-protocol in parent /ietf-routing:routing/routing-instance[name='default']/routing-protocols
Looking for 'routing-protocol'
Created entity child 'routing-protocol' in parent '/ietf-routing:routing/routing-instance[name='default']/routing-protocols'
Looking at parent entity 'routing-protocol'
Looking at child leaf '/ietf-routing:routing/routing-instance[name='default']/routing-protocols/routing-protocol[type='ietf-routing:static'][name='1']/type'
Creating entity leaf 'type' of value 'ietf-routing:static' in parent '/ietf-routing:routing/routing-instance[name='default']/routing-protocols/routing-protocol[type='ietf-routing:static'][name='1']'
Created entity leaf 'type' of value 'ietf-routing:static' in parent '/ietf-routing:routing/routing-instance[name='default']/routing-protocols/routing-protocol[type='ietf-routing:static'][name='1']'
Looking at child leaf '/ietf-routing:routing/routing-instance[name='default']/routing-protocols/routing-protocol[type='ietf-routing:static'][name='1']/name'
Creating entity leaf 'name' of value '1' in parent '/ietf-routing:routing/routing-instance[name='default']/routing-protocols/routing-protocol[type='ietf-routing:static'][name='1']'
Created entity leaf 'name' of value '1' in parent '/ietf-routing:routing/routing-instance[name='default']/routing-protocols/routing-protocol[type='ietf-routing:static'][name='1']'
Segmentation fault (core dumped)

I have not seen such behavior. Could it be that C++ compiler version on your system is different from one that was used to create libydk and libydk_gnmi artifacts? The compiler type and versions, which were used to build artifacts are listed in the documentation on the GitHub. Hopefully this issue will be fixed after you recompile and reinstall YDK core components as suggested in previous post.
Yan Gorelik
YDK Solutions

So I went back through the installation process and I think I found that I have the wrong libssh library.  I'm running Ubuntu 18.04 and I'm not sure how to update the package (or downgrade it if recommended).  When I look around for the libssh package versions I see that 0.8.0 is for Ubuntu 18.04 (which I'm running) any quick pointers on how to get to a good release for libssh?  

 

(NetAutomation) dpeterson@Linux-DHCP:~$ apt list --installed | grep libssh

libssh-4/bionic-updates,bionic-security,now 0.8.0~20170825.94fa1e38-1ubuntu0.5 amd64 [installed]
libssh-dev/bionic-updates,bionic-security,now 0.8.0~20170825.94fa1e38-1ubuntu0.5 amd64 [installed]

The libssh installation is described here on the GitHub. Please make sure the system requirements are satisfied before the compilation.

Yan Gorelik
YDK Solutions
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: