cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2082
Views
5
Helpful
4
Replies

BGP Attribute Error

crench92
Spotlight
Spotlight

I'm using the newest available docker image of ydk-py.  I'm using a script that takes in a YAML representation of YANG modeled configuration.  When I try applying a router id for BGP, it says the attribute doesn't exist even though the YANG model suggests it does.  Can anyone see something I'm doing wrong?  

 

YANG path attached

YAML File attached

python recursion code at error attached

Error attached

 

 

1 Accepted Solution

Accepted Solutions

abhirame
Cisco Employee
Cisco Employee
Looking at your YAML files, it seems you are mixing YANG and python attributes somehow. You should only use the python attribute names like “router_id”. Please refer to the documentation: http://ydk.cisco.com/py/docs/ydk.models.cisco_ios_xe.html to find the python classes/attributes corresponding to your YANG

View solution in original post

4 Replies 4

abhirame
Cisco Employee
Cisco Employee
Looking at your YAML files, it seems you are mixing YANG and python attributes somehow. You should only use the python attribute names like “router_id”. Please refer to the documentation: http://ydk.cisco.com/py/docs/ydk.models.cisco_ios_xe.html to find the python classes/attributes corresponding to your YANG

Thanks a lot.  I was putting dashes in the fields based on what it looked like in the pyang output of the YANG model versus what is expected in the attached API document which are underscores.

I fixed the YAML to underscores but now I get the following:

 

root@2fbb1af0ab2a:~/ydk-py/yang/yaml-101# python 1_send_yaml.py bgp bgp.yaml
Traceback (most recent call last):
File "1_send_yaml.py", line 32, in <module>
sys.exit(main())
File "1_send_yaml.py", line 24, in main
interface = YdkModel(args.model, data_parsed)
File "/root/ydk-py/yang/yaml-101/ydk_yaml.py", line 43, in __init__
instantiate(self.binding, k, v)
File "/root/ydk-py/yang/yaml-101/ydk_yaml.py", line 21, in instantiate
instantiate(container_instance, k, v, action='assign')
File "/root/ydk-py/yang/yaml-101/ydk_yaml.py", line 12, in instantiate
getattr(binding, model_key).append(instantiate(binding, model_key, el, action='return'))
File "/root/ydk-py/yang/yaml-101/ydk_yaml.py", line 21, in instantiate
instantiate(container_instance, k, v, action='assign')
File "/root/ydk-py/yang/yaml-101/ydk_yaml.py", line 12, in instantiate
getattr(binding, model_key).append(instantiate(binding, model_key, el, action='return'))
File "/usr/local/lib/python2.7/dist-packages/ydk/types/py_types.py", line 621, in append
self._log_error_and_raise_exception(msg, YInvalidArgumentError)
File "/usr/local/lib/python2.7/dist-packages/ydk/types/py_types.py", line 459, in _log_error_and_raise_exception
raise exception_class(msg)
ydk.errors.YInvalidArgumentError: Argument <class 'ydk.types.py_types.YList'> is not supported by YList class; data ignored

 

Not sure what it doesn't like here.

This looks like your YAML file is doing something that the YList class does not like. It may be trying to somehow trying to create a YList.

Please check the ydk-py-samples for examples on how to use YDK objects: https://github.com/CiscoDevNet/ydk-py-samples/tree/master/samples/basic/crud/models/cisco-ios-xe/Cisco-IOS-XE-native/native.

For how to use YAML, please check their documentation or try something like stackoverflow etc. I do not know YAML so I cannot comment on how you might debug or fix this error. Sorry