Accessing the Command Line Interface

FlexSwitch ships with an industry standard CLI that is available for device configuration and management.

To use the FlexSwitch ClI begin by accessing it from a terminal or via RDP.

Accessing the CLI

Appliance Mode vs Disaggregated Mode

FlexSwitch can be installed as a monolithic image (Appliance Mode) where the package includes both FlexSwtich and Linux.

Appliance Mode

When FlexSwtich is installed in Appliance Mode, the default user automatically enters the CLI when they log in.

The default user shell is CLI, however a user can be given bash shell access.

For more information about user access, see the User Access page.

Disaggregated Mode

When FlexSwitch is install in the disaggregated mode it boots into the Bash shell.

To enter the CLI from the Bash shell use the commands shown below.

localhost:/# cd /opt/flexswitch/apps/cli2/
localhost:/opt/flexswitch/apps/cli2# ./snap_cli.py 

Note

The default password for the cli user is snaproute

Upon successful login, this splash screen is presented:

cli splash screen

CLI Modes

Privileged Mode

When you access the CLI it is at the root of the command tree. To begin using the CLI you must be in the privileged mode.

Use the enable command to enter the privileged mode.

localhost>enable
localhost#

Use the ? key to see a list of root commands.

----------------------------------------
Command            Description
----------------------------------------
control:
context:
   clear         Clear Action Commands
   config        Configuration Commands
   reset         Reset Action Commands
   save          Save Action Commands
   show          Show Commands

localhost#

Configuration Mode

The configuration mode allows you to configure the features and functions of FlexSwitch.

Use the config command to enter the configuration mode.

localhost#config
localhose(config)#

Built-In Help

The CLI has a help interface with TAB completion and ? suggestions.

Tab Completion

The TAB key can be used as a shortcut for completing individual words in a command or as a way to see available sub-commands in the current context.

Using TAB to complete a word, for example:

When typing show int.

localhost#show int<TAB>

Using TAB at this moment causes the parser to automatically change the command to show interface.

localhost#show interface <TAB>

Using TAB with show interface displays the available options in a brief way without the descriptions given when using ?.

localhost#show interface 
description  fpPort       logical      status       vlan         

TAB completion can be used at each sub-command level to see which options are available.

Note

In the following example, all ports and breakouts are shown whether or not they are configured.

localhost#show interface fpPort <TAB>
1     13    17    20    24    28    31    35    39    42    46    49s1  5     50s3  51s2  52s1  53    53s4  54s3  8     
10    14    18    21    25    29    32    36    4     43    47    49s2  50    50s4  51s3  52s2  53s1  54    54s4  9     
11    15    19    22    26    3     33    37    40    44    48    49s3  50s1  51    51s4  52s3  53s2  54s1  6     
12    16    2     23    27    30    34    38    41    45    49    49s4  50s2  51s1  52    52s4  53s3  54s2  7     

The end of the sub-command tree is the same as it is with the ?.

localhost#show interface fpPort 1 <TAB>
description  statistics   status       

If there is an overlap between 2 or more words, when using TAB completion each available option will be displayed.

localhost#show interface fpPort 1 stat<TAB>
statistics  status 

In the following example both statistics and status are valid sub-commands for the show interface fpPort 1 command and both start with stat.

Simply inputing an i or a u and then TAB allows the command to auto-complete.

localhost#show interface fpPort 1 stati<TAB>   
localhost#show interface fpPort 1 statistics 
Applying Show:
  RX
    0 unicast packets 0 unicast octets
    0 input discards 0 input errors
    0 unknown protocol 0 runts 0 giants
    0 Fragments 0 CRC 0 jabber
  TX    0 unicast packets 0 unicast octets
    0 output discards 0 output errors
------------------------------------------------------------------------------
sdk:printPortState(fpPort1,) result: SUCCESS

Using the Question Mark

For a list of available commands use the ? at any context:

localhost#?
---------------------------------------------
 Command              Description            
---------------------------------------------
 control:                                    
 context:                                    
   clear     Clear Action Commands  
   config    Configuration Commands 
   reset     Reset Action Commands  
   save      Save Action Commands   
   show      Show Commands          

The example above shows that the available commands at the top-level context are clear, config, reset, save, and show.

Using the ? at the config prompt shows to sets of available commands control and context.

Control Commands

 control:                                                                  
   <cr>                                                           
   apply                                                          
   clearunapplied             Clear the current pending config,   
                                       no argument will clear all, or you  
                                       can delete by cmd index             
   end                        Return to enable mode               
   exit                       Exit current CLI tree position, if  
                                       at base then will exit CLI          
   help                       "Display help for current commands, 
                                       short hand notation of ? can be     
                                       used as well                        
   no                                                             
   ping                       Ping Command                        
   quit                        Quiting FlexSwitch CLI.  This will 
                                       stop the CLI session                
   show                       Show running configuration          
   showunapplied              Display the currently unapplied     
                                       configuration.  An optional 'full'  
                                       argument can be supplied to         
                                               show all objects which are  
                                       pending not just valid provisioning 
                                       objects                             
   where                      Display the current command path    

The control commands shown above are available in all commands and sub-commands in configuration mode.