docs: add useful debug CLI

Change-Id: I5ef9ecd741f1623ae1b7a23fa0a4fa6db7e243a3
Signed-off-by: Scott Keeler <skeeler@cisco.com>
This commit is contained in:
Scott Keeler
2018-10-23 15:16:46 -04:00
committed by Damjan Marion
parent 8a6928938c
commit 70f28fc4b8
16 changed files with 1058 additions and 249 deletions

View File

@ -1,15 +1,22 @@
.. _intcommands:
Interface Commands
==================
.. _interface:
.. toctree::
Basic Interface Commands
=========================
There are several commands that are associated to Basic Interface:
* `Show Interface`_
* `Clear Interfaces`_
.. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .
.. _showintcommand:
Show Interface
==============
Shows software interface information including counters and features
++++++++++++++++
Shows software interface information including counters and features.
Summary/Usage
-------------
@ -26,18 +33,18 @@ Example of how to show the interface counters:
.. code-block:: console
vpp# show int
Name Idx State Counter Count
Name Idx State Counter Count
TenGigabitEthernet86/0/0 1 up rx packets 6569213
rx bytes 9928352943
tx packets 50384
tx bytes 3329279
TenGigabitEthernet86/0/1 2 down
TenGigabitEthernet86/0/1 2 down
VirtualEthernet0/0/0 3 up rx packets 50384
rx bytes 3329279
tx packets 6569213
tx bytes 9928352943
drops 1498
local0 0 down
local0 0 down
Example of how to display the interface placement:
@ -62,7 +69,7 @@ Example of how to display the interface placement:
VirtualEthernet0/0/13 queue 3 (polling)
Clear Interfaces
================
+++++++++++++++++
Clear the statistics for all interfaces (statistics associated with the
'*show interface*' command).
@ -80,86 +87,3 @@ Example of how to clear the statistics for all interfaces:
.. code-block:: console
vpp# clear interfaces
Set Interface Mac Address
=========================
The '*set interface mac address* ' command allows to set MAC address of
given interface. In case of NIC interfaces the one has to support MAC
address change. A side effect of MAC address change are changes of MAC
addresses in FIB tables (ipv4 and ipv6).
Summary/Usage
-------------
.. code-block:: shell
set interface mac address <interface> <mac-address>.
Examples
--------
Examples of how to change MAC Address of interface:
.. code-block:: console
vpp# set interface mac address GigabitEthernet0/8/0 aa:bb:cc:dd:ee:01
vpp# set interface mac address host-vpp0 aa:bb:cc:dd:ee:02
vpp# set interface mac address tap-0 aa:bb:cc:dd:ee:03
vpp# set interface mac address pg0 aa:bb:cc:dd:ee:04
Set Interface Mtu
=================
.. toctree::
Summary/Usage
-------------
.. code-block:: shell
set interface mtu [packet|ip4|ip6|mpls] <value> <interface>.
Set Interface Promiscuous
=========================
Summary/Usage
-------------
.. code-block:: shell
set interface promiscuous [on|off] <interface>.
.. _setintstate:
Set Interface State
===================
This command is used to change the admin state (up/down) of an
interface.
If an interface is down, the optional '*punt*' flag can also be set. The
'*punt*' flag implies the interface is disabled for forwarding but punt
all traffic to slow-path. Use the '*enable*' flag to clear '*punt*' flag
(interface is still down).
Summary/Usage
-------------
.. code-block:: shell
set interface state <interface> [up|down|punt|enable].
Examples
--------
Example of how to configure the admin state of an interface to **up**:
.. code-block:: console
vpp# set interface state GigabitEthernet2/0/0 up
Example of how to configure the admin state of an interface to **down**:
.. code-block:: console
vpp# set interface state GigabitEthernet2/0/0 down

View File

