CZ-NIC / yangson

GNU Lesser General Public License v3.0
53 stars 20 forks source link

yangson crash at deviation statement #110

Closed JWestling closed 3 years ago

JWestling commented 3 years ago

I get this crash when running yangson:

$ yangson -p ../yang/ yang-modules.json
Traceback (most recent call last):
  File "/tmp/venv39/bin/yangson", line 8, in <module>
    sys.exit(main())
  File "/tmp/venv39/lib/python3.9/site-packages/yangson/__main__.py", line 112, in main
    dm = DataModel(yl, tuple(sp.split(":")))
  File "/tmp/venv39/lib/python3.9/site-packages/yangson/datamodel.py", line 85, in __init__
    self._build_schema()
  File "/tmp/venv39/lib/python3.9/site-packages/yangson/datamodel.py", line 208, in _build_schema
    self.schema._deviation_stmt(dev, sctx)
  File "/tmp/venv39/lib/python3.9/site-packages/yangson/schemanode.py", line 714, in _deviation_stmt
    target._apply_deviate(dstmt, sctx)
  File "/tmp/venv39/lib/python3.9/site-packages/yangson/schemanode.py", line 195, in _apply_deviate
    method = getattr(self, "_deviate_" +
AttributeError: 'LeafListNode' object has no attribute '_deviate_notifiable_state-data'

I believe that it is this deviation statement that is causing the crash:

    deviation /me3gpp:ManagedElement {
      deviate add {
        notife:notifiable-state-data true;
      }
    }

Any ideas what the problem might be?

llhotka commented 3 years ago

Hmm, notife:notifiable-state-data is an extension, right? As long as Yangson doesn't recognize this extension, this deviation statement is useless. However, Yangson shouldn't crash, just do nothing, I will fix this.

JWestling commented 3 years ago

yes, it is an extension. I think not crashing is good enough for me. I only what to be able to do other instance data validation and dont care about the extension.

llhotka commented 3 years ago

Fixed in e5a1ef40 (PyPI version 1.4.10)

JWestling commented 3 years ago

Thanks! I can confirm that it is not crashing with yangson-1.4.10.