yangcli

NAME
SYNOPSIS
DESCRIPTION
USAGE
OPTIONS
SEARCH PATH
ERROR LOGGING
ENVIRONMENT
CONFIGURATION FILES
FILES
DIAGNOSTICS
LICENSE
AUTHOR
SEE ALSO

NAME

yangcli − YANG-based NETCONF-over-SSH client application

SYNOPSIS

   yangcli [parameter=value...]

  yangcli --help [brief | normal | full]

  yangcli --version

DESCRIPTION

yangcli is a Command Line Interface for the NETCONF protocol.

    Normal Mode:
       An interactive CLI shell with command line history.

   Autostart-mode:
       If the ’server’ parameter is present, then yangcli will
        attempt to connect to that server upon startup.  If the
       ’user’ and ’password’ parameters 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-script’ or ’run-command’ parameter is present,
       then the specified script or command will be run automatically
       upon startup.

   Batch-mode:
       If the ’batch-mode’ parameter is present, then either the
       ’run-script’ or ’run-command’ parameter 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")

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

--autocomp=boolean

Controls whether partial keywords will be checked for interactive or script commands. If true (the default), the first match for a partial keyword will be used if no definition is found for a command name or parameter name. If false, 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. If true, the default history file will be used (~/.yuma/.yangcli_history) for loading and saving the history buffer. This is the default value. If false, the history buffer will only be stored and loaded manually with the history command.

--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. If false, the ’load-module’ command must be used to explicitly load all the desired definition modules.

--bad-data=enum

Specifies how invalid user input from the CLI will be handled when filling PDUs for remote operations.

   enum values:
      ignore(0)
         Silently accept invalid PDU and data model
         parameters.  Intended for advanced server
         testing mode only.
      warn(1)
         Warn, but accept invalid PDU and data model
         parameters.
      check(2)
         Prompt the user to keep the invalid value
         or re-enter the value.
      error(3)
         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 the ’run-script’ parameter, or a command provided with the ’run-command’ parameter, or else the program will simply exit. If the auto-connect mode is enabled, then this will mode 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.conf will be not be checked if this parameter is present.

--datapath=list

Internal file search path for configuration data files. Overrides the YUMA_DATAPATH environment variable.

--default-module=string

Default module name string to use before ’netconf’ and ’yangcli’ are 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(0)
          Plain identifier without any prefix format.
       prefix(1)
          Plain text with XML prefix added format.
       module(2)
          Plain text with module name as prefix added format.
       xml(3)
          XML format.

--feature-disable=module:feature

Identifies a feature which should be considered disabled. Zero or more entries are allowed.

--feature-enable-default=boolean

If true (the default), then features will be enabled by default. If false, 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. If true, then canonical order will be used. This is the default value. If false, the specified order will be used.

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

--indent=number

Number of spaces to indent (0..9) in formatted output. The default is 3 spaces.

--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 the log parameter is also present.

--log-level=enum

Sets the debug logging level for the program.

--modpath=list

Directory search path for YANG and YIN files. Overrides the YUMA_MODPATH environment variable.

--module=string

YANG or YIN source module name to load upon startup. If this string represents a filespec, ending with the .yang or .yin extension, 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

--password=string

User password to use for NETCONF sessions. If none, then user will be prompted before connecting.

--port=number

The NETCONF port number to use for starting sessions. If not present, then port 830, followed by port 22, will be tried.

--runpath=list

Internal file search path for script files. Overrides the YUMA_RUNPATH environment 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.

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

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

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

--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 as 8 spaces. range: 0 | 40 .. 4095. The default value is 72.

--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 the YUMA_HOME environment variable, if it is present. If a zero-length string is entered, then the YUMA_HOME environment 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:

  1) file is in the current directory
  2) YUMA_MODPATH environment var (or set by modpath parameter)
  3) $HOME/modules directory
  4) $YUMA_HOME/modules directory
  5) $YUMA_INSTALL/modules directory 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 errors
     warn:   print warnings
     info:   print generally interesting trace info
     debug:  print general debugging trace info
     debug2: print verbose debugging trace info
     debug3: print very verbose 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 The default is: /etc/yuma/yangcli.conf

An ASCII configuration file format is supported to store command line parameters.

The config parameter is used to specify a specific config file, otherwise the default config file will be 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.

Each program must have its own section, identifies 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/

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)

LICENSE

The Yuma Tools programs and documentation are subject to a software license, available at:

    http://yuma.iwl.com/licenses/yumatools-cs-license.pdf

AUTHOR

Andy Bierman, <andyb at iwl dot com>

SEE ALSO

netconf-subsystem(1) netconfd(1) yangdiff(1) yangdump(1)