[YANGTOOLS-734] yang-system-test: -p directories are for dependency search Created: 04/Jan/17 Updated: 10/Apr/22 Resolved: 23/Feb/17 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Vratko Polak | Assignee: | Peter Kajsa |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 7480 |
| Description |
|
This request is not very compatible with Examining existing Yang validators, it turns out their focus is not on validating a whole set of Yang models, but on validating a single Yang file instead. Of course most Yang modules are including other modules, so to ascertain validity those other modules should also be available. Thus a Yang validator needs to be able to search for dependencies, and -p directories are the locations the validator should search for the needed files in (defaulting to current working directory if no -p is given). In order for yang-system-test to be used as a Yang validator in existing validation frameworks, it should honor the same semantics. As a evidence, here [0] is description of -p in yanglint, and here [1] is how yangvalidator.com invokes pyang to validate a particular Yang file. [0] https://github.com/CESNET/libyang/blob/master/tools/lint/main_ni.c#L50 P.S.: For purpose of validation of single files, perhaps odl-yang-validator would be a better name than yang-system-test. |
| Comments |
| Comment by Vratko Polak [ 11/Jan/17 ] |
|
As an example let us have these files present: Where module to-test imports module standard, but not module broken. Assume that bronken.yang is broken and would cause a failure. Assume to-test.yang is correct and would pass. Currently this call: After fixing this. the same call would only add ./to-test.yang (because it is an explicit filename) and ./deps/standard.yang (discovered dependency), but not ./deps/broken.yang In comparison, this call: After copying ./deps/standard.yang to ./standard.yang the repeated call would again pass, as ./ is implicitly always present in the list of directories where dependencies are searched for. |
| Comment by Vratko Polak [ 11/Jan/17 ] |
|
Aside of performance implications, this is also important for this case: |
| Comment by Viera Zelcamova [ 23/Jan/17 ] |
|
due higher priorities for API freeze, moving for M5 Carbon. |
| Comment by Vratko Polak [ 23/Jan/17 ] |
|
Most implementations of single module validators first scan all file names in -p directories to build a "library" of files, and when building a "schema context" they search and add files from that library only when needed to satisfy an import. Yangtools currently does not support such "library" behavior, so the fix is not trivial. |
| Comment by Peter Kajsa [ 30/Jan/17 ] |