554d4efb937aaaa6f181f179a1b459065f99f16e
[kvmfornfv.git] / docs / release / userguide / packet_forwarding.userguide.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3 .. http://creativecommons.org/licenses/by/4.0
4
5 =================
6 Packet Forwarding
7 =================
8
9 About Packet Forwarding
10 -----------------------
11
12 Packet Forwarding is a test suite of KVM4NFV. These latency tests measures the time taken by a
13 **Packet** generated by the traffic generator to travel from the originating device through the
14 network to the destination device. Packet Forwarding is implemented using test framework
15 implemented by OPNFV VSWITCHPERF project and an ``IXIA Traffic Generator``.
16
17 Version Features
18 ----------------
19
20 +-----------------------------+---------------------------------------------------+
21 |                             |                                                   |
22 |      **Release**            |               **Features**                        |
23 |                             |                                                   |
24 +=============================+===================================================+
25 |                             | - Packet Forwarding is not part of Colorado       |
26 |       Colorado              |   release of KVM4NFV                              |
27 |                             |                                                   |
28 +-----------------------------+---------------------------------------------------+
29 |                             | - Packet Forwarding is a testcase in KVM4NFV      |
30 |                             | - Implements three scenarios (Host/Guest/SRIOV)   |
31 |                             |   as part of testing in KVM4NFV                   |
32 |       Danube                | - Uses automated test framework of OPNFV          |
33 |                             |   VSWITCHPERF software (PVP/PVVP)                 |
34 |                             | - Works with IXIA Traffic Generator               |
35 +-----------------------------+---------------------------------------------------+
36 |                             | - Test cases involving multiple guests (PVVP/PVPV)|
37 |                             |   included.                                       |
38 |       Euphrates             | - Implemented Yardstick Grafana dashboard to      |
39 |                             |   publish results of packet forwarding test cases |
40 +-----------------------------+---------------------------------------------------+
41
42 VSPERF
43 ------
44
45 VSPerf is an OPNFV testing project.
46 VSPerf will develop a generic and architecture agnostic vSwitch testing framework and associated
47 tests, that will serve as a basis for validating the suitability of different vSwitch
48 implementations in a Telco NFV deployment environment. The output of this project will be utilized
49 by the OPNFV Performance and Test group and its associated projects, as part of OPNFV Platform and
50 VNF level testing and validation.
51
52 For complete VSPERF documentation go to `link.`_
53
54 .. _link.: http://artifacts.opnfv.org/vswitchperf/danube/index.html
55
56
57 Installation
58 ~~~~~~~~~~~~
59
60 Guidelines of installating `VSPERF`_.
61
62 .. _VSPERF: http://artifacts.opnfv.org/vswitchperf/colorado/configguide/index.html
63
64 Supported Operating Systems
65 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
67 * CentOS 7
68 * Fedora 20
69 * Fedora 21
70 * Fedora 22
71 * RedHat 7.2
72 * Ubuntu 14.04
73
74 Supported vSwitches
75 ~~~~~~~~~~~~~~~~~~~
76
77 The vSwitch must support Open Flow 1.3 or greater.
78
79 * OVS (built from source).
80 * OVS with DPDK (built from source).
81
82 Supported Hypervisors
83 ~~~~~~~~~~~~~~~~~~~~~
84
85 * Qemu version 2.6.
86
87 Other Requirements
88 ~~~~~~~~~~~~~~~~~~
89
90 The test suite requires Python 3.3 and relies on a number of other
91 packages. These need to be installed for the test suite to function.
92
93 Installation of required packages, preparation of Python 3 virtual
94 environment and compilation of OVS, DPDK and QEMU is performed by
95 script **systems/build_base_machine.sh**. It should be executed under
96 user account, which will be used for vsperf execution.
97
98  **Please Note:** Password-less sudo access must be configured for given user before script is
99 executed.
100
101 Execution of installation script:
102
103 .. code:: bash
104
105     $ cd vswitchperf
106     $ cd systems
107     $ ./build_base_machine.sh
108
109 Script **build_base_machine.sh** will install all the vsperf dependencies
110 in terms of system packages, Python 3.x and required Python modules.
111 In case of CentOS 7 it will install Python 3.3 from an additional repository
112 provided by Software Collections (`a link`_). In case of RedHat 7 it will
113 install Python 3.4 as an alternate installation in /usr/local/bin. Installation
114 script will also use `virtualenv`_ to create a vsperf virtual environment,
115 which is isolated from the default Python environment. This environment will
116 reside in a directory called **vsperfenv** in $HOME.
117
118 You will need to activate the virtual environment every time you start a
119 new shell session. Its activation is specific to your OS:
120
121 For running testcases VSPERF is installed on Intel pod1-node2 in which centos
122 operating system is installed. Only VSPERF installion on Centos is discussed here.
123 For installation steps on other operating systems please refer to `here`_.
124
125 .. _here: http://artifacts.opnfv.org/vswitchperf/colorado/configguide/index.html
126
127 For CentOS 7
128 ~~~~~~~~~~~~~~
129
130 ## Python 3 Packages
131
132 To avoid file permission errors and Python version issues, use virtualenv to create an isolated
133 environment with Python3. The required Python 3 packages can be found in the `requirements.txt` file
134 in the root of the test suite. They can be installed in your virtual environment like so:
135
136 .. code:: bash
137
138    scl enable python33 bash
139    # Create virtual environment
140    virtualenv vsperfenv
141    cd vsperfenv
142    source bin/activate
143    pip install -r requirements.txt
144
145
146 You need to activate the virtual environment every time you start a new shell session.
147 To activate, simple run:
148
149 .. code:: bash
150
151    scl enable python33 bash
152    cd vsperfenv
153    source bin/activate
154
155
156 Working Behind a Proxy
157 ~~~~~~~~~~~~~~~~~~~~~~
158
159 If you're behind a proxy, you'll likely want to configure this before running any of the above.
160 For example:
161
162 .. code:: bash
163
164    export http_proxy="http://<username>:<password>@<proxy>:<port>/";
165    export https_proxy="https://<username>:<password>@<proxy>:<port>/";
166    export ftp_proxy="ftp://<username>:<password>@<proxy>:<port>/";
167    export socks_proxy="socks://<username>:<password>@<proxy>:<port>/";
168
169 .. _a link: http://www.softwarecollections.org/en/scls/rhscl/python33/
170 .. _virtualenv: https://virtualenv.readthedocs.org/en/latest/
171
172 For other OS specific activation click `this link`_:
173
174 .. _this link:
175 http://artifacts.opnfv.org/vswitchperf/colorado/configguide/installation.html#other-requirements
176
177 Traffic-Generators
178 ------------------
179
180 VSPERF supports many Traffic-generators. For configuring VSPERF to work with the available traffic
181 generator go through `this`_.
182
183 .. _this: http://artifacts.opnfv.org/vswitchperf/colorado/configguide/trafficgen.html
184
185 VSPERF supports the following traffic generators:
186
187   * Dummy (DEFAULT): Allows you to use your own external
188     traffic generator.
189   * IXIA (IxNet and IxOS)
190   * Spirent TestCenter
191   * Xena Networks
192   * MoonGen
193
194 To see the list of traffic gens from the cli:
195
196 .. code-block:: console
197
198     $ ./vsperf --list-trafficgens
199
200 This guide provides the details of how to install
201 and configure the various traffic generators.
202
203 As KVM4NFV uses only IXIA traffic generator, it is discussed here. For complete documentation
204 regarding traffic generators please follow this `link`_.
205
206 .. _link: https://gerrit.opnfv.org/gerrit/gitweb?p=vswitchperf.git;a=blob;f=docs/configguide/trafficgen.rst;h=85fc35b886d30db3b92a6b7dcce7ca742b70cbdc;hb=HEAD
207
208 IXIA Setup
209 ----------
210
211 Hardware Requirements
212 ~~~~~~~~~~~~~~~~~~~~~
213
214 VSPERF requires the following hardware to run tests: IXIA traffic generator (IxNetwork), a machine
215 that runs the IXIA client software and a CentOS Linux release 7.1.1503 (Core) host.
216
217 Installation
218 ~~~~~~~~~~~~
219
220 Follow the installation instructions to install.
221
222 On the CentOS 7 system
223 ~~~~~~~~~~~~~~~~~~~~~~
224
225 You need to install IxNetworkTclClient$(VER_NUM)Linux.bin.tgz.
226
227 On the IXIA client software system
228 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
229
230 Find the IxNetwork TCL server app
231   - (start -> All Programs -> IXIA -> IxNetwork -> IxNetwork_$(VER_NUM) -> IxNetwork TCL Server)
232   - Right click on IxNetwork TCL Server, select properties
233   - Under shortcut tab in the Target dialogue box make sure there is the argument "-tclport xxxx"
234
235 where xxxx is your port number (take note of this port number you will need it for the
236 10_custom.conf file).
237
238 .. figure:: images/IXIA1.png
239    :name: IXIA1 setup
240    :width: 100%
241    :align: center
242
243 - Hit Ok and start the TCL server application
244
245 VSPERF configuration
246 --------------------
247
248 There are several configuration options specific to the IxNetworks traffic generator
249 from IXIA. It is essential to set them correctly, before the VSPERF is executed
250 for the first time.
251
252 Detailed description of options follows:
253
254  * TRAFFICGEN_IXNET_MACHINE - IP address of server, where IxNetwork TCL Server is running
255  * TRAFFICGEN_IXNET_PORT - PORT, where IxNetwork TCL Server is accepting connections from
256    TCL clients
257  * TRAFFICGEN_IXNET_USER - username, which will be used during communication with IxNetwork
258    TCL Server and IXIA chassis
259  * TRAFFICGEN_IXIA_HOST - IP address of IXIA traffic generator chassis
260  * TRAFFICGEN_IXIA_CARD - identification of card with dedicated ports at IXIA chassis
261  * TRAFFICGEN_IXIA_PORT1 - identification of the first dedicated port at TRAFFICGEN_IXIA_CARD
262    at IXIA chassis; VSPERF uses two separated ports for traffic generation. In case of
263    unidirectional traffic, it is essential to correctly connect 1st IXIA port to the 1st NIC
264    at DUT, i.e. to the first PCI handle from WHITELIST_NICS list. Otherwise traffic may not
265    be able to pass through the vSwitch.
266  * TRAFFICGEN_IXIA_PORT2 - identification of the second dedicated port at TRAFFICGEN_IXIA_CARD
267    at IXIA chassis; VSPERF uses two separated ports for traffic generation. In case of
268    unidirectional traffic, it is essential to correctly connect 2nd IXIA port to the 2nd NIC
269    at DUT, i.e. to the second PCI handle from WHITELIST_NICS list. Otherwise traffic may not
270    be able to pass through the vSwitch.
271  * TRAFFICGEN_IXNET_LIB_PATH - path to the DUT specific installation of IxNetwork TCL API
272  * TRAFFICGEN_IXNET_TCL_SCRIPT - name of the TCL script, which VSPERF will use for
273    communication with IXIA TCL server
274  * TRAFFICGEN_IXNET_TESTER_RESULT_DIR - folder accessible from IxNetwork TCL server,
275    where test results are stored, e.g. ``c:/ixia_results``; see test-results-share_
276  * TRAFFICGEN_IXNET_DUT_RESULT_DIR - directory accessible from the DUT, where test
277    results from IxNetwork TCL server are stored, e.g. ``/mnt/ixia_results``; see
278    test-results-share_
279
280 .. _test-results-share:
281
282 Test results share
283 ~~~~~~~~~~~~~~~~~~
284
285 VSPERF is not able to retrieve test results via TCL API directly. Instead, all test
286 results are stored at IxNetwork TCL server. Results are stored at folder defined by
287 ``TRAFFICGEN_IXNET_TESTER_RESULT_DIR`` configuration parameter. Content of this
288 folder must be shared (e.g. via samba protocol) between TCL Server and DUT, where
289 VSPERF is executed. VSPERF expects, that test results will be available at directory
290 configured by ``TRAFFICGEN_IXNET_DUT_RESULT_DIR`` configuration parameter.
291
292 Example of sharing configuration:
293
294  * Create a new folder at IxNetwork TCL server machine, e.g. ``c:\ixia_results``
295  * Modify sharing options of ``ixia_results`` folder to share it with everybody
296  * Create a new directory at DUT, where shared directory with results
297    will be mounted, e.g. ``/mnt/ixia_results``
298  * Update your custom VSPERF configuration file as follows:
299
300    .. code-block:: python
301
302        TRAFFICGEN_IXNET_TESTER_RESULT_DIR = 'c:/ixia_results'
303        TRAFFICGEN_IXNET_DUT_RESULT_DIR = '/mnt/ixia_results'
304
305    Note: It is essential to use slashes '/' also in path
306    configured by ``TRAFFICGEN_IXNET_TESTER_RESULT_DIR`` parameter.
307
308 * Install cifs-utils package.
309
310    e.g. at rpm based Linux distribution:
311
312 .. code-block:: console
313
314        yum install cifs-utils
315
316 * Mount shared directory, so VSPERF can access test results.
317
318    e.g. by adding new record into ``/etc/fstab``
319
320 .. code-block:: console
321
322        mount -t cifs //_TCL_SERVER_IP_OR_FQDN_/ixia_results /mnt/ixia_results
323              -o file_mode=0777,dir_mode=0777,nounix
324
325 It is recommended to verify, that any new file inserted into ``c:/ixia_results`` folder
326 is visible at DUT inside ``/mnt/ixia_results`` directory.
327
328
329 Cloning and building src dependencies
330 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331
332 In order to run VSPERF, you will need to download DPDK and OVS. You can do this manually and build
333 them in a preferred location, or you could use vswitchperf/src. The vswitchperf/src directory
334 contains makefiles that will allow you to clone and build the libraries that VSPERF depends on,
335 such as DPDK and OVS. To clone and build simply:
336
337 .. code:: bash
338
339    cd src
340    make
341
342 To delete a src subdirectory and its contents to allow you to re-clone simply use:
343
344 .. code:: bash
345
346    make cleanse
347
348 Configure the `./conf/10_custom.conf` file
349 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
350
351 The supplied `10_custom.conf` file must be modified, as it contains configuration items for which
352 there are no reasonable default values.
353
354 The configuration items that can be added is not limited to the initial contents. Any configuration
355 item mentioned in any .conf file in `./conf` directory can be added and that item will be overridden
356 by the custom configuration value.
357
358 Using a custom settings file
359 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
360
361 Alternatively a custom settings file can be passed to `vsperf` via the `--conf-file` argument.
362
363 .. code:: bash
364
365    ./vsperf --conf-file <path_to_settings_py> ...
366
367 Note that configuration passed in via the environment (`--load-env`) or via another command line
368 argument will override both the default and your custom configuration files. This
369 "priority hierarchy" can be described like so (1 = max priority):
370
371 1. Command line arguments
372 2. Environment variables
373 3. Configuration file(s)
374
375 vloop_vnf
376 ~~~~~~~~~
377
378 VSPERF uses a VM image called vloop_vnf for looping traffic in the deployment
379 scenarios involving VMs. The image can be downloaded from
380 `<http://artifacts.opnfv.org/>`__.
381
382 Please see the installation instructions for information on :ref:`vloop-vnf`
383 images.
384
385 .. _l2fwd-module:
386
387 l2fwd Kernel Module
388 ~~~~~~~~~~~~~~~~~~~
389
390 A Kernel Module that provides OSI Layer 2 Ipv4 termination or forwarding with
391 support for Destination Network Address Translation (DNAT) for both the MAC and
392 IP addresses. l2fwd can be found in <vswitchperf_dir>/src/l2fwd
393
394 Executing tests
395 ~~~~~~~~~~~~~~~~
396
397 Before running any tests make sure you have root permissions by adding the following line to
398 /etc/sudoers:
399
400 .. code:: bash
401
402    username ALL=(ALL)       NOPASSWD: ALL
403
404 username in the example above should be replaced with a real username.
405
406 To list the available tests:
407
408 .. code:: bash
409
410    ./vsperf --list-tests
411
412
413 To run a group of tests, for example all tests with a name containing
414 'RFC2544':
415
416 .. code:: bash
417
418    ./vsperf --conf-file=user_settings.py --tests="RFC2544"
419
420 To run all tests:
421
422 .. code:: bash
423
424    ./vsperf --conf-file=user_settings.py
425
426 Some tests allow for configurable parameters, including test duration (in seconds) as well as packet
427 sizes (in bytes).
428
429 .. code:: bash
430
431    ./vsperf --conf-file user_settings.py
432        --tests RFC2544Tput
433        --test-param` "rfc2544_duration=10;packet_sizes=128"
434
435 For all available options, check out the help dialog:
436
437 .. code:: bash
438
439     ./vsperf --help
440
441
442 Testcases
443 ----------
444
445 Available Tests in VSPERF are:
446
447    * phy2phy_tput
448    * phy2phy_forwarding
449    * back2back
450    * phy2phy_tput_mod_vlan
451    * phy2phy_cont
452    * pvp_cont
453    * pvvp_cont
454    * pvpv_cont
455    * phy2phy_scalability
456    * pvp_tput
457    * pvp_back2back
458    * pvvp_tput
459    * pvvp_back2back
460    * phy2phy_cpu_load
461    * phy2phy_mem_load
462
463 VSPERF modes of operation
464 --------------------------
465
466 VSPERF can be run in different modes. By default it will configure vSwitch,
467 traffic generator and VNF. However it can be used just for configuration
468 and execution of traffic generator. Another option is execution of all
469 components except traffic generator itself.
470
471 Mode of operation is driven by configuration parameter -m or --mode
472
473 .. code-block:: console
474
475     -m MODE, --mode MODE  vsperf mode of operation;
476        Values:
477             "normal" - execute vSwitch, VNF and traffic generator
478             "trafficgen" - execute only traffic generator
479             "trafficgen-off" - execute vSwitch and VNF
480             "trafficgen-pause" - execute vSwitch and VNF but wait before traffic transmission
481
482 In case, that VSPERF is executed in "trafficgen" mode, then configuration
483 of traffic generator can be modified through ``TRAFFIC`` dictionary passed to the
484 ``--test-params`` option. It is not needed to specify all values of ``TRAFFIC``
485 dictionary. It is sufficient to specify only values, which should be changed.
486 Detailed notes on ``TRAFFIC`` dictionary can be found at: ref:`configuration-of-traffic-dictionary`.
487
488 Example of execution of VSPERF in "trafficgen" mode:
489
490 .. code-block:: console
491
492     $ ./vsperf -m trafficgen --trafficgen IxNet --conf-file vsperf.conf \
493         --test-params "TRAFFIC={'traffic_type':'rfc2544_continuous','bidir':'False','framerate':60}"
494
495
496 Packet Forwarding Test Scenarios
497 --------------------------------
498
499 KVM4NFV currently implements three scenarios as part of testing:
500
501   * Host Scenario
502   * Guest Scenario.
503   * SR-IOV Scenario.
504
505
506 Packet Forwarding Host Scenario
507 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
508
509 Here host DUT has VSPERF installed in it and is properly configured to use IXIA Traffic-generator
510 by providing IXIA CARD, PORTS and Lib paths along with IP.
511 please refer to figure.2
512
513 .. figure:: images/Host_Scenario.png
514    :name: Host_Scenario
515    :width: 100%
516    :align: center
517
518 Packet Forwarding Guest Scenario (PXP Deployment)
519 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
520
521 Here the guest is a Virtual Machine (VM) launched by using vloop_vnf provided by vsperf project
522 on host/DUT using Qemu. In this latency test the time taken by the frame/packet to travel from the
523 originating device through network involving a guest to destination device is calculated.
524 The resulting latency values will define the performance of installed kernel.
525
526 .. figure:: images/Guest_Scenario.png
527    :name: Guest_Scenario
528    :width: 100%
529    :align: center
530
531 Every testcase uses one of the supported deployment scenarios to setup test environment.
532 The controller responsible for a given scenario configures flows in the vswitch to route
533 traffic among physical interfaces connected to the traffic generator and virtual
534 machines. VSPERF supports several deployments including PXP deployment, which can
535 setup various scenarios with multiple VMs.
536
537 These scenarios are realized by VswitchControllerPXP class, which can configure and
538 execute given number of VMs in serial or parallel configurations. Every VM can be
539 configured with just one or an even number of interfaces. In case that VM has more than
540 2 interfaces, then traffic is properly routed among pairs of interfaces.
541
542 Example of traffic routing for VM with 4 NICs in serial configuration:
543
544 .. code-block:: console
545
546                  +------------------------------------------+
547                  |  VM with 4 NICs                          |
548                  |  +---------------+    +---------------+  |
549                  |  |  Application  |    |  Application  |  |
550                  |  +---------------+    +---------------+  |
551                  |      ^       |            ^       |      |
552                  |      |       v            |       v      |
553                  |  +---------------+    +---------------+  |
554                  |  | logical ports |    | logical ports |  |
555                  |  |   0       1   |    |   2       3   |  |
556                  +--+---------------+----+---------------+--+
557                         ^       :            ^       :
558                         |       |            |       |
559                         :       v            :       v
560         +-----------+---------------+----+---------------+----------+
561         | vSwitch   |   0       1   |    |   2       3   |          |
562         |           | logical ports |    | logical ports |          |
563         | previous  +---------------+    +---------------+   next   |
564         | VM or PHY     ^       |            ^       |     VM or PHY|
565         |   port   -----+       +------------+       +--->   port   |
566         +-----------------------------------------------------------+
567
568
569 It is also possible to define different number of interfaces for each VM to better
570 simulate real scenarios.
571
572 The number of VMs involved in the test and the type of their connection is defined
573 by deployment name as follows:
574
575   * ``pvvp[number]`` - configures scenario with VMs connected in series with
576     optional ``number`` of VMs. In case that ``number`` is not specified, then
577     2 VMs will be used.
578
579     Example of 2 VMs in a serial configuration:
580
581     .. code-block:: console
582
583        +----------------------+  +----------------------+
584        |   1st VM             |  |   2nd VM             |
585        |   +---------------+  |  |   +---------------+  |
586        |   |  Application  |  |  |   |  Application  |  |
587        |   +---------------+  |  |   +---------------+  |
588        |       ^       |      |  |       ^       |      |
589        |       |       v      |  |       |       v      |
590        |   +---------------+  |  |   +---------------+  |
591        |   | logical ports |  |  |   | logical ports |  |
592        |   |   0       1   |  |  |   |   0       1   |  |
593        +---+---------------+--+  +---+---------------+--+
594                ^       :                 ^       :
595                |       |                 |       |
596                :       v                 :       v
597        +---+---------------+---------+---------------+--+
598        |   |   0       1   |         |   3       4   |  |
599        |   | logical ports | vSwitch | logical ports |  |
600        |   +---------------+         +---------------+  |
601        |       ^       |                 ^       |      |
602        |       |       +-----------------+       v      |
603        |   +----------------------------------------+   |
604        |   |              physical ports            |   |
605        |   |      0                         1       |   |
606        +---+----------------------------------------+---+
607                   ^                         :
608                   |                         |
609                   :                         v
610        +------------------------------------------------+
611        |                                                |
612        |                traffic generator               |
613        |                                                |
614        +------------------------------------------------+
615
616 * ``pvpv[number]`` - configures scenario with VMs connected in parallel with
617     optional ``number`` of VMs. In case that ``number`` is not specified, then
618     2 VMs will be used. Multistream feature is used to route traffic to particular
619     VMs (or NIC pairs of every VM). It means, that VSPERF will enable multistream
620     feaure and sets the number of streams to the number of VMs and their NIC
621     pairs. Traffic will be dispatched based on Stream Type, i.e. by UDP port,
622     IP address or MAC address.
623
624     Example of 2 VMs in a parallel configuration, where traffic is dispatched
625         based on the UDP port.
626
627     .. code-block:: console
628
629        +----------------------+  +----------------------+
630        |   1st VM             |  |   2nd VM             |
631        |   +---------------+  |  |   +---------------+  |
632        |   |  Application  |  |  |   |  Application  |  |
633        |   +---------------+  |  |   +---------------+  |
634        |       ^       |      |  |       ^       |      |
635        |       |       v      |  |       |       v      |
636        |   +---------------+  |  |   +---------------+  |
637        |   | logical ports |  |  |   | logical ports |  |
638        |   |   0       1   |  |  |   |   0       1   |  |
639        +---+---------------+--+  +---+---------------+--+
640                ^       :                 ^       :
641                |       |                 |       |
642                :       v                 :       v
643        +---+---------------+---------+---------------+--+
644        |   |   0       1   |         |   3       4   |  |
645        |   | logical ports | vSwitch | logical ports |  |
646        |   +---------------+         +---------------+  |
647        |      ^         |                 ^       :     |
648        |      |     ......................:       :     |
649        |  UDP | UDP :   |                         :     |
650        |  port| port:   +--------------------+    :     |
651        |   0  |  1  :                        |    :     |
652        |      |     :                        v    v     |
653        |   +----------------------------------------+   |
654        |   |              physical ports            |   |
655        |   |    0                               1   |   |
656        +---+----------------------------------------+---+
657                 ^                               :
658                 |                               |
659                 :                               v
660        +------------------------------------------------+
661        |                                                |
662        |                traffic generator               |
663        |                                                |
664        +------------------------------------------------+
665
666
667 PXP deployment is backward compatible with PVP deployment, where ``pvp`` is
668 an alias for ``pvvp1`` and it executes just one VM.
669
670 The number of interfaces used by VMs is defined by configuration option
671 ``GUEST_NICS_NR``. In case that more than one pair of interfaces is defined
672 for VM, then:
673
674     * for ``pvvp`` (serial) scenario every NIC pair is connected in serial
675       before connection to next VM is created
676     * for ``pvpv`` (parallel) scenario every NIC pair is directly connected
677       to the physical ports and unique traffic stream is assigned to it
678
679 Examples:
680
681     * Deployment ``pvvp10`` will start 10 VMs and connects them in series
682     * Deployment ``pvpv4`` will start 4 VMs and connects them in parallel
683     * Deployment ``pvpv1`` and GUEST_NICS_NR = [4] will start 1 VM with
684       4 interfaces and every NIC pair is directly connected to the
685       physical ports
686     * Deployment ``pvvp`` and GUEST_NICS_NR = [2, 4] will start 2 VMs;
687       1st VM will have 2 interfaces and 2nd VM 4 interfaces. These interfaces
688       will be connected in serial, i.e. traffic will flow as follows:
689       PHY1 -> VM1_1 -> VM1_2 -> VM2_1 -> VM2_2 -> VM2_3 -> VM2_4 -> PHY2
690
691 Note: In case that only 1 or more than 2 NICs are configured for VM,
692 then ``testpmd`` should be used as forwarding application inside the VM.
693 As it is able to forward traffic between multiple VM NIC pairs.
694
695 Note: In case of ``linux_bridge``, all NICs are connected to the same
696 bridge inside the VM.
697
698 Packet Forwarding SRIOV Scenario
699 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
700
701 In this test the packet generated at the IXIA is forwarded to the Guest VM launched on Host by
702 implementing SR-IOV interface at NIC level of host .i.e., DUT. The time taken by the packet to
703 travel through the network to the destination the IXIA traffic-generator is calculated and
704 published as a test result for this scenario.
705
706 SRIOV-support_ is given below, it details how to use SR-IOV.
707
708 .. figure:: images/SRIOV_Scenario.png
709    :name: SRIOV_Scenario
710    :width: 100%
711    :align: center
712
713 Using vfio_pci with DPDK
714 ~~~~~~~~~~~~~~~~~~~~~~~~~
715
716 To use vfio with DPDK instead of igb_uio add into your custom configuration
717 file the following parameter:
718
719 .. code-block:: python
720
721     PATHS['dpdk']['src']['modules'] = ['uio', 'vfio-pci']
722
723
724 **NOTE:** In case, that DPDK is installed from binary package, then please
725
726      set ``PATHS['dpdk']['bin']['modules']`` instead.
727
728 **NOTE:** Please ensure that Intel VT-d is enabled in BIOS.
729
730 **NOTE:** Please ensure your boot/grub parameters include
731 the following:
732
733 .. code-block:: console
734
735    iommu=pt intel_iommu=on
736
737 To check that IOMMU is enabled on your platform:
738
739 .. code-block:: console
740
741     $ dmesg | grep IOMMU
742     [    0.000000] Intel-IOMMU: enabled
743     [    0.139882] dmar: IOMMU 0: reg_base_addr fbffe000 ver 1:0 cap d2078c106f0466 ecap f020de
744     [    0.139888] dmar: IOMMU 1: reg_base_addr ebffc000 ver 1:0 cap d2078c106f0466 ecap f020de
745     [    0.139893] IOAPIC id 2 under DRHD base  0xfbffe000 IOMMU 0
746     [    0.139894] IOAPIC id 0 under DRHD base  0xebffc000 IOMMU 1
747     [    0.139895] IOAPIC id 1 under DRHD base  0xebffc000 IOMMU 1
748     [    3.335744] IOMMU: dmar0 using Queued invalidation
749     [    3.335746] IOMMU: dmar1 using Queued invalidation
750    ....
751
752 .. _SRIOV-support:
753
754 Using SRIOV support
755 ~~~~~~~~~~~~~~~~~~~
756
757 To use virtual functions of NIC with SRIOV support, use extended form
758 of NIC PCI slot definition:
759
760 .. code-block:: python
761
762     WHITELIST_NICS = ['0000:03:00.0|vf0', '0000:03:00.1|vf3']
763
764 Where ``vf`` is an indication of virtual function usage and following
765 number defines a VF to be used. In case that VF usage is detected,
766 then vswitchperf will enable SRIOV support for given card and it will
767 detect PCI slot numbers of selected VFs.
768
769 So in example above, one VF will be configured for NIC '0000:05:00.0'
770 and four VFs will be configured for NIC '0000:05:00.1'. Vswitchperf
771 will detect PCI addresses of selected VFs and it will use them during
772 test execution.
773
774 At the end of vswitchperf execution, SRIOV support will be disabled.
775
776 SRIOV support is generic and it can be used in different testing scenarios.
777 For example:
778
779
780 * vSwitch tests with DPDK or without DPDK support to verify impact
781   of VF usage on vSwitch performance
782 * tests without vSwitch, where traffic is forwared directly
783   between VF interfaces by packet forwarder (e.g. testpmd application)
784 * tests without vSwitch, where VM accesses VF interfaces directly
785   by PCI-passthrough to measure raw VM throughput performance.
786
787 Using QEMU with PCI passthrough support
788 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
789
790 Raw virtual machine throughput performance can be measured by execution of PVP
791 test with direct access to NICs by PCI passthrough. To execute VM with direct
792 access to PCI devices, enable vfio-pci. In order to use virtual functions,
793 SRIOV-support_ must be enabled.
794
795 Execution of test with PCI passthrough with vswitch disabled:
796
797 .. code-block:: console
798
799     $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf \
800                --vswitch none --vnf QemuPciPassthrough pvp_tput
801
802 Any of supported guest-loopback-application can be used inside VM with
803 PCI passthrough support.
804
805 Note: Qemu with PCI passthrough support can be used only with PVP test
806 deployment.
807
808 Guest Core and Thread Binding
809 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
810
811 VSPERF provides options to achieve better performance by guest core binding and
812 guest vCPU thread binding as well. Core binding is to bind all the qemu threads.
813 Thread binding is to bind the house keeping threads to some CPU and vCPU thread to
814 some other CPU, this helps to reduce the noise from qemu house keeping threads.
815
816
817 .. code-block:: python
818
819    GUEST_CORE_BINDING = [('#EVAL(6+2*#VMINDEX)', '#EVAL(7+2*#VMINDEX)')]
820
821 **NOTE** By default the GUEST_THREAD_BINDING will be none, which means same as
822 the GUEST_CORE_BINDING, i.e. the vcpu threads are sharing the physical CPUs with
823 the house keeping threads. Better performance using vCPU thread binding can be
824 achieved by enabling affinity in the custom configuration file.
825
826 For example, if an environment requires 28,29 to be core binded and 30,31 for
827 guest thread binding to achieve better performance.
828
829 .. code-block:: python
830
831    VNF_AFFINITIZATION_ON = True
832    GUEST_CORE_BINDING = [('28','29')]
833    GUEST_THREAD_BINDING = [('30', '31')]
834
835 Qemu CPU features
836 ^^^^^^^^^^^^^^^^^
837
838 QEMU default to a compatible subset of performance enhancing cpu features.
839 To pass all available host processor features to the guest.
840
841 .. code-block:: python
842
843    GUEST_CPU_OPTIONS = ['host,migratable=off']
844
845 **NOTE** To enhance the performance, cpu features tsc deadline timer for guest,
846 the guest PMU, the invariant TSC can be provided in the custom configuration file.
847
848 Selection of loopback application for tests with VMs
849 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
850
851 To select the loopback applications which will forward packets inside VMs,
852 the following parameter should be configured:
853
854 .. code-block:: python
855
856      GUEST_LOOPBACK = ['testpmd']
857
858 or use ``--test-params`` CLI argument:
859
860 .. code-block:: console
861
862         $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf \
863               --test-params "GUEST_LOOPBACK=['testpmd']"
864
865 Supported loopback applications are:
866
867 .. code-block:: console
868
869      'testpmd'       - testpmd from dpdk will be built and used
870      'l2fwd'         - l2fwd module provided by Huawei will be built and used
871      'linux_bridge'  - linux bridge will be configured
872      'buildin'       - nothing will be configured by vsperf; VM image must
873                        ensure traffic forwarding between its interfaces
874
875 Guest loopback application must be configured, otherwise traffic
876 will not be forwarded by VM and testcases with VM related deployments
877 will fail. Guest loopback application is set to 'testpmd' by default.
878
879 **NOTE:** In case that only 1 or more than 2 NICs are configured for VM,
880 then 'testpmd' should be used. As it is able to forward traffic between
881 multiple VM NIC pairs.
882
883 **NOTE:** In case of linux_bridge, all guest NICs are connected to the same
884 bridge inside the guest.
885
886 Results
887 ~~~~~~~
888
889 The results for the packet forwarding test cases are uploaded to artifacts and
890 also published on Yardstick Grafana dashboard.
891 The links for the same can be found below
892
893 .. code:: bash
894
895    http://artifacts.opnfv.org/kvmfornfv.html
896    http://testresults.opnfv.org/KVMFORNFV-Packet-Forwarding