1
2YANGLINT(1) General Commands Manual YANGLINT(1)
3
4
5
7 yanglint - YANG lint tool
8
10 yanglint
11 yanglint [OPTIONS] [-f { yang | yin | tree } ] FILE ...
12 yanglint [OPTIONS] [-f { xml | json } ] SCHEMA... FILE...
13
15 yanglint is a command-line tool for validating and converting YANG
16 schemas and the YANG modeled data. For a simple use, it validates the
17 provided file and if the output format specified, it converts input
18 data into the output format. If started with no argument, yanglint
19 opens interactive environment where the user is allowed to work with
20 schemas and data in a more complex way.
21
23 -h, --help
24 Outputs usage help and exits.
25
26 -v, --version
27 Outputs the version number and exits.
28
29 -V, --verbose
30 Increases the verbosity level. If not specified, only errors are
31 printed, with each appearance it adds: warnings, verbose mes‐
32 sages, debug messages (if compiled with debug information).
33
34 -p PATH, --path=PATH
35 Specifies search path for getting imported modules or included
36 submodules. The option can be used multiple times. The current
37 working directory and path of the module being added is used
38 implicitly.
39
40 -s, --strict
41 Changes handling of unknown data nodes - instead of silently
42 ignoring unknown data, error is printed and data parsing fails.
43 This option applies only on data parsing.
44
45 -f FORMAT, --format=FORMAT
46 Converts the content of the input FILEs into the specified FOR‐
47 MAT. If no OUTFILE is specified, the data are printed on the
48 standard output. Only the compatible formats for the input FILEs
49 are allowed, see the section FORMATS.
50
51 -o OUTFILE, --output=OUTFILE
52 Writes the output data into the specified OUTFILE. The option
53 can be used only in combination with --format option. In case of
54 converting schema, only a single input schema FILE is allowed.
55 In case of data input FILEs, input is merged and printed into a
56 single OUTFILE.
57
58 -F FEATURES, --features=FEATURES
59 Specifies the list of enabled features in the format MOD‐
60 ULE:[FEATURE,...]. In case of processing multiple modules, the
61 option can be used repeatedly. To disable all the features, use
62 an empty list specified for the particular module.
63
64 -d MODE, --default=MODE
65 Print data with default values, according to the MODE (to print
66 attributes, the ietf-netconf-with-defaults model must be
67 loaded). The MODE is one of the following:
68 · all - add missing default nodes
69 · all-tagged - add missing default nodes and mark all the
70 default nodes with the attribute
71 · trim - remove all nodes with a default value
72 · implicit-tagged - add missing nodes and mark them with the
73 attribute
74
75 -t TYPE, --type=TYPE
76 Specify data tree type in the input data FILEs. The TYPE is one
77 of the following:
78 · auto - Resolve data type (one of the following)
79 automatically (as pyang does). Applicable only on XML input
80 data.
81 · data - Complete datastore with status data
82 (default type).
83 · config - Configuration datastore (without status
84 data).
85 · get - Result of the NETCONF <get> operation.
86 · getconfig - Result of the NETCONF <get-config> opera‐
87 tion.
88 · edit - Content of the NETCONF <edit-config> opera‐
89 tion.
90 · rpc - Content of the NETCONF <rpc> message,
91 defined as YANG's rpc input statement.
92 · rpcreply - Reply to the RPC. This is just a virtual
93 TYPE, for parsing replies, 'auto' must be used since the data
94 FILEs are expected in pairs.
95 The first input data FILE is expected as
96 'rpc' TYPE, the second FILE is expected as reply to the previous
97 RPC.
98 · notif - Notification instance (content of the
99 <notification> element without <eventTime>.
100
101 -r FILE, --running=FILE]
102 Optional parameter for 'rpc' and 'notif' TYPEs, the FILE con‐
103 tains running configuration datastore data referenced from the
104 RPC/Notification. The same data apply to all input data FILEs.
105 Note that the file is validated as 'data' TYPE. Special value
106 '!' can be used as FILE argument to ignore the external refer‐
107 ences.
108
109 -y YANGLIB_PATH
110 Specify path to a yang-library data file (XML or JSON) describ‐
111 ing the initial context. If provided, yanglint loads the mod‐
112 ules according to the content of the yang-library data tree.
113 Otherwise, an empty content with only the internal libyang mod‐
114 ules is used. This does not limit user to load another modules
115 explicitly specified as command line parameters.
116
118 There are two types of formats to use.
119
120 Schemas
121 In case of schemas, the content can be converted into the
122 'yang', 'yin' and 'tree' formats. As input, only YANG and YIN
123 files are accepted. Note, that the corresponding file extension
124 is required.
125
126 Data
127 In case of YANG modeled data, the content can be converted
128 between 'xml' and 'json' formats. Remember that the correspond‐
129 ing file extension of the input file is required.
130
131
133 · Open interactive environment:
134 yanglint
135
136 · Convert YANG model into YIN and print it to the stdout:
137 yanglint --format=yin ./ietf-system.yang
138
139 · Convert ietf-system configuration data from XML to JSON:
140 yanglint --format=json --type=config --output=data.json ./ietf-
141 system.yang ./data.xml
142
143
145 https://github.com/CESNET/libyang (libyang homepage and Git repository)
146
148 Radek Krejci <rkrejci@cesnet.cz>, Michal Vasko <mvasko@cesnet.cz>
149
151 Copyright © 2015-2017 CESNET, a.l.e.
152
153
154
155libyang 2016-10-27 YANGLINT(1)