blob: 4b7060d5589cc0553b78f90fe45c892bb505bc9b [file] [log] [blame]
.\" Manpage for yanglint.
.\" Process this file with
.\" groff -man -Tascii yanglint.1
.\"
.TH YANGLINT 1 "2016-10-27" "libyang"
.SH NAME
yanglint \- YANG lint tool
.
.SH SYNOPSIS
.B yanglint
.br
.B yanglint
[\fIOPTIONS\fP]
[\-f { \fByang\fP | \fByin\fP | \fBtree\fP } ]
.I FILE ...
.br
.B yanglint
[\fIOPTIONS\fP]
[\-f { \fBxml\fP | \fBjson\fP } ]
\fISCHEMA\fP...
\fIFILE\fP...
.
.SH DESCRIPTION
\fByanglint\fP is a command-line tool for validating and converting YANG
schemas and the YANG modeled data. For a simple use, it validates the provided
file and if the output format specified, it converts input data into the output
format. If started with no argument, \fByanglint\fP opens interactive
environment where the user is allowed to work with schemas and data in a more
complex way.
.
.SH OPTIONS
.TP
.BR "\-h\fR,\fP \-\^\-help"
Outputs usage help and exits.
.TP
.BR "\-v\fR,\fP \-\^\-version"
Outputs the version number and exits.
.TP
.BR "\-V\fR,\fP \-\^\-verbose"
Increases the verbosity level. If not specified, only errors are printed, with
each appearance it adds: warnings, verbose messages, debug messages (if compiled
with debug information).
.TP
.BR "\-p \fIPATH\fP\fR,\fP \-\^\-path=\fIPATH\fP"
Specifies search path for getting imported modules or included submodules. The option
can be used multiple times. The current working directory and path of the module
being added is used implicitly.
.TP
.BR "\-s\fR,\fP \-\^\-strict"
Changes handling of unknown data nodes - instead of silently ignoring unknown data,
error is printed and data parsing fails. This option applies only on data parsing.
.TP
.BR "\-f \fIFORMAT\fP\fR,\fP \-\^\-format=\fIFORMAT\fP"
Converts the content of the input \fIFILE\fPs into the specified \fIFORMAT\fP. If no
\fIOUTFILE\fP is specified, the data are printed on the standard output. Only the
compatible formats for the input \fIFILE\fPs are allowed, see the section \fBFORMATS\fP.
.TP
.BR "\-o \fIOUTFILE\fP\fR,\fP \-\^\-output=\fIOUTFILE\fP"
Writes the output data into the specified \fIOUTFILE\fP. The option can be used
only in combination with \fB--format\fR option. In case of converting schema, only
a single input schema \fIFILE\fP is allowed. In case of data input \fIFILE\fPs,
input is merged and printed into a single \fIOUTFILE\fP.
.TP
.BR "\-F \fIFEATURES\fP\fR,\fP \-\^\-features=\fIFEATURES\fP"
Specifies the list of enabled features in the format
\fIMODULE\fP:[\fIFEATURE\fP,...]. In case of processing multiple modules, the
option can be used repeatedly. To disable all the features, use an empty list
specified for the particular module.
.TP
.BR "\-d \fIMODE\fP\fR,\fP \-\^\-default=\fIMODE\fP"
Print data with default values, according to the \fIMODE\fP (to print attributes,
the ietf-netconf-with-defaults model must be loaded). The \fIMODE\fP is one of the following:
\[bu] \fBall\fP - add missing default nodes
\[bu] \fBall-tagged\fP - add missing default nodes and mark all the default nodes with the attribute
\[bu] \fBtrim\fP - remove all nodes with a default value
\[bu] \fBimplicit-tagged\fP - add missing nodes and mark them with the attribute
.TP
.BR "\-t \fITYPE\fP\fR,\fP \-\^\-type=\fITYPE\fP"
Specify data tree type in the input data \fIFILE\fPs. The \fITYPE\fP is one of the following:
\[bu] \fBauto\fP - Resolve data type (one of the following) automatically (as pyang does). Applicable only on XML input data.
\[bu] \fBdata\fP - Complete datastore with status data (default type).
\[bu] \fBconfig\fP - Configuration datastore (without status data).
\[bu] \fBget\fP - Result of the NETCONF <get> operation.
\[bu] \fBgetconfig\fP - Result of the NETCONF <get-config> operation.
\[bu] \fBedit\fP - Content of the NETCONF <edit-config> operation.
\[bu] \fBrpc\fP - Content of the NETCONF <rpc> message, defined as YANG's rpc input statement.
\[bu] \fBrpcreply\fP - Reply to the RPC. This is just a virtual \fITYPE\fP, for parsing replies, '\fBauto\fP' must be used since the data \fIFILE\fPs are expected in pairs.
.br
The first input data \fIFILE\fP is expected as '\fBrpc\fP' \fITYPE\fP, the second \fIFILE\fP is expected as reply to the previous RPC.
\[bu] \fBnotif\fP - Notification instance (content of the <notification> element without <eventTime>.
.TP
.BR "\-O \fIFILE\fP\fR,\fP \-\^\-operational=\fIFILE\fP]
Optional parameter for '\fBrpc\fP' and '\fBnotif\fP' \fITYPE\fPs, the \fIFILE\fP contains running configuration datastore and
state data referenced from the RPC/Notification. The same data apply to all input data \fIFILE\fPs. Note that the file
is validated as '\fBdata\fP' \fITYPE\fP. Special value '\fB!\fP' can be used as \fIFILE\fP argument to ignore the external references.
.TP
.BR "\-y \fIYANGLIB_PATH\fP"
Specify path to a yang-library data file (XML or JSON) describing the initial context.
If provided, yanglint loads the modules according to the content of the yang-library data tree.
Otherwise, an empty content with only the internal libyang modules is used. This does
not limit user to load another modules explicitly specified as command line parameters.
.
.SH FORMATS
There are two types of formats to use.
.TP
.I Schemas
In case of schemas, the content can be converted into the '\fByang\fP', '\fByin\fP'
and '\fBtree\fP' formats. As input, only YANG and YIN files are
accepted. Note, that the corresponding file extension is required.
.TP
.I Data\ \ \
In case of YANG modeled data, the content can be converted between '\fBxml\fP'
and '\fBjson\fP' formats. Remember that the corresponding file extension of the
input file is required.
.
.SH EXAMPLES
.IP \[bu] 2
Open interactive environment:
yanglint
.IP \[bu]
Convert YANG model into YIN and print it to the stdout:
yanglint --format=yin ./ietf-system.yang
.IP \[bu]
Convert ietf-system configuration data from XML to JSON:
yanglint --format=json --type=config --output=data.json ./ietf-system.yang ./data.xml
.SH SEE ALSO
https://github.com/CESNET/libyang (libyang homepage and Git repository)
.
.SH AUTHORS
Radek Krejci <rkrejci@cesnet.cz>, Michal Vasko <mvasko@cesnet.cz>
.
.SH COPYRIGHT
Copyright \(co 2015-2017 CESNET, a.l.e.