cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
728
Views
5
Helpful
5
Replies

Error during generating .java classes for yang files using jnc

shvishnu
Cisco Employee
Cisco Employee

Hello,

We are seeing below errors when trying to generate .java classes from yang files using jnc

pyang -f jnc --jnc-output src/gen
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 800, in _search
iterate(stmt.i_children, acc)
AttributeError: i_children

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 552, in pairwise
item = next(iterator) # throws StopIteration if empty.
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/bin/pyang", line 493, in
run()
File "/usr/local/bin/pyang", line 462, in run
emit_obj.emit(ctx, modules, fd)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 208, in emit
self.generate_from(module)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 247, in generate_from
generator.generate()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 998, in generate
self.generate_classes()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1097, in generate_classes
child_generator.generate()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1000, in generate
self.generate_class()
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1202, in generate_class
field = self.generate_child(ch)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1286, in generate_child
child_gen = MethodGenerator(sub, self.ctx)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 1884, in init
search(stmt, yangelement_stmts | leaf_stmts)]
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 804, in search
search(stmt, keywords, dict)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 802, in _search
iterate(stmt.substmts, acc)
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 779, in iterate
key = ' '.join([ch.keyword, camelize(ch.arg)])
File "/usr/local/lib/python3.8/dist-packages/pyang/plugins/jnc.py", line 589, in camelize
for character, next_character in iterator:
RuntimeError: generator raised StopIteration

Please help identify the exact error here. The error is seen for only a handful of yang files. For remaining yang files, the java classes are generated without any errors/warnings.

Thanks,
Shrikant

1 Accepted Solution

Accepted Solutions

shvishnu
Cisco Employee
Cisco Employee

Seems like the issue was with Python version(3.7). Followed the solution mentioned in link and the issue was fixed.

View solution in original post

5 Replies 5

jvikman
Cisco Employee
Cisco Employee

Do you get this error for any YANG model or is it some specific models that this happens with?

jvikman
Cisco Employee
Cisco Employee

Have you asked your question on https://github.com/tail-f-systems/JNC/issues ?

I had posted it on discussions page https://github.com/tail-f-systems/JNC/discussions/134
Now I posted on the issues page https://github.com/tail-f-systems/JNC/issues/135

Thank you

shvishnu
Cisco Employee
Cisco Employee

I got this error for a few of the yang models like tailf-ncs.yang. Other yang models are being converted to POJO just fine.

shvishnu
Cisco Employee
Cisco Employee

Seems like the issue was with Python version(3.7). Followed the solution mentioned in link and the issue was fixed.