5  yp-shell – adding a CLI

Configure the optional yp-shell Command Line Interface (CLI).

 

Image41

NOTE: yp-shell is not available with YumaPro SDK Basic.

 

5.1  Pre-requisites

You should have completed “3 Installing YumaPro SDK”. If you have installed YumaPro SDK with a binary package then the CLI is included. If you have installed the SDK from source code then you need to have built and installed using EVERYTHING=1 or WITH_CLI=1 build variables.

 

5.2  Installing yp-shell

 

5.2.1  Add yp-shell to the /etc/shells File

The file /etc/shells must be edited with root access. The line /usr/bin/yp-shell needs to be added anywhere.

 

 

mydir> sudo <your_editor> /etc/shells

 

 

The following example file shows yp-shell added at the end:

 

 

mydir> cat /etc/shells

# /etc/shells: valid login shells

/bin/sh

/bin/dash

/bin/bash

/bin/rbash

/usr/bin/yp-shell

 

 

5.2.2  Change the Shell for the Login User to yp-shell

The user(s) that will be used to login to the OpenSSH server need to be created. In this example the user 'cli' is being created (the -m option creates a home folder for the new user):

 

 

mydir> sudo useradd -m --shell /usr/bin/yp-shell cli

 

 

Next create a password for the new user:

 

 

mydir> sudo passwd cli

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

 

 

If the user account already exists, then use the chsh command instead:

 

 

Ubuntu version:

mydir> sudo chsh --shell /usr/bin/yp-shell cli

 

Fedora version:

mydir> sudo usermod -s /usr/bin/yp-shell cli

 

 

Image16

NOTE: chsh dictates that the user can ONLY use the specified shell. Therefore DO NOT perform this command on a user that needs to access a bash terminal or any other type of shell other than yp-shell.

 

 

The system may need to be rebooted to activate the new shell.

Start the netconfd-pro server, the CLI must be enabled (it is by default).

 

A normal SSH login will invoke the yp-shell program when the user logs into the system:

 

 

extdir> ssh  cli@192.168.1.9

cli@192.168.1.9's password:

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.10.0-37-generic x86_64)

 

* Documentation:  https://help.ubuntu.com

* Management:     https://landscape.canonical.com

* Support:        https://ubuntu.com/advantage

 

27 packages can be updated.

0 updates are security updates.

 

Last login: Tue Oct 10 15:38:26 2017 from 192.168.1.9

 

Starting NETCONF session for cli on u16-vm over netconf-tcp-ncx on port 830

cli@u16-vm>

 

 

You can now enter CLI commands similar to the ones in yangcli-pro. The same help and command completion options are available.

 

 

cli@lu16-vm> sget /netconf-state/sessions

 

Filling container /netconf-state/sessions:

RPC Data Reply 3 for session 3 [default]:

 

rpc-reply {

 data {

   netconf-state {

     sessions {

       session  3 {

         session-id 3

         transport yid:netconf-cli

         username cli

         source-host 127.0.0.1

         login-time 2018-11-20T07:27:30Z

         in-rpcs 2

         in-bad-rpcs 0

         out-rpc-errors 0

         out-notifications 0

       }

     }

   }

 }

}

 

 

The two CLIs are very similar, the main difference is yp-shell is connected directly to the server it runs on and so does not have commands to create sessions to multiple servers.

 

Image15

To see the differences between yp-shell and yangcli-pro CLIs see the article: What is the difference between yp-shell in netconfd-pro and yangcli-pro?

 

 

 

 

 

 

A  Appendix: Installed Files

This section describes all the files and/or directories installed by the YumaPro packages.

A.1  Release Notes
A.2  YANG Modules
A.3  Shared Libraries

This section describes the shared libraries needed for the server to operate.

A.4  Binary Programs

This section describes the binary programs installed.

 

A.5  User Manual Pages

 

A.6  User Documentation

 

A.7  Sample Configuration Files

 

A.8  Developer Files
A.9  License and Packaging Information

 

B  Appendix: Next Steps

After Installation you can start learning more about YumaPro SDK with a set of lessons can be found on the YumaWorks’ Knowledge Base “Solutions – Server Developer – Getting Started” at: https://yumaworks.freshdesk.com/solution/folders/1000229490

 

B.1  Solutions

YumaWorks hosts a Knowledge Base with solutions to many Frequently Asked Questions (FAQs) located at: https://yumaworks.freshdesk.com/solution/categories

The Knowledge Base has the following sections:

 

B.2  More Documentation
B.3  Unix ‘man’ pages

The unix 'man' program can be used to get documentation about each program.  For example:

B.4  Program --help option

Each program also has extensive help information available with the --help CLI parameter.  For example: