Found two errors when trying to delete config:
1.When tried to delete a neighbor in router BGP, an error occured:
File "/Users/Muyiwhy/Documents/workspace/ydk_bgp/backend/util.py", line 56, in delete
crud.delete(provider, object)
File "/Users/Muyiwhy/virtualenv/ydk_new/lib/python2.7/site-packages/ydk/services/crud_service.py", line 87, in delete
------
entity_ns = entity.i_meta.namespaces
AttributeError: '_MetaInfoClass' object has no attribute 'namespaces'
Have tried XRV6.1.2 with YDK6.1.2 and XRV6.1.3 with YDK6.2.1. The error come up in both environment.
Changed the code in _provider_plugin.py line 546 to
def _encode_empty(self, root, entity, member):
try:
entity_ns = entity.i_meta.namespaces
except:
entity_ns = None
empty_ns = _yang_ns._namespaces[member.module_name]
NSMAP = {}
if entity_ns is not None and entity_ns != empty_ns:
NSMAP[None] = empty_ns
member_elem = etree.SubElement(root, member.name, nsmap=NSMAP)
and the error disappered. I'm not sure if there are any risk in this.
2.When tried to delete a community-set, an error occured:
File "/Users/Muyiwhy/Documents/workspace/ydk_bgp/backend/util.py", line 56, in delete
crud.delete(provider, object)
File "/Users/Muyiwhy/virtualenv/ydk_new/lib/python2.7/site-packages/ydk/services/crud_service.py", line 86, in delete
----
__import__(name)
This error only happend in XRV6.1.3 with YDK6.2.1, didn't happend in XRV6.1.2 with YDK6.1.2.
Changed the code in meta_service.py line 87 to
def get_active_deviation_tables(cls, capabilities, entity):
""" Return active deviation tables
Args:
cls: First argument for class method
capabilities: List of capabilities get from provider
enttiy: An instance of YDk object
Returns:
deviation_tables: A dictionary for deviation tables
"""
active_pmodule_names = _get_active_deviation_module_names(capabilities, entity)
deviation_tables = {}
for pname in active_pmodule_names:
try:
module = importlib.import_module('ydk.models._deviate._%s' % pname)
deviation_table = getattr(module, '_deviation_table')
deviation_tables[pname] = deviation_table
except:
continue
return deviation_tables
and the error disappered.
Is there a way to solve these error without changing the source code..
For the first error, I think it is a bug(maybe a typo, see here), sorry about that.
For the second error:
This error only happend in XRV6.1.3 with YDK6.2.1, didn't happend in XRV6.1.2 with YDK6.1.2.
YDK6.2.1( guess you are referring to this pypi package) is missing deviation models advertised in XRV6.1.3, maybe a better way to solve this issue is to generate and install a Python package for XRV6.1.3 with a profile file specific for this device(for example 6.2.1 profile file is for XRV6.2.1, and it uses YANG models published for XRV6.2.1, and is used to generate YDK6.2.1). Once you have a 6.1.3 profile, you could follow steps in ydk-gen repository, generate package then install package for 6.1.3(maybe in a different environment):
ydk-gen $ ./generate.py --bundle profiles/bundle/cisco-ios-xr_6_1_3.json
ydk-gen $ pip install gen-api/python/cisco_ios_xr-bundle/dist/ydk*.gz
The second issue should correspond to:
Comments
0 comments
Please sign in to leave a comment.