OS Manuals

/usr/bin/yanglint

YANG data modeling language library

From libyang-2.1 2.1.148-r7 (enterprise-packages), captured 2026-11-08 by running yanglint --help (exit 0). permalink

Example usage:
    yanglint [-f { yang | yin | info}] <schema>...
        Validates the YANG module <schema>(s) and all its dependencies, optionally printing
        them in the specified format.

    yanglint [-f { xml | json }] <schema>... <file>...
        Validates the YANG modeled data <file>(s) according to the <schema>(s) optionally
        printing them in the specified format.

    yanglint -t (nc-)rpc/notif [-O <operational-file>] <schema>... <file>
        Validates the YANG/NETCONF RPC/notification <file> according to the <schema>(s) using
        <operational-file> with possible references to the operational datastore data.
        To validate nested-notification or action, the <operational-file> is required.

    yanglint -t nc-reply -R <rpc-file> [-O <operational-file>] <schema>... <file>
        Validates the NETCONF rpc-reply <file> of RPC <rpc-file> according to the <schema>(s)
        using <operational-file> with possible references to the operational datastore data.

    yanglint
        Starts interactive mode with more features.

Options:
  -h, --help    Show this help message and exit.
  -v, --version Show version number and exit.
  -V, --verbose Increase libyang verbosity and show verbose messages. If specified
                a second time, show even debug messages.
  -Q, --quiet   Decrease libyang verbosity and hide warnings. If specified a second
                time, hide errors so no libyang messages are printed.
  -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.

  -I FORMAT, --in-format=FORMAT
                Load the data in one of the following formats:
                xml, json, lyb
                If input format not specified, it is detected from the file extension.

  -p PATH, --path=PATH
                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

  -D, --disable-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).

  -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. The option can be combined with --single-node
                option to print information only about the specified node.
  -q, --single-node
                Supplement to the --schema-node option to print information
                only about a single node specified as PATH argument.

  -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.

  -t TYPE, --type=TYPE
                Specify data tree type in the input data file(s):
        data          - Complete datastore with status data (default type).
        config        - Configuration datastore (without status data).
        get           - Data returned by the NETCONF <get> operation.
        getconfig     - Data returned by the NETCONF <get-config> operation.
        edit          - Config content of the NETCONF <edit-config> operation.
        rpc           - Invocation of a YANG RPC/action, defined as input.
        nc-rpc        - Similar to 'rpc' but expect and check also the NETCONF
                        envelopes <rpc> or <action>.
        reply         - Reply to a YANG RPC/action, defined as output. Note that
                        the reply data are expected inside a container representing
                        the original RPC/action invocation.
        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 of a YANG notification.
        nc-notif      - Similar to 'notif' but expect and check also the NETCONF
                        envelope <notification> with element <eventTime> and its
                        sibling as the actual notification.

  -d MODE, --default=MODE
                Print data with default values, according to the MODE
                (to print attributes, 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 the attribute.

  -E XPATH, --data-xpath=XPATH
                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.

  -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=LINE_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. The option has effect only for 'data' and 'config' TYPEs.

  -y, --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.

  -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 deref() XPath function within leafref
Options (27)
OptionDescriptionSource
-h, --helpShow this help message and exit.help + man
-Q, --quietDecrease libyang verbosity and hide warnings.help
-f, --format FORMATConverts the content of the input FILEs into the specified FORMAT.help + man
-I, --in-format FORMATLoad the data in one of the following formats: xml, json, lyb If input format not specified, it is detected from the file extension.help
-p, --path PATHSpecifies search path for getting imported modules or included submodules.help + man
-D, --disable-searchdirDo not implicitly search in current working directory for schema modules.help
-F, --features FEATURESSpecific module features to support in the form <module-name>:(<feature>,)* Use <feature> '*' to enable all features of a module.help + man
-i, --make-implementedMake the imported modules "referenced" from any loaded module also implemented.help
-P, --schema-node PATHPrint only the specified subtree of the schema.help
-q, --single-nodeSupplement to the --schema-node option to print information only about a single node specified as PATH argument.help
-s, --submodule, --strict SUBMODULEChanges handling of unknown data nodes - instead of silently ignoring unknown data, error is printed and data parsing fails.help + man
-x, --ext-data FILEFile containing the specific data required by an extension.help
-n, --not-strictDo not require strict data parsing (silently skip unknown data), has no effect for schemas.help
-t, --type TYPESpecify data tree type in the input data file(s): data - Complete datastore with status data (default type).help + man
-d, --default MODEPrint data with default values, according to the MODE (to print attributes, ietf-netconf-with-defaults model must be loaded): all - Add missing default nodes.help + man
-E, --data-xpath XPATHEvaluate XPATH expression over the data and print the nodes satisfying the expression.help
-l, --listPrint info about the loaded schemas.help
-L, --tree-line-length LINE_LENGTHThe limit of the maximum line length on which the 'tree' format will try to be printed.help
-o, --output OUTFILEWrites the output data into the specified OUTFILE.help + man
-O, --operational FILEProvide optional data to extend validation of the '(nc-)rpc', '(nc-)reply' or '(nc-)notif' TYPEs.help
-R, --reply-rpc FILEProvide source RPC for parsing of the 'nc-reply' TYPE.help
-m, --mergeMerge input data files into a single tree and validate at once.help
-y, --yang-library YANGLIB_PATHSpecify path to a yang-library data file (XML or JSON) describing the initial context.help + man
-Y, --yang-library-file FILEParse FILE with "ietf-yang-library" data and use them to create an exact YANG schema context.help
-X, --extended-leafrefAllow usage of deref() XPath function within leafrefhelp
-v, --versionOutputs the version number and exits. (in the manual page but not in --help)man
-V, --verboseIncreases the verbosity level. (in the manual page but not in --help)man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.