forked from CESNET/libyang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyanglint.1
More file actions
200 lines (197 loc) · 9.56 KB
/
yanglint.1
File metadata and controls
200 lines (197 loc) · 9.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
.\" Manpage for yanglint.
.\" Process this file with
.\" groff -man -Tascii yanglint.1
.\"
.TH YANGLINT 1 "2025-8-19" "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"
Show this help message and exit.
.TP
.BR "\-v\fR,\fP \-\^\-version"
Show version number and exit.
.TP
.BR "\-V\fR,\fP \-\^\-verbose"
Increase libyang verbosity and show verbose messages. If specified a second time, show even debug messages.
.TP
.BR "\-Q\fR,\fP \-\^\-quiet"
Decrease libyang verbosity and hide warnings. If specified a second time, hide errors so no libyang messages are printed.
.TP
.BR "\-f \fIFORMAT\fP\fR,\fP \-\^\-format=\fIFORMAT\fP"
Convert input into FORMAT. Supported formats: yang, yin, tree, info and feature-param for schemas, xml, json, and lyb for data.
.TP
.BR "\-I \fIFORMAT\fP\fR,\fP \-\^\-in\-format=\fIFORMAT\fP"
Load the data in one of the following formats: xml, json, lyb. If input format not specified, it is detected from the
file extension.
.TP
.BR "\-p \fIPATH\fP\fR,\fP \-\^\-path=\fIPATH\fP"
Search path for schema (YANG/YIN) modules. The option can be used multiple times. The current working directory and the
path of the module being added is used implicitly. Subdirectories are also searched.
.TP
.BR "\-D\fR,\fP \-\^\-siable\-searchdir"
Do not implicitly search in current working directory for schema modules. If specified a second time, do not even
search in the module directory (all modules must be explicitly specified).
.TP
.BR "\-F \fIFEATURES\fP\fR,\fP \-\^\-features=\fIFEATURES\fP"
Specific module features to support in the form <module-name>:(<feature>,)*
Use <feature> '*' to enable all features of a module. This option can be specified multiple times, to enable features
in multiple modules. If this option is not specified, all the features in all the implemented modules are enabled.
.TP
.BR "\-i\fR,\fP \-\^\-make\-implemented"
Make the imported modules referenced from any loaded module also implemented. If specified a second time, all the
modules are set implemented.
.TP
.BR "\-P \fIPATH\fP\fR,\fP \-\^\-schema\-node=\fIPATH\fP"
Print only the specified subtree of the schema. The PATH is the XPath subset mentioned in documentation as the Path
format. The option can be combined with \-\^\-single-node option to print information only about the specified node.
.TP
.BR "\-q\fR,\fP \-\^\-single\-node"
Supplement to the \-\^\-schema-node option to print information only about a single node specified as PATH argument.
.TP
.BR "\-s \fISUBMODULE\fP\fR,\fP \-\^\-submodule=\fISUBMODULE\fP"
Print the specific submodule instead of the main module.
.TP
.BR "\-x \fIFILE\fP\fR,\fP \-\^\-ext\-data=\fIFILE\fP"
File containing the specific data required by an extension. Required by the schema-mount extension, for example, when
the operational data are expected in the file. File format is guessed.
.TP
.BR "\-n\fR,\fP \-\^\-not\-strict"
Do not require strict data parsing (silently skip unknown data), has no effect for schemas.
.TP
.BR "\-e\fR,\fP \-\^\-present"
Validate only with the schema modules whose data actually exist in the provided input data files. Takes effect only
with the 'data' or 'config' TYPEs. Used to avoid requiring mandatory nodes from modules which data are not present in
the provided input data files.
.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] \fBdata\fP - Complete (operational) datastore with state data (default).
\[bu] \fBconfig\fP - Configuration datastore (without state 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] \fBnc-rpc\fP - Similar to 'rpc' but expect and check also the NETCONF envelopes <rpc> or <action>.
\[bu] \fBreply\fP - Reply to the RPC/Action. Note that the reply data are expected inside a container
representing the original RPC/Action. This is necessary to identify appropriate
data definitions in the schema module.
\[bu] \fBnc-reply\fP - Similar to 'reply' but expect and check also the NETCONF envelope <rpc-reply> with
output data nodes as direct descendants. The original RPC/action invocation is expected"
in a separate parameter '-R' and is parsed as 'nc-rpc'.
\[bu] \fBnotif\fP - Notification instance (content of the <notification> element without <eventTime>).
\[bu] \fBnc-notif\fP - Similar to 'notif' but expect and check also the NETCONF envelope <notification> with
element <eventTime> and its sibling as the actual notification.
\[bu] \fBext\fP - Validates extension data based on loaded YANG modules. Need to be used with -k parameter.
.TP
.BR "\-d \fIMODE\fP\fR,\fP \-\^\-default=\fIMODE\fP"
Print data with default values, according to the MODE (to print attributes, ietf-netconf-with-defaults model
must be loaded):
\[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 an attribute.
.TP
.BR "\-E \fIXPATH\fP\fR,\fP \-\^\-data\-xpath=\fIXPATH\fP"
Evaluate XPATH expression over the data and print the nodes satisfying the expression. The output format is specific
and the option cannot be combined with the -f and -d options. Also all the data inputs are merged into a single data
tree where the expression is evaluated, so the -m option is always set implicitly.
.TP
.BR "\-l\fR,\fP \-\^\-list"
Print info about the loaded schemas. (i - imported module, I - implemented module)
In case the '-f' option with data encoding is specified, the list is printed as 'ietf-yang-library' data.
.TP
.BR "\-L \fILINE_LENGTH\fP\fR,\fP \-\^\-tree\-line\-length=\fITREE_LENGTH\fP"
The limit of the maximum line length on which the 'tree' format will try to be printed.
.TP
.BR "\-o \fIOUTFILE\fP\fR,\fP \-\^\-output=\fIOUTFILE\fP"
Write the output to OUTFILE instead of stdout.
.TP
.BR "\-O \fIFILE\fP\fR,\fP \-\^\-operational=\fIFILE\fP"
Provide optional data to extend validation of the '(nc-)rpc', '(nc-)reply' or '(nc-)notif' TYPEs. The FILE is supposed
to contain the operational datastore referenced from the operation. In case of a nested notification or action, its
parent existence is also checked in these operational data.
.TP
.BR "\-R \fIFILE\fP\fR,\fP \-\^\-reply\-rpc=\fIFILE\fP"
Provide source RPC for parsing of the 'nc-reply' TYPE. The FILE is supposed to contain the source 'nc-rpc' operation of
the reply.
.TP
.BR "\-m\fR,\fP \-\^\-merge"
Merge input data files into a single tree and validate at once. The option has effect only for 'data' and 'config' TYPEs.
.TP
.BR "\-y\fR,\fP \-\^\-yang\-library"
Load and implement internal 'ietf-yang-library' YANG module. Note that this module includes definitions of mandatory
state data that can result in unexpected data validation errors.
.TP
.BR "\-Y \fIFILE\fP\fR,\fP \-\^\-yang\-library\-file=\fIFILE\fP"
Parse FILE with 'ietf-yang-library' data and use them to create an exact YANG schema context. If specified, the '-F'
parameter (enabled features) is ignored.
.TP
.BR "\-X\fR,\fP \-\^\-extended\-leafref"
Allow usage of deref() XPath function within leafref
.TP
.BR "\-J\fR,\fP \-\^\-json\-null"
Allow usage of JSON empty values ('null') within input data
.TP
.BR "\-k\fR,\fP \-\^\-ext\-inst"
Name of extension instance in format: <module-name>:<extension-name>:<argument>. Need to be used with -t ext parameter.
.TP
.BR "\-G \fIGROUPS\fP\fR,\fP \-\^\-debug=\fIGROUPS\fP"
Enable printing of specific debugging message group (nothing will be printed unless verbosity is set to debug):
<group>[,<group>]* (dict, xpath, dep-sets)
.
.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 - 2025 CESNET, a.l.e.