YANGLINT(1)

๐Ÿ’– YANGLINT(1) โ€” the yanglint era ๐Ÿ’–

okay bestie, settle in, because this is a General Commands Manual page for yanglint, aka the YANG lint tool, and she is that girl. section 1, manual page realness. ๐ŸŽ€


โœจ NAME โœจ

yanglint โ€” YANG lint tool ๐Ÿฆ‹


๐ŸŒธ SYNOPSIS ๐ŸŒธ

yanglint
yanglint [OPTIONS] [-f { yang | yin | tree } ] FILE ...
yanglint [OPTIONS] [-f { xml | json } ] SCHEMA...  FILE...

like. three whole moods. pick your fighter. ๐Ÿ’…


๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

so yanglint is a command-line tool for validating and converting YANG schemas and the YANG modeled data. no cap.

for a simple use, it validates the provided file, and if the output format is specified, it converts input data into the output format. โœจ

and if you start it with no argument at all? it opens the interactive environment where you โ€” yes you, main character โ€” are allowed to work with schemas and data in a more complex way. ๐Ÿ‘‘


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -h, --help โ€” show this help message and then dip. exit. bye. ๐Ÿ‘‹
  • -v, --version โ€” show the version number and exit. it's giving quick flex. โญ
  • -V, --verbose โ€” crank up libyang verbosity and show verbose messages. specify it a second time and you get the even-more debug messages. ๐Ÿ›
  • -Q, --quiet โ€” turn libyang verbosity down and hide warnings. specify it a second time and errors get hidden too, so literally no libyang messages are printed at all. ๐Ÿคซ
  • -f FORMAT, --format=FORMAT โ€” convert input into FORMAT. supported formats: yang, yin, tree, info and feature-param for schemas; xml, json, and lyb for data. pick one, slay. ๐Ÿ”ฅ
  • -I FORMAT, --in-format=FORMAT โ€” load the data in one of: xml, json, lyb. if you don't specify the input format, it's detected from the file extension. psychic behavior, honestly. ๐Ÿ”ฎ
  • -p PATH, --path=PATH โ€” search path for schema (YANG/YIN) modules. can be used multiple times. the current working directory and the path of the module being added are used implicitly. subdirectories are also searched. she's thorough. ๐Ÿ’…
  • -D, --siable-searchdir โ€” do not implicitly search in current working directory for schema modules. if specified a second time, don't even search in the module directory (all modules must be explicitly specified). (yes, that spelling is the real flag name bestie, we don't fix it, we respect it ๐Ÿ’€)
  • -F FEATURES, --features=FEATURES โ€” 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. ๐Ÿงš
  • -i, --make-implemented โ€” make the imported modules referenced from any loaded module also implemented. if specified a second time, all the modules are set implemented. ๐Ÿ˜ค
  • -P PATH, --schema-node=PATH โ€” print only the specified subtree of the schema. the PATH is the XPath subset mentioned in documentation as the Path format. can be combined with the --single-node option to print information only about the specified node. ๐ŸŽฏ
  • -q, --single-node โ€” the supplement to the --schema-node option, to print information only about a single node specified as the PATH argument. one node. just the one. ๐Ÿ™ˆ
  • -s SUBMODULE, --submodule=SUBMODULE โ€” print the specific submodule instead of the main module. ๐Ÿฆ‹
  • -x FILE, --ext-data=FILE โ€” 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. โœจ
  • -n, --not-strict โ€” do not require strict data parsing (silently skip unknown data). has no effect for schemas. ๐Ÿซถ
  • -e, --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. lowkey genius. ๐Ÿ’ก
  • -t TYPE, --type=TYPE โ€” specify the data tree type in the input data FILEs. the TYPE is one of the following:
    • data โ€” complete (operational) datastore with state data (default). ๐Ÿ‘‘
    • config โ€” configuration datastore (without state data).
    • get โ€” result of the NETCONF <get> operation.
    • getconfig โ€” result of the NETCONF <get-config> operation.
    • edit โ€” content of the NETCONF <edit-config> operation.
    • rpc โ€” content of the NETCONF <rpc> message, defined as YANG's rpc input statement.
    • nc-rpc โ€” similar to 'rpc' but expect and check also the NETCONF envelopes <rpc> or <action>.
    • reply โ€” 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. ๐Ÿ“ฆ
    • nc-reply โ€” 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'.
    • notif โ€” notification instance (content of the <notification> element without <eventTime>).
    • nc-notif โ€” similar to 'notif' but expect and check also the NETCONF envelope <notification> with element <eventTime> and its sibling as the actual notification. ๐Ÿ””
    • ext โ€” validates extension data based on loaded YANG modules. needs to be used with the -k parameter.
  • -d MODE, --default=MODE โ€” print data with default values, according to the MODE (to print attributes, the ietf-netconf-with-defaults model must be loaded):
    • all โ€” add missing default nodes.
    • all-tagged โ€” add missing default nodes and mark all the default nodes with the attribute. ๐Ÿท๏ธ
    • trim โ€” remove all nodes with a default value. โœ‚๏ธ
    • implicit-tagged โ€” add missing nodes and mark them with an attribute.
  • -E XPATH, --data-xpath=XPATH โ€” evaluate the 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. ๐Ÿ˜ฎ
  • -l, --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. ๐Ÿ“‹
  • -L LINE_LENGTH, --tree-line-length=TREE_LENGTH โ€” the limit of the maximum line length on which the 'tree' format will try to be printed. ๐Ÿ“
  • -o OUTFILE, --output=OUTFILE โ€” write the output to OUTFILE instead of stdout. ๐Ÿซถ
  • -O FILE, --operational=FILE โ€” 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. ๐Ÿ—‚๏ธ
  • -R FILE, --reply-rpc=FILE โ€” provide source RPC for parsing of the 'nc-reply' TYPE. the FILE is supposed to contain the source 'nc-rpc' operation of the reply. ๐Ÿ’Œ
  • -m, --merge โ€” merge input data files into a single tree and validate at once. has effect only for the 'data' and 'config' TYPEs. ๐ŸŒˆ
  • -y, --yang-library โ€” load and implement the internal 'ietf-yang-library' YANG module. note that this module includes definitions of mandatory state data that can result in unexpected data validation errors. โš ๏ธ
  • -Y FILE, --yang-library-file=FILE โ€” 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. ๐Ÿ™…
  • -X, --extended-leafref โ€” allow usage of the deref() XPath function within leafref. ๐Ÿ”—
  • -J, --json-null โ€” allow usage of JSON empty values ('null') within input data. ๐Ÿ•ณ๏ธ
  • -k, --ext-inst โ€” name of extension instance in format: <module-name>:<extension-name>:<argument>. needs to be used with the -t ext parameter. ๐Ÿ”ง
  • -G GROUPS, --debug=GROUPS โ€” enable printing of a specific debugging message group (nothing will be printed unless verbosity is set to debug): <group>[,<group>]* (dict, xpath, dep-sets). ๐Ÿž

