Me = stuck
Closed this issue · 3 comments
I am running into an issue with the compliance report, I bet it's me, but I am not able to identify what I am doing wrong.
Following the tutorial: https://github.com/napalm-automation/napalm-yang/blob/develop/interactive_demo/tutorial.ipynb, under the "Compliance Report" paragraph.
I paste this in my Python console:
>>> data = {
... "interfaces": {
... "interface":{
... "Et1": {
... "config": {
... "mtu": 9000
... },
... },
... "Et2": {
... "config": {
... "mtu": 1500
... }
... }
... }
... }
... }
>>> # We load a dict for convenience, any source will do
... config = napalm_yang.base.Root()
>>> config.add_model(napalm_yang.models.openconfig_interfaces())
>>> config.load_dict(data)
>>> report = config.compliance_report("/home/admin/validate.yml")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/napalm_yang/base.py", line 289, in compliance_report
return validate.compliance_report(self, validation_file=validation_file)
File "/usr/local/lib/python2.7/dist-packages/napalm_base/validate.py", line 158, in compliance_report
actual_results = getattr(cls, getter)(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/napalm_yang/base.py", line 181, in to_dict
r = _to_dict(v, filter)
File "/usr/local/lib/python2.7/dist-packages/napalm_yang/base.py", line 319, in _to_dict
result = _to_dict_container(element, filter)
File "/usr/local/lib/python2.7/dist-packages/napalm_yang/base.py", line 333, in _to_dict_container
r = _to_dict(v, filter)
File "/usr/local/lib/python2.7/dist-packages/napalm_yang/base.py", line 321, in _to_dict
result = _to_dict_list(element, filter)
File "/usr/local/lib/python2.7/dist-packages/napalm_yang/base.py", line 342, in _to_dict_list
for k, v in element.items():
AttributeError: 'YANGBaseClass' object has no attribute 'items'
>>>
>>> with open('/home/admin/validate.yml') as fopen:
... print(fopen.read())
...
---
- to_dict:
_kwargs:
filter: true
interfaces:
interface:
Et1:
config:
mtu: 9000
Et2:
config:
mtu: 9000
_mode: strict
>>>
I am running napalm-yang 0.0.6. Didin't want to bother @dbarrosop, as this isn't an emergency & perhaps I'm not the only one stuck at this point.
Any feedback is much appreciated, thanks!
That error is probably because you are not using the patched version of pyangbind
. Make sure you are using the one in the requirements file (patches are upstreamed but haven't been released yet).
Thanks a lot, @dbarrosop - I will give it a try!
I guess everything is fine so closing this one.