yangcli(1)
π NAME π
yangcli β YANG-based NETCONF-over-SSH client application. This is yangcli 2.14, bestie. periodt β¨
π¦ SYNOPSIS π¦
yangcli [parameter=value...]
yangcli --help [brief | normal | full]
yangcli --version
πΈ DESCRIPTION πΈ
okay so yangcli is a Command Line Interface for the NETCONF protocol. It uses the YANG data modeling language to manage the NETCONF content layer. This version supports the YANG data modeling language defined in RFC 6020. No cap. π
- Normal Mode: an interactive CLI shell with command line history. π
- Autostart-mode: if the
serverparameter is present, thenyangcliwill attempt to connect to that server upon startup. If theuserandpasswordparameters are also present, then the user will not be prompted before the connection is attempted. This parameter will be processed first, if script-mode or batch-mode is used. π - Script-mode: if the
run-scriptorrun-commandparameter is present, then the specified script or command will be run automatically upon startup. β¨ - Batch-mode: if the
batch-modeparameter is present, then either therun-scriptorrun-commandparameter will be invoked, if present, and then the program will exit. π
π USAGE π
Parameters can be entered in any order, and have the form:
[start] name [separator [value]]
where:
start== 0, 1, or 2 dashes (foo,-foo,--foo)name== parameter name- Parameter name completion will be attempted if a partial name is entered. π«Ά
separator== whitespace or equals sign (foo=bar,foo bar)value== string value for the parameter.- Strings with whitespace need to be double quoted (
--foo="some string")
- Strings with whitespace need to be double quoted (
Some examples of valid command line parameters:
foo=3
-foo=3
--foo=3
foo 3
foo=fred
--foo "fred flintstone"
Partial parameter names can be entered if they are unique. β¨
π OPTIONS π
--aliases-file[=filespec]β specifies theyangclicommand aliases file to use. The default is~/.yuma/.yangcli_aliases. π--alt-names=booleanβ sets the altername name match mode to use for UrlPath name searches. The default istrue(allow matches on alt-name extension). π¦--autoaliases=booleanβ controls whether theyangclicommand aliases will be saved at exit and loaded at startup. Iftrue, thealiases-fileparameter will be used if it is set, or else the default aliases file will be used (~/.yuma/.yangcli_aliases), for loading and saving theyangclicommand aliases. Iffalse, theyangclicommand aliases will only be stored and loaded manually with thealiasescommand. The default istrue. π--autocomp=booleanβ controls whether partial keywords will be checked for interactive or script commands. Iftrue(the default), the first match for a partial keyword will be used if no definition is found for a command name or parameter name. Iffalse, then exact command and parameter name values must be given. π--autohistory=booleanβ controls whether the command line history buffer will be saved at exit and loaded at startup. Iftrue, the default history file will be used (~/.yuma/.yangcli_history) for loading and saving the history buffer. This is the default value. Iffalse, the history buffer will only be stored and loaded manually with thehistorycommand. β¨--autoload=booleanβ controls whether any YANG content modules will be automatically loaded upon startup or upon session startup with a server. This is the default value. Iffalse, theload-modulecommand must be used to explicitly load all the desired definition modules. π¦--autouservars=booleanβ controls whether theyangcliuser variables will be saved at exit and loaded at startup. Iftrue, theuservars-fileparameter will be used if set, or else the default user variables file will be used (~/.yuma/yangcli_uservars.xml), for loading and saving theyangcliuser variables. Iffalse, theyangcliuser variables will only be stored and loaded manually with theuservarscommand. The default istrue. π--bad-data=enumβ specifies how invalid user input from the CLI will be handled when filling PDUs for remote operations. enum values:ignoreβ silently accept invalid PDU and data model parameters. Intended for advanced server testing mode only. πwarnβ warn, but accept invalid PDU and data model parameters. πcheckβ prompt the user to keep the invalid value or re-enter the value. πerrorβ prompt the user to re-enter the invalid value. π
--batch-modeβ if present, the interactive CLI will not be used. A script should be provided with therun-scriptparameter, or a command provided with therun-commandparameter, or else the program will simply exit. If the auto-connect mode is enabled, then this mode will simply test if a NETCONF session can be established, then exit. π--config=filespecβ the name of the configuration file to use. Any parameter except this one can be set in the config file. The default config file/etc/yuma/yangcli.confwill not be checked if this parameter is present. π--datapath=listβ internal file search path for configuration data files. Overrides theYUMA_DATAPATHenvironment variable. π--default-module=stringβ default module name string to use beforenetconfandyangcliare tried. The module prefix may need to be used for other modules. β¨--deviation=stringβ this parameter identifies a YANG module that should only be checked for deviation statements for external modules. These will be collected and applied to the real module(s) being processed. Deviations are applied as patches to the target module. Since they are not identified in the target module at all (ala imports), they have to be specified explicitly, so they will be correctly processed. Zero or more instances of this parameter are allowed. π--display-mode=enumβ controls how values are displayed during output to STDOUT or a log file. enum values:plainβ plain identifier without any prefix format. πprefixβ plain text with XML prefix added format. β¨moduleβ plain text with module name as prefix added format. π¦xmlβ XML format. πxml-nonsβ XML format, but without any namespace (xmlns) attributes. πΈjsonβ JSON format. π
--dump-session=<filespec-base>β filespec base for dumping the raw netconf traffic data and timestamp information. Example:
--dump-session=/tmp/ses-
The following files are created:
/tmp/ses-outβ session data sent to server/tmp/ses-inβ session data received from server/tmp/ses-out.tsβ size and timestamp for data transmitted/tmp/ses-in.tsβ size and timestamp for data received
--echo-replies=booleanβ allow RPC replies to be echoed to the log or STDOUT. Iftrue,<rpc-reply>messages containing data will be output to the log, if log-level is'info'or higher. Iffalse,<rpc-reply>messages containing data will not be output to the log, regardless of the value of log-level. π--echo-requests=booleanβ allow RPC requests to be echoed to the log or STDOUT. Iftrue,<rpc>messages will be output to the log, if log-level is'info'or higher. Iffalse,<rpc>messages will not be output to the log, regardless of the value of log-level. β¨--feature-disable=module:featureβ identifies a feature which should be considered disabled. Zero or more entries are allowed. π--feature-enable-default=booleanβ iftrue(the default), then features will be enabled by default. Iffalse, then features will be disabled by default. π--feature-enable=module:featureβ identifies a feature which should be considered enabled. Zero or more entries are allowed. π--fixorder=booleanβ controls whether PDU parameters will be automatically sent to the server in the correct order. Iftrue, then canonical order will be used. This is the default value. Iffalse, the specified order will be used. β¨--force-target=enumβ controls whether the candidate or running configuration datastore will be used as the default edit target, when both are supported by the server. enum values:candidateβ force default edit target to candidate. π¦runningβ force default edit target to running. π
--helpβ print this help text and exit. The help-mode choice (--brief,--normal, or--full) may also be present to control the amount of help text printed. π--home=dirspecβ directory specification for the home directory to use instead ofHOME. π--indent=numberβ number of spaces to indent (0..9) in formatted output. The default is2spaces. β¨--log=filespecβ filespec for the log file to use instead of STDOUT. If this string begins with a'~'character, then a username is expected to follow or a directory separator character. If it begins with a'$'character, then an environment variable name is expected to follow. π--log-appendβ if present, the log will be appended not over-written. If not, the log will be over-written. Only meaningful if thelogparameter is also present. π--log-level=enumβ sets the debug logging level for the program. enum values:offerrorwarninfodebugdebug2debug3debug4
--match-names=enumβ Match mode to use for UrlPath name searches. enum values:exactβ The name must exactly match the node name for all characters in both name strings.exact-nocaseβ The name must match the node name for all characters in both name strings. Strings are not case-sensitive.oneβ The name must exactly match the first N characters of just one node name, which must be the only partial name match found.one-nocaseβ The name must exactly match the first N characters of just one node name, which must be the only partial name match found. Strings are not case-sensitive.firstβ The name must exactly match the first N characters of any node name. The first one found will be used.first-nocaseβ The name must exactly match the first N characters of any node name. The first one found will be used. Strings are not case-sensitive.
--modpath=listβ Directory search path for YANG and YIN files. Overrides theYUMA_MODPATHenvironment variable. β¨--module=stringβ YANG or YIN source module name to load upon startup. If this string represents a filespec, ending with the.yangor.yinextension, then only that file location will be checked. π
If this string represents a module name, then the module search path will be checked for a file the .yang or .yin extension.
If this string begins with a ~ character, then a username is expected to follow or a directory separator character. If it begins with a $ character, then an environment variable name is expected to follow.
~/some/path ==> <my-home-dir>/some/path
~fred/some/path ==> <fred-home-dir>/some/path
$workdir/some/path ==> <workdir-env-var>/some/path
--ncport=numberβ The NETCONF port number to use for starting sessions. If not present, then port830, followed by port22, will be tried. π--password=stringβ User password to use for NETCONF sessions. If none, then user will be prompted before connecting. π--private-key=stringβ Contains the file path specification for the file containing the client-side private key. If both'public-key'and'private-key'files are present, the client will attempt to connect to the server using these keys. If this fails, or not done, then password authentication will be attempted. ποΈ--protocols=bitsβ Specifies which protocol versions the program or session will attempt to use. Empty set is not allowed. Default is to enable all protocols. bit values:netconf1.0β RFC 4741 base:1.0netconf1.1β RFC xxxx base:1.1
--public-key=stringβ Contains the file path specification for the file containing the client-side public key. If both'public-key'and'private-key'files are present, the client will attempt to connect to the server using these keys. If this fails, or not done, then password authentication will be attempted. π--run-command=stringβ The specified command will be invoked upon startup. If the auto-connect parameters are provided, then a session will be established before running the command. β‘--run-script=stringβ The specified script will be invoked upon startup. If the auto-connect parameters are provided, then a session will be established before running the script. If a quoted string is used, then any parameters after the script name will be passed to the script. π--runpath=listβ Internal file search path for script files. Overrides theYUMA_RUNPATHenvironment variable. π€οΈ--server=stringβ IP address or DNS name of the NETCONF server target to use for the auto-startup mode, or as the default value when starting a new session. π--subdirs=booleanβ If false, the file search paths for modules, scripts, and data files will not include sub-directories if they exist in the specified path.
If true, then these file search paths will include sub-directories, if present. Any directory name beginning with a dot (.) character, or named CVS, will be ignored. This is the default mode. π
--time-rpcs=booleanβ Measure the round-trip time of each<rpc>request and<rpc-reply>at the session level. Echo the elapsed time value to screen if in interactive mode, as well as the log if the log is a file instead of stdout. β±οΈ--timeout=numberβ The number of seconds to wait for a response from the server before declaring a timeout. Zero means do not timeout at all. β--transport=enumβ Identifies the transport protocol that should be used. This is the default that will be used or the value used in auto-connect mode. The value can also be provided when invoking the'connect'command. enum values:--use-xmlheader=β Specifies how file result variables will be written for XML files. Controls whether the XML preamble header will be written or not. π§Ύ--user=stringβ User name to use for NETCONF sessions. This value will be used in auto-startup mode, or as the default value when starting a new session. πββοΈ--uservars-file=filespecβ Specifies the yangcli user variables file to use. The default is~/.yuma/yangcli_uservars.xml. ποΈ--versionβ Print the program version string and exit. π--warn-idlen=numberβ Control whether identifier length warnings will be generated. The value zero disables all identifier length checking. If non-zero, then a warning will be generated if an identifier is defined which has a length is greater than this amount. range:0 | 8 .. 1023. The default value is64. β οΈ--warn-linelen=numberβ Control whether line length warnings will be generated. The value zero disables all line length checking. If non-zero, then a warning will be generated if the line length is greater than this amount. Tab characters are counted as8spaces. range:0 | 40 .. 4095. The default value is72. π--warn-off=numberβ Control whether the specified warning number will be generated and counted in the warning total for the module being parsed. range:400 .. 899. This parameter may be entered zero or more times. π--yuma-home=stringβ Directory for the yuma project root to use. If present, this directory location will override theYUMA_HOMEenvironment variable, if it is present. If a zero-length string is entered, then theYUMA_HOMEenvironment variable will be ignored. π
π SEARCH PATH π
When a module name is entered as input, or when a module or submodule name is specified in an import or include statement within the file, the following search algorithm is used to find the file:
- file is in the current directory
YUMA_MODPATHenvironment var (or set by modpath parameter)$HOME/modulesdirectory$YUMA_HOME/modulesdirectory$YUMA_INSTALL/modulesdirectory OR default install module location,'/usr/share/yuma/modules'
By default, the entire directory tree for all locations (except step 1) will be searched, not just the specified directory. The subdirs parameter can be used to prevent sub-directories from being searched.
Any directory name beginning with a dot character (.) will be skipped. Also, any directory named CVS will be skipped in directory searches. π«
π ERROR LOGGING π
By default, warnings and errors are sent to STDOUT.
A log file can be specified instead with the log parameter.
Existing log files can be reused with the logappend parameter, otherwise log files are overwritten.
The logging level can be controlled with the log-level parameter.
The default log level is 'info'. The log-levels are additive:
off: suppress all errors (not recommended!) A program return code of'1'indicates some error.error: print errorswarn: print warningsinfo: print generally interesting trace infodebug: print general debugging trace infodebug2: print verbose debugging trace infodebug3: print very verbose debugging trace infodebug4: print maximum debugging trace info
π ENVIRONMENT π
The following optional environment variables can be used to control module search behavior:
HOMEβ The user's home directory (e.g.,/home/andy)YUMA_HOMEβ The root of the user's Yuma work directory (e.g.,/home/andy/swdev/netconf)YUMA_INSTALLβ The root of the directory that yangdump is installed on this system (default is,/usr/share/yuma)YUMA_DATAPATHβ Colon-separated list of directories to search for data files. (e.g.:'./workdir/data-files:/home/andy/test-data') The datapath parameter will override this environment variable, if both are present.YUMA_MODPATHβ Colon-separated list of directories to search for modules and submodules. (e.g.:'./workdir/modules:/home/andy/test-modules') The modpath parameter will override this environment variable, if both are present.YUMA_RUNPATHβ Colon-separated list of directories to search for script files. (e.g.:'./workdir/scripts:/home/andy/scripts') The runpath parameter will override this environment variable, if both are present.
πΈ CONFIGURATION FILES πΈ
π yangcli.conf
YANG config file, bestie. The default is: /etc/yuma/yangcli.conf
An ASCII configuration file format is supported so you can stash your command line parameters in a file like a little treasure chest. π
The config parameter is what you use to point at a specific config file β otherwise the default config file is the one that gets checked.
- A hash mark until EOLN is treated as a comment
- All text is case-sensitive
- Whitespace within a line is not significant
- Whitespace to end a line is significant/ Unless the line starts a multi-line string, an escaped EOLN (backslash EOLN) is needed to enter a leaf on multiple lines.
- For parameters that define lists, the key components are listed just after the parameter name, without any name, e.g.,
interface eth0 {
# name = eth0 is not listed inside the braces
ifMtu 1500
ifName mySystem
}
A config file can contain any number of parameter sets for different programs. It's giving β¨multitaskingβ¨.
Each program must have its own section, identified by its name:
# this is a comment
yangcli {
log-level debug
default-module yuma-interfaces
}
π FILES π
The following data files must be present in the module search path in order for this program to function:
- YANG module library
- default:
/usr/share/yuma/modules/
- default:
- yangcli command aliases
- default:
~/.yuma/.yangcli_aliases - CLI parameters:
--autoaliases,--aliases-file - See the
aliasesandaliascommand for details. - The format of the aliases file is text.
- A comment is a line that begins with a
#character, and will be ignored. Comments are not saved if the--autoaliases=trueparameter value is used. - Single or double quotes can be used.
- default:
Example aliases file:
---------------------
g=get
gc=get-config
gcnacm='sget-config --source=running /nacm'
geteth0="xget /interfaces/interface[name='eth0']"
- yangcli user variables
- default:
~/.yuma/yangcli_uservars.xml - CLI parameters:
--autouservars,--uservars-file - See the
uservarscommand for details. - The format of the uservars file is XML.
- Refer to the
varscontainer inyangcli.yangfor a definition of the XML contents.
- default:
π DIAGNOSTICS π
Internal diagnostics may generate the following type of message if any bugs are detected at runtime:
[E0]
filename.c:linenum error-number (error-msg)
Not the error message you want, but lowkey the one you deserve if a bug slipped through. π
π AUTHORS π
Andy Bierman, <andy at netconfcentral dot org>
Vladimir Vassilev, <vladimir at lightside-instruments dot com>
π«Ά SEE ALSO π«Ά
netconf-subsystem(1) netconfd(1)
and that's a wrap, bestie π
this whole page is from the Linux source, version dated March 23, 2025, and it's the yangcli(1) manual β go forth and slay your NETCONF sessions fr fr π¦β¨
π¦ where this page comes from
- debian trixie: yangcli 2.14-1
- ubuntu questing: yangcli 2.14-1build1
- ubuntu resolute: yangcli 2.14-1build2
- ubuntu stonking: yangcli 2.14-1build3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms