Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to pyangbind for "action" statement #210

Open
nickweeds opened this issue Jun 8, 2018 · 2 comments
Open

Add support to pyangbind for "action" statement #210

nickweeds opened this issue Jun 8, 2018 · 2 comments

Comments

@nickweeds
Copy link

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.

@marcokloeckler
Copy link

I also experienced that problem and did a quick and dirty fix. See here.
You just need to add action to a specific list. (here is the required addition)

I know this is a dirty fix, but the generation works and the actions are ignored (empty classes are created).

@JoseIgnacioTamayo JoseIgnacioTamayo changed the title pyang bind fails with TypeError on Yang action statement Add support to pyangbind for "action" statement Feb 23, 2024
@JoseIgnacioTamayo
Copy link
Collaborator

Updated the Title of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants