|
yangto − validate YANG modules and convert them to different formats |
|
yangto [parameter= value ...] |
|
yangto provides validation and translation of YANG
data models. Information about a module or submodule can be
generated as well. For XSD translation, use the format=xsd parameter. For a 1 line output of the module name and version, use the modversion parameter. For a listing of all the symbols that the file exports to other files, use the exports parameter. For a listing of all the files that the file depends on, to compile, use the dependencies parameter. For a listing of all the accessible object identifiers that the file contains, use the identifiers parameter. |
|
Parameters can be entered in any order, and have the form: [start] name [separator [value]] where: start == 0, 1, or 2 dashes (foo, -foo, --foo) name == parameter name Parameter name completion will be attempted if a partial name is entered. separator == whitespace or equals sign (foo=bar, foo bar) value == string value for the parameter. Strings with whitespace need to be double quoted (--foo="some string") Some examples of valid command line parameters: foo=3 Partial parameter names can be entered if they are unique. |
|
--config=filespec |
|
The name of the configuration file to use. Any parameter except this one can be set in the config file. The default config file /etc/yangto.conf will be not be checked if this parameter is present. |
|
--module=string |
|
YANG or NCX source module name to validate and convert. The subtree option cannot be used if this option is present. |
|
--subtree=string |
|
Path specification of the directory subtree to convert. All of the YANG and NCX source modules contained in the specified directory sub-tree will be processed. If this parameter is used instead of module, then the output parameter must not be present. Instead, the defname option must be used, or it will be selected as the default. If the format parameter is present, then one file with the default name will be generated for each YANG file found in the sub-tree. Note that symbolic links are not followed during the directory traversal. Only real directories will be searched and regular files will be checked as modules. Processing will continue to the next file if a module contains errors. |
|
--output=filespec |
|
Output file name to use. Default is STDOUT if none specified and the defname parameter is also missing. Not used if the format parameter is missing, or if the subtree parameter is present. |
|
--defname |
|
Output to a file with the default name for the format, in the current directory. Not used if the format parameter is missing. This is the only available output option if the subtree parameter is present. |
|
--format=xsd |
|
Type of conversion desired, if any. If this parameter is missing, then no translation will be done, but the module will be validated. XSD translation is the only supported option at this time. |
|
--modversion |
|
Validate the file, write the [sub]module name, version and source filespec, then exit. |
|
--exports |
|
Validate the file, write information for the symbols that this [sub]module exports, then exit. Report includes the following info for the specific file, not the entire module, if submodules are used: - [sub]module name - version - source filespec - namespace (module only) - prefix (module only) - belongs-to (submodule only) - typedefs - groupings - objects, rpcs, notifications - extensions. |
|
--dependencies |
|
Validate the file, write the module name, version and module source for each file that this [sub]module imports and includes, then exit. Each dependency type, name, version, and source is listed once. If the dependency version and source are missing, then that import or include file was not found. |
|
--identifiers |
|
Validate the file, write the list of object identifiers, that this [sub]module contains, then exit. Each accessible object node is listed once, including all child nodes. Notifications and RPC methods are considered top-level objects, and have object identifiers as well as configuration and state data.. |
|
--help |
Print yangto help file and exit. |
|
--log=filespec |
|
Filespec for the log file to use instead of STDOUT. |
|
--log-append |
|
If present, the log will be appended not over-written. If not, the log will be over-written. Only meaningful if the log parameter is also present. |
|
--log-level=enum |
|
Sets the debug logging level for the program. |
|
--modpath=list |
|
Directory search path for YANG and NCX modules. |
|
--schemaloc=string |
|
If present, then this string will be used to prepend to XSD filenames, when generating schemaLocation clauses. If missing, then the schemaLocation element is not generated during XSD translation. |
|
--no-subdirs |
|
If present, the file search paths for modules, scripts, and data files will not include sub-directories if they exist in the specified path. If missing, then these file search paths will include sub-directories, if present. Any directory name beginning with a dot (.) character, or named CVS, will be ignored. |
|
--with-submods |
|
If present, then submodules will be processed within the main module, instead of separately. For example, a single XSD will be generated instead of using XSD ’include’ directives within the main module, For identifier or dependency listings, the entire module contents will be checked, not just the main module. If this mode is selected, then submodels entered with the module parameter will be ignored. Normally, a separate output file is generated for each input file, so that XSD output and other reports for a main module will not include information for submodules. |
|
--version |
|
Print yangto version string and exit. |
|
Operations can be performed on one or more files with the module parameter, or an entire directory tree with the subtree parameter. Unless the help or version parameters is entered, one of these input file parameters is mandatory. |
|
When a module name is entered as input, or when a module or submodule name is specified in an import or include statement within the file, the following search algorithm is used to find the file: 1) file is in the current directory By default, the entire directory tree for all locations (except step 1) will be searched, not just the specified directory. The no-subdirs parameter can be used to prevent sub-directories from being searched. Any directory name beginning with a dot character (.) will be skipped. Also, any directory named CVS will be skipped in directory searches. |
|
By default, any translation output will be sent to STDOUT. The output parameter can be used to specify the full filespec of the output file to use instead. The defname parameter can be used to generate a default filename in the current directory for the output. E.g., the default XSD filename is <name>_<version>.xsd. This is the default mode when subtree input mode is selected. |
|
By default, warnings and errors are sent to STDOUT. A log file can be specified instead with the log’ parameter. Existing log files can be reused with the ’logappend’ parameter, otherwise log files are overwritten. The logging level can be controlled with the log-level parameter. The default log level is ’info’. The log-levels are additive: off: suppress all errors (not recommended!) A program return code of ’1’ indicates some error. error: print errors warn: print warnings info: print generally interesting trace info debug: print general debugging trace info debug2: print verbose debugging trace info |
|
The following optional environment variables can be used to control module search behavior: |
|
HOME |
The user’s home directory (e.g., /home/andy) |
|
YANG_HOME |
|
The root of the user’s YANG work directory (e.g., /home/andy/swdev/netconf) |
|
YANG_INSTALL |
|
The root of the directory that yangto is installed on this system (default is, /usr/share/yang) |
|
YANG_MODPATH |
|
Colon-separated list of directories to search for modules and submodules. (e.g.: ’./workdir/modules:/home/andy/test-modules’) The modpath parameter will override this environment variable, if both are present. |
|
yangto.conf |
|
YANG config file The default is: /etc/yangto.conf An ASCII configuration file format is supported to store command line parameters. The config parameter is used to specify a specific config file, otherwise the default config file will be checked. - A hash mark until EOLN is treated as a comment interface eth0 { # name = eth0 is not listed inside the
braces A config file can contain any number of parameter sets for different programs. Each program must have its own section, identifies by its name: # this is a comment netconfd { ... } |
|
The following data files must be present in the module search path in order for this program to function: * yangto.ncx default: /usr/share/yang/modules/apps/yangto.ncx * ncxtypes.ncx default: /usr/share/yang/modules/base/ncxtypes.ncx |
|
- keyref Xpath expressions are not validated |
|
Internal diagnostics may generate the following type of message if any bugs are detected at runtime: [E0] filename.c:linenum error-number (error-msg) |
|
Andy Bierman, <andy at andybierman dot com> |
|
pyang(1) |