@ -0,0 +1,222 @@
.. _interface:
.. toctree::
Create Interfaces Commands
===========================
This section contains those interface commands that are associated to creating an interface:
* `Create Host-Interface`_
* `Create Interface Memif`_
* `Create Loopback Interface`_
* `Create Sub-Interfaces`_
.. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .
Create Host-Interface
++++++++++++++++++++++
Summary/Usage
-------------
create host-interface name <*ifname*> [*hw-addr <*mac-addr*>]
Description
------------
Create a host interface that will attach to a linux AF_PACKET interface, one side of a veth pair. The veth pair must already exist. Once created, a new host interface will exist in VPP with the name 'host-<*ifname*>', where '<*ifname*>' is the name of the specified veth pair. Use the `show interface` command to display host interface details.
This command has the following optional parameters:
hw-addr <*mac-addr*> - Optional ethernet address, can be in either X:X:X:X:X:X unix or X.X.X cisco format
Example Usage
-------------
Example of how to create a host interface tied to one side of an existing linux veth pair named vpp1:
.. code-block:: console
vpp# create host-interface name vpp1
host-vpp1
Once the host interface is created, enable the interface using:
.. code-block:: console
vpp# set interface state host-vpp1 up
Declaration and Implementation
-------------------------------
**Declaration:** af_packet_create_command (src/vnet/devices/af_packet/cli.c line 133)
**Implementation:** af_packet_create_command_fn
Create Interface Memif
+++++++++++++++++++++++
Summary/Usage
-------------
create interface memif [id <*id*>] [socket-id <*socket-id*>] [ring-size <*size*>] [buffer-size <*size*>] [hw-addr <*mac-address*>] <master|slave> [rx-queues <*number*>] [tx-queues <*number*>] [mode ip] [secret <*string*>]
Declaration and Implementation
-------------------------------
**Declaration:** memif_create_command (src/plugins/memif/cli.c line 258)
**Implementation:** memif_create_command_fn
Create Loopback Interface
++++++++++++++++++++++++++
Summary/Usage
--------------
create loopback interface [mac <*mac-addr*>] [instance <*instance*>]
Description
------------
Create a loopback interface. Optionally, a MAC Address can be provided. If not provided, de:ad:00:00:00:<*loopId*> will be used.
Example Usage
--------------
The following two command syntaxes are equivalent:
.. code-block:: console
vpp# loopback create-interface [mac <*mac-addr*>] [instance <*instance*>]
vpp# create loopback interface [mac <*mac-addr*>] [instance <*instance*>]
Example of how to create a loopback interface:
.. code-block:: console
vpp# create loopback interface
Declaration and Implementation
-------------------------------
**Declaration:** create_loopback_interface_command (src/vnet/ethernet/interface.c line 879)
**Implementation:** create_simulated_ethernet_interfaces
Create Sub-Interfaces
++++++++++++++++++++++
This command is used to add VLAN IDs to interfaces, also known as
subinterfaces. The primary input to this command is the *interface*
and *subId* (subinterface Id) parameters. If no additional VLAN ID is
provide, the VLAN ID is assumed to be the *subId*. The VLAN ID and
*subId* can be different, but this is not recommended.
This command has several variations:
- **create sub-interfaces** <*interface*> <*subId*> - Create a subinterface
to process packets with a given 802.1q VLAN ID (same value as the
*subId*).
- **create sub-interfaces** <*interface*> <*subId*> default - Adding the
*default* parameter indicates that packets with VLAN IDs that do
not match any other subinterfaces should be sent to this
subinterface.
- **create sub-interfaces** <*interface*> <*subId*> untagged - Adding the
*untagged* parameter indicates that packets no VLAN IDs should be
sent to this subinterface.
- **create sub-interfaces** <*interface*> <*subId*>-<*subId*> - Create a
range of subinterfaces to handle a range of VLAN IDs.
- **create sub-interfaces** <*interface*> <*subId*> dot1q|dot1ad <*vlanId*>|any
[exact-match] - Use this command to specify the outer VLAN ID, to
either be explicited or to make the VLAN ID different from the
*subId*.
- **create sub-interfaces** <*interface*> <*subId*> dot1q|dot1ad <*vlanId*>|any
inner-dot1q <*vlanId*>|any [exact-match] - Use this command to
specify the outer VLAN ID and the innner VLAN ID.
When *dot1q* or *dot1ad* is explictly entered, subinterfaces can be
configured as either *exact-match* or *non-exact match*. *Non-exact match* is
the CLI default. If *exact-match* is specified, packets must have the
same number of VLAN tags as the configuration. For *non-exact-match*,
packets must at least that number of tags. L3 (routed) interfaces must
be configured as exact-match. L2 interfaces are typically configured as
non-exact-match. If *dot1q* or *dot1ad* is NOT entered, then the
default behavior is *exact-match*.
Use the **show interface** command to display all subinterfaces.
Summary/Usage
-------------
.. code-block:: shell
create sub-interfaces <interface> {<subId> [default|untagged]} | {<subId>-<subId>} | {<subId> dot1q|dot1ad <vlanId>|any [inner-dot1q <vlanId>|any] [exact-match]}
Example Usage
--------------
Example of how to create a VLAN subinterface 11 to process packets on 802.1q VLAN ID 11:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11
The previous example is shorthand and is equivalent to:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 11 exact-match
Example of how to create a subinterface number that is different from the VLAN ID:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100
Examples of how to create q-in-q and q-in-any subinterfaces:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100 inner-dot1q 200
vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1q 100 inner-dot1q any
Examples of how to create dot1ad interfaces:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1ad 11
vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1ad 100 inner-dot1q 200
Examples of *exact-match* versus non-exact match. A packet with outer VLAN 100 and inner VLAN 200 would match this interface, because the default is non-exact match:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100
However, the same packet would NOT match this interface because *exact-match* is specified and only one VLAN is configured, but packet contains two VLANs:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100 exact-match
Example of how to created a subinterface to process untagged packets:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 5 untagged
Example of how to created a subinterface to process any packet with a VLAN ID that does not match any other subinterface:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 7 default
When subinterfaces are created, they are in the down state. Example of how to enable a newly created subinterface:
.. code-block:: console
vpp# set interface GigabitEthernet2/0/0.7 up

