tail-f-systems / JNC

JNC (Java NETCONF Client) is the name of a Java library for communicating with NETCONF agents, and a plugin for pyang (http://code.google.com/p/pyang/) to generate Java classes from YANG models, to be used by the JNC library.
Other
77 stars 87 forks source link

pyang_jnc : Convert multiple yang files at once #138

Open tsoihim opened 1 year ago

tsoihim commented 1 year ago

Hi, I'm trying to convert multiple yang files to java classes using pyang_jnc. The yang files include many "include" and "augment" statements.

I checked that pyang_jnc works perfectly on a single yang file as below.

Shell tsoihim@dev:yang-models pyang --path ./hfr -f jnc --jnc-output ./test ./hfr/hfr-rd-vlans.yang WARNING: No "src" in output directory path, defaulting to "src/gen".%
tsoihim@dev:yang-models ls src/gen hfrRdEthernet hfrRdTypes hfrRdVlans ianaIfType ietfInterfaces ietfYangTypes

However, I faced the error below when I tried to convert multiple yang files at once.

Shell tsoihim@dev:yang-models pyang --path ./hfr -f jnc --jnc-output ./test ./hfr/*.yang
WARNING: No "src" in output directory path, defaulting to "src/gen".too many files to convert

I found that "multiple_modules" is set to False in JNCPlugin class, so i wonder if pyang_jnc doesn't support converting multiple yang files at once.

Please let me know if there is a way to convert multiple yang files at once.

micnovak commented 1 year ago

Please, can you clarify, if you are referring to JncPyangPlugin for gradle or to something else? The JncPyangTask takes inputFiles, which is a list. You can resolve the (using wildcards) list in your build.gradle. E.g. with https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileTree.html.

Sorry, now I see you meant pyang plugin, not gradle plugin (even though using gradle plugin can solve your issue with wildcards).