cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
910
Views
0
Helpful
2
Replies

get_config error with Openconfig models

Hello,

 

I am currently trying to retrieve the configuration using the get_config method from the NetconfService.

 

Below are the different exception while using the get_config method with different read_filters

 

  • openconfig_interfaces
interfaces = openconfig_interfaces.Interfaces()
output = d.get_config(sp_instance, interfaces)
---------------------------------------------------------------------------
YCoreError                                Traceback (most recent call last)
<ipython-input-49-3539478d375b> in <module>
----> 1 output = d.get_config(sp_instance, interfaces)

~/devapp_unit_test/src/ipnd_devapp/core/drivers/netconf_driver.py in get_config(self, sp_instance, read_filter)
     68
     69         try:
---> 70             output = self.netconf.get_config(sp_instance, source=Datastore.running, read_filter=read_filter)
     71             return output
     72         except YServiceError as yse:

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/services/netconf_service.py in get_config(self, provider, source, read_filter)
    113
    114         with _handle_error():
--> 115             result = self._ns.get_config(provider, source, filters)
    116         if isinstance(read_filter, EntityCollection):
    117             result = Config(result)

/usr/lib/python3.6/contextlib.py in __exit__(self, type, value, traceback)
     97                 value = type()
     98             try:
---> 99                 self.gen.throw(type, value, traceback)
    100             except StopIteration as exc:
    101                 # Suppress StopIteration *unless* it's the same exception that

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/errors/error_handler.py in handle_runtime_error()
     80     finally:
     81         if _exc:
---> 82             _raise(_exc)
     83
     84

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/errors/error_handler.py in _raise(exc)
     52     """
     53     if sys.version_info >= (3,3):
---> 54         exec("raise exc from None")
     55     else:
     56         raise exc

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/errors/error_handler.py in <module>

YCoreError:  YCodecError:Data model "urn:ietf:params:xml:ns:yang:iana-if-type" not found.. Path:
  • Entire running configuration
In [55]: output = d.get_config(sp_instance)
---------------------------------------------------------------------------
YCoreError                                Traceback (most recent call last)
<ipython-input-55-0dcc98205ffb> in <module>
----> 1 output = d.get_config(sp_instance)

~/devapp_unit_test/src/ipnd_devapp/core/drivers/netconf_driver.py in get_config(self, sp_instance, read_filter)
     68
     69         try:
---> 70             output = self.netconf.get_config(sp_instance, source=Datastore.running, read_filter=read_filter)
     71             return output
     72         except YServiceError as yse:

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/services/netconf_service.py in get_config(self, provider, source, read_filter)
    106         if read_filter is None:
    107             with _handle_error():
--> 108                 return _read_entities(provider, True, source)
    109
    110         filters = read_filter

/usr/lib/python3.6/contextlib.py in __exit__(self, type, value, traceback)
     97                 value = type()
     98             try:
---> 99                 self.gen.throw(type, value, traceback)
    100             except StopIteration as exc:
    101                 # Suppress StopIteration *unless* it's the same exception that

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/errors/error_handler.py in handle_runtime_error()
     80     finally:
     81         if _exc:
---> 82             _raise(_exc)
     83
     84

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/errors/error_handler.py in _raise(exc)
     52     """
     53     if sys.version_info >= (3,3):
---> 54         exec("raise exc from None")
     55     else:
     56         raise exc

~/.virtualenvs/netconf_driver/lib/python3.6/site-packages/ydk/errors/error_handler.py in <module>

YCoreError:  Couldn't fetch child entity 'keies' in parent /Cisco-IOS-XR-lib-keychain-cfg:keychains/keychain[chain-name='FOO']

The get_method works with other models like openconfig_bgp, Cisco_IOS_XR_clns_isis_cfg Cisco_IOS_XR_cdp_cfg.

 

I am testing these methods against a NCS55xx box running 6.3.3 but I currently have 6.5.1 packages installed.

 

ydk-packages installed

ydk                     0.7.3
ydk-models-cisco-ios-xr 6.5.1
ydk-models-ietf         0.1.5.post2
ydk-models-openconfig   0.1.6.post1

 

2 Replies 2

ygorelik
Cisco Employee
Cisco Employee

Hello Mufaddal

 

The yang models for XR 6.3.3 and 6.5.1 are different and therefore incompatible. In particular case the modules Cisco-IOS-XR-lib-keychain-cfg.yang are different. Apparently the container name keys was misspelled and corrected in 6.5.1:

 

XR 6.3.3

      container keies {

        description

          "Configure a Key";

        list key {

 

   container macsec-keychain {

        presence "Indicates a macsec-keychain node is configured.";

        description

          "Name of the key chain for MACSec";

        container macsec-keies {

          description

            "Configure a Key";

 

XR 6.5.1

      container keys {

        description

          "Configure a Key";

        list key {

          key "key-id";

 

      container macsec-keychain {

        description

          "Name of the key chain for MACSec";

        container macsec-keys {

          description

            "Configure a Key";

 

So you need to use model bundle, which corresponds to your router’s software version.

How to do that? Well, unfortunately we have backward compatibility issues between YDK core and bundle releases.

In first iteration I would suggest you to use ydk-models-cisco-ios-xr 6.3.2 with YDK-0.7.1 .

 

If that is not working or you are tied to YDK-0.7.3, please let me know. We will find alternative solution.

 

Thanks and regards,

Yan

 

Thanks Yan.

 

I have found quite a few validation errors in openconfig-interfaces and openconfig-lldp which I have taken with the HTTS support which has been quite helpful for fixing the issue via a SMU.

 

Regards