View File

@ -1,32 +1,87 @@
.. _hardwarecommands:
.. _interface:
.. toctree::
Hardware-Interfaces Commands
=============================
This section contains those interface commands that are related to hardware-interfaces:
* `Show Bridge-Domain`_
* `Show Hardware-Interfaces`_
* `Clear Hardware-Interfaces`_
.. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .
Show Bridge-Domain
+++++++++++++++++++
Summary/Usage
--------------
show bridge-domain [*bridge-domain-id* [detail|int|arp| *bd-tag* ]]
Description
------------
Show a summary of all the bridge-domain instances or detailed view of a single bridge-domain. Bridge-domains are created by adding an interface to a bridge using the **set interface l2 bridge** command.
Example Usage
--------------
.. code-block:: console
Example of displaying all bridge-domains:
vpp# show bridge-domain
ID Index Learning U-Forwrd UU-Flood Flooding ARP-Term BVI-Intf
0 0 off off off off off local0
200 1 on on on on off N/A
Example of displaying details of a single bridge-domains:
vpp# show bridge-domain 200 detail
ID Index Learning U-Forwrd UU-Flood Flooding ARP-Term BVI-Intf
200 1 on on on on off N/A
Interface Index SHG BVI VLAN-Tag-Rewrite
GigabitEthernet0/8/0.200 3 0 - none
GigabitEthernet0/9/0.200 4 0 - none
Declaration and Implementation
-------------------------------
**Declaration:** bd_show_cli (src/vnet/l2/l2_bd.c line 1151)
**Implementation:** bd_show
Show Hardware-Interfaces
========================
+++++++++++++++++++++++++
Display more detailed information about all or a list of given
interfaces. The verboseness of the output can be controlled by the
following optional parameters:
- brief: Only show name, index and state (default for bonded
- **brief**: Only show name, index and state (default for bonded
interfaces).
- verbose: Also display additional attributes (default for all other
- **verbose**: Also display additional attributes (default for all other
interfaces).
- detail: Also display all remaining attributes and extended
- **detail**: Also display all remaining attributes and extended
statistics.
**To limit the output of the command to bonded interfaces and their
slave interfaces, use the '*bond*' optional parameter.**
.. note::
To limit the output of the command to bonded interfaces and their
slave interfaces, use the '*bond*' optional parameter.
Summary/Usage
-------------
--------------
.. code-block:: shell
show hardware-interfaces [brief|verbose|detail] [bond] [<interface> [<interface> [..]]] [<sw_idx> [<sw_idx> [..]]].
Examples
--------
---------
Example of how to display default data for all interfaces:
.. code-block:: console
@ -56,7 +111,7 @@ Example of how to display default data for all interfaces:
local0 0 down local0
local
Example of how to display '*verbose*' data for an interface by name and software index (where 2 is the software index):
Example of how to display *verbose* data for an interface by name and software index (where 2 is the software index):
.. code-block:: console
@ -76,10 +131,10 @@ Example of how to display '*verbose*' data for an interface by name and software
cpu socket 0
Clear Hardware-Interfaces
=========================
+++++++++++++++++++++++++++
Clear the extended statistics for all or a list of given interfaces
(statistics associated with the '*show hardware-interfaces*' command).
(statistics associated with the **show hardware-interfaces** command).
Summary/Usage
@ -88,7 +143,7 @@ Summary/Usage
.. code-block:: shell
clear hardware-interfaces [<interface> [<interface> [..]]] [<sw_idx> [<sw_idx> [..]]].
Examples
--------
@ -100,7 +155,7 @@ Example of how to clear the extended statistics for all interfaces:
vpp# clear hardware-interfaces
Example of how to clear the extended statistics for an interface by name and software index (where 2 is the software index):
Example of how to clear the extended statistics for an interface by name and software index (where 2 is the software index):
.. code-block:: console

View File

@ -1,10 +1,17 @@
.. _interfacecommands:
.. _interface:
.. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .
.. _intcommands:
Interface Commands
==================
This section identifies the following types of interface commands:
.. toctree::
:maxdepth: 2
basic
hardware
interface
subinterface
create_interface
setinterface

View File

@ -0,0 +1,187 @@
.. _interface:
.. toctree::
Set Interface Commands
=======================
This section covers those commands that are related to setting an interface:
* `Set Interface`_
* `Set Interface IP Address`_
* `Set Interface L2 Bridge`_
* `Set Interface Mtu`_
* `Set Interface Promiscuous`_
* `Set Interface State`_
.. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .
Set Interface
++++++++++++++++
Summary/Usage
-------------
Interface commands.
Declaration and Implementation
-------------------------------
**Declaration:** vnet_cli_set_interface_command (src/vnet/interface_cli.c line 484)
Set Interface IP Address
+++++++++++++++++++++++++
Summary/Usage
-------------
set interface ip address [del] <*interface*> <*ip-addr*>/<*mask*> | [all]
Description
-------------
Add an IP Address to an interface or remove and IP Address from an interface. The IP Address can be an IPv4 or an IPv6 address. Interfaces may have multiple IPv4 and IPv6 addresses. There is no concept of primary vs. secondary interface addresses; they're just addresses.
To display the addresses associated with a given interface, use the command **show interface address** <*interface*>.
.. note::
The debug CLI does not enforce classful mask-width / addressing constraints.
Example Usage
--------------
An example of how to add an IPv4 address to an interface:
.. code-block:: console
vpp# set interface ip address GigabitEthernet2/0/0 172.16.2.12/24
An example of how to add an IPv6 address to an interface:
.. code-block:: console
vpp# set interface ip address GigabitEthernet2/0/0 ::a:1:1:0:7/126
To delete a specific interface ip address:
.. code-block:: console
vpp# set interface ip address GigabitEthernet2/0/0 172.16.2.12/24 del
To delete all interfaces addresses (IPv4 and IPv6):
.. code-block:: console
vpp# set interface ip address GigabitEthernet2/0/0 del all
Declaration and Implementation
-------------------------------
**Declaration:** set_interface_ip_address_command (src/vnet/ip/ip46_cli.c line 216)
**Implementation:** add_del_ip_address
Set Interface L2 Bridge
+++++++++++++++++++++++++
Summary/Usage
-------------
set interface l2 bridge <*interface*> <*bridge-domain-id*> [bvi|uu-fwd] [shg]
Description
-------------
Use this command put an interface into Layer 2 bridge domain. If a bridge-domain with the provided bridge-domain-id does not exist, it will be created. Interfaces in a bridge-domain forward packets to other interfaces in the same bridge-domain based on destination mac address. To remove an interface from a the Layer 2 bridge domain, put the interface in a different mode, for example Layer 3 mode.
Optionally, an interface can be added to a Layer 2 bridge-domain as a Bridged Virtual Interface (bvi). Only one interface in a Layer 2 bridge-domain can be a bvi.
Optionally, a split-horizon group can also be specified. This defaults to 0 if not specified.
Example Usage
--------------
Example of how to configure a Layer 2 bridge-domain with three interfaces (where 200 is the bridge-domain-id):
.. code-block:: console
vpp# set interface l2 bridge GigabitEthernet0/8/0.200 200
This interface is added a BVI interface:
.. code-block:: console
vpp# set interface l2 bridge GigabitEthernet0/9/0.200 200 bvi
This interface also has a split-horizon group of 1 specified:
.. code-block:: console
vpp# set interface l2 bridge GigabitEthernet0/a/0.200 200 1
Example of how to remove an interface from a Layer2 bridge-domain:
.. code-block:: console
vpp# set interface l3 GigabitEthernet0/a/0.200
Declaration and Implementation
-------------------------------
**Declaration:** int_l2_bridge_cli (src/vnet/l2/l2_input.c line 949)
**Implementation:** int_l2_bridge
Set Interface Mtu
++++++++++++++++++
Summary/Usage
-------------
.. code-block:: shell
set interface mtu [packet|ip4|ip6|mpls] <value> <interface>
Set Interface Promiscuous
++++++++++++++++++++++++++
Summary/Usage
-------------
.. code-block:: shell
set interface promiscuous [on|off] <interface>.
.. _setintstate:
Set Interface State
++++++++++++++++++++
This command is used to change the admin state (up/down) of an
interface.
If an interface is down, the optional *punt* flag can also be set. The
*punt* flag implies the interface is disabled for forwarding but punt
all traffic to slow-path. Use the *enable* flag to clear *punt* flag
(interface is still down).
Summary/Usage
-------------
.. code-block:: shell
set interface state <interface> [up|down|punt|enable].
Example Usage
----------------
Example of how to configure the admin state of an interface to **up**:
.. code-block:: console
vpp# set interface state GigabitEthernet2/0/0 up
Example of how to configure the admin state of an interface to **down**:
.. code-block:: console
vpp# set interface state GigabitEthernet2/0/0 down

View File

@ -1,117 +0,0 @@
.. _subinterfacecommands:
.. toctree::
Create Sub-Interfaces
=====================
This command is used to add VLAN IDs to interfaces, also known as
subinterfaces. The primary input to this command is the '*interface*'
and '*subId*' (subinterface Id) parameters. If no additional VLAN ID is
provide, the VLAN ID is assumed to be the '*subId*'. The VLAN ID and
'*subId*' can be different, but this is not recommended.
This command has several variations:
- **create sub-interfaces <interface> <subId>** - Create a subinterface
to process packets with a given 802.1q VLAN ID (same value as the
'*subId*').
- **create sub-interfaces <interface> <subId> default** - Adding the
'*default*' parameter indicates that packets with VLAN IDs that do
not match any other subinterfaces should be sent to this
subinterface.
- **create sub-interfaces <interface> <subId> untagged** - Adding the
'*untagged*' parameter indicates that packets no VLAN IDs should be
sent to this subinterface.
- **create sub-interfaces <interface> <subId>-<subId>** - Create a
range of subinterfaces to handle a range of VLAN IDs.
- **create sub-interfaces <interface> <subId> dot1q|dot1ad <vlanId>|any
[exact-match]** - Use this command to specify the outer VLAN ID, to
either be explicited or to make the VLAN ID different from the
'*subId*'.
- **create sub-interfaces <interface> <subId> dot1q|dot1ad <vlanId>|any
inner-dot1q <vlanId>|any [exact-match]** - Use this command to
specify the outer VLAN ID and the innner VLAN ID.
When '*dot1q*' or '*dot1ad*' is explictly entered, subinterfaces can be
configured as either exact-match or non-exact match. Non-exact match is
the CLI default. If '*exact-match*' is specified, packets must have the
same number of VLAN tags as the configuration. For non-exact-match,
packets must at least that number of tags. L3 (routed) interfaces must
be configured as exact-match. L2 interfaces are typically configured as
non-exact-match. If '*dot1q*' or '*dot1ad*' is NOT entered, then the
default behavior is exact-match.
Use the '*show interface*' command to display all subinterfaces.
Summary/Usage
-------------
.. code-block:: shell
create sub-interfaces <interface> {<subId> [default|untagged]} | {<subId>-<subId>} | {<subId> dot1q|dot1ad <vlanId>|any [inner-dot1q <vlanId>|any] [exact-match]}.
Examples
--------
Example of how to create a VLAN subinterface 11 to process packets on 802.1q VLAN ID 11:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11
The previous example is shorthand and is equivalent to:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 11 exact-match
Example of how to create a subinterface number that is different from the VLAN ID:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100
Examples of how to create q-in-q and q-in-any subinterfaces:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100 inner-dot1q 200
vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1q 100 inner-dot1q any
Examples of how to create dot1ad interfaces:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1ad 11
vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1ad 100 inner-dot1q 200
Examples of '*exact-match*' versus non-exact match. A packet with outer VLAN 100 and inner VLAN 200 would match this interface, because the default is non-exact match:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100
However, the same packet would NOT match this interface because '*exact-match*' is specified and only one VLAN is configured, but packet contains two VLANs:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100 exact-match
Example of how to created a subinterface to process untagged packets:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 5 untagged
Example of how to created a subinterface to process any packet with a VLAN ID that does not match any other subinterface:
.. code-block:: console
vpp# create sub-interfaces GigabitEthernet2/0/0 7 default
When subinterfaces are created, they are in the down state. Example of how to enable a newly created subinterface:
.. code-block:: console
vpp# set interface GigabitEthernet2/0/0.7 up