Using the CLI
The yp-shell program can be used within the server to provide a YANG-aware command line interface. It is based on the 'yangcli-pro' program, and provides limited functionality for a dedicated session to the local NETCONF server.
The program connects to the local server as a NETCONF client. Command lines are converted to NETCONF RPC operations as needed and the server responses are used and/or displayed to complete high level network management functions.
yp-shell Setup
The yp-shell program must be installed and setup on the target system before it can be used.
Binary Packages
The yp-shell program must be setup as a shell on the target system. This program is included in the 'Advanced' feature binary packages:
yumapro-sdk
yumapro-pthreads
yumapro-sdk-eval
yumapro-pthreads-eval
Source Packages
This program is included in some source packages.
yumapro
yumapro-server
The WITH_CLI=1 make option must be used to include this feature in the build.
Target System Setup
The login user for the CLI must be properly configured to the yp-shell program will function properly.
Refer to the System Configuration section for an overview of the configuration options for YumaPro SDK programs.
Refer to the Configuration Parameters section for an overview of the configuration file syntax for YumaPro SDK programs.
Refer to the yp-shell – adding a CLI section for complete operating system shell setup details.
Documentation
The YumaPro yangcli-pro Manual contains the documentation for the yp-shell program. Only a subset of the CLI parameters and commands are allowed in yp-shell.
The following sections apply to yp-shell:
yp-shell Configuration
The yp-shell and yangcli-pro programs share the same configuration file.
Note
The default configuration file must be used for yp-shell if any CLI parameter settings are needed.
The file /etc/yumapro/yangcli-pro.conf
will be checked
when the yp-shell program is launched as a login shell.
If it is not found, then only default CLI parameter settings will be
used. However, most of the parameters can be changed at run-time
using Read-write System Variables.
It is possible to specify the --run-script parameter in the configuration to run a yangcli script. This can be done to set variables and/or run commands at the start of each yp-shell session.
Recommended yp-shell Parameter Settings
In some cases the default value for a parameter may not the recommended value for the best CLI feature behavior. For example:
the default is selected to preserve existing behavior
a feature is not enabled by default because it uses more resources
there are multiple options and the default may not be objectively better than any of the other options.
Change Defaults
Parameter |
Value |
Comments |
---|---|---|
|
Cleanup NETCONF sessions properly upon exit |
|
|
Shadow the "<running>" configuration to improve tab key completion for data nodes |
|
|
Break key will exit the current mode instead of exit program |
|
|
Display YANG data with simple CLI syntax |
|
|
Display complete help text instead of truncated help text |
|
|
Allow multiple leaf-lists on the same line in config mode |
|
|
Use same value as the --match-names parameter |
|
|
Display just the data, not the NETCONF reply headers |
|
|
Make sure XML files sent to a server are not altered |
Using Notifications
By default, server notifications are not available in yp-shell. This can be changed by setting the --with-notif-commands parameter to 'true'.
Using Enable Mode
By default, the Config Mode feature is available to anyone. This can be changed by setting the --with-enable-mode parameter to 'true'.
If 'true', the user must enter the 'enable' command to enter enable mode. If the enable-password command has been used to configure a password for the enable command, then this password must be provided by the user in order to enter enable mode.
Within enable mode, the 'config term' command can be used to enter configuration mode.
Controlling Available Commands
The commands available in a yp-shell session are a subset of all yangcli-pro commands.
Use the tab key at the exec mode prompt to display all available commands
Default Builtin Commands
By default, the following built-in commands are available in yp-shell:
In addition to these commands, the RPC operations learned from the server session are also listed as commands. An asterisk '*' follows the command name to indicate it is a server command.
Removing Commands
There are some parameters that can be used to control the commands that are visible and available to the user.
--restrict-edit-mode: Remove all edit operations so only Config Mode can be used to edit server configurations.
--disable-command: Remove a specific command
--hide-command: Remove a specific command from the tab and help keys, but it is still available to use
Adding Notification Commands
Use the --with-notif-commands='true' CLI parameter setting to enable the following commands:
Adding Scripts and Exec Commands
Use the --ypshell-exec-ok='true' CLI parameter setting to enable the run, run-shell, and related commands. The --allow-shell='true' CLI parameter setting must also be used.
yp-shell Differences
The yp-shell and yangcli-pro programs share the same code, but some behavior is different.
No Startup Screen
The yp-shell program uses a dedicated session to the local server. There is no startup screen that shows copyright and help info.
No Session Startup Screen
A summary of the server session modules, features, and other capabilities is shown when a yangcli-pro session starts. This is not done in yp-shell. This information can be displayed at any time using the 'show session' command.