Hi, while trying to check data in Cisco_IOS_XR_ip_rib_ipv4_oper module getting error ydk.errors.YPYModelError: 0 already in list.
Traceback (most recent call last):
File "rib_oper.py", line 40, in <module>
rib_read = crud.read(provider, rib_oper)
File "/usr/local/lib/python3.5/dist-packages/ydk/services/crud_service.py", line 152, in read
return provider.decode(payload, read_filter)
---------------
results.append(result)
File "/usr/local/lib/python3.5/dist-packages/ydk/types.py", line 319, in append
raise YPYModelError("{} already in list".format(item))
ydk.errors.YPYModelError: 0 already in list
Could you clarify which version of the YDK you are using.
As to what is happening, you are not doing anything wrong. This is an issue in terms of how the YANG model is defined for the “labelstk” element of ipv4-rib-edm-path. This is defined as:
leaf-list labelstk {
type uint32;
max-elements "3";
description "Labels for this path";
}
However, if you look at the raw XML, you will see:
Even though it has no labels, IOS-XR is outputting the elements of an internal array. This set of values is illegal as a leaf-list must have only unique values on it. Will take this to the relevant development team and see if there is a workaround that can be applied to the YDK .
- we are using 0.5.3. and getting same error also for Cisco_IOS_XR_ipv4_bgp_oper model for different XR versions(5.3.4 and 6.1.2). Seems there is again some repeating af-array in bpm-nistance-table.bpm-instances.instance. Seems like some XR issue but would be great to address in YDK if it's issue of more models.
workaround is by removing that if condition from types.py append method.
def append(self, item):
# if item in self:
# raise YPYModelError("{} already in list".format(item))
lst_item = YListItem(item, self.parent, self.name)
super(YLeafList, self).append(lst_item)
You're running into an IOS XR defect in the RIB model (CSCvd43804). Similar issues have been found in BGP (CSCvb93609) and ISIS (CSCva02506) oper models. The latter already fixed in 6.1.2. The former will be fixed in 6.2.1 which should be available in a couple of week. We're tracking a YDK enhancement to facilitate access to the XML payload when invalid data is detected. See Include additional data in ydk exception · Issue #381 · CiscoDevNet/ydk-gen · GitHub.
Comments
0 comments
Please sign in to leave a comment.