๐Ÿฆ‹ FORMATS ๐Ÿฆ‹

there are two types of formats to use. two!! โœŒ๏ธ

Schemas

in case of schemas, the content can be converted into the 'yang', 'yin' and 'tree' formats. as input, only YANG and YIN files are accepted. note that the corresponding file extension is required. ๐Ÿ“Ž

Data

in case of YANG modeled data, the content can be converted between 'xml' and 'json' formats. remember that the corresponding file extension of the input file is required. ๐Ÿ“Ž


โญ EXAMPLES โญ

  1. open the interactive environment:
yanglint
  1. convert a YANG model into YIN and print it to the stdout:
yanglint --format=yin ./ietf-system.yang
  1. convert ietf-system configuration data from XML to JSON:
yanglint --format=json --type=config --output=data.json ./ietf-system.yang ./data.xml

ate. no crumbs. ๐Ÿ’…


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


๐Ÿ’– AUTHORS ๐Ÿ’–

Radek Krejci <rkrejci@cesnet.cz>, Michal Vasko <mvasko@cesnet.cz> ๐Ÿซถ


Copyright ยฉ 2015 - 2025 CESNET, a.l.e.


ok that's the whole page bestie, every single flag accounted for, nothing skipped, we ate and left no crumbs ๐Ÿ“

published by libyang, dated 2025-8-19, and that's the vibe check, periodt. โœจ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from