docs: convert plugins doc md->rst
[vpp.git] / docs / usecases / trafficgen.md
1 Vpp Stateless Traffic Generation
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
6 can 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  | traffic generator |           | UUT               |
14  | port 0            | <=======> | port 0            |
15  | 192.168.40.2/24   |           | 192.168.40.1/24   |
16  +-------------------+           +-------------------+
17
18  +-------------------+           +-------------------+
19  | traffic generator |           | UUT               |
20  | port 1            | <=======> | port 1            |
21  | 192.168.41.2/24   |           | 192.168.41.1/24   |
22  +-------------------+           +-------------------+
23 ```
24
25 Traffic Generator Setup Script
26 ------------------------------
27
28 ```
29  set int ip address FortyGigabitEthernet2/0/0 192.168.40.2/24
30  set int ip address FortyGigabitEthernet2/0/1 192.168.41.2/24
31  set int state FortyGigabitEthernet2/0/0 up
32  set int state FortyGigabitEthernet2/0/1 up
33
34  comment { send traffic to the VPP UUT }
35
36  packet-generator new {
37      name worker0
38      worker 0
39      limit 0
40      rate 1.2e7
41      size 128-128
42      tx-interface FortyGigabitEthernet2/0/0
43      node FortyGigabitEthernet2/0/0-output
44      data { IP4: 1.2.40 -> 3cfd.fed0.b6c8
45             UDP: 192.168.40.10 -> 192.168.50.10
46             UDP: 1234 -> 2345
47             incrementing 114
48      }
49  }
50
51  packet-generator new {
52      name worker1
53      worker 1
54      limit 0
55      rate 1.2e7
56      size 128-128
57      tx-interface FortyGigabitEthernet2/0/1
58      node FortyGigabitEthernet2/0/1-output
59      data { IP4: 1.2.4 -> 3cfd.fed0.b6c9
60             UDP: 192.168.41.10 -> 192.168.51.10
61             UDP: 1234 -> 2345
62             incrementing 114
63      }
64  }
65
66  comment { delete return traffic on sight }
67
68  ip route add 192.168.50.0/24 via drop
69  ip route add 192.168.51.0/24 via drop
70 ```
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  ## Specify a number of workers to be created
82  ## Workers are pinned to N consecutive CPU cores while skipping "skip-cores" CPU core(s)
83  ## and main thread's CPU core
84  workers 2
85 ```
86
87 Any plausible packet generator script - including one which replays
88 pcap captures - can be used.
89
90
91 UUT Setup Script
92 ----------------
93
94 The vpp UUT uses a couple of static routes to forward traffic back to
95 the traffic generator:
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
105 ```