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 suport for anydata and anyxml statements #141

Open
lgifre opened this issue Aug 29, 2017 · 1 comment
Open

Add suport for anydata and anyxml statements #141

lgifre opened this issue Aug 29, 2017 · 1 comment

Comments

@lgifre
Copy link
Contributor

lgifre commented Aug 29, 2017

Hi Rob,

While generating bindings for a model in RFC 8040 Section 8 (https://tools.ietf.org/html/rfc8040#section-8), pyangbind is reporting an exception that seem to be a bug. The model (simplified by removing non-relevant parts) is listed below. The same exception is raised when you use anyxml instead of anydata.

module model {
	yang-version 1.1;
	namespace "test:model";
	prefix "m";

	container error {
		anydata error-info;
		//anyxml error-info;
	}
}

I'm generating the bindings using:

export PYBINDPLUGIN=`/usr/bin/env python -c 'import pyangbind; import os; print "%s/plugin" % os.path.dirname(pyangbind.__file__)'`
pyang --plugindir /usr/local/lib/python2.7/dist-packages/pyangbind/plugin -f pybind -o bindings.py model.yang

And pyangbind raises the next exception. Pyangbind raises the same exception when your model contains anyxml instead of anydata:

Traceback (most recent call last):
  File "/usr/local/bin/pyang", line 444, in <module>
    run()
  File "/usr/local/bin/pyang", line 413, in run
    emit_obj.emit(ctx, modules, fd)
  File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 224, in emit
    build_pybind(ctx, modules, fd)
  File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 426, in build_pybind
    get_children(ctx, fd, children, m, m)
  File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 742, in get_children
    parent_cfg=parent_cfg, choice=choice, register_paths=register_paths)
  File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 1408, in get_element
    choice=choice, register_paths=register_paths)
  File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 742, in get_children
    parent_cfg=parent_cfg, choice=choice, register_paths=register_paths)
  File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 1460, in get_element
    element.search_one('type')))
  File "/usr/local/lib/python2.7/dist-packages/pyangbind/plugin/pybind.py", line 1150, in build_elemtype
    pattern_stmt = et.search_one('pattern') if not et.search_one('pattern') \
AttributeError: 'NoneType' object has no attribute 'search_one'

Could you check it, please?

TIA,
Lluís

@JoseIgnacioTamayo JoseIgnacioTamayo changed the title AttributeError with anydata and anyxml statements Add suport for anydata and anyxml statements Feb 23, 2024
@JoseIgnacioTamayo
Copy link
Collaborator

Update the Issue tiitle to reflect the intention.
Also, #284

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

2 participants