Skip to content

Add support to pyangbind for "action" statement #210

@nickweeds

Description

@nickweeds

If the Yang module contains a Yang 1.1 action statement then pyang bind fails with a TypeError.

For example, running pyang bind on the ietf-routing.yang module in RFC 8349 fails as follows:

$ pyang --plugindir $PYBINDPLUGIN -f pybind -o ietf-routing.py ietf-routing.yang
Traceback (most recent call last):
  File "/usr/bin/pyang", line 444, in <module>
    run()
  File "/usr/bin/pyang", line 413, in run
    emit_obj.emit(ctx, modules, fd)
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 203, in emit
    build_pybind(ctx, modules, fd)
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 419, in build_pybind
    get_children(ctx, fd, children, m, m)
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 760, in get_children
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 1456, in get_element
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 760, in get_children
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 1456, in get_element
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 760, in get_children
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 1456, in get_element
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 760, in get_children
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 1456, in get_element
    register_paths=register_paths,
  File "/data/npw/tmp/pyangbind/pyangbind/plugin/pybind.py", line 820, in get_children
    raise TypeError("unhandled keyword with children %s at %s" % (parent.keyword, parent.pos))
TypeError: unhandled keyword with children action at ietf-routing.yang:469

[This output is from running pyangbind master commit bcb1d86]

It would be preferable to ignore action statements and generate the rest of the Python code, or to support action statements in a similar fashion to RPCs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions