Validating YANG Files
The yangdump-pro program will always validate the modules specified in the configuration parameters, unless one of the quick exit modes is requested (--version or --help). If a valid --format parameter is present, then some sort of translation will also be attempted.
The modules or submodules to validate are specified with the --module and/or --subtree configuration parameters.
All sub-modules that are included, and all modules that are imported, are also validated. This is done in the order the import or include statements are encountered. Errors and warnings that occur in included submodules or imported modules may be repeated, if it is used more than once within the requested set of files to validate.
The netconfd-pro server will refuse to run if any of its core YANG modules contain any errors, as reported by the yangdump-pro parser.
The --deviation parameter is used to specify any YANG module files that contain YANG deviation statements, which may apply to any of the modules specified with the --module or --subtree parameters. Modules parsed as deviation files are not validated. Imported modules are not actually read, and therefore not validated either.
A module can appear in the deviation list and the module or subtree module list. The deviation statements will simply be processed separately from the other YANG statements found in the file.
If all the deviation statements for a module appear in the same module as the objects that are the target(s) of the deviations, then the --deviation parameter does not need to be used.
There is no way to specify the exact revision date associated with each file, at this time. The module search path needs to be configured such that the module search algorithms will find the appropriate versions.
This only applies if the revision-date statement is not present in the import statement, of course. Otherwise, only the specified revision-date will be used, or an error will be generated if the exact import file was not found.
yangdump-pro Validation Messages
A error is generated, and the error count for the module is incremented, if any violation of the YANG standard is detected.
A warning is generated, and the warning count for the module is incremented, if:
any suspected misuse of the YANG standard is detected.
any YANG statements which have no affect are detected.
any duplicate statements which may conflict with previous statements are detected.
any violation of a YANG usage guideline is detected.
any statements which may cause operational conflicts, due to duplicate values from another module is detected. The module prefix or an augment statement which adds a node with the same name are examples of this type of operational conflict.
An informational message is generated if any potentially interesting conditions or abnormality is detected.
A debugging message is generated if available, to track the internal behavior of the yangdump-pro parser.
The default --log-level configuration parameter value is 'info'. It is strongly suggested that the log-level not be set to 'off' or 'error'. Instead, set the log level to at least 'warning', and use the --warn-error, --warn-idlen, --warn-linelen, --warn-off, and --warn-up configuration parameters to suppress or modify specific warning messages.
Generally, a context-specific error message is generated, followed by a structured error message.
A context-sensitive error message will begin "Error: ....".
A structured error message will begin with a line in the following format:
<module>:<line-number>:<column-number>: error(<error-number>):<msg>
where:
module is a module or submodule name
Validation Example
The following example shows the error messages that are generated for
the 'testloops.yang' file, usually installed at
/usr/share/yumapro/modules/test/fail/testloops.yang
.
user1$ yangdump-pro testloops
Error: import 'testloops' for current module testloops.yang:6.5: error(327): import loop
Error: include 'testloops' for current submodule testloops.yang:10.5: error(328): include loop
Error: if-feature loop detected for 'A' in feature 'C' testloops.yang:66.5: error(325): definition loop detected
Error: typedef 'typeloop' cannot use type 'typeloop' testloops.yang:35.8: error(325): definition loop detected
Error: named type loops with type 'typeloop2' on line 43 testloops.yang:47.8: error(325): definition loop detected
Error: uses of 'grouploop' is contained within that grouping, defined on line 50 testloops.yang:51.8: error(325): definition loop detected
Error: grouping 'grouploop2' on line 54 loops in uses, defined in module testloops, line 63 testloops.yang:54.5: error(325): definition loop detected
Error: grouping 'grouploop3' on line 58 loops in uses, defined in module testloops, line 55 testloops.yang:58.5: error(325): definition loop detected
Error: grouping 'grouploop4' on line 62 loops in uses, defined in module testloops, line 59 testloops.yang:62.5: error(325): definition loop detected
Error: leafref path in leaf LR1 loops with leaf LR3 testloops.yang:16.5: error(359): leafref path loop
Error: leafref path in leaf LR2 loops with leaf LR1 testloops.yang:22.5: error(359): leafref path loop
Error: leafref path in leaf LR3 loops with leaf LR2 testloops.yang:28.5: error(359): leafref path loop
* /usr/share/yumapro/modules/test/fail/testloops.yang * 12 Errors, 0 Warnings user1$