docs: better docs, mv doxygen to sphinx
[vpp.git] / docs / usecases / trafficgen.rst
1 Stateless Traffic Gen with VPP
2 ==============================
3
4 It’s simple to configure vpp as a high-performance stateless traffic
5 generator. A couple of vpp worker threads running on an older system can
6 easily generate 20 MPPS’ worth of traffic.
7
8 In the configurations shown below, we connect a vpp traffic generator
9 and a vpp UUT using two 40 gigabit ethernet ports on each system:
10
11 ::
12
13     +-------------------+           +-------------------+
14     | traffic generator |           | UUT               |
15     | port 0            | <=======> | port 0            |
16     | 192.168.40.2/24   |           | 192.168.40.1/24   |
17     +-------------------+           +-------------------+
18
19     +-------------------+           +-------------------+
20     | traffic generator |           | UUT               |
21     | port 1            | <=======> | port 1            |
22     | 192.168.41.2/24   |           | 192.168.41.1/24   |
23     +-------------------+           +-------------------+
24
25 Traffic Generator Setup Script
26 ------------------------------
27
28 ::
29
30     set int ip address FortyGigabitEthernet2/0/0 192.168.40.2/24
31     set int ip address FortyGigabitEthernet2/0/1 192.168.41.2/24
32     set int state FortyGigabitEthernet2/0/0 up
33     set int state FortyGigabitEthernet2/0/1 up
34
35     comment { send traffic to the VPP UUT }
36
37     packet-generator new {
38         name worker0
39         worker 0
40         limit 0
41         rate 1.2e7
42         size 128-128
43         tx-interface FortyGigabitEthernet2/0/0
44         node FortyGigabitEthernet2/0/0-output
45         data { IP4: 1.2.40 -> 3cfd.fed0.b6c8
46                UDP: 192.168.40.10 -> 192.168.50.10
47                UDP: 1234 -> 2345
48                incrementing 114
49         }
50     }
51
52     packet-generator new {
53         name worker1
54         worker 1
55         limit 0
56         rate 1.2e7
57         size 128-128
58         tx-interface FortyGigabitEthernet2/0/1
59         node FortyGigabitEthernet2/0/1-output
60         data { IP4: 1.2.4 -> 3cfd.fed0.b6c9
61                UDP: 192.168.41.10 -> 192.168.51.10
62                UDP: 1234 -> 2345
63                incrementing 114
64         }
65     }
66
67     comment { delete return traffic on sight }
68
69     ip route add 192.168.50.0/24 via drop
70     ip route add 192.168.51.0/24 via drop
71
72 Note 1: the destination MAC addresses shown in the configuration (e.g.
73 3cfd.fed0.b6c8 and 3cfd.fed0.b6c9) **must** match the vpp UUT port MAC
74 addresses.
75
76 Note 2: this script assumes that /etc/vpp/startup.conf and/or the
77 command-line in use specifies (at least) two worker threads. Uncomment
78 “workers 2” in the cpu configuration section of /etc/vpp/startup.conf:
79
80 ::
81
82     ## Specify a number of workers to be created
83     ## Workers are pinned to N consecutive CPU cores while skipping "skip-cores" CPU core(s)
84     ## and main thread's CPU core
85     workers 2
86
87 Any plausible packet generator script - including one which replays pcap
88 captures - can be used.
89
90 UUT Setup Script
91 ----------------
92
93 The vpp UUT uses a couple of static routes to forward traffic back to
94 the traffic generator:
95
96 ::
97
98     set int ip address FortyGigabitEthernet2/0/0 192.168.40.1/24
99     set int ip address FortyGigabitEthernet2/0/1 192.168.41.1/24
100     set int state FortyGigabitEthernet2/0/0 up
101     set int state FortyGigabitEthernet2/0/1 up
102
103     ip route add 192.168.50.10/32 via 192.168.41.2
104     ip route add 192.168.51.10/32 via 192.168.40.2