blob: 9324c992f00df8df65ca7f12b3866754b3a1c687 [file] [log] [blame]
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +02001Generating traffic with VPP
2===========================
3
4Vpp includes a fairly capable network simulator plugin, which can
5simulate real-world round-trip times and a configurable network packet
6loss rate. Its perfect for evaluating the performance of a TCP stack
7under specified delay/bandwidth/loss conditions.
8
9The nsim plugin cross-connects two physical interfaces at layer 2,
10introducing the specified delay and network loss parameters.
11Reconfiguration on the fly is OK, with the proviso that packets held in
12the network simulator scheduling wheel will be lost.
13
14Configuration
15-------------
16
17Configuration by debug CLI is simple. First, specify the simulator
18configuration: unidirectional delay (half of the desired RTT), the link
19bandwidth, and the expected average packet size. These parameters allow
20the network simulator allocate the right amount of buffering to produce
21the requested delay/bandwidth product.
22
23::
24
25 set nsim delay 25.0 ms bandwidth 10 gbit packet-size 128
26
27To simulate network packet drops, add either packets-per-drop or
28drop-fraction [0.0 1.0]” parameters:
29
30::
31
32 set nsim delay 25.0 ms bandwidth 10 gbit packet-size 128 packets-per-drop 10000
33
34Remember to configure the layer-2 cross-connect:
35
36::
37
38 nsim enable-disable <interface-1> <interface-2>
39
40Packet Generator Configuration
41------------------------------
42
43Heres a unit-test configuration for the vpp packet generator:
44
45::
46
47 loop cre
48 set int ip address loop0 11.22.33.1/24
49 set int state loop0 up
50
51 loop cre
52 set int ip address loop1 11.22.34.1/24
53 set int state loop1 up
54
55 set nsim delay 1.0 ms bandwidth 10 gbit packet-size 128 packets-per-drop 1000
56 nsim enable-disable loop0 loop1
57
58 packet-generator new {
59 name s0
60 limit 10000
61 size 128-128
62 interface loop0
63 node ethernet-input
64 data { IP4: 1.2.3 -> 4.5.6
65 UDP: 11.22.33.44 -> 11.22.34.44
66 UDP: 1234 -> 2345
67 incrementing 114
68 }
69 }
70
71For extra realism, the network simulator drops any specific packet with
72the specified probability. In this example, we see that slight variation
73from run to run occurs as it should.
74
75::
76
77 DBGvpp# pa en
78 DBGvpp# sh err
79 Count Node Reason
80 9991 nsim Packets buffered
81 9 nsim Network loss simulation drop packets
82 9991 ethernet-input l3 mac mismatch
83
84 DBGvpp# clear err
85 DBGvpp# pa en
86 DBGvpp# sh err
87 sh err
88 Count Node Reason
89 9993 nsim Packets buffered
90 7 nsim Network loss simulation drop packets
91 9993 ethernet-input l3 mac mismatch