docs: Add more on trex
[vpp.git] / docs / usecases / simpleperf / trex2.rst
1 .. _trex2:
2
3 TRex Stateless Mode
4 ===================
5
6 TRex can also be run in a stateless mode. For a detailed description of TRex stateless support
7 please refer to `TRex Stateless Support <https://trex-tgn.cisco.com/trex/doc/trex_stateless.html>`_.
8
9 In this section we show some simple examples using TRex stateless mode. These examples use
10 the configuration as shown in the section :ref:`trex`. These examples we will be using VMWare VMs.
11
12 To use TRex stateless mode we use 2 terminals on the TRex traffic generator node.  One terminal will
13 be used for the TRex console and one to monitor the traffic.
14
15 In one of terminals start TRex in stateless mode.  Use *Ctrl-C* to stop.
16
17 .. code-block:: console
18
19     # cd v2.46/
20     # ./trex -i
21     -Per port stats table 
22           ports |               0 |               1 |               2 |               3 
23      -----------------------------------------------------------------------------------------
24        opackets |               0 |               0 |               0 |               0 
25          obytes |               0 |               0 |               0 |               0 
26        ipackets |               6 |               6 |               5 |               5 
27          ibytes |             384 |             384 |             320 |             320 
28         ierrors |               0 |               0 |               0 |               0 
29         oerrors |               0 |               0 |               0 |               0 
30           Tx Bw |       0.00  bps |       0.00  bps |       0.00  bps |       0.00  bps 
31     
32     -Global stats enabled 
33      Cpu Utilization : 0.0  %
34      Platform_factor : 1.0  
35      Total-Tx        :       0.00  bps  
36      Total-Rx        :     238.30  bps  
37      Total-PPS       :       0.00  pps  
38      Total-CPS       :       0.00  cps  
39     
40      Expected-PPS    :       0.00  pps  
41      Expected-CPS    :       0.00  cps  
42      Expected-BPS    :       0.00  bps  
43     
44      Active-flows    :        0  Clients :        0   Socket-util : 0.0000 %    
45      Open-flows      :        0  Servers :        0   Socket :        0 Socket/Clients :  -nan 
46      drop-rate       :       0.00  bps   
47      current time    : 21.4 sec  
48      test duration   : 0.0 sec  
49      *** TRex is shutting down - cause: 'CTRL + C detected'
50      All cores stopped !! 
51
52 In the other terminal start the TRex console. With this console we will execute the TRex commands.
53
54 .. code-block:: console
55
56     # cd v2.46/
57     # ./trex -console
58     
59     Using 'python' as Python interpeter
60     
61     
62     Connecting to RPC server on localhost:4501                   [SUCCESS]
63     
64     
65     Connecting to publisher server on localhost:4500             [SUCCESS]
66     
67     
68     Acquiring ports [0, 1, 2, 3]:                                [SUCCESS]
69     
70     
71     Server Info:
72     
73     Server version:   v2.46 @ STL
74     Server mode:      Stateless
75     Server CPU:       2 x Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
76     Ports count:      4 x 10Gbps @ VMXNET3 Ethernet Controller  
77     
78     -=TRex Console v3.0=-
79     
80     Type 'help' or '?' for supported actions
81     trex>
82
83 Start some traffic using the **stl/imix.py** traffic profile.
84
85 .. code-block:: console
86
87     trex>start -f ./stl/imix.py -p 0 1 2 3 -m 9475mbps
88     
89     Removing all streams from port(s) [0, 1, 2, 3]:              [SUCCESS]
90     
91     
92     Attaching 3 streams to port(s) [0]:                          [SUCCESS]
93     
94     
95     Attaching 3 streams to port(s) [1]:                          [SUCCESS]
96     
97     
98     Attaching 3 streams to port(s) [2]:                          [SUCCESS]
99     
100     
101     Attaching 3 streams to port(s) [3]:                          [SUCCESS]
102     
103     
104     Starting traffic on port(s) [0, 1, 2, 3]:                    [SUCCESS]
105     
106     80.94 [ms]
107     
108     trex>
109
110 The **-f ./stl/imix.py** argument specifies the file that is used to create the
111 traffic profile. The argument **-p 0 1 2 3** specifies the ports to be used.
112 The argument **-m 9475mbps** the number of packets/sec to be used.
113 All the arguments can be displayed with the **-h** argument.
114
115 In the other terminal the display shows the statistics related the traffic flows.
116
117 .. code-block:: console
118
119     -Per port stats table 
120           ports |               0 |               1 |               2 |               3
121      -----------------------------------------------------------------------------------------
122        opackets |       789907304 |       789894738 |       790017701 |       790017132 
123          obytes |    285397726750 |    285392406754 |    285406864578 |    285405883070 
124        ipackets |      1563501970 |              45 |      1563504693 |              44 
125          ibytes |    564870783050 |            2880 |    564873491682 |            2816 
126         ierrors |        15728759 |               0 |        15732451 |               0 
127         oerrors |               0 |               0 |               0 |               0 
128           Tx Bw |     606.55 Mbps |     606.19 Mbps |     606.25 Mbps |     606.51 Mbps 
129
130     -Global stats enabled 
131      Cpu Utilization : 100.0  %  2.4 Gb/core 
132      Platform_factor : 1.0  
133      Total-Tx        :       2.43 Gbps  
134      Total-Rx        :       2.40 Gbps  
135      Total-PPS       :     841.44 Kpps  
136      Total-CPS       :       0.00  cps  
137     
138      Expected-PPS    :       0.00  pps  
139      Expected-CPS    :       0.00  cps  
140      Expected-BPS    :       0.00  bps  
141     
142      Active-flows    :        0  Clients :        0   Socket-util : 0.0000 %    
143      Open-flows      :        0  Servers :        0   Socket :        0 Socket/Clients :  -nan 
144      Total_queue_full : 6529970196         
145      drop-rate       :       0.00  bps   
146      current time    : 4016.8 sec  
147      test duration   : 0.0 sec  
148     
149 More statistics can be displayed on the TRex console using the **tui** command.
150
151 .. code-block:: console
152
153     trex>tui
154     
155     Global Statistitcs
156     
157     connection   : localhost, Port 4501                  total_tx_L2  : 2.45 Gb/sec                    
158     version      : STL @ v2.46                           total_tx_L1  : 2.59 Gb/sec                    
159     cpu_util.    : 99.89% @ 2 cores (1 per port)         total_rx     : 2.42 Gb/sec                    
160     rx_cpu_util. : 4.03% / 837.39 Kpkt/sec               total_pps    : 846.96 Kpkt/sec                
161     async_util.  : 0.05% / 1.76 KB/sec                   drop_rate    : 0 b/sec                        
162                                                          queue_full   : 42,750,771 pkts                
163     
164     Port Statistics
165     
166        port    |         0         |         1         |         2         |         3         |       total       
167     -----------+-------------------+-------------------+-------------------+-------------------+------------------
168     owner      |              root |              root |              root |              root |                   
169     link       |                UP |                UP |                UP |                UP |                   
170     state      |      TRANSMITTING |      TRANSMITTING |      TRANSMITTING |      TRANSMITTING |                   
171     speed      |           10 Gb/s |           10 Gb/s |           10 Gb/s |           10 Gb/s |                   
172     CPU util.  |            99.89% |            99.89% |            99.89% |            99.89% |                   
173     --         |                   |                   |                   |                   |                   
174     Tx bps L2  |       612.76 Mbps |       613.07 Mbps |       612.52 Mbps |       612.77 Mbps |         2.45 Gbps 
175     Tx bps L1  |       646.64 Mbps |       646.96 Mbps |        646.4 Mbps |       646.64 Mbps |         2.59 Gbps 
176     Tx pps     |       211.72 Kpps |        211.8 Kpps |       211.73 Kpps |       211.71 Kpps |       846.96 Kpps 
177     Line Util. |            6.47 % |            6.47 % |            6.46 % |            6.47 % |                   
178     ---        |                   |                   |                   |                   |                   
179     Rx bps     |         1.21 Gbps |     \u25bc\u25bc\u25bc 23.03 bps |         1.21 Gbps |          5.94 bps |         2.42 G    bps 
180     Rx pps     |       418.59 Kpps |          0.04 pps |       418.77 Kpps |          0.01 pps |       837.36 Kpps 
181     ----       |                   |                   |                   |                   |                   
182     opackets   |           5227126 |           5227271 |           5432528 |           5432354 |          21319279 
183     ipackets   |          10526000 |                 5 |          10527054 |                 4 |          21053063 
184     obytes     |        1890829910 |        1891039152 |        1965259162 |        1965124338 |        7712252562 
185     ibytes     |        3807894454 |               320 |        3808149896 |               256 |        7616044926 
186     tx-pkts    |        5.23 Mpkts |        5.23 Mpkts |        5.43 Mpkts |        5.43 Mpkts |       21.32 Mpkts 
187     rx-pkts    |       10.53 Mpkts |            5 pkts |       10.53 Mpkts |            4 pkts |       21.05 Mpkts 
188     tx-bytes   |           1.89 GB |           1.89 GB |           1.97 GB |           1.97 GB |           7.71 GB 
189     rx-bytes   |           3.81 GB |             320 B |           3.81 GB |             256 B |           7.62 GB 
190     -----      |                   |                   |                   |                   |                   
191     oerrors    |                 0 |                 0 |                 0 |                 0 |                 0 
192     ierrors    |           133,370 |                 0 |           132,529 |                 0 |           265,899