docs: Fix param name test-param to test-params
[vswitchperf.git] / docs / userguide / testusage.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. (c) OPNFV, Intel Corporation, AT&T and others.
4
5 vSwitchPerf test suites userguide
6 ---------------------------------
7
8 General
9 ^^^^^^^
10
11 VSPERF requires a traffic generators to run tests, automated traffic gen
12 support in VSPERF includes:
13
14 - IXIA traffic generator (IxNetwork hardware) and a machine that runs the IXIA
15   client software.
16 - Spirent traffic generator (TestCenter hardware chassis or TestCenter virtual
17   in a VM) and a VM to run the Spirent Virtual Deployment Service image,
18   formerly known as "Spirent LabServer".
19
20 If you want to use another traffic generator, please select the Dummy generator
21 option as shown in `Traffic generator instructions
22 <http://artifacts.opnfv.org/vswitchperf/docs/configguide/trafficgen.html>`__
23
24 VSPERF Installation
25 ^^^^^^^^^^^^^^^^^^^
26
27 To see the supported Operating Systems, vSwitches and system requirements,
28 please follow the `installation instructions
29 <http://artifacts.opnfv.org/vswitchperf/docs/configguide/installation.html>`__ to
30 install.
31
32 Traffic Generator Setup
33 ^^^^^^^^^^^^^^^^^^^^^^^
34
35 Follow the `Traffic generator instructions
36 <http://artifacts.opnfv.org/vswitchperf/docs/configguide/trafficgen.html>`__ to
37 install and configure a suitable traffic generator.
38
39 Cloning and building src dependencies
40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41
42 In order to run VSPERF, you will need to download DPDK and OVS. You can
43 do this manually and build them in a preferred location, OR you could
44 use vswitchperf/src. The vswitchperf/src directory contains makefiles
45 that will allow you to clone and build the libraries that VSPERF depends
46 on, such as DPDK and OVS. To clone and build simply:
47
48 .. code-block:: console
49
50     $ cd src
51     $ make
52
53 VSPERF can be used with stock OVS (without DPDK support). When build
54 is finished, the libraries are stored in src_vanilla directory.
55
56 The 'make' builds all options in src:
57
58 * Vanilla OVS
59 * OVS with vhost_user as the guest access method (with DPDK support)
60 * OVS with vhost_cuse s the guest access method (with DPDK support)
61
62 The vhost_user build will reside in src/ovs/
63 The vhost_cuse build will reside in vswitchperf/src_cuse
64 The Vanilla OVS build will reside in vswitchperf/src_vanilla
65
66 To delete a src subdirectory and its contents to allow you to re-clone simply
67 use:
68
69 .. code-block:: console
70
71      $ make clobber
72
73 Configure the ``./conf/10_custom.conf`` file
74 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75
76 The ``10_custom.conf`` file is the configuration file that overrides
77 default configurations in all the other configuration files in ``./conf``
78 The supplied ``10_custom.conf`` file **MUST** be modified, as it contains
79 configuration items for which there are no reasonable default values.
80
81 The configuration items that can be added is not limited to the initial
82 contents. Any configuration item mentioned in any .conf file in
83 ``./conf`` directory can be added and that item will be overridden by
84 the custom configuration value.
85
86 Using a custom settings file
87 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
89 If your ``10_custom.conf`` doesn't reside in the ``./conf`` directory
90 of if you want to use an alternative configuration file, the file can
91 be passed to ``vsperf`` via the ``--conf-file`` argument.
92
93 .. code-block:: console
94
95     $ ./vsperf --conf-file <path_to_custom_conf> ...
96
97 Note that configuration passed in via the environment (``--load-env``)
98 or via another command line argument will override both the default and
99 your custom configuration files. This "priority hierarchy" can be
100 described like so (1 = max priority):
101
102 1. Command line arguments
103 2. Environment variables
104 3. Configuration file(s)
105
106 vloop_vnf
107 ^^^^^^^^^
108
109 vsperf uses a VM called vloop_vnf for looping traffic in the PVP and PVVP
110 deployment scenarios. The image can be downloaded from
111 `<http://artifacts.opnfv.org/>`__.
112
113 .. code-block:: console
114
115     $ wget http://artifacts.opnfv.org/vswitchperf/vloop-vnf-ubuntu-14.04_20151216.qcow2
116
117 vloop_vnf forwards traffic through a VM using one of:
118 * DPDK testpmd
119 * Linux Bridge
120 * l2fwd kernel Module.
121
122 Alternatively you can use your own QEMU image.
123
124 l2fwd Kernel Module
125 ^^^^^^^^^^^^^^^^^^^
126
127 A Kernel Module that provides OSI Layer 2 Ipv4 termination or forwarding with
128 support for Destination Network Address Translation (DNAT) for both the MAC and
129 IP addresses. l2fwd can be found in <vswitchperf_dir>/src/l2fwd
130
131 Executing tests
132 ^^^^^^^^^^^^^^^
133
134 Before running any tests make sure you have root permissions by adding
135 the following line to /etc/sudoers:
136
137 .. code-block:: console
138
139     username ALL=(ALL)       NOPASSWD: ALL
140
141 username in the example above should be replaced with a real username.
142
143 To list the available tests:
144
145 .. code-block:: console
146
147     $ ./vsperf --list
148
149 To run a single test:
150
151 .. code-block:: console
152
153     $ ./vsperf $TESTNAME
154
155 Where $TESTNAME is the name of the vsperf test you would like to run.
156
157 To run a group of tests, for example all tests with a name containing
158 'RFC2544':
159
160 .. code-block:: console
161
162     $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf --tests="RFC2544"
163
164 To run all tests:
165
166 .. code-block:: console
167
168     $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
169
170 Some tests allow for configurable parameters, including test duration
171 (in seconds) as well as packet sizes (in bytes).
172
173 .. code:: bash
174
175     $ ./vsperf --conf-file user_settings.py
176         --tests RFC2544Tput
177         --test-params "duration=10;pkt_sizes=128"
178
179 For all available options, check out the help dialog:
180
181 .. code-block:: console
182
183     $ ./vsperf --help
184
185 Executing Vanilla OVS tests
186 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
187
188 1. If needed, recompile src for all OVS variants
189
190 .. code-block:: console
191
192      $ cd src
193      $ make distclean
194      $ make
195
196 2. Update your ''10_custom.conf'' file to use the appropriate variables
197 for Vanilla OVS:
198
199 .. code-block:: console
200
201    VSWITCH = 'OvsVanilla'
202    VSWITCH_VANILLA_PHY_PORT_NAMES = ['$PORT1', '$PORT2']
203
204 Where $PORT1 and $PORT2 are the Linux interfaces you'd like to bind
205 to the vswitch.
206
207 3. Run test:
208
209 .. code-block:: console
210
211      $ ./vsperf --conf-file=<path_to_custom_conf>
212
213 Please note if you don't want to configure Vanilla OVS through the
214 configuration file, you can pass it as a CLI argument; BUT you must
215 set the ports.
216
217 .. code-block:: console
218
219     $ ./vsperf --vswitch OvsVanilla
220
221
222 Executing PVP and PVVP tests
223 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
224
225 To run tests using vhost-user as guest access method:
226
227 1. Set VHOST_METHOD and VNF of your settings file to:
228
229 .. code-block:: console
230
231    VHOST_METHOD='user'
232    VNF = 'QemuDpdkVhost'
233
234 2. If needed, recompile src for all OVS variants
235
236 .. code-block:: console
237
238      $ cd src
239      $ make distclean
240      $ make
241
242 3. Run test:
243
244 .. code-block:: console
245
246      $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
247
248 To run tests using vhost-cuse as guest access method:
249
250 1. Set VHOST_METHOD and VNF of your settings file to:
251
252 .. code-block:: console
253
254      VHOST_METHOD='cuse'
255      VNF = 'QemuDpdkVhostCuse'
256
257 2. If needed, recompile src for all OVS variants
258
259 .. code-block:: console
260
261      $ cd src
262      $ make distclean
263      $ make
264
265 3. Run test:
266
267 .. code-block:: console
268
269      $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
270
271 Executing PVP tests using Vanilla OVS
272 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
273
274 To run tests using Vanilla OVS:
275
276 1. Set the following variables:
277
278 .. code-block:: console
279
280    VSWITCH = 'OvsVanilla'
281    VNF = 'QemuVirtioNet'
282
283    VANILLA_TGEN_PORT1_IP = n.n.n.n
284    VANILLA_TGEN_PORT1_MAC = nn:nn:nn:nn:nn:nn
285
286    VANILLA_TGEN_PORT2_IP = n.n.n.n
287    VANILLA_TGEN_PORT2_MAC = nn:nn:nn:nn:nn:nn
288
289    VANILLA_BRIDGE_IP = n.n.n.n
290
291    or use --test-param
292
293    $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
294               --test-params "vanilla_tgen_tx_ip=n.n.n.n;
295                             vanilla_tgen_tx_mac=nn:nn:nn:nn:nn:nn"
296
297
298 2. If needed, recompile src for all OVS variants
299
300 .. code-block:: console
301
302      $ cd src
303      $ make distclean
304      $ make
305
306 3. Run test:
307
308 .. code-block:: console
309
310      $ ./vsperf --conf-file<path_to_custom_conf>/10_custom.conf
311
312 Using vfio_pci with DPDK
313 ^^^^^^^^^^^^^^^^^^^^^^^^^
314
315 To use vfio with DPDK instead of igb_uio edit 'conf/02_vswitch.conf'
316 with the following parameters:
317
318 .. code-block:: console
319
320     DPDK_MODULES = [
321      ('vfio-pci'),
322     ]
323     SYS_MODULES = ['cuse']
324
325 **NOTE:** Please ensure that Intel VT-d is enabled in BIOS.
326
327 **NOTE:** Please ensure your boot/grub parameters include
328 the following:
329
330 .. code-block:: console
331
332     iommu=pt intel_iommu=on
333
334 To check that IOMMU is enabled on your platform:
335
336 .. code-block:: console
337
338     $ dmesg | grep IOMMU
339     [    0.000000] Intel-IOMMU: enabled
340     [    0.139882] dmar: IOMMU 0: reg_base_addr fbffe000 ver 1:0 cap d2078c106f0466 ecap f020de
341     [    0.139888] dmar: IOMMU 1: reg_base_addr ebffc000 ver 1:0 cap d2078c106f0466 ecap f020de
342     [    0.139893] IOAPIC id 2 under DRHD base  0xfbffe000 IOMMU 0
343     [    0.139894] IOAPIC id 0 under DRHD base  0xebffc000 IOMMU 1
344     [    0.139895] IOAPIC id 1 under DRHD base  0xebffc000 IOMMU 1
345     [    3.335744] IOMMU: dmar0 using Queued invalidation
346     [    3.335746] IOMMU: dmar1 using Queued invalidation
347     ....
348
349 Selection of loopback application for PVP and PVVP tests
350 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
351
352 To select loopback application, which will perform traffic forwarding
353 inside VM, following configuration parameter should be configured:
354
355 .. code-block:: console
356
357      GUEST_LOOPBACK = ['testpmd', 'testpmd']
358
359 or use --test-param
360
361 .. code-block:: console
362
363         $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
364               --test-params "guest_loopback=testpmd"
365
366 Supported loopback applications are:
367
368 .. code-block:: console
369
370      'testpmd'       - testpmd from dpdk will be built and used
371      'l2fwd'         - l2fwd module provided by Huawei will be built and used
372      'linux_bridge'  - linux bridge will be configured
373      'buildin'       - nothing will be configured by vsperf; VM image must
374                        ensure traffic forwarding between its interfaces
375
376 Guest loopback application must be configured, otherwise traffic
377 will not be forwarded by VM and testcases with PVP and PVVP deployments
378 will fail. Guest loopback application is set to 'testpmd' by default.
379
380 Executing Packet Forwarding tests
381 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
382
383 To select application, which will perform packet forwarding,
384 following configuration parameter should be configured:
385
386   .. code-block:: console
387
388      VSWITCH = 'none'
389      PKTFWD = 'TestPMD'
390
391      or use --vswitch and --fwdapp
392
393      $ ./vsperf --conf-file user_settings.py
394               --vswitch none
395               --fwdapp TestPMD
396
397 Supported Packet Forwarding applications are:
398
399   .. code-block:: console
400
401      'testpmd'       - testpmd from dpdk
402
403
404 1. Update your ''10_custom.conf'' file to use the appropriate variables
405 for selected Packet Forwarder:
406
407   .. code-block:: console
408
409    # testpmd configuration
410    TESTPMD_ARGS = []
411    # packet forwarding mode: io|mac|mac_retry|macswap|flowgen|rxonly|txonly|csum|icmpecho
412    TESTPMD_FWD_MODE = 'csum'
413    # checksum calculation layer: ip|udp|tcp|sctp|outer-ip
414    TESTPMD_CSUM_LAYER = 'ip'
415    # checksum calculation place: hw (hardware) | sw (software)
416    TESTPMD_CSUM_CALC = 'sw'
417    # recognize tunnel headers: on|off
418    TESTPMD_CSUM_PARSE_TUNNEL = 'off'
419
420 2. Run test:
421
422   .. code-block:: console
423
424      $ ./vsperf --conf-file <path_to_settings_py>
425
426 VSPERF modes of operation
427 ^^^^^^^^^^^^^^^^^^^^^^^^^
428
429 VSPERF can be run in different modes. By default it will configure vSwitch,
430 traffic generator and VNF. However it can be used just for configuration
431 and execution of traffic generator. Another option is execution of all
432 components except traffic generator itself.
433
434 Mode of operation is driven by configuration parameter -m or --mode
435
436 .. code-block:: console
437
438     -m MODE, --mode MODE  vsperf mode of operation;
439         Values:
440             "normal" - execute vSwitch, VNF and traffic generator
441             "trafficgen" - execute only traffic generator
442             "trafficgen-off" - execute vSwitch and VNF
443             "trafficgen-pause" - execute vSwitch and VNF but wait before traffic transmission
444
445 In case, that VSPERF is executed in "trafficgen" mode, then configuration
446 of traffic generator should be configured through --test-params option.
447 Supported CLI options useful for traffic generator configuration are:
448
449 .. code-block:: console
450
451     'traffic_type'  - One of the supported traffic types. E.g. rfc2544,
452                       back2back or continuous
453                       Default value is "rfc2544".
454     'bidirectional' - Specifies if generated traffic will be full-duplex (true)
455                       or half-duplex (false)
456                       Default value is "false".
457     'iload'         - Defines desired percentage of frame rate used during
458                       continuous stream tests.
459                       Default value is 100.
460     'multistream'   - Defines number of flows simulated by traffic generator.
461                       Value 0 disables MultiStream feature
462                       Default value is 0.
463     'stream_type'   - Stream Type is an extension of the "MultiStream" feature.
464                       If MultiStream is disabled, then Stream Type will be
465                       ignored. Stream Type defines ISO OSI network layer used
466                       for simulation of multiple streams.
467                       Default value is "L4".
468
469 Example of execution of VSPERF in "trafficgen" mode:
470
471 .. code-block:: console
472
473     $ ./vsperf -m trafficgen --trafficgen IxNet --conf-file vsperf.conf
474         --test-params "traffic_type=continuous;bidirectional=True;iload=60"
475
476 Code change verification by pylint
477 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
478
479 Every developer participating in VSPERF project should run
480 pylint before his python code is submitted for review. Project
481 specific configuration for pylint is available at 'pylint.rc'.
482
483 Example of manual pylint invocation:
484
485 .. code-block:: console
486
487           $ pylint --rcfile ./pylintrc ./vsperf
488
489 GOTCHAs:
490 ^^^^^^^^
491
492 OVS with DPDK and QEMU
493 ~~~~~~~~~~~~~~~~~~~~~~~
494
495 If you encounter the following error: "before (last 100 chars):
496 '-path=/dev/hugepages,share=on: unable to map backing store for
497 hugepages: Cannot allocate memory\r\n\r\n" with the PVP or PVVP
498 deployment scenario, check the amount of hugepages on your system:
499
500 .. code-block:: console
501
502     $ cat /proc/meminfo | grep HugePages
503
504
505 By default the vswitchd is launched with 1Gb of memory, to  change
506 this, modify --socket-mem parameter in conf/02_vswitch.conf to allocate
507 an appropriate amount of memory:
508
509 .. code-block:: console
510
511     VSWITCHD_DPDK_ARGS = ['-c', '0x4', '-n', '4', '--socket-mem 1024,0']
512
513 More information
514 ^^^^^^^^^^^^^^^^
515
516 For more information and details refer to the vSwitchPerf user guide at:
517 http://artifacts.opnfv.org/vswitchperf/brahmaputra/userguide/index.html
518