960f47f3a9ccd3ac5bb975565a73fa7d05a2ccf7
[vswitchperf.git] / conf / integration / 01b_dpdk_regression_tests.conf
1 # Copyright 2017-2018 Intel Corporation., Tieto
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #   http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # This file introduces a set of regression tests, which verify several DPDK features
16 # used internally by Open vSwitch. Tests can be used for verification of performance
17 # and correct functionality of upcoming DPDK and OVS releases and release candidates.
18
19 ############################################################
20 #
21 #  Generic configuration used by OVSDPDK testcases
22 #
23 ############################################################
24
25 # required to import path to the log file
26 from conf import settings
27
28 _OVSDPDK_1st_PMD_CORE = 4
29 _OVSDPDK_2nd_PMD_CORE = 5
30 # calculate PMD mask from core IDs configured above
31 _OVSDPDK_PMD_MASK_1_CORE = str(hex(1<<_OVSDPDK_1st_PMD_CORE))[2:]
32 _OVSDPDK_PMD_MASK_2_CORE = str(hex((1<<_OVSDPDK_1st_PMD_CORE) + (1<<_OVSDPDK_2nd_PMD_CORE))[2:])
33
34 _OVSDPDK_GUEST_5_CORES = [('7', '8', '9', '10', '11')]
35
36 # number of queues configured in OVS and GUEST
37 _OVSDPDK_MQ = '2'
38
39 # path to the log file
40 _RESULTS_PATH = settings.getValue('RESULTS_PATH')
41 name, ext = os.path.splitext(settings.getValue('LOG_FILE_VSWITCHD'))
42 log_file = "{name}_{uid}{ex}".format(name=name,uid=settings.getValue('LOG_TIMESTAMP'),ex=ext)
43 _OVSDPDK_VSWITCH_LOG = os.path.join(_RESULTS_PATH, log_file)
44
45 _OVSDPDK_HEADER_LEN = 18                # length of frame headers in bytes, it's used for calculation
46                                         # of payload size, i.e. payload = frame_size - header_len
47
48 _OVSDPDK_PKT_SIZES = (64,128,256,512,1024,1500)
49
50 INTEGRATION_TESTS = INTEGRATION_TESTS + [
51     ############################################################
52     #
53     #  DPDK NIC Support
54     #
55     ############################################################
56     {
57         "Name": "ovsdpdk_nic_p2p_single_pmd_unidir_cont",
58         "Deployment": "p2p",
59         "Description": "P2P with single PMD in OVS and unidirectional traffic.",
60         "vSwitch" : "OvsDpdkVhost",
61         "Parameters" : {
62             "TRAFFIC" : {
63                 "traffic_type" : "rfc2544_continuous",
64                 "frame_rate" : 100,
65                 'bidir' : 'False',
66             },
67             "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
68             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
69         },
70     },
71     {
72         "Name": "ovsdpdk_nic_p2p_single_pmd_bidir_cont",
73         "Deployment": "p2p",
74         "Description": "P2P with single PMD in OVS and bidirectional traffic.",
75         "vSwitch" : "OvsDpdkVhost",
76         "Parameters" : {
77             "TRAFFIC" : {
78                 "traffic_type" : "rfc2544_continuous",
79                 "frame_rate" : 100,
80                 'bidir' : 'True',
81             },
82             "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
83             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
84         },
85     },
86     {
87         "Name": "ovsdpdk_nic_p2p_two_pmd_bidir_cont",
88         "Deployment": "p2p",
89         "Description": "P2P with two PMDs in OVS and bidirectional traffic.",
90         "vSwitch" : "OvsDpdkVhost",
91         "Parameters" : {
92             "TRAFFIC" : {
93                 "traffic_type" : "rfc2544_continuous",
94                 "frame_rate" : 100,
95                 'bidir' : 'True',
96             },
97             "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
98             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
99         },
100     },
101     {
102         "Name": "ovsdpdk_nic_p2p_single_pmd_unidir_tput",
103         "Deployment": "p2p",
104         "Description": "P2P with single PMD in OVS and unidirectional traffic.",
105         "vSwitch" : "OvsDpdkVhost",
106         "Parameters" : {
107             "TRAFFIC" : {
108                 "traffic_type" : "rfc2544_throughput",
109                 'bidir' : 'False',
110             },
111             "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
112             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
113         },
114     },
115     {
116         "Name": "ovsdpdk_nic_p2p_single_pmd_bidir_tput",
117         "Deployment": "p2p",
118         "Description": "P2P with single PMD in OVS and bidirectional traffic.",
119         "vSwitch" : "OvsDpdkVhost",
120         "Parameters" : {
121             "TRAFFIC" : {
122                 "traffic_type" : "rfc2544_throughput",
123                 'bidir' : 'True',
124             },
125             "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
126             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
127         },
128     },
129     {
130         "Name": "ovsdpdk_nic_p2p_two_pmd_bidir_tput",
131         "Deployment": "p2p",
132         "Description": "P2P with two PMDs in OVS and bidirectional traffic.",
133         "vSwitch" : "OvsDpdkVhost",
134         "Parameters" : {
135             "TRAFFIC" : {
136                 "traffic_type" : "rfc2544_throughput",
137                 'bidir' : 'True',
138             },
139             "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
140             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
141         },
142     },
143     ############################################################
144     #
145     #  DPDK Hotplug Support
146     #
147     ############################################################
148     {
149         "Name": "ovsdpdk_hotplug_attach",
150         "Deployment": "clean",
151         "Description": "Ensure successful port-add after binding a device to igb_uio after ovs-vswitchd is launched.",
152         "vSwitch" : "OvsDpdkVhost",
153         "Parameters" : {
154             # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
155             'WHITELIST_NICS' : [],
156             'NICS' : [],
157         },
158         "TestSteps": [
159                         # restore original NICS configuration, so we can use add/del_phy_port
160                         ['settings', 'setValue', 'TEST_PARAMS', ''],
161                         # add DPDK port, but it should fail
162                         ['vswitch', 'add_switch', 'int_br0'],
163                         ['#port', 'vswitch', 'add_phy_port', 'int_br0'],
164                         # check, that DPDK port is not available and remove it
165                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
166                                                 '|Error attaching device.*$NICS[0]["pci"]'],
167                         # NOTE: it fails in case that NIC was already bound to DPDK driver
168                         ['tools', 'assert', 'len(#STEP[-1])'],
169                         ['vswitch', 'del_port', 'int_br0', '#STEP[port][0]'],
170                         # find out which DPDK driver is being used; it should be the last configured
171                         # DPDK module; optional path and .ko suffix must be removed
172                         ['tools', 'eval', '\'$TOOLS["dpdk_modules"][-1]\'.split("/")[-1].split(".")[0]'],
173                         # bind NIC to DPDK driver
174                         ['tools', 'exec_shell', 'sudo $TOOLS["bind-tool"] --bind #STEP[-1] $NICS[0]["pci"]'],
175                         # and check that DPDK port can be created without errors
176                         ['#port2', 'vswitch', 'add_phy_port', 'int_br0'],
177                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
178                                                 '|Error attaching device.*$NICS[0]["pci"]'],
179                         ['tools', 'assert', 'not len(#STEP[-1])'],
180                      ]
181     },
182     {
183         # Support of netdev-dpdk/detach has been removed from OVS, so testcase will fail with recent
184         # OVS/DPDK versions. There is an ongoing discussion about possible support of netdev-dpdk/detach
185         # in the future OVS versions.
186         # Test has been tested with:
187         #   OVS_TAG = 03d6399e618e4136c5da0be2b6f18f0b7d75b2bb
188         #   DPDK_TAG = v16.11
189         "Name": "ovsdpdk_hotplug_detach",
190         "Deployment": "clean",
191         "Description": "Same as ovsdpdk_hotplug_attach, but delete and detach the device after the hotplug. "
192                        "Note: Support of netdev-dpdk/detach has been removed from OVS, so testcase will fail "
193                        "with recent OVS/DPDK versions.",
194         "vSwitch" : "OvsDpdkVhost",
195         "Parameters" : {
196             # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
197             'WHITELIST_NICS' : [],
198             'NICS' : [],
199         },
200         "TestSteps": [
201                         # check if OVS supports netdev-dpdk/detach, fail otherwise
202                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] list-commands', '|netdev-dpdk\/detach'],
203                         ['tools', 'assert', 'len(#STEP[-1])'],
204                         # restore original NICS configuration, so we can use add/del_phy_port
205                         ['settings', 'setValue', 'TEST_PARAMS', ''],
206                         # find out which DPDK driver is being used; it should be the last configured
207                         # DPDK module; optional path and .ko suffix must be removed
208                         ['tools', 'eval', '\'$TOOLS["dpdk_modules"][-1]\'.split("/")[-1].split(".")[0]'],
209                         # bind NIC to DPDK driver
210                         ['tools', 'exec_shell', 'sudo $TOOLS["bind-tool"] --bind #STEP[-1] $NICS[0]["pci"]'],
211                         # and check that DPDK port can be created without errors
212                         ['vswitch', 'add_switch', 'int_br0'],
213                         ['#port', 'vswitch', 'add_phy_port', 'int_br0'],
214                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
215                                                 '|Error attaching device.*$NICS[0]["pci"]'],
216                         ['tools', 'assert', 'not len(#STEP[-1])'],
217                         # try to unbind port - should fail beause it is being used
218                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] netdev-dpdk/detach $NICS[0]["pci"] 2>&1; exit 0',
219                                                 '|Device.*$NICS[0]["pci"].*is being used by interface'],
220                         ['tools', 'assert', 'len(#STEP[-1])'],
221                         # delete port and unbind it - should succeed
222                         ['vswitch', 'del_port', 'int_br0', '#STEP[port][0]'],
223                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] netdev-dpdk/detach $NICS[0]["pci"]',
224                                                 '|Device.*$NICS[0]["pci"].*has been detached'],
225                         ['tools', 'assert', 'len(#STEP[-1])'],
226                         # try to add port again
227                         ['vswitch', 'add_phy_port', 'int_br0'],
228                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
229                                                 '|Error attaching device.*$NICS[0]["pci"]'],
230                         # it will work because auto attach was implemented into OVS
231                         ['tools', 'assert', 'not len(#STEP[-1])'],
232                         ['vswitch', 'del_switch', 'int_br0'],
233                      ]
234     },
235 ]
236
237 ############################################################
238 #
239 #  RX Checksum Support
240 #
241 ############################################################
242 # TCL script used for simulation of traffic with wrong CRC
243 _OVSDPDK_CRC_CRC_TCL = ''
244 _OVSDPDK_CRC_FRAME_LOSS = ''
245
246 _OVSDPDK_CRC_VERIFY_CRC = [
247     # use TCL script with tunneling protocols encap/decap support;
248     # it must be configured dynamically, otherwise it won't
249     # be possible to change it again below.
250     ['settings', 'setValue', 'TRAFFICGEN_IXNET_TCL_SCRIPT',
251      'ixnetrfc2544v2.tcl'],
252     # send traffic before IP or UDP header checksum is randomized
253     ['trafficgen', 'send_traffic', {}],
254     ['trafficgen', 'get_results'],
255     # packets should flow through OVS without frameloss (frame_rate is low)
256     ['tools', 'assert', 'float(#STEP[-1][0]["frame_loss_percent"]) == 0'],
257     # for 2nd run use TCL file with randomized checksum values
258     ['settings', 'setValue', 'TRAFFICGEN_IXNET_TCL_SCRIPT',
259      '$_OVSDPDK_CRC_CRC_TCL'],
260     ['trafficgen', 'send_traffic', {}],
261     ['trafficgen', 'get_results'],
262     # and verify that majority of frames but not all of them were lost
263     ['tools', 'assert', 'round(float(#STEP[-1][0]["frame_loss_percent"]),3) == $_OVSDPDK_CRC_FRAME_LOSS'],
264 ]
265
266 INTEGRATION_TESTS = INTEGRATION_TESTS + [
267     {
268         "Name": "ovsdpdk_checksum_l3",
269         "Deployment": "op2p",
270         "Description": "Test verifies RX IP header checksum (offloading) validation for tunneling protocols.",
271         "Tunnel Type": "vxlan",
272         "Tunnel Operation": "decapsulation",
273         "vSwitch" : "OvsDpdkVhost",
274         "Parameters" : {
275             "TRAFFICGEN" : "IxNet",
276             "TRAFFIC" : {
277                 "traffic_type" : "rfc2544_continuous",
278                 "frame_rate" : 20,
279                 'bidir' : 'False',
280             },
281             "TRAFFICGEN_DURATION" : 10,
282             "TRAFFICGEN_PKT_SIZES" : (64,)
283         },
284         "TestSteps": [
285                         # TCL file with randomized IP header checksum values
286                         ['settings', 'setValue', '_OVSDPDK_CRC_CRC_TCL',
287                          'ixnetrfc2544v2_random_ip_crc.tcl'],
288                         # IP checksum is a value between 0 and 65536, so only 1 of 65536
289                         # frames has correct CRC and all other frames will be dropped
290                         ['settings', 'setValue', '_OVSDPDK_CRC_FRAME_LOSS',
291                          round(100 - 1 / 65536 * 100, 3)],
292                     ] + _OVSDPDK_CRC_VERIFY_CRC
293     },
294     {
295         "Name": "ovsdpdk_checksum_l4",
296         "Deployment": "op2p",
297         "Description": "Test verifies RX UDP header checksum (offloading) validation for tunneling protocols.",
298         "Tunnel Type": "vxlan",
299         "Tunnel Operation": "decapsulation",
300         "vSwitch" : "OvsDpdkVhost",
301         "Parameters" : {
302             "TRAFFICGEN" : "IxNet",
303             "TRAFFIC" : {
304                 "traffic_type" : "rfc2544_continuous",
305                 "frame_rate" : 20,
306                 'bidir' : 'False',
307             },
308             "TRAFFICGEN_DURATION" : 10,
309             "TRAFFICGEN_PKT_SIZES" : (64,)
310         },
311         "TestSteps": [
312                         # TCL file with randomized UDP header checksum values
313                         ['settings', 'setValue', '_OVSDPDK_CRC_CRC_TCL',
314                          'ixnetrfc2544v2_random_udp_crc.tcl'],
315                         # UDP checksum can be disabled by value 0; so valid checksum
316                         # values are from 1 to 65535; It means that only one of 65535 frames
317                         # has correct checksum and all other frames will be dropped
318                         ['settings', 'setValue', '_OVSDPDK_CRC_FRAME_LOSS',
319                          round(100 - 1 / 65535 * 100, 3)],
320                     ] + _OVSDPDK_CRC_VERIFY_CRC
321     },
322     ############################################################
323     #
324     #  Flow Control Support
325     #
326     ############################################################
327     {
328         "Name": "ovsdpdk_flow_ctrl_rx",
329         "Deployment": "p2p",
330         "Description": "Test the rx flow control functionality of DPDK PHY ports.",
331         "vSwitch" : "OvsDpdkVhost",
332         "Parameters" : {
333             "TRAFFICGEN" : "IxNet",
334             "TRAFFIC" : {
335                 "traffic_type" : "rfc2544_continuous",
336                 "frame_rate" : 100,
337                 "flow_control" : True,
338                 'bidir' : 'True',
339             },
340             "TRAFFICGEN_DURATION" : 10,
341             "TRAFFICGEN_PKT_SIZES" : (64,)
342         },
343         "TestSteps": [
344                         # send traffic before flow control is applied
345                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show'],
346                         ['trafficgen', 'send_traffic', {}],
347                         ['trafficgen', 'get_results'],
348                         # frame loss with small packets should be detected
349                         ['tools', 'assert', '#STEP[-1][0]["frame_loss_percent"] > 10'],
350                         # delete phy ports so they can be created with flow control
351                         ['vswitch', 'del_flow', '$VSWITCH_BRIDGE_NAME', {}],
352                         ['vswitch', 'del_port', '$VSWITCH_BRIDGE_NAME', 'dpdk0'],
353                         ['vswitch', 'del_port', '$VSWITCH_BRIDGE_NAME', 'dpdk1'],
354                         # turn on flow control
355                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] add-port $VSWITCH_BRIDGE_NAME dpdk0 -- set Interface dpdk0 type=dpdk options:dpdk-devargs=$NICS[0]["pci"] options:rx-flow-ctrl=true'],
356                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] add-port $VSWITCH_BRIDGE_NAME dpdk1 -- set Interface dpdk1 type=dpdk options:dpdk-devargs=$NICS[1]["pci"] options:rx-flow-ctrl=true'],
357                         ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '3', 'actions': ['output:4'], 'idle_timeout': '0'}],
358                         ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '4', 'actions': ['output:3'], 'idle_timeout': '0'}],
359                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show'],
360                         ['trafficgen', 'send_traffic', {}],
361                         ['trafficgen', 'get_results'],
362                         # frame loss with flow control enabled should converge to 0%
363                         ['tools', 'assert', 'float(#STEP[-1][0]["frame_loss_percent"]) == 0'],
364                     ]
365     },
366     {
367         "Name": "ovsdpdk_flow_ctrl_rx_dynamic",
368         "Deployment": "p2p",
369         "Description": "Change the rx flow control support at run time and ensure the system honored the changes.",
370         "vSwitch" : "OvsDpdkVhost",
371         "Parameters" : {
372             "TRAFFICGEN" : "IxNet",
373             "TRAFFIC" : {
374                 "traffic_type" : "rfc2544_continuous",
375                 "frame_rate" : 100,
376                 "flow_control" : True,
377                 'bidir' : 'True',
378             },
379             "TRAFFICGEN_DURATION" : 10,
380             "TRAFFICGEN_PKT_SIZES" : (64,)
381         },
382         "TestSteps": [
383                         # send traffic before flow control is applied
384                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show'],
385                         ['trafficgen', 'send_traffic', {}],
386                         ['trafficgen', 'get_results'],
387                         # frame loss with small packets should be detected
388                         ['tools', 'assert', '#STEP[-1][0]["frame_loss_percent"] > 10'],
389                         # turn on flow control
390                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 type=dpdk options:rx-flow-ctrl=true'],
391                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk1 type=dpdk options:rx-flow-ctrl=true'],
392                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show'],
393                         ['trafficgen', 'send_traffic', {}],
394                         ['trafficgen', 'get_results'],
395                         # frame loss with flow control enabled should converge to 0%
396                         ['tools', 'assert', 'float(#STEP[-1][0]["frame_loss_percent"]) == 0'],
397                     ]
398     },
399     ############################################################
400     #
401     #  Multiqueue Support
402     #
403     ############################################################
404     {
405         "Name": "ovsdpdk_mq_p2p_rxqs",
406         "Deployment": "p2p",
407         "Description": "Setup rxqs on NIC port.",
408         "vSwitch" : "OvsDpdkVhost",
409         "Parameters" : {
410             "TRAFFIC" : {
411                 "traffic_type" : "rfc2544_continuous",
412                 "frame_rate" : 100,
413                 'bidir' : 'True',
414             },
415             "TRAFFICGEN_DURATION" : 1,
416             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
417             "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
418         },
419         "TestSteps": [
420                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpif-netdev/pmd-rxq-show','|dpdk[01]\s+queue-id:\s+\d+'],
421                         # check that requested nr of queues was created on both NICs
422                         ['tools', 'assert', 'len(#STEP[-1])=={}'.format(int(_OVSDPDK_MQ)*2)],
423                     ]
424     },
425     {
426         "Name": "ovsdpdk_mq_p2p_rxqs_same_core_affinity",
427         "Deployment": "p2p",
428         "Description": "Affinitize rxqs to the same core.",
429         "vSwitch" : "OvsDpdkVhost",
430         "Parameters" : {
431             "TRAFFIC" : {
432                 "traffic_type" : "rfc2544_continuous",
433                 "frame_rate" : 100,
434                 'bidir' : 'True',
435             },
436             "TRAFFICGEN_DURATION" : 1,
437             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
438             "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
439         },
440         "TestSteps": [
441                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"]  -- set Interface dpdk0 other_config:pmd-rxq-affinity="0:{},1:{}"'.format(_OVSDPDK_1st_PMD_CORE, _OVSDPDK_1st_PMD_CORE)],
442                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpif-netdev/pmd-rxq-show','|dpdk0\s+queue-id:\s+0'],
443                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpif-netdev/pmd-rxq-show','|dpdk0\s+queue-id:\s+1'],
444                         ['tools', 'assert', 'len(#STEP[-2])==1'],
445                         ['tools', 'assert', 'len(#STEP[-2])==1'],
446                     ]
447     },
448     {
449         "Name": "ovsdpdk_mq_p2p_rxqs_multi_core_affinity",
450         "Deployment": "p2p",
451         "Description": "Affinitize rxqs to separate cores.",
452         "vSwitch" : "OvsDpdkVhost",
453         "Parameters" : {
454             "TRAFFIC" : {
455                 "traffic_type" : "rfc2544_continuous",
456                 "frame_rate" : 100,
457                 'bidir' : 'True',
458             },
459             "TRAFFICGEN_DURATION" : 1,
460             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
461             "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
462         },
463         "TestSteps": [
464                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"]  -- set Interface dpdk0 other_config:pmd-rxq-affinity="0:{},1:{}"'.format(_OVSDPDK_1st_PMD_CORE, _OVSDPDK_2nd_PMD_CORE)],
465                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpif-netdev/pmd-rxq-show','|dpdk0\s+queue-id:\s+0'],
466                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpif-netdev/pmd-rxq-show','|dpdk0\s+queue-id:\s+1'],
467                         ['tools', 'assert', 'len(#STEP[-2])==1'],
468                         ['tools', 'assert', 'len(#STEP[-2])==1'],
469                     ]
470     },
471     {
472         "Name" : "ovsdpdk_mq_pvp_rxqs",
473         "Deployment" : "clean",
474         "Description" : "Setup rxqs on vhost user port.",
475         "vSwitch" : "OvsDpdkVhost",
476         "VNF" : "QemuDpdkVhostUser",
477         "Parameters" : {
478             "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
479             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
480             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
481             "GUEST_NIC_QUEUES" : [_OVSDPDK_MQ],
482             "GUEST_LOOPBACK" : ['clean'],
483         },
484         "TestSteps": STEP_VSWITCH_PVP_INIT +
485                      [
486                         ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] dpif-netdev/pmd-rxq-show",
487                          '|dpdkvhostuserclient0\s+queue-id:\s+\d'],
488                         ['tools', 'assert', 'len(#STEP[-1])==1'],
489                         ['vnf', 'start'],
490                         ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] dpif-netdev/pmd-rxq-show",
491                          '|dpdkvhostuserclient0\s+queue-id:\s+0'],
492                         ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] dpif-netdev/pmd-rxq-show",
493                          '|dpdkvhostuserclient0\s+queue-id:\s+1'],
494                         ['tools', 'assert', 'len(#STEP[-2])==1'],
495                         ['tools', 'assert', 'len(#STEP[-2])==1'],
496                         ['vnf', 'stop'],
497                      ] +
498                      STEP_VSWITCH_PVP_FINIT
499     },
500     {
501         "Name" : "ovsdpdk_mq_pvp_rxqs_linux_bridge",
502         "Deployment" : "clean",
503         "Description" : "Confirm traffic received over vhost RXQs with Linux virtio device in guest.",
504         "vSwitch" : "OvsDpdkVhost",
505         "VNF" : "QemuDpdkVhostUser",
506         "Parameters" : {
507             # configure 2 queues at both OVS and QEMU
508             "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
509             "GUEST_NIC_QUEUES" : [_OVSDPDK_MQ],
510             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
511             "GUEST_LOOPBACK" : ['clean'],
512             "TRAFFICGEN_DURATION" : 5,
513             "TRAFFICGEN" : "IxNet",
514             "TRAFFIC" : {
515                 "bidir" : "false",
516                 "traffic_type" : "rfc2544_continuous",
517                 "multistream" : 6,
518                 "stream_type" : "L3",
519                 "frame_rate" : 1,
520                 'l2': {
521                     'srcmac': "00:00:07:00:0E:00",
522                     'dstmac': "00:00:00:00:00:01"
523                 },
524                 'l3': {
525                     'enabled': True,
526                     'proto': 'udp',
527                     'srcip': '6.6.6.6',
528                     'dstip': '1.1.1.1',
529                 },
530             }
531         },
532         "TestSteps": STEP_VSWITCH_PVP_INIT + [
533                         # one flow will sent data to the VM
534                         ['vswitch', 'add_flow', 'int_br0',
535                          {'in_port': '#STEP[1][1]', 'actions': ['output:#STEP[3][1]'], 'idle_timeout': '0'}],
536                         # second flow just forwards traffic to the traffic generator,
537                         # so send_traffic() will end with success
538                         ['vswitch', 'add_flow', 'int_br0',
539                          {'in_port': '#STEP[2][1]', 'actions': ['output:#STEP[1][1]'], 'idle_timeout': '0'}],
540                         ['vnf', 'start'],
541                         # configure two channels, so multiple cores could be used
542                         ['vnf', 'execute_and_wait', 'ethtool -L eth0 combined 2'],
543                         ['vnf', 'execute_and_wait', 'ethtool -l eth0', '|Combined:\s+2'],
544                         ['tools', 'assert', 'len(#STEP[-1])==2'],
545                         # traffic will be sent to several DST IPs so it can be
546                         # dispatched between channels; We have to insert routes
547                         # and ARPs, otherwise traffic will be dropped
548                         ['vnf', 'execute_and_wait', 'ifconfig eth0 5.5.5.1/24 up'],
549                         ['vnf', 'execute_and_wait', 'sysctl -w net.ipv4.ip_forward=1'],
550                         ['vnf', 'execute_and_wait', 'sysctl -w net.ipv4.conf.all.rp_filter=0'],
551                         ['vnf', 'execute_and_wait', 'ip route add 6.6.6.0/24 dev eth0'],
552                         ['vnf', 'execute_and_wait', 'route add default gw 6.6.6.6 eth0'],
553                         ['vnf', 'execute_and_wait', 'arp -s 6.6.6.6 00:00:07:00:0E:00'],
554                         ['vnf', 'execute_and_wait', 'ip route add 1.1.1.0/31 dev eth0'],
555                         ['vnf', 'execute_and_wait', 'route add default gw 1.1.1.1 eth0'],
556                         ['vnf', 'execute_and_wait', 'arp -s 1.1.1.1 DE:AD:BE:EF:CA:FA'],
557                         ['vnf', 'execute_and_wait', 'ip route add 1.1.1.2/31 dev eth0'],
558                         ['vnf', 'execute_and_wait', 'route add default gw 1.1.1.3 eth0'],
559                         ['vnf', 'execute_and_wait', 'arp -s 1.1.1.3 DE:AD:BE:EF:CA:FB'],
560                         ['vnf', 'execute_and_wait', 'ip route add 1.1.1.4/31 dev eth0'],
561                         ['vnf', 'execute_and_wait', 'route add default gw 1.1.1.5 eth0'],
562                         ['vnf', 'execute_and_wait', 'arp -s 1.1.1.5 DE:AD:BE:EF:CA:FC'],
563                         ['vnf', 'execute_and_wait', 'ip a'],
564
565                         ['trafficgen', 'send_traffic',{}],
566                         # check interrupts to verify that traffic was corectly dispatched...
567                         ['#result', 'vnf', 'execute_and_wait', 'cat /proc/interrupts',
568                          '|^\s*\d+:\s+(\d+)\s+(\d+).+virtio0-input'],
569                         # ...it means that two channels were created...
570                         ['tools', 'assert', 'len(#STEP[result])==2'],
571                         # ...and both channels processed data; Check that interrupt count is "much"
572                         # higher than 0 to eliminate impact of rogue interrupts.
573                         ['tools', 'assert', 'int(#STEP[result][0][0]) + int(#STEP[result][0][1]) > 1000'],
574                         ['tools', 'assert', 'int(#STEP[result][1][0]) + int(#STEP[result][1][1]) > 1000'],
575                         ['vnf', 'stop'],
576                      ]
577     },
578     {
579         "Name" : "ovsdpdk_mq_pvp_rxqs_testpmd",
580         "Deployment" : "clean",
581         "Description" : "Confirm traffic received over vhost RXQs with DPDK device in guest.",
582         "vSwitch" : "OvsDpdkVhost",
583         "VNF" : "QemuDpdkVhostUser",
584         "Parameters" : {
585             "TRAFFICGEN" : "IxNet",
586             # configure 2 queues at both OVS and QEMU
587             "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
588             "GUEST_NIC_QUEUES" : [_OVSDPDK_MQ],
589             "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
590             "GUEST_CORE_BINDING" : _OVSDPDK_GUEST_5_CORES,
591             "GUEST_LOOPBACK" : ['testpmd'],
592             # there must be separate CPU for each of RX/TX queues
593             "GUEST_SMP" : ['5'],
594             "GUEST_TESTPMD_PARAMS" : ['-c 0x1F -n 4 --socket-mem 512 -- '
595                                       '--burst=64 -i --nb-cores=4 '
596                                       # map queue stats to separate regs to verify MQ functionality
597                                       '--rx-queue-stats-mapping=\(0,0,0\),\(0,1,1\),\(1,0,2\),\(1,1,3\) '
598                                       '--tx-queue-stats-mapping=\(0,0,4\),\(0,1,5\),\(1,0,6\),\(1,1,7\) '
599                                       '--rxq=2 --txq=2'],
600             "TRAFFICGEN_DURATION" : 5,
601             "TRAFFIC" : {
602                 "traffic_type" : "rfc2544_continuous",
603                 "multistream" : 3,
604                 "stream_type" : "L3",
605                 'l3': {
606                     'enabled': True,
607                     'proto': 'udp',
608                     'srcip': '6.6.6.6',
609                     'dstip': '1.1.1.1',
610                 },
611             },
612         },
613         "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
614                      [
615                         ['vnf', 'start'],
616                         ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] dpif-netdev/pmd-rxq-show",
617                          '|dpdk\w+\s+queue-id:\s+\d'],
618                         # there must be two standalone queue records for every interface (2x4)
619                         ['tools', 'assert', 'len(#STEP[-1])==8'],
620                         ['trafficgen', 'send_traffic', {}],
621
622                         # check that packets were received by both queues at both ports
623                         ['vnf', 'execute_and_wait', 'show port stats 0', 60, 'testpmd>',
624                          '|Stats reg  [01] RX-packets:\s+(\d+)'],
625                         ['tools', 'assert', '"0" not in #STEP[-1]'],
626                         # rx queue of 2nd port should be mapped to reg 2 and 3, but mapping might not work
627                         # so let us check that exactly two RX regs have non zero values
628                         ['vnf', 'execute_and_wait', 'show port stats 1', 60, 'testpmd>',
629                          '|Stats reg\s+\d+ RX-packets:\s+\d\d+'],
630                         ['tools', 'assert', 'len(#STEP[-1])==2'],
631                         # clean up
632                         ['vnf', 'stop'],
633                      ]
634     },
635     ############################################################
636     #
637     #  Vhost User
638     #
639     ############################################################
640     {
641         "Name": "ovsdpdk_vhostuser_client",
642         "Deployment": "pvp",
643         "Description": "Test vhost-user client mode",
644         "vSwitch" : "OvsDpdkVhost",
645         "VNF" : "QemuDpdkVhostUser",
646         "Parameters" : {
647             "TRAFFIC" : {
648                 "traffic_type" : "rfc2544_continuous",
649                 "frame_rate" : 100,
650                 'bidir' : 'True',
651             },
652             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
653             "TRAFFICGEN_DURATION" : 1,
654         },
655         "TestSteps": [
656                         # check that client ports are really used
657                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
658                                                 '|type.*dpdkvhostuserclient'],
659                         ['tools', 'assert', 'len(#STEP[-1])==2'],
660                         # send traffic manually, so TC will fail in case
661                         # that packets won't make it through
662                         ['trafficgen', 'send_traffic', {}],
663                      ],
664     },
665     {
666         "Name": "ovsdpdk_vhostuser_client_reconnect",
667         "Deployment": "pvp",
668         "Description": "Test vhost-user client mode reconnect feature",
669         "vSwitch" : "OvsDpdkVhost",
670         "VNF" : "QemuDpdkVhostUser",
671         "Parameters" : {
672             "TRAFFIC" : {
673                 "traffic_type" : "rfc2544_continuous",
674                 "frame_rate" : 100,
675                 'bidir' : 'True',
676             },
677             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
678             "TRAFFICGEN_DURATION" : 1,
679         },
680         "TestSteps": [
681                         # send traffic to verify correct PVP configuration
682                         ['trafficgen', 'send_traffic', {}],
683                         ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
684                         # restart vswitchd, ovsdb is kept untouched, so ovs configuration
685                         # (except flows) will be restored
686                         ['vswitch', 'restart'],
687                         ['vswitch', 'del_flow', '$VSWITCH_BRIDGE_NAME', {}],
688                         ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
689                         ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '1', 'actions': ['output:3'], 'idle_timeout': '0'}],
690                         ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '3', 'actions': ['output:1'], 'idle_timeout': '0'}],
691                         ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '2', 'actions': ['output:4'], 'idle_timeout': '0'}],
692                         ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '4', 'actions': ['output:2'], 'idle_timeout': '0'}],
693                         ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
694                         # send traffic to verify that OVS works correctly after restart
695                         ['trafficgen', 'send_traffic', {}],
696                      ],
697     },
698     {
699         "Name": "ovsdpdk_vhostuser_server",
700         "Deployment": "pvp",
701         "Description": "Test vhost-user server mode",
702         "vSwitch" : "OvsDpdkVhost",
703         "VNF" : "QemuDpdkVhostUser",
704         "Parameters" : {
705             "TRAFFIC" : {
706                 "traffic_type" : "rfc2544_continuous",
707                 "frame_rate" : 100,
708                 'bidir' : 'True',
709             },
710             "VSWITCH_VHOSTUSER_SERVER_MODE" : True,
711             "TRAFFICGEN_DURATION" : 1,
712         },
713         "TestSteps": [
714                         # check that server ports are really used
715                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
716                                                 '|type.*dpdkvhostuser$'],
717                         ['tools', 'assert', 'len(#STEP[-1])==2'],
718                         # send traffic manually, so TC will fail in case
719                         # that packets won't make it through
720                         ['trafficgen', 'send_traffic', {}],
721                      ],
722     },
723     {
724         "Name": "ovsdpdk_vhostuser_sock_dir",
725         "Deployment": "clean",
726         "Description": "Verify functionality of vhost-sock-dir flag",
727         "vSwitch" : "OvsDpdkVhost",
728         "Parameters" : {
729             "VSWITCH_VHOSTUSER_SERVER_MODE" : True,
730         },
731         "TestSteps": [
732                         ['vswitch', 'add_switch', '$VSWITCH_BRIDGE_NAME'],
733                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Open_vSwitch . '
734                          'other_config:vhost-sock-dir=test_dir'],
735                         # enforce vswitchd to read new configuration
736                         ['vswitch', 'restart'],
737                         ['tools', 'exec_shell', 'sudo mkdir $TOOLS["ovs_var_tmp"]/test_dir'],
738                         ['vswitch', 'add_vport', '$VSWITCH_BRIDGE_NAME'],
739                         ['tools', 'exec_shell', 'ls -1 $TOOLS["ovs_var_tmp"]/test_dir',
740                          '|dpdkvhostuser0'],
741                         ['tools', 'assert', 'len(#STEP[-1])'],
742                      ],
743     },
744 ]
745 ############################################################
746 #
747 #  Virtual Devices Support
748 #
749 ############################################################
750 _OVSDPDK_VDEV_ADD_NULL = [
751     ['vswitch', 'add_switch', 'int_br0'],
752     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"]  add-port int_br0 null0 -- '
753      'set Interface null0 type=dpdk options:dpdk-devargs=eth_null0'],
754     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show', '|dpdk-devargs=\S+eth_null0'],
755     ['tools', 'assert', 'len(#STEP[-1])==1'],
756 ]
757
758 _OVSDPDK_VDEV_ADD_AF_PACKET = [
759     # resore original NICS configuration, so we can use NICS dictionary
760     ['settings', 'setValue', 'TEST_PARAMS', ''],
761     # check if vsperf was able to read device name
762     ['tools', 'assert', 'str(\"$NICS[0]["device"]\") != \"None\"'],
763     ['tools', 'exec_shell', 'sudo ip link set dev $NICS[0]["device"] up'],
764     ['vswitch', 'add_switch', 'int_br0'],
765     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"]  add-port int_br0 myeth0 -- '
766      'set Interface myeth0 type=dpdk options:dpdk-devargs=eth_af_packet0,iface=$NICS[0]["device"]'],
767     # check if device was created...
768     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show', '|dpdk-devargs=\S+eth_af_packet0'],
769     ['tools', 'assert', 'len(#STEP[-1])==1'],
770     # ...without errors
771     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show', '|Error attaching device'],
772     ['tools', 'assert', 'not len(#STEP[-1])'],
773 ]
774
775 INTEGRATION_TESTS = INTEGRATION_TESTS + [
776     {
777         "Name": "ovsdpdk_vdev_add_null_pmd",
778         "Deployment": "clean",
779         "Description": "Test addition of port using the null DPDK PMD driver.",
780         "vSwitch" : "OvsDpdkVhost",
781         "TestSteps": _OVSDPDK_VDEV_ADD_NULL
782     },
783     {
784         "Name": "ovsdpdk_vdev_del_null_pmd",
785         "Deployment": "clean",
786         "Description": "Test deletion of port using the null DPDK PMD driver.",
787         "vSwitch" : "OvsDpdkVhost",
788         "TestSteps": _OVSDPDK_VDEV_ADD_NULL + [
789                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"]  del-port null0'],
790                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
791                          '|dpdk-devargs=\S+eth_null0'],
792                         ['tools', 'assert', 'not len(#STEP[-1])'],
793                     ]
794     },
795     {
796         "Name": "ovsdpdk_vdev_add_af_packet_pmd",
797         "Deployment": "clean",
798         "Description": "Test addition of port using the af_packet DPDK PMD driver.",
799         "vSwitch" : "OvsDpdkVhost",
800         "Parameters" : {
801             # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
802             'WHITELIST_NICS' : [],
803             'NICS' : [],
804         },
805         "TestSteps": _OVSDPDK_VDEV_ADD_AF_PACKET
806     },
807     {
808         "Name": "ovsdpdk_vdev_del_af_packet_pmd",
809         "Deployment": "clean",
810         "Description": "Test deletion of port using the af_packet DPDK PMD driver.",
811         "vSwitch" : "OvsDpdkVhost",
812         "Parameters" : {
813             # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
814             'WHITELIST_NICS' : [],
815             'NICS' : [],
816         },
817         "TestSteps": _OVSDPDK_VDEV_ADD_AF_PACKET + [
818                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"]  del-port myeth0'],
819                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
820                          '|dpdk-devargs=\S+eth_af_packet0'],
821                         ['tools', 'assert', 'not len(#STEP[-1])'],
822                     ]
823     },
824     ############################################################
825     #
826     #  NUMA Support
827     #
828     ############################################################
829     {
830         "Name": "ovsdpdk_numa",
831         "Deployment": "clean",
832         "Description": "Test vhost-user NUMA support. Vhostuser PMD threads should migrate "
833                        "to the same numa slot, where QEMU is executed.",
834         "vSwitch" : "OvsDpdkVhost",
835         "VNF" : "QemuDpdkVhostUser",
836         "Parameters" : {
837             # ensure that memory and cpus are available at both numa slots
838             "DPDK_SOCKET_MEM" : ['1024', '1024'],
839             "VSWITCH_PMD_CPU_MASK" : 'FFFFFE',
840             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
841             # traffic won't be send, so speed up VNF deployment
842             "GUEST_LOOPBACK" : ['clean']
843         },
844         "TestSteps": STEP_VSWITCH_PVP_INIT +
845             [
846                 # check that at least 2 numa slots are available
847                 ['tools', 'exec_shell', 'numactl -H', '|available: ([0-9]+)'],
848                 ['tools', 'assert', '#STEP[-1][0]>1'],
849                 # check that PMD thread serving dpdkvhostuserclient0 runs at NUMA slot 0
850                 ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] "
851                     "dpif-netdev/pmd-rxq-show | "
852                     "sed -e '/dpdkvhostuserclient0/,$d' | tac",
853                     '|pmd thread numa_id ([0-9])+'
854                 ],
855                 ['tools', 'assert', '#STEP[-1][0]==0'],
856                 # store last 2 cores from 2nd numa slot
857                 ['tools', 'exec_shell', 'numactl -H', '|node 1 cpus:.*\s+(\\d+) (\\d+)$'],
858                 # pin VNF to 2nd NUMA slot
859                 ['settings', 'setValue', 'GUEST_CORE_BINDING',
860                     [("#STEP[-1][0][0]", "#STEP[-1][0][1]")]
861                 ],
862                 ['vnf', 'start'],
863                 # ...and check that PMD thread serving dpdkvhostuserclient0
864                 # has migrated to NUMA slot 1
865                 ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] "
866                     "dpif-netdev/pmd-rxq-show | "
867                     "sed -e '/dpdkvhostuserclient0/,$d' | tac",
868                     '|pmd thread numa_id ([0-9])+'
869                 ],
870                 ['tools', 'assert', '#STEP[-1][0]==1'],
871                 ['vnf', 'stop'],
872             ] +
873             STEP_VSWITCH_PVP_FINIT
874     },
875     ############################################################
876     #
877     #  Jumbo Frame Support
878     #
879     ############################################################
880     {
881         "Name": "ovsdpdk_jumbo_increase_mtu_phy_port_ovsdb",
882         "Deployment": "clean",
883         "Description": "Ensure that the increased MTU for a DPDK physical port is updated in OVSDB.",
884         "vSwitch" : "OvsDpdkVhost",
885         "TestSteps": [
886                         ['vswitch', 'add_switch', 'int_br0'],
887                         ['vswitch', 'add_phy_port', 'int_br0'],
888                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
889                         ['tools', 'assert', 'int(#STEP[-1])==1500'],
890                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9000'],
891                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
892                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
893                     ]
894     },
895     {
896         "Name": "ovsdpdk_jumbo_increase_mtu_vport_ovsdb",
897         "Deployment": "clean",
898         "Description": "Ensure that the increased MTU for a DPDK vhost-user port is updated in OVSDB.",
899         "vSwitch" : "OvsDpdkVhost",
900         "Parameters" : {
901             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
902         },
903         "TestSteps": [
904                         ['vswitch', 'add_switch', 'int_br0'],
905                         ['vswitch', 'add_vport', 'int_br0'],
906                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
907                         ['tools', 'assert', 'int(#STEP[-1])==1500'],
908                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9000'],
909                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
910                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
911                     ]
912     },
913     {
914         "Name": "ovsdpdk_jumbo_reduce_mtu_phy_port_ovsdb",
915         "Deployment": "clean",
916         "Description": "Ensure that the reduced MTU for a DPDK physical port is updated in OVSDB.",
917         "vSwitch" : "OvsDpdkVhost",
918         "Parameters" : {
919             "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
920             "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
921         },
922         "TestSteps": [
923                         ['vswitch', 'add_switch', 'int_br0'],
924                         ['vswitch', 'add_phy_port', 'int_br0'],
925                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
926                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
927                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=2000'],
928                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
929                         ['tools', 'assert', 'int(#STEP[-1])==2000'],
930                     ]
931     },
932     {
933         "Name": "ovsdpdk_jumbo_reduce_mtu_vport_ovsdb",
934         "Deployment": "clean",
935         "Description": "Ensure that the reduced MTU for a DPDK vhost-user port is updated in OVSDB.",
936         "vSwitch" : "OvsDpdkVhost",
937         "Parameters" : {
938             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
939             "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
940             "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
941         },
942         "TestSteps": [
943                         ['vswitch', 'add_switch', 'int_br0'],
944                         ['vswitch', 'add_vport', 'int_br0'],
945                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
946                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
947                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=2000'],
948                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
949                         ['tools', 'assert', 'int(#STEP[-1])==2000'],
950                     ]
951     },
952     {
953         "Name": "ovsdpdk_jumbo_increase_mtu_phy_port_datapath",
954         "Deployment": "clean",
955         "Description": "Ensure that the MTU for a DPDK physical port is updated in the datapath itself when increased to a valid value.",
956         "vSwitch" : "OvsDpdkVhost",
957         "TestSteps": [
958                         ['vswitch', 'add_switch', 'int_br0'],
959                         ['vswitch', 'add_phy_port', 'int_br0'],
960                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=1500'],
961                         ['tools', 'assert', 'len(#STEP[-1])==1'],
962                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9000'],
963                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
964                         ['tools', 'assert', 'len(#STEP[-1])==1'],
965                     ]
966     },
967     {
968         "Name": "ovsdpdk_jumbo_increase_mtu_vport_datapath",
969         "Deployment": "clean",
970         "Description": "Ensure that the MTU for a DPDK vhost-user port is updated in the datapath itself when increased to a valid value.",
971         "vSwitch" : "OvsDpdkVhost",
972         "Parameters" : {
973             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
974         },
975         "TestSteps": [
976                         ['vswitch', 'add_switch', 'int_br0'],
977                         ['vswitch', 'add_vport', 'int_br0'],
978                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=1500'],
979                         ['tools', 'assert', 'len(#STEP[-1])==1'],
980                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9000'],
981                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
982                         ['tools', 'assert', 'len(#STEP[-1])==1'],
983                     ]
984     },
985     {
986         "Name": "ovsdpdk_jumbo_reduce_mtu_phy_port_datapath",
987         "Deployment": "clean",
988         "Description": "Ensure that the MTU for a DPDK physical port is updated in the datapath itself when decreased to a valid value.",
989         "vSwitch" : "OvsDpdkVhost",
990         "Parameters" : {
991             "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
992             "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
993         },
994         "TestSteps": [
995                         ['vswitch', 'add_switch', 'int_br0'],
996                         ['vswitch', 'add_phy_port', 'int_br0'],
997                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
998                         ['tools', 'assert', 'len(#STEP[-1])==1'],
999                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=2000'],
1000                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=2000'],
1001                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1002                     ]
1003     },
1004     {
1005         "Name": "ovsdpdk_jumbo_reduce_mtu_vport_datapath",
1006         "Deployment": "clean",
1007         "Description": "Ensure that the MTU for a DPDK vhost-user port is updated in the datapath itself when decreased to a valid value.",
1008         "vSwitch" : "OvsDpdkVhost",
1009         "Parameters" : {
1010             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1011             "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1012             "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1013         },
1014         "TestSteps": [
1015                         ['vswitch', 'add_switch', 'int_br0'],
1016                         ['vswitch', 'add_vport', 'int_br0'],
1017                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
1018                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1019                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=2000'],
1020                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=2000'],
1021                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1022                     ]
1023     },
1024     {
1025         "Name": "ovsdpdk_jumbo_mtu_upper_bound_phy_port",
1026         "Deployment": "clean",
1027         "Description": "Verify that the upper bound limit is enforced for OvS DPDK Phy ports.",
1028         "vSwitch" : "OvsDpdkVhost",
1029         "TestSteps": [
1030                         ['vswitch', 'add_switch', 'int_br0'],
1031                         ['vswitch', 'add_phy_port', 'int_br0'],
1032                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9702'],
1033                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1034                         ['tools', 'assert', 'int(#STEP[-1])==9702'],
1035                         # get line number of next log file entry
1036                         ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1037                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9711'],
1038                         # check vswitchd log file, that new MTU request was denied
1039                         ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1040                          '|unsupported MTU 9711'],
1041                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1042                         ['tools', 'assert', 'int(#STEP[-1])==9702'],
1043                     ]
1044     },
1045     {
1046         "Name": "ovsdpdk_jumbo_mtu_upper_bound_vport",
1047         "Deployment": "clean",
1048         "Description": "Verify that the upper bound limit is enforced for OvS DPDK vhost-user ports.",
1049         "vSwitch" : "OvsDpdkVhost",
1050         "Parameters" : {
1051             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1052         },
1053         "TestSteps": [
1054                         ['vswitch', 'add_switch', 'int_br0'],
1055                         ['vswitch', 'add_vport', 'int_br0'],
1056                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9702'],
1057                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1058                         ['tools', 'assert', 'int(#STEP[-1])==9702'],
1059                         # get line number of next log file entry
1060                         ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1061                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9711'],
1062                         # check vswitchd log file, that new MTU request was denied
1063                         ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1064                          '|unsupported MTU 9711'],
1065                         ['tools', 'assert', 'len(#STEP[-1])'],
1066                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1067                         ['tools', 'assert', 'int(#STEP[-1])==9702'],
1068                     ]
1069     },
1070     {
1071         "Name": "ovsdpdk_jumbo_mtu_lower_bound_phy_port",
1072         "Deployment": "clean",
1073         "Description": "Verify that the lower bound limit is enforced for OvS DPDK Phy ports.",
1074         "vSwitch" : "OvsDpdkVhost",
1075         "TestSteps": [
1076                         ['vswitch', 'add_switch', 'int_br0'],
1077                         ['vswitch', 'add_phy_port', 'int_br0'],
1078                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=68'],
1079                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1080                         ['tools', 'assert', 'int(#STEP[-1])==68'],
1081                         # get line number of next log file entry
1082                         ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1083                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=67'],
1084                         # check vswitchd log file, that new MTU request was denied
1085                         ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1086                          '|unsupported MTU 67'],
1087                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1088                         ['tools', 'assert', 'int(#STEP[-1])==68'],
1089                     ]
1090     },
1091     {
1092         "Name": "ovsdpdk_jumbo_mtu_lower_bound_vport",
1093         "Deployment": "clean",
1094         "Description": "Verify that the lower bound limit is enforced for OvS DPDK vhost-user ports.",
1095         "vSwitch" : "OvsDpdkVhost",
1096         "Parameters" : {
1097             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1098         },
1099         "TestSteps": [
1100                         ['vswitch', 'add_switch', 'int_br0'],
1101                         ['vswitch', 'add_vport', 'int_br0'],
1102                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=68'],
1103                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1104                         ['tools', 'assert', 'int(#STEP[-1])==68'],
1105                         # get line number of next log file entry
1106                         ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1107                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=67'],
1108                         # check vswitchd log file, that new MTU request was denied
1109                         ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1110                          '|unsupported MTU 67'],
1111                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1112                         ['tools', 'assert', 'int(#STEP[-1])==68'],
1113                     ]
1114     },
1115     {
1116         "Name": "ovsdpdk_jumbo_p2p",
1117         "Deployment": "p2p",
1118         "Description": "Ensure that jumbo frames are received, processed and forwarded correctly by DPDK physical ports.",
1119         "vSwitch" : "OvsDpdkVhost",
1120         "Parameters" : {
1121             "TRAFFIC" : {
1122                 "traffic_type" : "rfc2544_continuous",
1123                 "frame_rate" : 100,
1124                 'bidir' : 'False',
1125                 'learning_frames' : False,
1126             },
1127             "TRAFFICGEN_PKT_SIZES" : (9018,),
1128             "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1129             "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1130         },
1131         "TestSteps": [
1132                         # verify jumbo frame configuration
1133                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1134                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1135                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk1 mtu'],
1136                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1137                         ['trafficgen', 'send_traffic', {}],
1138                         # check that jumbo frames were received by traffic generator
1139                         ['trafficgen', 'get_results'],
1140                         # i.e. (RX in Bytes/s) divide (RX frames/s) ~ 9018 Bytes
1141                         ['tools', 'assert', 'round(float(#STEP[-1][0]["throughput_rx_mbps"])*1000000/8 / '
1142                          'float(#STEP[-1][0]["throughput_rx_fps"]))==9018'],
1143                      ]
1144     },
1145 {
1146         "Name": "ovsdpdk_jumbo_pvp",
1147         "Deployment": "clean",
1148         "Description": "Ensure that jumbo frames are received, processed and forwarded correctly by DPDK vhost-user ports.",
1149         "vSwitch" : "OvsDpdkVhost",
1150         "VNF" : "QemuDpdkVhostUser",
1151         "Parameters" : {
1152             "TRAFFIC" : {
1153                 "traffic_type" : "rfc2544_continuous",
1154                 "frame_rate" : 100,
1155                 'bidir' : 'False',
1156                 'learning_frames' : False,
1157             },
1158             "TRAFFICGEN_PKT_SIZES" : (9018,),
1159             "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1160             "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1161             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1162             "GUEST_LOOPBACK" : ['linux_bridge'],
1163             "GUEST_NIC_MERGE_BUFFERS_DISABLE" : [False],
1164         },
1165         "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT + [
1166                         # verify jumbo frame configuration
1167                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1168                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1169                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk1 mtu'],
1170                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1171                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1172                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1173                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient1 mtu'],
1174                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1175                         # VNF startup, MTU configuration
1176                         ['vnf', 'start'],
1177                         ['vnf', 'execute_and_wait', 'ifconfig eth0 mtu 9000'],
1178                         ['vnf', 'execute_and_wait', 'ifconfig eth1 mtu 9000'],
1179                         ['trafficgen', 'send_traffic', {}],
1180                         # check that jumbo frames were received by traffic generator
1181                         ['trafficgen', 'get_results'],
1182                         # i.e. (RX in Bytes/s) divide (RX frames/s) ~ 9018 Bytes
1183                         ['tools', 'assert', 'round(float(#STEP[-1][0]["throughput_rx_mbps"])*1000000/8 / '
1184                          'float(#STEP[-1][0]["throughput_rx_fps"]))==9018'],
1185                         ['vnf', 'stop'],
1186                    ] + STEP_VSWITCH_PVP_FLOWS_FINIT
1187     },
1188     {
1189         "Name": "ovsdpdk_jumbo_p2p_upper_bound",
1190         "Deployment": "p2p",
1191         "Description": "Ensure that jumbo frames above the configured Rx port's MTU are not accepted",
1192         "vSwitch" : "OvsDpdkVhost",
1193         "Parameters" : {
1194             "TRAFFIC" : {
1195                 "traffic_type" : "rfc2544_continuous",
1196                 "frame_rate" : 10,
1197                 'bidir' : 'False',
1198                 'learning_frames' : False,
1199             },
1200             "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1201             "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1202         },
1203         "TestSteps": [
1204                         # set and verify jumbo frame support
1205                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1206                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1207                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk1 mtu'],
1208                         ['tools', 'assert', 'int(#STEP[-1])==9000'],
1209                         # set packetsize to 9018 and send traffic
1210                         ['settings', 'setValue', 'TRAFFICGEN_PKT_SIZES', (9018,)],
1211                         ['trafficgen', 'send_traffic', {}],
1212                         ['trafficgen', 'get_results'],
1213                         # all traffic should pass through (i.e. 0% frame loss)
1214                         ['tools', 'assert', 'float(#STEP[-1][0]["frame_loss_percent"])==0'],
1215                         # set packetsize to 9702 and send traffic
1216                         ['settings', 'setValue', 'TRAFFICGEN_PKT_SIZES', (9702,)],
1217                         # disable verification of send_traffic "!" prefix, otherwise vsperf
1218                         # will fail when 100% packet loss is detected
1219                         ['!trafficgen', 'send_traffic', {}],
1220                         ['trafficgen', 'get_results'],
1221                         # all traffic should be dropped
1222                         ['tools', 'assert', 'float(#STEP[-1][0]["frame_loss_percent"])==100'],
1223                      ]
1224     },
1225 ]
1226 ############################################################
1227 #
1228 #  Rate Limiting
1229 #
1230 ############################################################
1231 # default settings of limiter used in macros and tests
1232 _OVSDPDK_RATE_PORT = 'dpdk'
1233 _OVSDPDK_RATE_NICID = '0'
1234 _OVSDPDK_RATE_RATE = '10000'             # desired maximum rate of PAYLOAD carried by frames
1235 _OVSDPDK_RATE_BURST = '8000'
1236 _OVSDPDK_RATE_LIMITER_CREATED = 'True'   # set to False to verify that limiter was not created
1237
1238 _OVSDPDK_RATE_DEVIATION = '5'            # acceptable deviation from configured frame rate in %
1239 # Formula used for validation of rate settings.
1240 # Note: OVS parameter "ingress_policing_rate" configures maximum rate of payload in Kbps,
1241 # but traffic generator measures throughput in Mbps based on whole frames including headers.
1242 # Thus measured RX throughput value reported by traffic generator must be deducted by bit
1243 # rate consumed by frame header transmission.
1244 _OVSDPDK_RATE_CHECK = ('abs(1-float(#STEP[{}][{}]["throughput_rx_mbps"])*1000*'
1245                        '(1-$_OVSDPDK_HEADER_LEN/float(#STEP[{}][{}]["packet_size"]))'
1246                        '/float($_OVSDPDK_RATE_RATE))*100 < $_OVSDPDK_RATE_DEVIATION')
1247
1248 # macro will setup rate limiter at interface defined by _DPDK_RATE_PORT and
1249 # _DPDK_RATE_NICID; It will verify, that limiter was created by parsing
1250 # vswitchd log file. It will also check that proper limiter values are
1251 # set for given interface.
1252 _OVSDPDK_RATE_set_rate_limiter = [
1253     # get line number of next log file entry
1254     ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1255     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1256      'set Interface $_OVSDPDK_RATE_PORT$_OVSDPDK_RATE_NICID '
1257      'ingress_policing_burst=$_OVSDPDK_RATE_BURST '
1258      'ingress_policing_rate=$_OVSDPDK_RATE_RATE'],
1259     # verify that interface has correct rate limiter configuration
1260     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1261      'list interface $_OVSDPDK_RATE_PORT$_OVSDPDK_RATE_NICID',
1262      '(ingress_policing_\w+: \d+)'],
1263     ['tools', 'assert', '"ingress_policing_burst: $_OVSDPDK_RATE_BURST" in #STEP[-1]'],
1264     ['tools', 'assert', '"ingress_policing_rate: $_OVSDPDK_RATE_RATE" in #STEP[-2]'],
1265 ]
1266
1267 _OVSDPDK_RATE_set_rate_limiter_NIC0 = [
1268     ['settings', 'setValue', '_OVSDPDK_RATE_NICID', '0']
1269 ] + _OVSDPDK_RATE_set_rate_limiter
1270
1271 _OVSDPDK_RATE_set_rate_limiter_NIC1 = [
1272     ['settings', 'setValue', '_OVSDPDK_RATE_NICID', '1']
1273 ] + _OVSDPDK_RATE_set_rate_limiter
1274
1275 # macro will set different limiter values and sends traffic to verify proper
1276 # limiter functionality
1277 _OVSDPDK_RATE_confirm_multiple_rate_limit_setup = \
1278     _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1279         # by default rate limit is 10Mbits/s
1280         ['trafficgen', 'send_traffic', {}],
1281         ['trafficgen', 'get_results'],
1282         # check result and accept preconfigured deviation to the configured frame rate
1283         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("-1", "0", "-1", "0")],
1284         # set rate limit to 20Mbits/s
1285         ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '20000']
1286      ] + _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1287         ['trafficgen', 'send_traffic', {}],
1288         ['trafficgen', 'get_results'],
1289         # check result and accept preconfigured deviation to the configured frame rate
1290         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("-1", "0", "-1", "0")],
1291         # set rate limit to 30Mbits/s
1292         ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '30000']
1293      ] + _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1294         ['trafficgen', 'send_traffic', {}],
1295         ['trafficgen', 'get_results'],
1296         # check result and accept preconfigured deviation to the configured frame rate
1297         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("-1", "0", "-1", "0")],
1298         # disable rate limiter and verify unlimited speed
1299         ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '0'],
1300         ['settings', 'setValue', '_OVSDPDK_RATE_BURST', '0'],
1301         ['settings', 'setValue', '_OVSDPDK_RATE_LIMITER_CREATED', 'False'],
1302      ] + _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1303         ['trafficgen', 'send_traffic', {}],
1304         # check that traffic rate is no longer limited
1305         ['trafficgen', 'get_results'],
1306         ['tools', 'assert', 'int(#STEP[-1][0]["throughput_rx_mbps"])>500'],
1307         ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
1308     ]
1309
1310 INTEGRATION_TESTS = INTEGRATION_TESTS + [
1311     {
1312         "Name": "ovsdpdk_rate_create_phy_port",
1313         "Deployment": "clean",
1314         "Description": "Ensure a rate limiting interface can be created on a physical DPDK port.",
1315         "vSwitch" : "OvsDpdkVhost",
1316         "TestSteps": [
1317                         ['vswitch', 'add_switch', 'int_br0'],
1318                         ['vswitch', 'add_phy_port', 'int_br0'],
1319                     ] + _OVSDPDK_RATE_set_rate_limiter
1320     },
1321     {
1322         "Name": "ovsdpdk_rate_delete_phy_port",
1323         "Deployment": "clean",
1324         "Description": "Ensure a rate limiting interface can be destroyed on a physical DPDK port.",
1325         "vSwitch" : "OvsDpdkVhost",
1326         "TestSteps": [
1327                         ['vswitch', 'add_switch', 'int_br0'],
1328                         ['vswitch', 'add_phy_port', 'int_br0'],
1329                     ] + _OVSDPDK_RATE_set_rate_limiter + [
1330                         ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '0'],
1331                         ['settings', 'setValue', '_OVSDPDK_RATE_BURST', '0'],
1332                         ['settings', 'setValue', '_OVSDPDK_RATE_LIMITER_CREATED', 'False'],
1333                     ] + _OVSDPDK_RATE_set_rate_limiter
1334     },
1335     {
1336         "Name": "ovsdpdk_rate_create_vport",
1337         "Deployment": "clean",
1338         "Description": "Ensure a rate limiting interface can be created on a vhost-user port.",
1339         "vSwitch" : "OvsDpdkVhost",
1340         "Parameters" : {
1341             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1342             "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1343         },
1344         "TestSteps": [
1345                         ['vswitch', 'add_switch', 'int_br0'],
1346                         ['vswitch', 'add_vport', 'int_br0'],
1347                     ] + _OVSDPDK_RATE_set_rate_limiter
1348     },
1349     {
1350         "Name": "ovsdpdk_rate_delete_vport",
1351         "Deployment": "clean",
1352         "Description": "Ensure a rate limiting interface can be destroyed on a vhost-user port.",
1353         "vSwitch" : "OvsDpdkVhost",
1354         "Parameters" : {
1355             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1356             "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1357         },
1358         "TestSteps": [
1359                         ['vswitch', 'add_switch', 'int_br0'],
1360                         ['vswitch', 'add_vport', 'int_br0'],
1361                     ] + _OVSDPDK_RATE_set_rate_limiter + [
1362                         ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '0'],
1363                         ['settings', 'setValue', '_OVSDPDK_RATE_BURST', '0'],
1364                         ['settings', 'setValue', '_OVSDPDK_RATE_LIMITER_CREATED', 'False'],
1365                     ] + _OVSDPDK_RATE_set_rate_limiter
1366     },
1367     {
1368         "Name": "ovsdpdk_rate_no_policing",
1369         "Deployment": "clean",
1370         "Description": "Ensure when a user attempts to create a rate limiting interface but is missing policing rate argument, no rate limitiner is created.",
1371         "vSwitch" : "OvsDpdkVhost",
1372         "Parameters" : {
1373             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1374             "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1375             "_OVSDPDK_RATE_RATE" : '0',
1376             "_OVSDPDK_RATE_BURST" : '1000',
1377             "_OVSDPDK_RATE_LIMITER_CREATED" : 'False',
1378         },
1379         "TestSteps": [
1380                         ['vswitch', 'add_switch', 'int_br0'],
1381                         ['vswitch', 'add_vport', 'int_br0'],
1382                     ] + _OVSDPDK_RATE_set_rate_limiter
1383     },
1384     {
1385         "Name": "ovsdpdk_rate_no_burst",
1386         "Deployment": "clean",
1387         "Description": "Ensure when a user attempts to create a rate limiting interface but is missing policing burst argument, rate limitiner is created.",
1388         "vSwitch" : "OvsDpdkVhost",
1389         "Parameters" : {
1390             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1391             "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1392             "_OVSDPDK_RATE_RATE" : '10000',
1393             "_OVSDPDK_RATE_BURST" : '0',
1394             "_OVSDPDK_RATE_LIMITER_CREATED" : 'True',
1395         },
1396         "TestSteps": [
1397                         ['vswitch', 'add_switch', 'int_br0'],
1398                         ['vswitch', 'add_vport', 'int_br0'],
1399                     ] + _OVSDPDK_RATE_set_rate_limiter
1400     },
1401     {
1402         "Name": "ovsdpdk_rate_p2p",
1403         "Deployment": "p2p",
1404         "Description": "Ensure when a user creates a rate limiting physical interface that the traffic is limited to the specified policer rate in a p2p setup.",
1405         "vSwitch" : "OvsDpdkVhost",
1406         "Parameters" : {
1407             "_OVSDPDK_RATE_PORT" : 'dpdk',
1408             "TRAFFIC" : {
1409                 "traffic_type" : "rfc2544_continuous",
1410                 "frame_rate" : 100,
1411                 'bidir' : 'False',
1412             },
1413         },
1414         "TestSteps": _OVSDPDK_RATE_confirm_multiple_rate_limit_setup
1415     },
1416     {
1417         "Name": "ovsdpdk_rate_pvp",
1418         "Deployment": "pvp",
1419         "Description": "Ensure when a user creates a rate limiting vHost User interface that the traffic is limited to the specified policer rate in a pvp setup.",
1420         "vSwitch" : "OvsDpdkVhost",
1421         "VNF" : "QemuDpdkVhostUser",
1422         "Parameters" : {
1423             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1424             "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1425             "TRAFFIC" : {
1426                 "traffic_type" : "rfc2544_continuous",
1427                 "frame_rate" : 100,
1428                 'bidir' : 'False',
1429             },
1430         },
1431         "TestSteps": _OVSDPDK_RATE_confirm_multiple_rate_limit_setup
1432     },
1433     {
1434         "Name": "ovsdpdk_rate_p2p_multi_pkt_sizes",
1435         "Deployment": "p2p",
1436         "Description": "Ensure that rate limiting works for various frame sizes.",
1437         "vSwitch" : "OvsDpdkVhost",
1438         "Parameters" : {
1439             "_OVSDPDK_RATE_PORT" : 'dpdk',
1440             "_OVSDPDK_RATE_RATE" : '10000',
1441             "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
1442             "TRAFFIC" : {
1443                 "traffic_type" : "rfc2544_continuous",
1444                 "frame_rate" : 100,
1445                 'bidir' : 'False',
1446             },
1447         },
1448         "TestSteps": _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1449                         # dump rate limiter configuration of both NICs
1450                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1451                          'list interface dpdk0'],
1452                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1453                          'list interface dpdk1'],
1454                         ['trafficgen', 'send_traffic', {}],
1455                         ['#result', 'trafficgen', 'get_results'],
1456                         # check results and accept preconfigured deviation to the configured frame rates
1457                         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","0", "result","0")],
1458                         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","1", "result","1")],
1459                         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","2", "result","2")],
1460                         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","3", "result","3")],
1461                         ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","4", "result","4")],
1462                     ],
1463     },
1464 ]
1465 ############################################################
1466 #
1467 #  Quality of Service
1468 #
1469 ############################################################
1470 # default settings of limiter used in macros and tests
1471 _OVSDPDK_QOS_PORT = 'dpdk'
1472 _OVSDPDK_QOS_NICID = '0'
1473 _OVSDPDK_QOS_CIR = '1250000'  # desired maximum rate of PAYLOAD carried by frames in BYTEs
1474 _OVSDPDK_QOS_CBS = '2048'
1475
1476 _OVSDPDK_QOS_DEVIATION = '5'            # acceptable deviation from configured frame rate in %
1477 # Formula used for validation of rate settings.
1478 # Note: OVS parameter "ingress_policing_rate" configures maximum rate of payload in Kbps,
1479 # but traffic generator measures throughput in Mbps based on whole frames including headers.
1480 # Thus measured RX throughput value reported by traffic generator must be deducted by bit
1481 # rate consumed by frame header transmission.
1482 _OVSDPDK_QOS_CHECK = ('abs(1-float(#STEP[{}][{}]["throughput_rx_mbps"])*1000000*'
1483                       '(1-$_OVSDPDK_HEADER_LEN/float(#STEP[{}][{}]["packet_size"]))'
1484                       '/float($_OVSDPDK_QOS_CIR*8))*100 < $_OVSDPDK_QOS_DEVIATION')
1485
1486
1487 # macro will setup QoS at interface defined by _OVSDPDK_QOS_PORT and
1488 # _OVSDPDK_QOS_NICID; It will verify, that QoS was created by parsing
1489 # vswitchd log file. It will also check that proper QoS values are
1490 # set for given interface.
1491 _OVSDPDK_QOS_set_qos = [
1492     # get line number of next log file entry
1493     ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1494
1495     # Crete QoS policy and check the returned policy ID
1496     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1497      'set port $_OVSDPDK_QOS_PORT$_OVSDPDK_QOS_NICID qos=@newqos -- '
1498      '--id=@newqos create qos type=egress-policer other-config:cir=$_OVSDPDK_QOS_CIR '
1499      'other-config:cbs=$_OVSDPDK_QOS_CBS','|\w{8}-\w{4}-\w{4}-\w{4}-\w{12}'],
1500     ['tools', 'assert', 'len(#STEP[-1])==1'],
1501
1502     # Check the QoS policy and attributes
1503     ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show '
1504      '$_OVSDPDK_QOS_PORT$_OVSDPDK_QOS_NICID', '.+'],
1505     ['tools', 'assert', "'QoS: $_OVSDPDK_QOS_PORT$_OVSDPDK_QOS_NICID egress-policer' in #STEP[-1]"],
1506     ['tools', 'assert', "'cbs: $_OVSDPDK_QOS_CBS' in #STEP[-2]"],
1507     ['tools', 'assert', "'cir: $_OVSDPDK_QOS_CIR' in #STEP[-3]"],
1508 ]
1509
1510 _OVSDPDK_QOS_set_qos_NIC0 = [
1511     ['settings', 'setValue', '_OVSDPDK_QOS_NICID', '0']
1512 ] + _OVSDPDK_QOS_set_qos
1513
1514 _OVSDPDK_QOS_set_qos_NIC1 = [
1515     ['settings', 'setValue', '_OVSDPDK_QOS_NICID', '1']
1516 ] + _OVSDPDK_QOS_set_qos
1517
1518 # macro will set different limiter values and sends traffic to verify proper
1519 # QoS functionality
1520 _OVSDPDK_QOS_confirm_multiple_qos_setup = [
1521         # Create QoS policy with payload rate of 23*10^6 Bytes/s
1522         ['settings', 'setValue', '_OVSDPDK_QOS_CIR', '23000000']
1523      ] + _OVSDPDK_QOS_set_qos_NIC0 + _OVSDPDK_QOS_set_qos_NIC1 + [
1524         ['trafficgen', 'send_traffic', {}],
1525         ['trafficgen', 'get_results'],
1526         ['tools', 'assert', _OVSDPDK_QOS_CHECK.format("-1", "0", "-1", "0")],
1527         # Create QoS policy with payload rate of 46*10^6 Bytes/s
1528         ['settings', 'setValue', '_OVSDPDK_QOS_CIR', '46000000']
1529      ] + _OVSDPDK_QOS_set_qos_NIC0 + _OVSDPDK_QOS_set_qos_NIC1 + [
1530         ['trafficgen', 'send_traffic', {}],
1531         ['trafficgen', 'get_results'],
1532         ['tools', 'assert', _OVSDPDK_QOS_CHECK.format("-1", "0", "-1", "0")],
1533         # Create QoS policy with payload rate of 92*10^6 Bytes/s
1534         ['settings', 'setValue', '_OVSDPDK_QOS_CIR', '92000000']
1535      ] + _OVSDPDK_QOS_set_qos_NIC0 + _OVSDPDK_QOS_set_qos_NIC1 + [
1536         ['trafficgen', 'send_traffic', {}],
1537         ['trafficgen', 'get_results'],
1538         ['tools', 'assert', _OVSDPDK_QOS_CHECK.format("-1", "0", "-1", "0")],
1539      ]
1540
1541 INTEGRATION_TESTS = INTEGRATION_TESTS + [
1542     {
1543         "Name": "ovsdpdk_qos_create_phy_port",
1544         "Deployment": "clean",
1545         "Description": "Ensure a QoS policy can be created on a physical DPDK port",
1546         "vSwitch": "OvsDpdkVhost",
1547         "TestSteps": [
1548                         ['vswitch', 'add_switch', 'int_br0'],
1549                         ['vswitch', 'add_phy_port', 'int_br0'],
1550                     ] + _OVSDPDK_QOS_set_qos
1551     },
1552     {
1553         "Name": "ovsdpdk_qos_delete_phy_port",
1554         "Deployment": "clean",
1555         "Description": "Ensure an existing QoS policy can be destroyed on a physical DPDK port.",
1556         "vSwitch": "OvsDpdkVhost",
1557         "TestSteps": [
1558                         ['vswitch', 'add_switch', 'int_br0'],
1559                         ['vswitch', 'add_phy_port', 'int_br0'],
1560                      ] + _OVSDPDK_QOS_set_qos + [
1561                         # Destroy the QoS policy and check the attributes
1562                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] -- destroy QoS #STEP[1][0] -- clear Port #STEP[1][0] qos'],
1563                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]', 'QoS not configured on #STEP[1][0]'],
1564                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1565                      ]
1566     },
1567     {
1568         "Name": "ovsdpdk_qos_create_vport",
1569         "Deployment": "clean",
1570         "Description": "Ensure a QoS policy can be created on a virtual vhost user port.",
1571         "vSwitch": "OvsDpdkVhost",
1572         "Parameters" : {
1573             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1574             "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1575         },
1576         "TestSteps": [
1577                         ['vswitch', 'add_switch', 'int_br0'],
1578                         ['vswitch', 'add_vport', 'int_br0'],
1579                     ] + _OVSDPDK_QOS_set_qos
1580     },
1581     {
1582         "Name": "ovsdpdk_qos_delete_vport",
1583         "Deployment": "clean",
1584         "Description": "Ensure an existing QoS policy can be destroyed on a vhost user port.",
1585         "vSwitch": "OvsDpdkVhost",
1586         "Parameters" : {
1587             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1588             "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1589         },
1590         "TestSteps": [
1591                         ['vswitch', 'add_switch', 'int_br0'],
1592                         ['vswitch', 'add_vport', 'int_br0'],
1593                      ] + _OVSDPDK_QOS_set_qos + [
1594                         # Destroy the QoS policy and check the attributes
1595                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] -- destroy QoS #STEP[1][0] -- clear Port #STEP[1][0] qos'],
1596                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]', 'QoS not configured on #STEP[1][0]'],
1597                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1598                      ]
1599     },
1600     {
1601         "Name": "ovsdpdk_qos_create_no_cir",
1602         "Deployment": "clean",
1603         "Description": "Ensure that a QoS policy cannot be created if the egress policer cir argument is missing.",
1604         "vSwitch": "OvsDpdkVhost",
1605         "Parameters" : {},
1606         "TestSteps": [
1607                          # Setup switch,port and logs
1608                         ['vswitch', 'add_switch', '$VSWITCH_BRIDGE_NAME'],
1609                         ['vswitch', 'add_vport', '$VSWITCH_BRIDGE_NAME'],
1610                         ['#LOG_MARK', 'tools', 'exec_shell',
1611                          'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1612
1613                         # Crete QoS policy and check the returned policy ID
1614                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set port #STEP[1][0] qos=@newqos -- '
1615                          '--id=@newqos create qos type=egress-policer other-config:cbs=2048',
1616                          '\w{8}-\w{4}-\w{4}-\w{4}-\w{12}'],
1617                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1618
1619                         # Check the OVS logs
1620                         ['tools', 'exec_shell', "sed -n '#STEP[LOG_MARK][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1621                          'Failed to set QoS type egress-policer on port #STEP[1][0]: Invalid argument'],
1622                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1623
1624                         # Check the attributes for vhost0
1625                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]',
1626                          'QoS not configured on #STEP[1][0]'],
1627                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1628                     ]
1629     },
1630     {
1631         "Name": "ovsdpdk_qos_create_no_cbs",
1632         "Deployment": "clean",
1633         "Description": "Ensure that a QoS policy cannot be created if the egress policer cbs argument is missing.",
1634         "vSwitch": "OvsDpdkVhost",
1635         "Parameters" : {},
1636         "TestSteps": [
1637                          # Setup switch,port and logs
1638                         ['vswitch', 'add_switch', '$VSWITCH_BRIDGE_NAME'],
1639                         ['vswitch', 'add_vport', '$VSWITCH_BRIDGE_NAME'],
1640                         ['#LOG_MARK', 'tools', 'exec_shell',
1641                          'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1642
1643                         # Crete QoS policy and check the returned policy ID
1644                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set port #STEP[1][0] qos=@newqos -- '
1645                          '--id=@newqos create qos type=egress-policer other-config:cir=1250000',
1646                          '\w{8}-\w{4}-\w{4}-\w{4}-\w{12}'],
1647                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1648
1649                         # Check the OVS logs
1650                         ['tools', 'exec_shell', "sed -n '#STEP[LOG_MARK][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1651                          'Failed to set QoS type egress-policer on port #STEP[1][0]: Invalid argument'],
1652                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1653
1654                         # Check the attributes for vhost0
1655                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]',
1656                          'QoS not configured on #STEP[1][0]'],
1657                         ['tools', 'assert', 'len(#STEP[-1])==1'],
1658                     ]
1659     },
1660     {
1661         "Name": "ovsdpdk_qos_p2p",
1662         "Deployment": "p2p",
1663         "Description": "In a p2p setup, ensure when a QoS egress policer is created that the traffic is limited to the specified rate.",
1664         "vSwitch": "OvsDpdkVhost",
1665         "Parameters" : {
1666             "TRAFFIC" : {
1667                 "traffic_type" : "rfc2544_continuous",
1668                 "frame_rate" : 100,
1669                 'bidir' : 'False',
1670             },
1671         },
1672         "TestSteps": _OVSDPDK_QOS_confirm_multiple_qos_setup
1673     },
1674     {
1675         "Name": "ovsdpdk_qos_pvp",
1676         "Deployment": "pvp",
1677         "Description": "In a pvp setup, ensure when a QoS egress policer is created that the traffic is limited to the specified rate.",
1678         "vSwitch": "OvsDpdkVhost",
1679         "VNF" : "QemuDpdkVhostUser",
1680         "Parameters" : {
1681             "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1682             "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1683             "TRAFFIC" : {
1684                 "traffic_type" : "rfc2544_continuous",
1685                 "frame_rate" : 100,
1686                 'bidir' : 'False',
1687             },
1688         },
1689         "TestSteps": _OVSDPDK_QOS_confirm_multiple_qos_setup
1690     },
1691     ############################################################
1692     #
1693     #  Custom statistics
1694     #
1695     ############################################################
1696     {
1697         "Name": "ovsdpdk_custstat_check",
1698         "Deployment": "clean",
1699         "Description": "Test if custom statistics are supported.",
1700         "vSwitch" : "OvsDpdkVhost",
1701         "TestSteps": [
1702                         # enable custom statistics
1703                         ['vswitch', 'add_switch', 'int_br0', [
1704                                                   'protocols=OpenFlow10,OpenFlow11,OpenFlow12,'
1705                                                   'OpenFlow13,OpenFlow14,OpenFlow15']],
1706                         ['#port', 'vswitch', 'add_phy_port', 'int_br0'],
1707                         # check that custom statistics are available for given interface
1708                         ['tools', 'exec_shell', 'sudo $TOOLS["ovs-ofctl"] -O OpenFlow14 '
1709                                                 'dump-ports int_br0 #STEP[port][1]',
1710                                                 '|CUSTOM Statistics'],
1711                         ['tools', 'assert', 'len(#STEP[-1])'],
1712                         ['vswitch', 'del_port', 'int_br0', '#STEP[port][0]'],
1713                         ['vswitch', 'del_switch', 'int_br0'],
1714                     ]
1715     },
1716     {
1717         "Name": "ovsdpdk_custstat_rx_error",
1718         "Deployment": "clean",
1719         "Description": "Test bad ethernet CRC counter 'rx_crc_errors' exposed by custom statistics.",
1720         "vSwitch" : "OvsDpdkVhost",
1721         "Parameters" : {
1722             "OVS_OFCTL_ARGS" : [],
1723             "TRAFFICGEN" : "IxNet",
1724             "TRAFFIC" : {
1725                 "traffic_type" : "rfc2544_continuous",
1726                 "frame_rate" : 10,
1727             },
1728             "TRAFFICGEN_DURATION" : 10,
1729             "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544_bad_l2_crc.tcl",
1730         },
1731         "TestSteps": [
1732                         # enable custom statistics
1733                         ['vswitch', 'add_switch', 'int_br0', [
1734                                                   'protocols=OpenFlow10,OpenFlow11,OpenFlow12,'
1735                                                   'OpenFlow13,OpenFlow14,OpenFlow15']],
1736                         ['#port1', 'vswitch', 'add_phy_port', 'int_br0'],
1737                         ['#port2', 'vswitch', 'add_phy_port', 'int_br0'],
1738                         ['vswitch', 'add_flow', 'int_br0', {'in_port': '1', 'actions': ['output:2']}],
1739                         ['vswitch', 'add_flow', 'int_br0', {'in_port': '2', 'actions': ['output:1']}],
1740                         ['#crc_old', 'tools', 'exec_shell', 'sudo $TOOLS["ovs-ofctl"] -O OpenFlow14 '
1741                                               'dump-ports int_br0 #STEP[port1][1]',
1742                                               '|rx_crc_errors=(\d+)'],
1743                         # frames will be dropped by NIC, so we have to suppress send_traffic validation
1744                         # to avoid test failure
1745                         ['!trafficgen', 'send_traffic', {}],
1746                         # check that custom statistics are available for given interface
1747                         ['#crc_new', 'tools', 'exec_shell', 'sudo $TOOLS["ovs-ofctl"] -O OpenFlow14 '
1748                                               'dump-ports int_br0 #STEP[port1][1]',
1749                                               '|rx_crc_errors=(\d+)'],
1750                         ['tools', 'assert', '#STEP[crc_new] > #STEP[crc_old]'],
1751                         # tear down the environment
1752                         ['vswitch', 'dump_flows', 'int_br0'],
1753                         ['vswitch', 'del_flow', 'int_br0', {}],
1754                         ['vswitch', 'del_port', 'int_br0', '#STEP[port1][0]'],
1755                         ['vswitch', 'del_port', 'int_br0', '#STEP[port2][0]'],
1756                         ['vswitch', 'del_switch', 'int_br0'],
1757                     ]
1758     },
1759 ]