integration: Test vHost User numa awareness
[vswitchperf.git] / docs / userguide / integration.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 Integration tests
6 =================
7
8 VSPERF includes a set of integration tests defined in conf/integration.
9 These tests can be run by specifying --integration as a parameter to vsperf.
10 Current tests in conf/integration include switch functionality and Overlay
11 tests.
12
13 Tests in the conf/integration can be used to test scaling of different switch
14 configurations by adding steps into the test case.
15
16 For the overlay tests VSPERF supports VXLAN, GRE and GENEVE tunneling protocols.
17 Testing of these protocols is limited to unidirectional traffic and
18 P2P (Physical to Physical scenarios).
19
20 NOTE: The configuration for overlay tests provided in this guide is for
21 unidirectional traffic only.
22
23 Executing Integration Tests
24 ---------------------------
25
26 To execute integration tests VSPERF is run with the integration parameter. To
27 view the current test list simply execute the following command:
28
29 .. code-block:: console
30
31     ./vsperf --integration --list
32
33 The standard tests included are defined inside the
34 ``conf/integration/01_testcases.conf`` file.
35
36 Test Steps
37 ----------
38
39 Execution of integration tests are done on a step by step work flow starting
40 with step 0 as defined inside the test case. Each step of the test increments
41 the step number by one which is indicated in the log.
42
43 .. code-block:: console
44
45     (testcases.integration) - Step 1 - 'vswitch add_switch ['int_br1']' ... OK
46
47 Each step in the test case is validated. If a step does not pass validation the
48 test will fail and terminate. The test will continue until a failure is detected
49 or all steps pass. A csv report file is generated after a test completes with an
50 OK or FAIL result.
51
52 Test objects and their functions
53 --------------------------------
54
55 Every test step can call a function of one of the supported test objects. The list
56 of supported objects and their most common functions follows:
57
58     * ``vswitch`` - provides functions for vSwitch configuration
59
60       List of supported functions:
61
62         * ``add_switch br_name`` - creates a new switch (bridge) with given ``br_name``
63         * ``del_switch br_name`` - deletes switch (bridge) with given ``br_name``
64         * ``add_phy_port br_name`` - adds a physical port into bridge specified by ``br_name``
65         * ``add_vport br_name`` - adds a virtual port into bridge specified by ``br_name``
66         * ``del_port br_name port_name`` - removes physical or virtual port specified by
67           ``port_name`` from bridge ``br_name``
68         * ``add_flow br_name flow`` - adds flow specified by ``flow`` dictionary into
69           the bridge ``br_name``; Content of flow dictionary will be passed to the vSwitch.
70           In case of Open vSwitch it will be passed to the ``ovs-ofctl add-flow`` command.
71           Please see Open vSwitch documentation for the list of supported flow parameters.
72         * ``del_flow br_name [flow]`` - deletes flow specified by ``flow`` dictionary from
73           bridge ``br_name``; In case that optional parameter ``flow`` is not specified
74           or set to an empty dictionary ``{}``, then all flows from bridge ``br_name``
75           will be deleted.
76         * ``dump_flows br_name`` - dumps all flows from bridge specified by ``br_name``
77         * ``enable_stp br_name`` - enables Spanning Tree Protocol for bridge ``br_name``
78         * ``disable_stp br_name`` - disables Spanning Tree Protocol for bridge ``br_name``
79         * ``enable_rstp br_name`` - enables Rapid Spanning Tree Protocol for bridge ``br_name``
80         * ``disable_rstp br_name`` - disables Rapid Spanning Tree Protocol for bridge ``br_name``
81
82         Examples:
83
84         .. code-block:: python
85
86             ['vswitch', 'add_switch', 'int_br0']
87
88             ['vswitch', 'del_switch', 'int_br0']
89
90             ['vswitch', 'add_phy_port', 'int_br0']
91
92             ['vswitch', 'del_port', 'int_br0', '#STEP[2][0]']
93
94             ['vswitch', 'add_flow', 'int_br0', {'in_port': '1', 'actions': ['output:2'],
95              'idle_timeout': '0'}],
96
97             ['vswitch', 'enable_rstp', 'int_br0']
98
99     * ``vnf[ID]`` - provides functions for deployment and termination of VNFs; Optional
100       alfanumerical ``ID`` is used for VNF identification in case that testcase
101       deploys multiple VNFs.
102
103       List of supported functions:
104
105         * ``start`` - starts a VNF based on VSPERF configuration
106         * ``stop`` - gracefully terminates given VNF
107
108         Examples:
109
110         .. code-block:: python
111
112             ['vnf1', 'start']
113             ['vnf2', 'start']
114             ['vnf2', 'stop']
115             ['vnf1', 'stop']
116
117     * ``trafficgen`` - triggers traffic generation
118
119       List of supported functions:
120
121         * ``send_traffic traffic`` - starts a traffic based on the vsperf configuration
122           and given ``traffic`` dictionary. More details about ``traffic`` dictionary
123           and its possible values are available at `Traffic Generator Integration Guide
124           <http://artifacts.opnfv.org/vswitchperf/docs/design/trafficgen_integration_guide.html#step-5-supported-traffic-types>`__
125
126         Examples:
127
128         .. code-block:: python
129
130             ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput'}]
131
132             ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : 'True'}]
133
134     * ``settings`` - reads or modifies VSPERF configuration
135
136       List of supported functions:
137
138         * ``getValue param`` - returns value of given ``param``
139         * ``setValue param value`` - sets value of ``param`` to given ``value``
140
141         Examples:
142
143         .. code-block:: python
144
145             ['settings', 'getValue', 'TOOLS']
146
147             ['settings', 'setValue', 'GUEST_USERNAME', ['root']]
148
149     * ``namespace`` - creates or modifies network namespaces
150
151       List of supported functions:
152
153         * ``create_namespace name`` - creates new namespace with given ``name``
154         * ``delete_namespace name`` - deletes namespace specified by its ``name``
155         * ``assign_port_to_namespace port name [port_up]`` - assigns NIC specified by ``port``
156           into given namespace ``name``; If optional parameter ``port_up`` is set to ``True``,
157           then port will be brought up.
158         * ``add_ip_to_namespace_eth port name addr cidr`` - assigns an IP address ``addr``/``cidr``
159           to the NIC specified by ``port`` within namespace ``name``
160         * ``reset_port_to_root port name`` - returns given ``port`` from namespace ``name`` back
161           to the root namespace
162
163         Examples:
164
165         .. code-block:: python
166
167             ['namespace', 'create_namespace', 'testns']
168
169             ['namespace', 'assign_port_to_namespace', 'eth0', 'testns']
170
171     * ``veth`` - manipulates with eth and veth devices
172
173       List of supported functions:
174
175         * ``add_veth_port port peer_port`` - adds a pair of veth ports named ``port`` and
176           ``peer_port``
177         * ``del_veth_port port peer_port`` - deletes a veth port pair specified by ``port``
178           and ``peer_port``
179         * ``bring_up_eth_port eth_port [namespace]`` - brings up ``eth_port`` in (optional)
180           ``namespace``
181
182         Examples:
183
184         .. code-block:: python
185
186             ['veth', 'add_veth_port', 'veth', 'veth1']
187
188             ['veth', 'bring_up_eth_port', 'eth1']
189
190     * ``tools`` - provides a set of helper functions
191
192       List of supported functions:
193
194         * ``Assert condition`` - evaluates given ``condition`` and raises ``AssertionError``
195           in case that condition is not ``True``
196         * ``Eval expression`` - evaluates given expression as a python code and returns
197           its result
198         * ``Exec command [regex]`` - executes a shell command and filters its output by
199           (optional) regular expression
200
201         Examples:
202
203         .. code-block:: python
204
205             ['tools', 'exec', 'numactl -H', 'available: ([0-9]+)']
206             ['tools', 'assert', '#STEP[-1][0]>1']
207
208     * ``wait`` - is used for test case interruption. This object doesn't have
209       any functions. Once reached, vsperf will pause test execution and waits
210       for press of ``Enter key``. It can be used during testcase design
211       for debugging purposes.
212
213       Examples:
214
215       .. code-block:: python
216
217         ['wait']
218
219 Test Macros
220 -----------
221
222 Test profiles can include macros as part of the test step. Each step in the
223 profile may return a value such as a port name. Recall macros use #STEP to
224 indicate the recalled value inside the return structure. If the method the
225 test step calls returns a value it can be later recalled, for example:
226
227 .. code-block:: python
228
229     {
230         "Name": "vswitch_add_del_vport",
231         "Deployment": "clean",
232         "Description": "vSwitch - add and delete virtual port",
233         "TestSteps": [
234                 ['vswitch', 'add_switch', 'int_br0'],               # STEP 0
235                 ['vswitch', 'add_vport', 'int_br0'],                # STEP 1
236                 ['vswitch', 'del_port', 'int_br0', '#STEP[1][0]'],  # STEP 2
237                 ['vswitch', 'del_switch', 'int_br0'],               # STEP 3
238              ]
239     }
240
241 This test profile uses the vswitch add_vport method which returns a string
242 value of the port added. This is later called by the del_port method using the
243 name from step 1.
244
245 It is also possible to use negative indexes in step macros. In that case
246 ``#STEP[-1]`` will refer to the result from previous step, ``#STEP[-2]``
247 will refer to result of step called before previous step, etc. It means,
248 that you could change ``STEP 2`` from previous example to achieve the same
249 functionality:
250
251 .. code-block:: python
252
253                 ['vswitch', 'del_port', 'int_br0', '#STEP[-1][0]'],  # STEP 2
254
255 Also commonly used steps can be created as a separate profile.
256
257 .. code-block:: python
258
259     STEP_VSWITCH_PVP_INIT = [
260         ['vswitch', 'add_switch', 'int_br0'],           # STEP 0
261         ['vswitch', 'add_phy_port', 'int_br0'],         # STEP 1
262         ['vswitch', 'add_phy_port', 'int_br0'],         # STEP 2
263         ['vswitch', 'add_vport', 'int_br0'],            # STEP 3
264         ['vswitch', 'add_vport', 'int_br0'],            # STEP 4
265     ]
266
267 This profile can then be used inside other testcases
268
269 .. code-block:: python
270
271     {
272         "Name": "vswitch_pvp",
273         "Deployment": "clean",
274         "Description": "vSwitch - configure switch and one vnf",
275         "TestSteps": STEP_VSWITCH_PVP_INIT +
276                      [
277                         ['vnf', 'start'],
278                         ['vnf', 'stop'],
279                      ] +
280                      STEP_VSWITCH_PVP_FINIT
281     }
282
283 HelloWorld and other basic Testcases
284 ------------------------------------
285
286 The following examples are for demonstration purposes.
287 You can run them by copying and pasting into the
288 conf/integration/01_testcases.conf file.
289 A command-line instruction is shown at the end of each
290 example.
291
292 HelloWorld
293 ^^^^^^^^^^
294
295 The first example is a HelloWorld testcase.
296 It simply creates a bridge with 2 physical ports, then sets up a flow to drop
297 incoming packets from the port that was instantiated at the STEP #1.
298 There's no interaction with the traffic generator.
299 Then the flow, the 2 ports and the bridge are deleted.
300 'add_phy_port' method creates a 'dpdk' type interface that will manage the
301 physical port. The string value returned is the port name that will be referred
302 by 'del_port' later on.
303
304 .. code-block:: python
305
306     {
307         "Name": "HelloWorld",
308         "Description": "My first testcase",
309         "Deployment": "clean",
310         "TestSteps": [
311             ['vswitch', 'add_switch', 'int_br0'],   # STEP 0
312             ['vswitch', 'add_phy_port', 'int_br0'], # STEP 1
313             ['vswitch', 'add_phy_port', 'int_br0'], # STEP 2
314             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
315                 'actions': ['drop'], 'idle_timeout': '0'}],
316             ['vswitch', 'del_flow', 'int_br0'],
317             ['vswitch', 'del_port', 'int_br0', '#STEP[1][0]'],
318             ['vswitch', 'del_port', 'int_br0', '#STEP[2][0]'],
319             ['vswitch', 'del_switch', 'int_br0'],
320         ]
321
322     }
323
324 To run HelloWorld test:
325
326   .. code-block:: console
327
328     ./vsperf --conf-file user_settings.py --integration HelloWorld
329
330 Specify a Flow by the IP address
331 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
332
333 The next example shows how to explicitly set up a flow by specifying a
334 destination IP address.
335 All packets received from the port created at STEP #1 that have a destination
336 IP address = 90.90.90.90 will be forwarded to the port created at the STEP #2.
337
338 .. code-block:: python
339
340     {
341         "Name": "p2p_rule_l3da",
342         "Description": "Phy2Phy with rule on L3 Dest Addr",
343         "Deployment": "clean",
344         "biDirectional": "False",
345         "TestSteps": [
346             ['vswitch', 'add_switch', 'int_br0'],   # STEP 0
347             ['vswitch', 'add_phy_port', 'int_br0'], # STEP 1
348             ['vswitch', 'add_phy_port', 'int_br0'], # STEP 2
349             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
350                 'dl_type': '0x0800', 'nw_dst': '90.90.90.90', \
351                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
352             ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous'}],
353             ['vswitch', 'dump_flows', 'int_br0'],   # STEP 5
354             ['vswitch', 'del_flow', 'int_br0'],     # STEP 7 == del-flows
355             ['vswitch', 'del_port', 'int_br0', '#STEP[1][0]'],
356             ['vswitch', 'del_port', 'int_br0', '#STEP[2][0]'],
357             ['vswitch', 'del_switch', 'int_br0'],
358         ]
359     },
360
361 To run the test:
362
363   .. code-block:: console
364
365     ./vsperf --conf-file user_settings.py --integration p2p_rule_l3da
366
367 Multistream feature
368 ^^^^^^^^^^^^^^^^^^^
369
370 The next testcase uses the multistream feature.
371 The traffic generator will send packets with different UDP ports.
372 That is accomplished by using "Stream Type" and "MultiStream" keywords.
373 4 different flows are set to forward all incoming packets.
374
375 .. code-block:: python
376
377     {
378         "Name": "multistream_l4",
379         "Description": "Multistream on UDP ports",
380         "Deployment": "clean",
381         "Stream Type": "L4",
382         "MultiStream": 4,
383         "TestSteps": [
384             ['vswitch', 'add_switch', 'int_br0'],   # STEP 0
385             ['vswitch', 'add_phy_port', 'int_br0'], # STEP 1
386             ['vswitch', 'add_phy_port', 'int_br0'], # STEP 2
387             # Setup Flows
388             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
389                 'dl_type': '0x0800', 'nw_proto': '17', 'udp_dst': '0', \
390                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
391             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
392                 'dl_type': '0x0800', 'nw_proto': '17', 'udp_dst': '1', \
393                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
394             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
395                 'dl_type': '0x0800', 'nw_proto': '17', 'udp_dst': '2', \
396                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
397             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
398                 'dl_type': '0x0800', 'nw_proto': '17', 'udp_dst': '3', \
399                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
400             # Send mono-dir traffic
401             ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', \
402                 'bidir' : 'False'}],
403             # Clean up
404             ['vswitch', 'del_flow', 'int_br0'],
405             ['vswitch', 'del_port', 'int_br0', '#STEP[1][0]'],
406             ['vswitch', 'del_port', 'int_br0', '#STEP[2][0]'],
407             ['vswitch', 'del_switch', 'int_br0'],
408          ]
409     },
410
411 To run the test:
412
413   .. code-block:: console
414
415     ./vsperf --conf-file user_settings.py --integration multistream_l4
416
417 PVP with a VM Replacement
418 ^^^^^^^^^^^^^^^^^^^^^^^^^
419
420 This example launches a 1st VM in a PVP topology, then the VM is replaced
421 by another VM.
422 When VNF setup parameter in ./conf/04_vnf.conf is "QemuDpdkVhostUser"
423 'add_vport' method creates a 'dpdkvhostuser' type port to connect a VM.
424
425 .. code-block:: python
426
427     {
428         "Name": "ex_replace_vm",
429         "Description": "PVP with VM replacement",
430         "Deployment": "clean",
431         "TestSteps": [
432             ['vswitch', 'add_switch', 'int_br0'],       # STEP 0
433             ['vswitch', 'add_phy_port', 'int_br0'],     # STEP 1
434             ['vswitch', 'add_phy_port', 'int_br0'],     # STEP 2
435             ['vswitch', 'add_vport', 'int_br0'],        # STEP 3    vm1
436             ['vswitch', 'add_vport', 'int_br0'],        # STEP 4
437
438             # Setup Flows
439             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
440                 'actions': ['output:#STEP[3][1]'], 'idle_timeout': '0'}],
441             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[4][1]', \
442                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
443             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[2][1]', \
444                 'actions': ['output:#STEP[4][1]'], 'idle_timeout': '0'}],
445             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[3][1]', \
446                 'actions': ['output:#STEP[1][1]'], 'idle_timeout': '0'}],
447
448             # Start VM 1
449             ['vnf1', 'start'],
450             # Now we want to replace VM 1 with another VM
451             ['vnf1', 'stop'],
452
453             ['vswitch', 'add_vport', 'int_br0'],        # STEP 11    vm2
454             ['vswitch', 'add_vport', 'int_br0'],        # STEP 12
455             ['vswitch', 'del_flow', 'int_br0'],
456             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
457                 'actions': ['output:#STEP[11][1]'], 'idle_timeout': '0'}],
458             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[12][1]', \
459                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
460
461             # Start VM 2
462             ['vnf2', 'start'],
463             ['vnf2', 'stop'],
464             ['vswitch', 'dump_flows', 'int_br0'],
465
466             # Clean up
467             ['vswitch', 'del_flow', 'int_br0'],
468             ['vswitch', 'del_port', 'int_br0', '#STEP[1][0]'],
469             ['vswitch', 'del_port', 'int_br0', '#STEP[2][0]'],
470             ['vswitch', 'del_port', 'int_br0', '#STEP[3][0]'],    # vm1
471             ['vswitch', 'del_port', 'int_br0', '#STEP[4][0]'],
472             ['vswitch', 'del_port', 'int_br0', '#STEP[11][0]'],   # vm2
473             ['vswitch', 'del_port', 'int_br0', '#STEP[12][0]'],
474             ['vswitch', 'del_switch', 'int_br0'],
475         ]
476     },
477
478 To run the test:
479
480   .. code-block:: console
481
482      ./vsperf --conf-file user_settings.py --integration ex_replace_vm
483
484 VM with a Linux bridge
485 ^^^^^^^^^^^^^^^^^^^^^^
486
487 In this example a command-line parameter allows to set up a Linux bridge into
488 the guest VM.
489 That's one of the available ways to specify the guest application.
490 Packets matching the flow will be forwarded to the VM.
491
492 .. code-block:: python
493
494     {
495         "Name": "ex_pvp_rule_l3da",
496         "Description": "PVP with flow on L3 Dest Addr",
497         "Deployment": "clean",
498         "TestSteps": [
499             ['vswitch', 'add_switch', 'int_br0'],       # STEP 0
500             ['vswitch', 'add_phy_port', 'int_br0'],     # STEP 1
501             ['vswitch', 'add_phy_port', 'int_br0'],     # STEP 2
502             ['vswitch', 'add_vport', 'int_br0'],        # STEP 3    vm1
503             ['vswitch', 'add_vport', 'int_br0'],        # STEP 4
504             # Setup Flows
505             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
506                 'dl_type': '0x0800', 'nw_dst': '90.90.90.90', \
507                 'actions': ['output:#STEP[3][1]'], 'idle_timeout': '0'}],
508             # Each pkt from the VM is forwarded to the 2nd dpdk port
509             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[4][1]', \
510                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
511             # Start VMs
512             ['vnf1', 'start'],
513             ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', \
514                 'bidir' : 'False'}],
515             ['vnf1', 'stop'],
516             # Clean up
517             ['vswitch', 'dump_flows', 'int_br0'],       # STEP 10
518             ['vswitch', 'del_flow', 'int_br0'],         # STEP 11
519             ['vswitch', 'del_port', 'int_br0', '#STEP[1][0]'],
520             ['vswitch', 'del_port', 'int_br0', '#STEP[2][0]'],
521             ['vswitch', 'del_port', 'int_br0', '#STEP[3][0]'],  # vm1 ports
522             ['vswitch', 'del_port', 'int_br0', '#STEP[4][0]'],
523             ['vswitch', 'del_switch', 'int_br0'],
524         ]
525     },
526
527 To run the test:
528
529   .. code-block:: console
530
531     ./vsperf --conf-file user_settings.py --test-params
532             "guest_loopback=linux_bridge" --integration ex_pvp_rule_l3da
533
534 Forward packets based on UDP port
535 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
536
537 This examples launches 2 VMs connected in parallel.
538 Incoming packets will be forwarded to one specific VM depending on the
539 destination UDP port.
540
541 .. code-block:: python
542
543     {
544         "Name": "ex_2pvp_rule_l4dp",
545         "Description": "2 PVP with flows on L4 Dest Port",
546         "Deployment": "clean",
547         "Stream Type": "L4",    # loop UDP ports
548         "MultiStream": 2,
549         "TestSteps": [
550             ['vswitch', 'add_switch', 'int_br0'],       # STEP 0
551             ['vswitch', 'add_phy_port', 'int_br0'],     # STEP 1
552             ['vswitch', 'add_phy_port', 'int_br0'],     # STEP 2
553             ['vswitch', 'add_vport', 'int_br0'],        # STEP 3    vm1
554             ['vswitch', 'add_vport', 'int_br0'],        # STEP 4
555             ['vswitch', 'add_vport', 'int_br0'],        # STEP 5    vm2
556             ['vswitch', 'add_vport', 'int_br0'],        # STEP 6
557             # Setup Flows to reply ICMPv6 and similar packets, so to
558             # avoid flooding internal port with their re-transmissions
559             ['vswitch', 'add_flow', 'int_br0', \
560                 {'priority': '1', 'dl_src': '00:00:00:00:00:01', \
561                 'actions': ['output:#STEP[3][1]'], 'idle_timeout': '0'}],
562             ['vswitch', 'add_flow', 'int_br0', \
563                 {'priority': '1', 'dl_src': '00:00:00:00:00:02', \
564                 'actions': ['output:#STEP[4][1]'], 'idle_timeout': '0'}],
565             ['vswitch', 'add_flow', 'int_br0', \
566                 {'priority': '1', 'dl_src': '00:00:00:00:00:03', \
567                 'actions': ['output:#STEP[5][1]'], 'idle_timeout': '0'}],
568             ['vswitch', 'add_flow', 'int_br0', \
569                 {'priority': '1', 'dl_src': '00:00:00:00:00:04', \
570                 'actions': ['output:#STEP[6][1]'], 'idle_timeout': '0'}],
571             # Forward UDP packets depending on dest port
572             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
573                 'dl_type': '0x0800', 'nw_proto': '17', 'udp_dst': '0', \
574                 'actions': ['output:#STEP[3][1]'], 'idle_timeout': '0'}],
575             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[1][1]', \
576                 'dl_type': '0x0800', 'nw_proto': '17', 'udp_dst': '1', \
577                 'actions': ['output:#STEP[5][1]'], 'idle_timeout': '0'}],
578             # Send VM output to phy port #2
579             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[4][1]', \
580                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
581             ['vswitch', 'add_flow', 'int_br0', {'in_port': '#STEP[6][1]', \
582                 'actions': ['output:#STEP[2][1]'], 'idle_timeout': '0'}],
583             # Start VMs
584             ['vnf1', 'start'],                          # STEP 16
585             ['vnf2', 'start'],                          # STEP 17
586             ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', \
587                 'bidir' : 'False'}],
588             ['vnf1', 'stop'],
589             ['vnf2', 'stop'],
590             ['vswitch', 'dump_flows', 'int_br0'],
591             # Clean up
592             ['vswitch', 'del_flow', 'int_br0'],
593             ['vswitch', 'del_port', 'int_br0', '#STEP[1][0]'],
594             ['vswitch', 'del_port', 'int_br0', '#STEP[2][0]'],
595             ['vswitch', 'del_port', 'int_br0', '#STEP[3][0]'],  # vm1 ports
596             ['vswitch', 'del_port', 'int_br0', '#STEP[4][0]'],
597             ['vswitch', 'del_port', 'int_br0', '#STEP[5][0]'],  # vm2 ports
598             ['vswitch', 'del_port', 'int_br0', '#STEP[6][0]'],
599             ['vswitch', 'del_switch', 'int_br0'],
600         ]
601     },
602
603 To run the test:
604
605   .. code-block:: console
606
607     ./vsperf --conf-file user_settings.py --integration ex_2pvp_rule_l4dp
608
609 Executing Tunnel encapsulation tests
610 ------------------------------------
611
612 The VXLAN OVS DPDK encapsulation tests requires IPs, MAC addresses,
613 bridge names and WHITELIST_NICS for DPDK.
614
615 NOTE: Only Ixia traffic generators currently support the execution of the tunnel
616 encapsulation tests. Support for other traffic generators may come in a future
617 release.
618
619 Default values are already provided. To customize for your environment, override
620 the following variables in you user_settings.py file:
621
622   .. code-block:: python
623
624     # Variables defined in conf/integration/02_vswitch.conf
625     # Tunnel endpoint for Overlay P2P deployment scenario
626     # used for br0
627     VTEP_IP1 = '192.168.0.1/24'
628
629     # Used as remote_ip in adding OVS tunnel port and
630     # to set ARP entry in OVS (e.g. tnl/arp/set br-ext 192.168.240.10 02:00:00:00:00:02
631     VTEP_IP2 = '192.168.240.10'
632
633     # Network to use when adding a route for inner frame data
634     VTEP_IP2_SUBNET = '192.168.240.0/24'
635
636     # Bridge names
637     TUNNEL_INTEGRATION_BRIDGE = 'br0'
638     TUNNEL_EXTERNAL_BRIDGE = 'br-ext'
639
640     # IP of br-ext
641     TUNNEL_EXTERNAL_BRIDGE_IP = '192.168.240.1/24'
642
643     # vxlan|gre|geneve
644     TUNNEL_TYPE = 'vxlan'
645
646     # Variables defined conf/integration/03_traffic.conf
647     # For OP2P deployment scenario
648     TRAFFICGEN_PORT1_MAC = '02:00:00:00:00:01'
649     TRAFFICGEN_PORT2_MAC = '02:00:00:00:00:02'
650     TRAFFICGEN_PORT1_IP = '1.1.1.1'
651     TRAFFICGEN_PORT2_IP = '192.168.240.10'
652
653 To run VXLAN encapsulation tests:
654
655   .. code-block:: console
656
657     ./vsperf --conf-file user_settings.py --integration
658              --test-params 'tunnel_type=vxlan' overlay_p2p_tput
659
660 To run GRE encapsulation tests:
661
662   .. code-block:: console
663
664     ./vsperf --conf-file user_settings.py --integration
665              --test-params 'tunnel_type=gre' overlay_p2p_tput
666
667 To run GENEVE encapsulation tests:
668
669   .. code-block:: console
670
671     ./vsperf --conf-file user_settings.py --integration
672              --test-params 'tunnel_type=geneve' overlay_p2p_tput
673
674 To run OVS NATIVE tunnel tests (VXLAN/GRE/GENEVE):
675
676 1. Install the OVS kernel modules
677
678   .. code:: console
679
680     cd src/ovs/ovs
681     sudo -E make modules_install
682
683 2. Set the following variables:
684
685   .. code-block:: python
686
687     VSWITCH = 'OvsVanilla'
688     # Specify vport_* kernel module to test.
689     PATHS['vswitch']['OvsVanilla']['src']['modules'] = [
690         'vport_vxlan',
691         'vport_gre',
692         'vport_geneve',
693         'datapath/linux/openvswitch.ko',
694     ]
695
696   **NOTE:** In case, that Vanilla OVS is installed from binary package, then
697   please set ``PATHS['vswitch']['OvsVanilla']['bin']['modules']`` instead.
698
699 3. Run tests:
700
701   .. code-block:: console
702
703     ./vsperf --conf-file user_settings.py --integration
704              --test-params 'tunnel_type=vxlan' overlay_p2p_tput
705
706
707 Executing VXLAN decapsulation tests
708 ------------------------------------
709
710 To run VXLAN decapsulation tests:
711
712 1. Set the variables used in "Executing Tunnel encapsulation tests"
713
714 2. Set dstmac of DUT_NIC2_MAC to the MAC adddress of the 2nd NIC of your DUT
715
716   .. code-block:: python
717
718     DUT_NIC2_MAC = '<DUT NIC2 MAC>'
719
720 3. Run test:
721
722   .. code-block:: console
723
724     ./vsperf --conf-file user_settings.py --integration overlay_p2p_decap_cont
725
726 If you want to use different values for your VXLAN frame, you may set:
727
728   .. code-block:: python
729
730     VXLAN_FRAME_L3 = {'proto': 'udp',
731                       'packetsize': 64,
732                       'srcip': TRAFFICGEN_PORT1_IP,
733                       'dstip': '192.168.240.1',
734                      }
735     VXLAN_FRAME_L4 = {'srcport': 4789,
736                       'dstport': 4789,
737                       'vni': VXLAN_VNI,
738                       'inner_srcmac': '01:02:03:04:05:06',
739                       'inner_dstmac': '06:05:04:03:02:01',
740                       'inner_srcip': '192.168.0.10',
741                       'inner_dstip': '192.168.240.9',
742                       'inner_proto': 'udp',
743                       'inner_srcport': 3000,
744                       'inner_dstport': 3001,
745                      }
746
747
748 Executing GRE decapsulation tests
749 ---------------------------------
750
751 To run GRE decapsulation tests:
752
753 1. Set the variables used in "Executing Tunnel encapsulation tests"
754
755 2. Set dstmac of DUT_NIC2_MAC to the MAC adddress of the 2nd NIC of your DUT
756
757   .. code-block:: python
758
759     DUT_NIC2_MAC = '<DUT NIC2 MAC>'
760
761 3. Run test:
762
763   .. code-block:: console
764
765     ./vsperf --conf-file user_settings.py --test-params 'tunnel_type=gre'
766              --integration overlay_p2p_decap_cont
767
768
769 If you want to use different values for your GRE frame, you may set:
770
771   .. code-block:: python
772
773     GRE_FRAME_L3 = {'proto': 'gre',
774                     'packetsize': 64,
775                     'srcip': TRAFFICGEN_PORT1_IP,
776                     'dstip': '192.168.240.1',
777                    }
778
779     GRE_FRAME_L4 = {'srcport': 0,
780                     'dstport': 0
781                     'inner_srcmac': '01:02:03:04:05:06',
782                     'inner_dstmac': '06:05:04:03:02:01',
783                     'inner_srcip': '192.168.0.10',
784                     'inner_dstip': '192.168.240.9',
785                     'inner_proto': 'udp',
786                     'inner_srcport': 3000,
787                     'inner_dstport': 3001,
788                    }
789
790
791 Executing GENEVE decapsulation tests
792 ------------------------------------
793
794 IxNet 7.3X does not have native support of GENEVE protocol. The
795 template, GeneveIxNetTemplate.xml_ClearText.xml, should be imported
796 into IxNET for this testcase to work.
797
798 To import the template do:
799
800 1. Run the IxNetwork TCL Server
801 2. Click on the Traffic menu
802 3. Click on the Traffic actions and click Edit Packet Templates
803 4. On the Template editor window, click Import. Select the template
804    tools/pkt_gen/ixnet/GeneveIxNetTemplate.xml_ClearText.xml
805    and click import.
806 5. Restart the TCL Server.
807
808 To run GENEVE decapsulation tests:
809
810 1. Set the variables used in "Executing Tunnel encapsulation tests"
811
812 2. Set dstmac of DUT_NIC2_MAC to the MAC adddress of the 2nd NIC of your DUT
813
814   .. code-block:: python
815
816     DUT_NIC2_MAC = '<DUT NIC2 MAC>'
817
818 3. Run test:
819
820   .. code-block:: console
821
822     ./vsperf --conf-file user_settings.py --test-params 'tunnel_type=geneve'
823              --integration overlay_p2p_decap_cont
824
825
826 If you want to use different values for your GENEVE frame, you may set:
827
828   .. code-block:: python
829
830     GENEVE_FRAME_L3 = {'proto': 'udp',
831                        'packetsize': 64,
832                        'srcip': TRAFFICGEN_PORT1_IP,
833                        'dstip': '192.168.240.1',
834                       }
835
836     GENEVE_FRAME_L4 = {'srcport': 6081,
837                        'dstport': 6081,
838                        'geneve_vni': 0,
839                        'inner_srcmac': '01:02:03:04:05:06',
840                        'inner_dstmac': '06:05:04:03:02:01',
841                        'inner_srcip': '192.168.0.10',
842                        'inner_dstip': '192.168.240.9',
843                        'inner_proto': 'udp',
844                        'inner_srcport': 3000,
845                        'inner_dstport': 3001,
846                       }
847
848
849 Executing Native/Vanilla OVS VXLAN decapsulation tests
850 ------------------------------------------------------
851
852 To run VXLAN decapsulation tests:
853
854 1. Set the following variables in your user_settings.py file:
855
856   .. code-block:: python
857
858     PATHS['vswitch']['OvsVanilla']['src']['modules'] = [
859         'vport_vxlan',
860         'datapath/linux/openvswitch.ko',
861     ]
862
863     DUT_NIC1_MAC = '<DUT NIC1 MAC ADDRESS>'
864
865     TRAFFICGEN_PORT1_IP = '172.16.1.2'
866     TRAFFICGEN_PORT2_IP = '192.168.1.11'
867
868     VTEP_IP1 = '172.16.1.2/24'
869     VTEP_IP2 = '192.168.1.1'
870     VTEP_IP2_SUBNET = '192.168.1.0/24'
871     TUNNEL_EXTERNAL_BRIDGE_IP = '172.16.1.1/24'
872     TUNNEL_INT_BRIDGE_IP = '192.168.1.1'
873
874     VXLAN_FRAME_L2 = {'srcmac':
875                       '01:02:03:04:05:06',
876                       'dstmac': DUT_NIC1_MAC
877                      }
878
879     VXLAN_FRAME_L3 = {'proto': 'udp',
880                       'packetsize': 64,
881                       'srcip': TRAFFICGEN_PORT1_IP,
882                       'dstip': '172.16.1.1',
883                      }
884
885     VXLAN_FRAME_L4 = {
886                       'srcport': 4789,
887                       'dstport': 4789,
888                       'protocolpad': 'true',
889                       'vni': 99,
890                       'inner_srcmac': '01:02:03:04:05:06',
891                       'inner_dstmac': '06:05:04:03:02:01',
892                       'inner_srcip': '192.168.1.2',
893                       'inner_dstip': TRAFFICGEN_PORT2_IP,
894                       'inner_proto': 'udp',
895                       'inner_srcport': 3000,
896                       'inner_dstport': 3001,
897                      }
898
899   **NOTE:** In case, that Vanilla OVS is installed from binary package, then
900   please set ``PATHS['vswitch']['OvsVanilla']['bin']['modules']`` instead.
901
902 2. Run test:
903
904   .. code-block:: console
905
906     ./vsperf --conf-file user_settings.py --integration
907              --test-params 'tunnel_type=vxlan' overlay_p2p_decap_cont
908
909 Executing Native/Vanilla OVS GRE decapsulation tests
910 ----------------------------------------------------
911
912 To run GRE decapsulation tests:
913
914 1. Set the following variables in your user_settings.py file:
915
916   .. code-block:: python
917
918     PATHS['vswitch']['OvsVanilla']['src']['modules'] = [
919         'vport_gre',
920         'datapath/linux/openvswitch.ko',
921     ]
922
923     DUT_NIC1_MAC = '<DUT NIC1 MAC ADDRESS>'
924
925     TRAFFICGEN_PORT1_IP = '172.16.1.2'
926     TRAFFICGEN_PORT2_IP = '192.168.1.11'
927
928     VTEP_IP1 = '172.16.1.2/24'
929     VTEP_IP2 = '192.168.1.1'
930     VTEP_IP2_SUBNET = '192.168.1.0/24'
931     TUNNEL_EXTERNAL_BRIDGE_IP = '172.16.1.1/24'
932     TUNNEL_INT_BRIDGE_IP = '192.168.1.1'
933
934     GRE_FRAME_L2 = {'srcmac':
935                     '01:02:03:04:05:06',
936                     'dstmac': DUT_NIC1_MAC
937                    }
938
939     GRE_FRAME_L3 = {'proto': 'udp',
940                     'packetsize': 64,
941                     'srcip': TRAFFICGEN_PORT1_IP,
942                     'dstip': '172.16.1.1',
943                    }
944
945     GRE_FRAME_L4 = {
946                     'srcport': 4789,
947                     'dstport': 4789,
948                     'protocolpad': 'true',
949                     'inner_srcmac': '01:02:03:04:05:06',
950                     'inner_dstmac': '06:05:04:03:02:01',
951                     'inner_srcip': '192.168.1.2',
952                     'inner_dstip': TRAFFICGEN_PORT2_IP,
953                     'inner_proto': 'udp',
954                     'inner_srcport': 3000,
955                     'inner_dstport': 3001,
956                    }
957
958   **NOTE:** In case, that Vanilla OVS is installed from binary package, then
959   please set ``PATHS['vswitch']['OvsVanilla']['bin']['modules']`` instead.
960
961 2. Run test:
962
963   .. code-block:: console
964
965     ./vsperf --conf-file user_settings.py --integration
966              --test-params 'tunnel_type=gre' overlay_p2p_decap_cont
967
968 Executing Native/Vanilla OVS GENEVE decapsulation tests
969 -------------------------------------------------------
970
971 To run GENEVE decapsulation tests:
972
973 1. Set the following variables in your user_settings.py file:
974
975   .. code-block:: python
976
977     PATHS['vswitch']['OvsVanilla']['src']['modules'] = [
978         'vport_geneve',
979         'datapath/linux/openvswitch.ko',
980     ]
981
982     DUT_NIC1_MAC = '<DUT NIC1 MAC ADDRESS>'
983
984     TRAFFICGEN_PORT1_IP = '172.16.1.2'
985     TRAFFICGEN_PORT2_IP = '192.168.1.11'
986
987     VTEP_IP1 = '172.16.1.2/24'
988     VTEP_IP2 = '192.168.1.1'
989     VTEP_IP2_SUBNET = '192.168.1.0/24'
990     TUNNEL_EXTERNAL_BRIDGE_IP = '172.16.1.1/24'
991     TUNNEL_INT_BRIDGE_IP = '192.168.1.1'
992
993     GENEVE_FRAME_L2 = {'srcmac':
994                        '01:02:03:04:05:06',
995                        'dstmac': DUT_NIC1_MAC
996                       }
997
998     GENEVE_FRAME_L3 = {'proto': 'udp',
999                        'packetsize': 64,
1000                        'srcip': TRAFFICGEN_PORT1_IP,
1001                        'dstip': '172.16.1.1',
1002                       }
1003
1004     GENEVE_FRAME_L4 = {'srcport': 6081,
1005                        'dstport': 6081,
1006                        'protocolpad': 'true',
1007                        'geneve_vni': 0,
1008                        'inner_srcmac': '01:02:03:04:05:06',
1009                        'inner_dstmac': '06:05:04:03:02:01',
1010                        'inner_srcip': '192.168.1.2',
1011                        'inner_dstip': TRAFFICGEN_PORT2_IP,
1012                        'inner_proto': 'udp',
1013                        'inner_srcport': 3000,
1014                        'inner_dstport': 3001,
1015                       }
1016
1017   **NOTE:** In case, that Vanilla OVS is installed from binary package, then
1018   please set ``PATHS['vswitch']['OvsVanilla']['bin']['modules']`` instead.
1019
1020 2. Run test:
1021
1022   .. code-block:: console
1023
1024     ./vsperf --conf-file user_settings.py --integration
1025              --test-params 'tunnel_type=geneve' overlay_p2p_decap_cont
1026
1027
1028 Executing Tunnel encapsulation+decapsulation tests
1029 --------------------------------------------------
1030
1031 The OVS DPDK encapsulation_decapsulation tests requires IPs, MAC addresses,
1032 bridge names and WHITELIST_NICS for DPDK.
1033
1034 The test cases can test the tunneling encap and decap without using any ingress
1035 overlay traffic as compared to above test cases. To achieve this the OVS is
1036 configured to perform encap and decap in a series on the same traffic stream as
1037 given below.
1038
1039 TRAFFIC-IN --> [ENCAP] --> [MOD-PKT] --> [DECAP] --> TRAFFIC-OUT
1040
1041
1042 Default values are already provided. To customize for your environment, override
1043 the following variables in you user_settings.py file:
1044
1045   .. code-block:: python
1046
1047     # Variables defined in conf/integration/02_vswitch.conf
1048
1049     # Bridge names
1050     TUNNEL_EXTERNAL_BRIDGE1 = 'br-phy1'
1051     TUNNEL_EXTERNAL_BRIDGE2 = 'br-phy2'
1052     TUNNEL_MODIFY_BRIDGE1 = 'br-mod1'
1053     TUNNEL_MODIFY_BRIDGE2 = 'br-mod2'
1054
1055     # IP of br-mod1
1056     TUNNEL_MODIFY_BRIDGE_IP1 = '10.0.0.1/24'
1057
1058     # Mac of br-mod1
1059     TUNNEL_MODIFY_BRIDGE_MAC1 = '00:00:10:00:00:01'
1060
1061     # IP of br-mod2
1062     TUNNEL_MODIFY_BRIDGE_IP2 = '20.0.0.1/24'
1063
1064     #Mac of br-mod2
1065     TUNNEL_MODIFY_BRIDGE_MAC2 = '00:00:20:00:00:01'
1066
1067     # vxlan|gre|geneve, Only VXLAN is supported for now.
1068     TUNNEL_TYPE = 'vxlan'
1069
1070 To run VXLAN encapsulation+decapsulation tests:
1071
1072   .. code-block:: console
1073
1074     ./vsperf --conf-file user_settings.py --integration
1075              overlay_p2p_mod_tput