4167f4dc477d1b247a431d8a622581520c61dca2
[vpp.git] / doxygen / siphon_templates / clicmd / index_header.md
1 {#
2 # Copyright (c) 2016 Comcast Cable Communications Management, LLC.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #}
16 # Debug CLI    {{'{#'}}clicmd}
17
18 The VPP network stack comes equipped with a set of commands that are useful
19 for debugging.
20
21 The easiest way to access the CLI (with proper permissions) is to use the
22 vppctl command:
23
24 ```
25 sudo vppctl <cli-command>
26 ```
27
28 The CLI parser matches static keyword strings, eventually invoking an action
29 function. Unambiguous partial keyword matching always occurs. The action
30 functions consume input until satisfied or until they fail. This model makes
31 for easy coding, but does not guarantee useful "help" output. It's up to the
32 CLI command writer to add useful help strings.
33
34 You can find the source code of CLI commands by searching for instances of the
35 @c VLIB_CLI_COMMAND macro in the code source files.
36
37 Please help maintain and improve this document to make and keep these commands
38 clear and useful!
39
40 @todo Document where to modify this CLI intro text.
41
42
43 ## Debug and Telnet CLI
44
45 The debug CLI is enabled with the unix interactive parameter or startup
46 configuration option. This causes VPP to start without daemonizing and
47 presents a command line interface on the terminal where it is run.
48
49 The Telnet CLI is enabled with the `cli-listen localhost:5002` option which
50 will cause VPP to listen for TCP connections on the localhost address port
51 @c 5002. A Telnet client can then connect to this port (for example, `telnet
52 localhost 5002`) and will receive a command line prompt.
53
54 This configuration will enable both mechanisms:
55
56 ```
57 unix {
58   interactive
59   cli-listen localhost:5002
60 }
61 ```
62
63 The debug CLI can operate in line mode, which may be useful when running
64 inside an IDE like Emacs. This is enabled with the option
65 `unix cli-line-mode`. Several other options exist that alter how this
66 CLI works, see the @ref syscfg section for details.
67
68 The CLI starts with a banner graphic (which can be disabled) and a prompt. The
69 prompt will typically read `vpp` for a release version of VPP and `DBGvpp#`
70 for a development version with debugging enabled, for example:
71
72         _______    _        _   _____  ___ 
73      __/ __/ _ \  (_)__    | | / / _ \/ _ \
74      _/ _// // / / / _ \   | |/ / ___/ ___/
75      /_/ /____(_)_/\___/   |___/_/  /_/    
76     
77     vpp# 
78
79 versus:
80
81         _______    _        _   _____  ___ 
82      __/ __/ _ \  (_)__    | | / / _ \/ _ \
83      _/ _// // / / / _ \   | |/ / ___/ ___/
84      /_/ /____(_)_/\___/   |___/_/  /_/    
85     
86     DBGvpp# 
87
88 This prompt can be configured with the `unix cli-prompt` setting and the
89 banner is disabled with `unix cli-no-banner`.
90
91 ## CLI features
92
93 The CLI has several editing features that make it easy to use.
94
95 - Cursor keys left/right will move the cursor within a command line;
96   typing will insert at the cursor; erase will erase at the cursor.
97
98 - Ctrl-left/right will search for the start of the next word to
99   the left or right.
100 - Home/end will jump the cursor to the start and end of the line.
101 - Cursor keys up/down and ^P/^N iterate through the command history
102   buffer. Lines from the history buffer may be edited. New commands
103   are added to the end of the buffer when executed; though
104   duplicates of the previous command are not added.
105 - ^U erases the line contents from the left of the cursor to the
106   start.
107 - ^K erases the contents from the cursor to the end.
108 - ^S/^R will search the command history forwards or in reverse for
109   a command; start typing for matches to auto complete.
110 - ^L will clear the screen (if supported by the terminal) and repaint
111   the prompt and any current line. The cursor position is also
112   retained.
113 - The CLI can be closed with the quit command. Alternatively, ^D on
114   an empty input line will also close the session. Closing the debug
115   session will also shutdown VPP.
116
117 Output that exceeds the length of a terminal page will be buffered, up to a
118 limit.
119
120 - Space or page-down displays the next page.
121 - Enter or down-arrow displays the next line.
122 - Page-up goes back a page.
123 - Up-arrow goes up a line.
124 - Home/end jump to the start/end of the buffered output.
125 - The key q quits the pager. Space and enter will also quit the
126   pager if the end of the buffer has been reached.
127
128 ## Index of CLI commands
129
130 [TOC]