[YANGTOOLS-15] Provide new Parser constructor Created: 12/Sep/13 Updated: 10/Apr/22 Resolved: 26/Sep/13 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | ||
| Reporter: | Christopher Hartley | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: Windows |
||
| Description |
|
What I need is an option like parseYangModels(File yangFile, File directory) Currently I need to do something like this this : List<File> yangFiles = new ArrayList<File>(); YangModelParser parser = new YangParserImpl(); Of course hard-coding won't work, so otherwise I'll need to parse each Yang file and compute the import transitive closure myself. I think this would be a useful addition to the API. |
| Comments |
| Comment by Martin Vitez [ 24/Sep/13 ] |
|
I am not sure if I fully understand your suggestion. Currently parser provides a couple of parse* methods which take List of files or streams and return collection of modules. Do you want to add method to parser for parsing single file which returns single Module object? |
| Comment by Christopher Hartley [ 25/Sep/13 ] |
|
Martin, the issue comes that if a module imports other modules (take IF-MIB.yang as an example) then I currently need to by hand look inside the yang files and determine all the imports than add them to the list before I call parseYangModels(). What I need is a convenience method that I can give the main file to and a path where my Yang files are. The convenience method would determine all of the files required to parse the original file, then call parseYangModels(ArrayList<File>) with a list of all the files needed to parse the original file. So based on my original example, I could do something like this YangModelParser parser = new YangParserImpl(); modules would contain IF-MIB.yang, iana-if-type, SNMPv2-TC and ietf-yang-types |
| Comment by Martin Vitez [ 26/Sep/13 ] |
|
Implemented in version 0.5.8-SNAPSHOT. |
| Comment by Christopher Hartley [ 26/Sep/13 ] |
|
thanks for this. I looked in build 117 |