1 # Copyright 2017-2018 Intel Corporation., Tieto
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
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.
19 ############################################################
21 # Generic configuration used by OVSDPDK testcases
23 ############################################################
25 # required to import path to the log file
26 from conf import settings
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:])
34 _OVSDPDK_GUEST_5_CORES = [('7', '8', '9', '10', '11')]
36 # number of queues configured in OVS and GUEST
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)
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
48 _OVSDPDK_PKT_SIZES = (64,128,256,512,1024,1500)
50 INTEGRATION_TESTS = INTEGRATION_TESTS + [
51 ############################################################
55 ############################################################
57 "Name": "ovsdpdk_nic_p2p_single_pmd_unidir_cont",
59 "Description": "P2P with single PMD in OVS and unidirectional traffic.",
60 "vSwitch" : "OvsDpdkVhost",
63 "traffic_type" : "rfc2544_continuous",
67 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
68 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
72 "Name": "ovsdpdk_nic_p2p_single_pmd_bidir_cont",
74 "Description": "P2P with single PMD in OVS and bidirectional traffic.",
75 "vSwitch" : "OvsDpdkVhost",
78 "traffic_type" : "rfc2544_continuous",
82 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
83 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
87 "Name": "ovsdpdk_nic_p2p_two_pmd_bidir_cont",
89 "Description": "P2P with two PMDs in OVS and bidirectional traffic.",
90 "vSwitch" : "OvsDpdkVhost",
93 "traffic_type" : "rfc2544_continuous",
97 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
98 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
102 "Name": "ovsdpdk_nic_p2p_single_pmd_unidir_tput",
104 "Description": "P2P with single PMD in OVS and unidirectional traffic.",
105 "vSwitch" : "OvsDpdkVhost",
108 "traffic_type" : "rfc2544_throughput",
111 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
112 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
116 "Name": "ovsdpdk_nic_p2p_single_pmd_bidir_tput",
118 "Description": "P2P with single PMD in OVS and bidirectional traffic.",
119 "vSwitch" : "OvsDpdkVhost",
122 "traffic_type" : "rfc2544_throughput",
125 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
126 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_1_CORE,
130 "Name": "ovsdpdk_nic_p2p_two_pmd_bidir_tput",
132 "Description": "P2P with two PMDs in OVS and bidirectional traffic.",
133 "vSwitch" : "OvsDpdkVhost",
136 "traffic_type" : "rfc2544_throughput",
139 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
140 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
143 ############################################################
145 # DPDK Hotplug Support
147 ############################################################
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",
154 # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
155 'WHITELIST_NICS' : [],
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])'],
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
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",
196 # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
197 'WHITELIST_NICS' : [],
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'],
237 ############################################################
239 # RX Checksum Support
241 ############################################################
242 # TCL script used for simulation of traffic with wrong CRC
243 _OVSDPDK_CRC_CRC_TCL = ''
244 _OVSDPDK_CRC_FRAME_LOSS = ''
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'],
266 INTEGRATION_TESTS = INTEGRATION_TESTS + [
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",
275 "TRAFFICGEN" : "IxNet",
277 "traffic_type" : "rfc2544_continuous",
281 "TRAFFICGEN_DURATION" : 10,
282 "TRAFFICGEN_PKT_SIZES" : (64,)
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
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",
302 "TRAFFICGEN" : "IxNet",
304 "traffic_type" : "rfc2544_continuous",
308 "TRAFFICGEN_DURATION" : 10,
309 "TRAFFICGEN_PKT_SIZES" : (64,)
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
322 ############################################################
324 # Flow Control Support
326 ############################################################
328 "Name": "ovsdpdk_flow_ctrl_rx",
330 "Description": "Test the rx flow control functionality of DPDK PHY ports.",
331 "vSwitch" : "OvsDpdkVhost",
333 "TRAFFICGEN" : "IxNet",
335 "traffic_type" : "rfc2544_continuous",
337 "flow_control" : True,
340 "TRAFFICGEN_DURATION" : 10,
341 "TRAFFICGEN_PKT_SIZES" : (64,)
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'],
367 "Name": "ovsdpdk_flow_ctrl_rx_dynamic",
369 "Description": "Change the rx flow control support at run time and ensure the system honored the changes.",
370 "vSwitch" : "OvsDpdkVhost",
372 "TRAFFICGEN" : "IxNet",
374 "traffic_type" : "rfc2544_continuous",
376 "flow_control" : True,
379 "TRAFFICGEN_DURATION" : 10,
380 "TRAFFICGEN_PKT_SIZES" : (64,)
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'],
399 ############################################################
403 ############################################################
405 "Name": "ovsdpdk_mq_p2p_rxqs",
407 "Description": "Setup rxqs on NIC port.",
408 "vSwitch" : "OvsDpdkVhost",
411 "traffic_type" : "rfc2544_continuous",
415 "TRAFFICGEN_DURATION" : 1,
416 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
417 "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
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)],
426 "Name": "ovsdpdk_mq_p2p_rxqs_same_core_affinity",
428 "Description": "Affinitize rxqs to the same core.",
429 "vSwitch" : "OvsDpdkVhost",
432 "traffic_type" : "rfc2544_continuous",
436 "TRAFFICGEN_DURATION" : 1,
437 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
438 "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
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'],
449 "Name": "ovsdpdk_mq_p2p_rxqs_multi_core_affinity",
451 "Description": "Affinitize rxqs to separate cores.",
452 "vSwitch" : "OvsDpdkVhost",
455 "traffic_type" : "rfc2544_continuous",
459 "TRAFFICGEN_DURATION" : 1,
460 "VSWITCH_PMD_CPU_MASK" : _OVSDPDK_PMD_MASK_2_CORE,
461 "VSWITCH_DPDK_MULTI_QUEUES" : _OVSDPDK_MQ,
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'],
472 "Name" : "ovsdpdk_mq_pvp_rxqs",
473 "Deployment" : "clean",
474 "Description" : "Setup rxqs on vhost user port.",
475 "vSwitch" : "OvsDpdkVhost",
476 "VNF" : "QemuDpdkVhostUser",
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'],
484 "TestSteps": STEP_VSWITCH_PVP_INIT +
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'],
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'],
498 STEP_VSWITCH_PVP_FINIT
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",
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",
516 "traffic_type" : "rfc2544_continuous",
518 "stream_type" : "L3",
521 'srcmac': "00:00:07:00:0E:00",
522 'dstmac': "00:00:00:00:00:01"
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'}],
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'],
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'],
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",
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
594 "GUEST_TESTPMD_PARAMS" : ['-c 0x1F -n 4 --socket-mem 512 -- '
595 '--burst=64 -i --nb-cores=4 '
597 "TRAFFICGEN_DURATION" : 5,
599 "traffic_type" : "rfc2544_continuous",
601 "stream_type" : "L3",
603 "learning_frames" : False,
611 "GUEST_QUEUE_STATS_MAPPING" : ["rx 0 0 0",
621 "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
624 ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] dpif-netdev/pmd-rxq-show",
625 '|dpdk\w+\s+queue-id:\s+\d'],
626 # there must be two standalone queue records for every interface (2x4)
627 ['tools', 'assert', 'len(#STEP[-1])==8'],
628 ['trafficgen', 'send_traffic', {}],
630 # check that packets were received by both queues at both ports
631 ['vnf', 'execute_and_wait', 'show port stats 0', 60, 'testpmd>',
632 '|Stats reg [01] RX-packets:\s+(\d+)'],
633 ['tools', 'assert', '"0" not in #STEP[-1]'],
634 # rx queue of 2nd port should be mapped to reg 2 and 3, but mapping might not work
635 # so let us check that exactly two RX regs have non zero values
636 ['vnf', 'execute_and_wait', 'show port stats 1', 60, 'testpmd>',
637 '|Stats reg\s+\d+ RX-packets:\s+\d\d+'],
638 ['tools', 'assert', 'len(#STEP[-1])==2'],
643 ############################################################
647 ############################################################
649 "Name": "ovsdpdk_vhostuser_client",
651 "Description": "Test vhost-user client mode",
652 "vSwitch" : "OvsDpdkVhost",
653 "VNF" : "QemuDpdkVhostUser",
656 "traffic_type" : "rfc2544_continuous",
660 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
661 "TRAFFICGEN_DURATION" : 1,
664 # check that client ports are really used
665 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
666 '|type.*dpdkvhostuserclient'],
667 ['tools', 'assert', 'len(#STEP[-1])==2'],
668 # send traffic manually, so TC will fail in case
669 # that packets won't make it through
670 ['trafficgen', 'send_traffic', {}],
674 "Name": "ovsdpdk_vhostuser_client_reconnect",
676 "Description": "Test vhost-user client mode reconnect feature",
677 "vSwitch" : "OvsDpdkVhost",
678 "VNF" : "QemuDpdkVhostUser",
681 "traffic_type" : "rfc2544_continuous",
685 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
686 "TRAFFICGEN_DURATION" : 1,
689 # send traffic to verify correct PVP configuration
690 ['trafficgen', 'send_traffic', {}],
691 ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
692 # restart vswitchd, ovsdb is kept untouched, so ovs configuration
693 # (except flows) will be restored
694 ['vswitch', 'restart'],
695 ['vswitch', 'del_flow', '$VSWITCH_BRIDGE_NAME', {}],
696 ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
697 ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '1', 'actions': ['output:3'], 'idle_timeout': '0'}],
698 ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '3', 'actions': ['output:1'], 'idle_timeout': '0'}],
699 ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '2', 'actions': ['output:4'], 'idle_timeout': '0'}],
700 ['vswitch', 'add_flow', '$VSWITCH_BRIDGE_NAME', {'in_port': '4', 'actions': ['output:2'], 'idle_timeout': '0'}],
701 ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
702 # send traffic to verify that OVS works correctly after restart
703 ['trafficgen', 'send_traffic', {}],
707 "Name": "ovsdpdk_vhostuser_server",
709 "Description": "Test vhost-user server mode",
710 "vSwitch" : "OvsDpdkVhost",
711 "VNF" : "QemuDpdkVhostUser",
714 "traffic_type" : "rfc2544_continuous",
718 "VSWITCH_VHOSTUSER_SERVER_MODE" : True,
719 "TRAFFICGEN_DURATION" : 1,
722 # check that server ports are really used
723 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
724 '|type.*dpdkvhostuser$'],
725 ['tools', 'assert', 'len(#STEP[-1])==2'],
726 # send traffic manually, so TC will fail in case
727 # that packets won't make it through
728 ['trafficgen', 'send_traffic', {}],
732 "Name": "ovsdpdk_vhostuser_sock_dir",
733 "Deployment": "clean",
734 "Description": "Verify functionality of vhost-sock-dir flag",
735 "vSwitch" : "OvsDpdkVhost",
737 "VSWITCH_VHOSTUSER_SERVER_MODE" : True,
740 ['vswitch', 'add_switch', '$VSWITCH_BRIDGE_NAME'],
741 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Open_vSwitch . '
742 'other_config:vhost-sock-dir=test_dir'],
743 # enforce vswitchd to read new configuration
744 ['vswitch', 'restart'],
745 ['tools', 'exec_shell', 'sudo mkdir $TOOLS["ovs_var_tmp"]/test_dir'],
746 ['vswitch', 'add_vport', '$VSWITCH_BRIDGE_NAME'],
747 ['tools', 'exec_shell', 'ls -1 $TOOLS["ovs_var_tmp"]/test_dir',
749 ['tools', 'assert', 'len(#STEP[-1])'],
753 ############################################################
755 # Virtual Devices Support
757 ############################################################
758 _OVSDPDK_VDEV_ADD_NULL = [
759 ['vswitch', 'add_switch', 'int_br0'],
760 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] add-port int_br0 null0 -- '
761 'set Interface null0 type=dpdk options:dpdk-devargs=eth_null0'],
762 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show', '|dpdk-devargs=\S+eth_null0'],
763 ['tools', 'assert', 'len(#STEP[-1])==1'],
766 _OVSDPDK_VDEV_ADD_AF_PACKET = [
767 # resore original NICS configuration, so we can use NICS dictionary
768 ['settings', 'setValue', 'TEST_PARAMS', ''],
769 # check if vsperf was able to read device name
770 ['tools', 'assert', 'str(\"$NICS[0]["device"]\") != \"None\"'],
771 ['tools', 'exec_shell', 'sudo ip link set dev $NICS[0]["device"] up'],
772 ['vswitch', 'add_switch', 'int_br0'],
773 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] add-port int_br0 myeth0 -- '
774 'set Interface myeth0 type=dpdk options:dpdk-devargs=eth_af_packet0,iface=$NICS[0]["device"]'],
775 # check if device was created...
776 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show', '|dpdk-devargs=\S+eth_af_packet0'],
777 ['tools', 'assert', 'len(#STEP[-1])==1'],
779 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show', '|Error attaching device'],
780 ['tools', 'assert', 'not len(#STEP[-1])'],
783 INTEGRATION_TESTS = INTEGRATION_TESTS + [
785 "Name": "ovsdpdk_vdev_add_null_pmd",
786 "Deployment": "clean",
787 "Description": "Test addition of port using the null DPDK PMD driver.",
788 "vSwitch" : "OvsDpdkVhost",
789 "TestSteps": _OVSDPDK_VDEV_ADD_NULL
792 "Name": "ovsdpdk_vdev_del_null_pmd",
793 "Deployment": "clean",
794 "Description": "Test deletion of port using the null DPDK PMD driver.",
795 "vSwitch" : "OvsDpdkVhost",
796 "TestSteps": _OVSDPDK_VDEV_ADD_NULL + [
797 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] del-port null0'],
798 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
799 '|dpdk-devargs=\S+eth_null0'],
800 ['tools', 'assert', 'not len(#STEP[-1])'],
804 "Name": "ovsdpdk_vdev_add_af_packet_pmd",
805 "Deployment": "clean",
806 "Description": "Test addition of port using the af_packet DPDK PMD driver.",
807 "vSwitch" : "OvsDpdkVhost",
809 # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
810 'WHITELIST_NICS' : [],
813 "TestSteps": _OVSDPDK_VDEV_ADD_AF_PACKET
816 "Name": "ovsdpdk_vdev_del_af_packet_pmd",
817 "Deployment": "clean",
818 "Description": "Test deletion of port using the af_packet DPDK PMD driver.",
819 "vSwitch" : "OvsDpdkVhost",
821 # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
822 'WHITELIST_NICS' : [],
825 "TestSteps": _OVSDPDK_VDEV_ADD_AF_PACKET + [
826 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] del-port myeth0'],
827 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show',
828 '|dpdk-devargs=\S+eth_af_packet0'],
829 ['tools', 'assert', 'not len(#STEP[-1])'],
832 ############################################################
836 ############################################################
838 "Name": "ovsdpdk_numa",
839 "Deployment": "clean",
840 "Description": "Test vhost-user NUMA support. Vhostuser PMD threads should migrate "
841 "to the same numa slot, where QEMU is executed.",
842 "vSwitch" : "OvsDpdkVhost",
843 "VNF" : "QemuDpdkVhostUser",
845 # ensure that memory and cpus are available at both numa slots
846 "DPDK_SOCKET_MEM" : ['1024', '1024'],
847 "VSWITCH_PMD_CPU_MASK" : 'FFFFFE',
848 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
849 # traffic won't be send, so speed up VNF deployment
850 "GUEST_LOOPBACK" : ['clean']
852 "TestSteps": STEP_VSWITCH_PVP_INIT +
854 # check that at least 2 numa slots are available
855 ['tools', 'exec_shell', 'numactl -H', '|available: ([0-9]+)'],
856 ['tools', 'assert', '#STEP[-1][0]>1'],
857 # check that PMD thread serving dpdkvhostuserclient0 runs at NUMA slot 0
858 ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] "
859 "dpif-netdev/pmd-rxq-show | "
860 "sed -e '/dpdkvhostuserclient0/,$d' | tac",
861 '|pmd thread numa_id ([0-9])+'
863 ['tools', 'assert', '#STEP[-1][0]==0'],
864 # store last 2 cores from 2nd numa slot
865 ['tools', 'exec_shell', 'numactl -H', '|node 1 cpus:.*\s+(\\d+) (\\d+)$'],
866 # pin VNF to 2nd NUMA slot
867 ['settings', 'setValue', 'GUEST_CORE_BINDING',
868 [("#STEP[-1][0][0]", "#STEP[-1][0][1]")]
871 # ...and check that PMD thread serving dpdkvhostuserclient0
872 # has migrated to NUMA slot 1
873 ['tools', 'exec_shell', "sudo $TOOLS['ovs-appctl'] "
874 "dpif-netdev/pmd-rxq-show | "
875 "sed -e '/dpdkvhostuserclient0/,$d' | tac",
876 '|pmd thread numa_id ([0-9])+'
878 ['tools', 'assert', '#STEP[-1][0]==1'],
881 STEP_VSWITCH_PVP_FINIT
883 ############################################################
885 # Jumbo Frame Support
887 ############################################################
889 "Name": "ovsdpdk_jumbo_increase_mtu_phy_port_ovsdb",
890 "Deployment": "clean",
891 "Description": "Ensure that the increased MTU for a DPDK physical port is updated in OVSDB.",
892 "vSwitch" : "OvsDpdkVhost",
894 ['vswitch', 'add_switch', 'int_br0'],
895 ['vswitch', 'add_phy_port', 'int_br0'],
896 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
897 ['tools', 'assert', 'int(#STEP[-1])==1500'],
898 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9000'],
899 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
900 ['tools', 'assert', 'int(#STEP[-1])==9000'],
904 "Name": "ovsdpdk_jumbo_increase_mtu_vport_ovsdb",
905 "Deployment": "clean",
906 "Description": "Ensure that the increased MTU for a DPDK vhost-user port is updated in OVSDB.",
907 "vSwitch" : "OvsDpdkVhost",
909 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
912 ['vswitch', 'add_switch', 'int_br0'],
913 ['vswitch', 'add_vport', 'int_br0'],
914 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
915 ['tools', 'assert', 'int(#STEP[-1])==1500'],
916 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9000'],
917 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
918 ['tools', 'assert', 'int(#STEP[-1])==9000'],
922 "Name": "ovsdpdk_jumbo_reduce_mtu_phy_port_ovsdb",
923 "Deployment": "clean",
924 "Description": "Ensure that the reduced MTU for a DPDK physical port is updated in OVSDB.",
925 "vSwitch" : "OvsDpdkVhost",
927 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
928 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
931 ['vswitch', 'add_switch', 'int_br0'],
932 ['vswitch', 'add_phy_port', 'int_br0'],
933 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
934 ['tools', 'assert', 'int(#STEP[-1])==9000'],
935 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=2000'],
936 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
937 ['tools', 'assert', 'int(#STEP[-1])==2000'],
941 "Name": "ovsdpdk_jumbo_reduce_mtu_vport_ovsdb",
942 "Deployment": "clean",
943 "Description": "Ensure that the reduced MTU for a DPDK vhost-user port is updated in OVSDB.",
944 "vSwitch" : "OvsDpdkVhost",
946 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
947 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
948 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
951 ['vswitch', 'add_switch', 'int_br0'],
952 ['vswitch', 'add_vport', 'int_br0'],
953 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
954 ['tools', 'assert', 'int(#STEP[-1])==9000'],
955 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=2000'],
956 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
957 ['tools', 'assert', 'int(#STEP[-1])==2000'],
961 "Name": "ovsdpdk_jumbo_increase_mtu_phy_port_datapath",
962 "Deployment": "clean",
963 "Description": "Ensure that the MTU for a DPDK physical port is updated in the datapath itself when increased to a valid value.",
964 "vSwitch" : "OvsDpdkVhost",
966 ['vswitch', 'add_switch', 'int_br0'],
967 ['vswitch', 'add_phy_port', 'int_br0'],
968 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=1500'],
969 ['tools', 'assert', 'len(#STEP[-1])==1'],
970 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9000'],
971 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
972 ['tools', 'assert', 'len(#STEP[-1])==1'],
976 "Name": "ovsdpdk_jumbo_increase_mtu_vport_datapath",
977 "Deployment": "clean",
978 "Description": "Ensure that the MTU for a DPDK vhost-user port is updated in the datapath itself when increased to a valid value.",
979 "vSwitch" : "OvsDpdkVhost",
981 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
984 ['vswitch', 'add_switch', 'int_br0'],
985 ['vswitch', 'add_vport', 'int_br0'],
986 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=1500'],
987 ['tools', 'assert', 'len(#STEP[-1])==1'],
988 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9000'],
989 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
990 ['tools', 'assert', 'len(#STEP[-1])==1'],
994 "Name": "ovsdpdk_jumbo_reduce_mtu_phy_port_datapath",
995 "Deployment": "clean",
996 "Description": "Ensure that the MTU for a DPDK physical port is updated in the datapath itself when decreased to a valid value.",
997 "vSwitch" : "OvsDpdkVhost",
999 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1000 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1003 ['vswitch', 'add_switch', 'int_br0'],
1004 ['vswitch', 'add_phy_port', 'int_br0'],
1005 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
1006 ['tools', 'assert', 'len(#STEP[-1])==1'],
1007 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=2000'],
1008 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=2000'],
1009 ['tools', 'assert', 'len(#STEP[-1])==1'],
1013 "Name": "ovsdpdk_jumbo_reduce_mtu_vport_datapath",
1014 "Deployment": "clean",
1015 "Description": "Ensure that the MTU for a DPDK vhost-user port is updated in the datapath itself when decreased to a valid value.",
1016 "vSwitch" : "OvsDpdkVhost",
1018 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1019 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1020 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1023 ['vswitch', 'add_switch', 'int_br0'],
1024 ['vswitch', 'add_vport', 'int_br0'],
1025 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=9000'],
1026 ['tools', 'assert', 'len(#STEP[-1])==1'],
1027 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=2000'],
1028 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] dpctl/show', '|mtu=2000'],
1029 ['tools', 'assert', 'len(#STEP[-1])==1'],
1033 "Name": "ovsdpdk_jumbo_mtu_upper_bound_phy_port",
1034 "Deployment": "clean",
1035 "Description": "Verify that the upper bound limit is enforced for OvS DPDK Phy ports.",
1036 "vSwitch" : "OvsDpdkVhost",
1038 ['vswitch', 'add_switch', 'int_br0'],
1039 ['vswitch', 'add_phy_port', 'int_br0'],
1040 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9702'],
1041 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1042 ['tools', 'assert', 'int(#STEP[-1])==9702'],
1043 # get line number of next log file entry
1044 ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1045 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=9711'],
1046 # check vswitchd log file, that new MTU request was denied
1047 ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1048 '|unsupported MTU 9711'],
1049 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1050 ['tools', 'assert', 'int(#STEP[-1])==9702'],
1054 "Name": "ovsdpdk_jumbo_mtu_upper_bound_vport",
1055 "Deployment": "clean",
1056 "Description": "Verify that the upper bound limit is enforced for OvS DPDK vhost-user ports.",
1057 "vSwitch" : "OvsDpdkVhost",
1059 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1062 ['vswitch', 'add_switch', 'int_br0'],
1063 ['vswitch', 'add_vport', 'int_br0'],
1064 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9702'],
1065 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1066 ['tools', 'assert', 'int(#STEP[-1])==9702'],
1067 # get line number of next log file entry
1068 ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1069 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=9711'],
1070 # check vswitchd log file, that new MTU request was denied
1071 ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1072 '|unsupported MTU 9711'],
1073 ['tools', 'assert', 'len(#STEP[-1])'],
1074 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1075 ['tools', 'assert', 'int(#STEP[-1])==9702'],
1079 "Name": "ovsdpdk_jumbo_mtu_lower_bound_phy_port",
1080 "Deployment": "clean",
1081 "Description": "Verify that the lower bound limit is enforced for OvS DPDK Phy ports.",
1082 "vSwitch" : "OvsDpdkVhost",
1084 ['vswitch', 'add_switch', 'int_br0'],
1085 ['vswitch', 'add_phy_port', 'int_br0'],
1086 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=68'],
1087 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1088 ['tools', 'assert', 'int(#STEP[-1])==68'],
1089 # get line number of next log file entry
1090 ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1091 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdk0 mtu_request=67'],
1092 # check vswitchd log file, that new MTU request was denied
1093 ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1094 '|unsupported MTU 67'],
1095 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1096 ['tools', 'assert', 'int(#STEP[-1])==68'],
1100 "Name": "ovsdpdk_jumbo_mtu_lower_bound_vport",
1101 "Deployment": "clean",
1102 "Description": "Verify that the lower bound limit is enforced for OvS DPDK vhost-user ports.",
1103 "vSwitch" : "OvsDpdkVhost",
1105 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1108 ['vswitch', 'add_switch', 'int_br0'],
1109 ['vswitch', 'add_vport', 'int_br0'],
1110 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=68'],
1111 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1112 ['tools', 'assert', 'int(#STEP[-1])==68'],
1113 # get line number of next log file entry
1114 ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1115 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set Interface dpdkvhostuserclient0 mtu_request=67'],
1116 # check vswitchd log file, that new MTU request was denied
1117 ['tools', 'exec_shell', "sed -n '#STEP[-2][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1118 '|unsupported MTU 67'],
1119 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1120 ['tools', 'assert', 'int(#STEP[-1])==68'],
1124 "Name": "ovsdpdk_jumbo_p2p",
1125 "Deployment": "p2p",
1126 "Description": "Ensure that jumbo frames are received, processed and forwarded correctly by DPDK physical ports.",
1127 "vSwitch" : "OvsDpdkVhost",
1130 "traffic_type" : "rfc2544_continuous",
1133 'learning_frames' : False,
1135 "TRAFFICGEN_PKT_SIZES" : (9018,),
1136 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1137 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1140 # verify jumbo frame configuration
1141 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1142 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1143 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk1 mtu'],
1144 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1145 ['trafficgen', 'send_traffic', {}],
1146 # check that jumbo frames were received by traffic generator
1147 ['trafficgen', 'get_results'],
1148 # i.e. (RX in Bytes/s) divide (RX frames/s) ~ 9018 Bytes
1149 ['tools', 'assert', 'round(float(#STEP[-1][0]["throughput_rx_mbps"])*1000000/8 / '
1150 'float(#STEP[-1][0]["throughput_rx_fps"]))==9018'],
1154 "Name": "ovsdpdk_jumbo_pvp",
1155 "Deployment": "clean",
1156 "Description": "Ensure that jumbo frames are received, processed and forwarded correctly by DPDK vhost-user ports.",
1157 "vSwitch" : "OvsDpdkVhost",
1158 "VNF" : "QemuDpdkVhostUser",
1161 "traffic_type" : "rfc2544_continuous",
1164 'learning_frames' : False,
1166 "TRAFFICGEN_PKT_SIZES" : (9018,),
1167 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1168 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1169 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1170 "GUEST_LOOPBACK" : ['linux_bridge'],
1171 "GUEST_NIC_MERGE_BUFFERS_DISABLE" : [False],
1173 "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT + [
1174 # verify jumbo frame configuration
1175 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1176 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1177 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk1 mtu'],
1178 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1179 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient0 mtu'],
1180 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1181 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdkvhostuserclient1 mtu'],
1182 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1183 # VNF startup, MTU configuration
1185 ['vnf', 'execute_and_wait', 'ifconfig eth0 mtu 9000'],
1186 ['vnf', 'execute_and_wait', 'ifconfig eth1 mtu 9000'],
1187 ['trafficgen', 'send_traffic', {}],
1188 # check that jumbo frames were received by traffic generator
1189 ['trafficgen', 'get_results'],
1190 # i.e. (RX in Bytes/s) divide (RX frames/s) ~ 9018 Bytes
1191 ['tools', 'assert', 'round(float(#STEP[-1][0]["throughput_rx_mbps"])*1000000/8 / '
1192 'float(#STEP[-1][0]["throughput_rx_fps"]))==9018'],
1194 ] + STEP_VSWITCH_PVP_FLOWS_FINIT
1197 "Name": "ovsdpdk_jumbo_p2p_upper_bound",
1198 "Deployment": "p2p",
1199 "Description": "Ensure that jumbo frames above the configured Rx port's MTU are not accepted",
1200 "vSwitch" : "OvsDpdkVhost",
1203 "traffic_type" : "rfc2544_continuous",
1206 'learning_frames' : False,
1208 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1209 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
1212 # set and verify jumbo frame support
1213 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk0 mtu'],
1214 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1215 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] get Interface dpdk1 mtu'],
1216 ['tools', 'assert', 'int(#STEP[-1])==9000'],
1217 # set packetsize to 9018 and send traffic
1218 ['settings', 'setValue', 'TRAFFICGEN_PKT_SIZES', (9018,)],
1219 ['trafficgen', 'send_traffic', {}],
1220 ['trafficgen', 'get_results'],
1221 # all traffic should pass through (i.e. 0% frame loss)
1222 ['tools', 'assert', 'float(#STEP[-1][0]["frame_loss_percent"])==0'],
1223 # set packetsize to 9702 and send traffic
1224 ['settings', 'setValue', 'TRAFFICGEN_PKT_SIZES', (9702,)],
1225 # disable verification of send_traffic "!" prefix, otherwise vsperf
1226 # will fail when 100% packet loss is detected
1227 ['!trafficgen', 'send_traffic', {}],
1228 ['trafficgen', 'get_results'],
1229 # all traffic should be dropped
1230 ['tools', 'assert', 'float(#STEP[-1][0]["frame_loss_percent"])==100'],
1234 ############################################################
1238 ############################################################
1239 # default settings of limiter used in macros and tests
1240 _OVSDPDK_RATE_PORT = 'dpdk'
1241 _OVSDPDK_RATE_NICID = '0'
1242 _OVSDPDK_RATE_RATE = '10000' # desired maximum rate of PAYLOAD carried by frames
1243 _OVSDPDK_RATE_BURST = '8000'
1244 _OVSDPDK_RATE_LIMITER_CREATED = 'True' # set to False to verify that limiter was not created
1246 _OVSDPDK_RATE_DEVIATION = '5' # acceptable deviation from configured frame rate in %
1247 # Formula used for validation of rate settings.
1248 # Note: OVS parameter "ingress_policing_rate" configures maximum rate of payload in Kbps,
1249 # but traffic generator measures throughput in Mbps based on whole frames including headers.
1250 # Thus measured RX throughput value reported by traffic generator must be deducted by bit
1251 # rate consumed by frame header transmission.
1252 _OVSDPDK_RATE_CHECK = ('abs(1-float(#STEP[{}][{}]["throughput_rx_mbps"])*1000*'
1253 '(1-$_OVSDPDK_HEADER_LEN/float(#STEP[{}][{}]["packet_size"]))'
1254 '/float($_OVSDPDK_RATE_RATE))*100 < $_OVSDPDK_RATE_DEVIATION')
1256 # macro will setup rate limiter at interface defined by _DPDK_RATE_PORT and
1257 # _DPDK_RATE_NICID; It will verify, that limiter was created by parsing
1258 # vswitchd log file. It will also check that proper limiter values are
1259 # set for given interface.
1260 _OVSDPDK_RATE_set_rate_limiter = [
1261 # get line number of next log file entry
1262 ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1263 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1264 'set Interface $_OVSDPDK_RATE_PORT$_OVSDPDK_RATE_NICID '
1265 'ingress_policing_burst=$_OVSDPDK_RATE_BURST '
1266 'ingress_policing_rate=$_OVSDPDK_RATE_RATE'],
1267 # verify that interface has correct rate limiter configuration
1268 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1269 'list interface $_OVSDPDK_RATE_PORT$_OVSDPDK_RATE_NICID',
1270 '(ingress_policing_\w+: \d+)'],
1271 ['tools', 'assert', '"ingress_policing_burst: $_OVSDPDK_RATE_BURST" in #STEP[-1]'],
1272 ['tools', 'assert', '"ingress_policing_rate: $_OVSDPDK_RATE_RATE" in #STEP[-2]'],
1275 _OVSDPDK_RATE_set_rate_limiter_NIC0 = [
1276 ['settings', 'setValue', '_OVSDPDK_RATE_NICID', '0']
1277 ] + _OVSDPDK_RATE_set_rate_limiter
1279 _OVSDPDK_RATE_set_rate_limiter_NIC1 = [
1280 ['settings', 'setValue', '_OVSDPDK_RATE_NICID', '1']
1281 ] + _OVSDPDK_RATE_set_rate_limiter
1283 # macro will set different limiter values and sends traffic to verify proper
1284 # limiter functionality
1285 _OVSDPDK_RATE_confirm_multiple_rate_limit_setup = \
1286 _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1287 # by default rate limit is 10Mbits/s
1288 ['trafficgen', 'send_traffic', {}],
1289 ['trafficgen', 'get_results'],
1290 # check result and accept preconfigured deviation to the configured frame rate
1291 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("-1", "0", "-1", "0")],
1292 # set rate limit to 20Mbits/s
1293 ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '20000']
1294 ] + _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1295 ['trafficgen', 'send_traffic', {}],
1296 ['trafficgen', 'get_results'],
1297 # check result and accept preconfigured deviation to the configured frame rate
1298 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("-1", "0", "-1", "0")],
1299 # set rate limit to 30Mbits/s
1300 ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '30000']
1301 ] + _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1302 ['trafficgen', 'send_traffic', {}],
1303 ['trafficgen', 'get_results'],
1304 # check result and accept preconfigured deviation to the configured frame rate
1305 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("-1", "0", "-1", "0")],
1306 # disable rate limiter and verify unlimited speed
1307 ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '0'],
1308 ['settings', 'setValue', '_OVSDPDK_RATE_BURST', '0'],
1309 ['settings', 'setValue', '_OVSDPDK_RATE_LIMITER_CREATED', 'False'],
1310 ] + _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1311 ['trafficgen', 'send_traffic', {}],
1312 # check that traffic rate is no longer limited
1313 ['trafficgen', 'get_results'],
1314 ['tools', 'assert', 'int(#STEP[-1][0]["throughput_rx_mbps"])>500'],
1315 ['vswitch', 'dump_flows', '$VSWITCH_BRIDGE_NAME'],
1318 INTEGRATION_TESTS = INTEGRATION_TESTS + [
1320 "Name": "ovsdpdk_rate_create_phy_port",
1321 "Deployment": "clean",
1322 "Description": "Ensure a rate limiting interface can be created on a physical DPDK port.",
1323 "vSwitch" : "OvsDpdkVhost",
1325 ['vswitch', 'add_switch', 'int_br0'],
1326 ['vswitch', 'add_phy_port', 'int_br0'],
1327 ] + _OVSDPDK_RATE_set_rate_limiter
1330 "Name": "ovsdpdk_rate_delete_phy_port",
1331 "Deployment": "clean",
1332 "Description": "Ensure a rate limiting interface can be destroyed on a physical DPDK port.",
1333 "vSwitch" : "OvsDpdkVhost",
1335 ['vswitch', 'add_switch', 'int_br0'],
1336 ['vswitch', 'add_phy_port', 'int_br0'],
1337 ] + _OVSDPDK_RATE_set_rate_limiter + [
1338 ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '0'],
1339 ['settings', 'setValue', '_OVSDPDK_RATE_BURST', '0'],
1340 ['settings', 'setValue', '_OVSDPDK_RATE_LIMITER_CREATED', 'False'],
1341 ] + _OVSDPDK_RATE_set_rate_limiter
1344 "Name": "ovsdpdk_rate_create_vport",
1345 "Deployment": "clean",
1346 "Description": "Ensure a rate limiting interface can be created on a vhost-user port.",
1347 "vSwitch" : "OvsDpdkVhost",
1349 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1350 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1353 ['vswitch', 'add_switch', 'int_br0'],
1354 ['vswitch', 'add_vport', 'int_br0'],
1355 ] + _OVSDPDK_RATE_set_rate_limiter
1358 "Name": "ovsdpdk_rate_delete_vport",
1359 "Deployment": "clean",
1360 "Description": "Ensure a rate limiting interface can be destroyed on a vhost-user port.",
1361 "vSwitch" : "OvsDpdkVhost",
1363 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1364 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1367 ['vswitch', 'add_switch', 'int_br0'],
1368 ['vswitch', 'add_vport', 'int_br0'],
1369 ] + _OVSDPDK_RATE_set_rate_limiter + [
1370 ['settings', 'setValue', '_OVSDPDK_RATE_RATE', '0'],
1371 ['settings', 'setValue', '_OVSDPDK_RATE_BURST', '0'],
1372 ['settings', 'setValue', '_OVSDPDK_RATE_LIMITER_CREATED', 'False'],
1373 ] + _OVSDPDK_RATE_set_rate_limiter
1376 "Name": "ovsdpdk_rate_no_policing",
1377 "Deployment": "clean",
1378 "Description": "Ensure when a user attempts to create a rate limiting interface but is missing policing rate argument, no rate limitiner is created.",
1379 "vSwitch" : "OvsDpdkVhost",
1381 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1382 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1383 "_OVSDPDK_RATE_RATE" : '0',
1384 "_OVSDPDK_RATE_BURST" : '1000',
1385 "_OVSDPDK_RATE_LIMITER_CREATED" : 'False',
1388 ['vswitch', 'add_switch', 'int_br0'],
1389 ['vswitch', 'add_vport', 'int_br0'],
1390 ] + _OVSDPDK_RATE_set_rate_limiter
1393 "Name": "ovsdpdk_rate_no_burst",
1394 "Deployment": "clean",
1395 "Description": "Ensure when a user attempts to create a rate limiting interface but is missing policing burst argument, rate limitiner is created.",
1396 "vSwitch" : "OvsDpdkVhost",
1398 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1399 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1400 "_OVSDPDK_RATE_RATE" : '10000',
1401 "_OVSDPDK_RATE_BURST" : '0',
1402 "_OVSDPDK_RATE_LIMITER_CREATED" : 'True',
1405 ['vswitch', 'add_switch', 'int_br0'],
1406 ['vswitch', 'add_vport', 'int_br0'],
1407 ] + _OVSDPDK_RATE_set_rate_limiter
1410 "Name": "ovsdpdk_rate_p2p",
1411 "Deployment": "p2p",
1412 "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.",
1413 "vSwitch" : "OvsDpdkVhost",
1415 "_OVSDPDK_RATE_PORT" : 'dpdk',
1417 "traffic_type" : "rfc2544_continuous",
1422 "TestSteps": _OVSDPDK_RATE_confirm_multiple_rate_limit_setup
1425 "Name": "ovsdpdk_rate_pvp",
1426 "Deployment": "pvp",
1427 "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.",
1428 "vSwitch" : "OvsDpdkVhost",
1429 "VNF" : "QemuDpdkVhostUser",
1431 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1432 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1434 "traffic_type" : "rfc2544_continuous",
1439 "TestSteps": _OVSDPDK_RATE_confirm_multiple_rate_limit_setup
1442 "Name": "ovsdpdk_rate_p2p_multi_pkt_sizes",
1443 "Deployment": "p2p",
1444 "Description": "Ensure that rate limiting works for various frame sizes.",
1445 "vSwitch" : "OvsDpdkVhost",
1447 "_OVSDPDK_RATE_PORT" : 'dpdk',
1448 "_OVSDPDK_RATE_RATE" : '10000',
1449 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
1451 "traffic_type" : "rfc2544_continuous",
1456 "TestSteps": _OVSDPDK_RATE_set_rate_limiter_NIC0 + _OVSDPDK_RATE_set_rate_limiter_NIC1 + [
1457 # dump rate limiter configuration of both NICs
1458 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1459 'list interface dpdk0'],
1460 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1461 'list interface dpdk1'],
1462 ['trafficgen', 'send_traffic', {}],
1463 ['#result', 'trafficgen', 'get_results'],
1464 # check results and accept preconfigured deviation to the configured frame rates
1465 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","0", "result","0")],
1466 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","1", "result","1")],
1467 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","2", "result","2")],
1468 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","3", "result","3")],
1469 ['tools', 'assert', _OVSDPDK_RATE_CHECK.format("result","4", "result","4")],
1473 ############################################################
1475 # Quality of Service
1477 ############################################################
1478 # default settings of limiter used in macros and tests
1479 _OVSDPDK_QOS_PORT = 'dpdk'
1480 _OVSDPDK_QOS_NICID = '0'
1481 _OVSDPDK_QOS_CIR = '1250000' # desired maximum rate of PAYLOAD carried by frames in BYTEs
1482 _OVSDPDK_QOS_CBS = '2048'
1484 _OVSDPDK_QOS_DEVIATION = '5' # acceptable deviation from configured frame rate in %
1485 # Formula used for validation of rate settings.
1486 # Note: OVS parameter "ingress_policing_rate" configures maximum rate of payload in Kbps,
1487 # but traffic generator measures throughput in Mbps based on whole frames including headers.
1488 # Thus measured RX throughput value reported by traffic generator must be deducted by bit
1489 # rate consumed by frame header transmission.
1490 _OVSDPDK_QOS_CHECK = ('abs(1-float(#STEP[{}][{}]["throughput_rx_mbps"])*1000000*'
1491 '(1-$_OVSDPDK_HEADER_LEN/float(#STEP[{}][{}]["packet_size"]))'
1492 '/float($_OVSDPDK_QOS_CIR*8))*100 < $_OVSDPDK_QOS_DEVIATION')
1495 # macro will setup QoS at interface defined by _OVSDPDK_QOS_PORT and
1496 # _OVSDPDK_QOS_NICID; It will verify, that QoS was created by parsing
1497 # vswitchd log file. It will also check that proper QoS values are
1498 # set for given interface.
1499 _OVSDPDK_QOS_set_qos = [
1500 # get line number of next log file entry
1501 ['tools', 'exec_shell', 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1503 # Crete QoS policy and check the returned policy ID
1504 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] '
1505 'set port $_OVSDPDK_QOS_PORT$_OVSDPDK_QOS_NICID qos=@newqos -- '
1506 '--id=@newqos create qos type=egress-policer other-config:cir=$_OVSDPDK_QOS_CIR '
1507 'other-config:cbs=$_OVSDPDK_QOS_CBS','|\w{8}-\w{4}-\w{4}-\w{4}-\w{12}'],
1508 ['tools', 'assert', 'len(#STEP[-1])==1'],
1510 # Check the QoS policy and attributes
1511 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show '
1512 '$_OVSDPDK_QOS_PORT$_OVSDPDK_QOS_NICID', '.+'],
1513 ['tools', 'assert', "'QoS: $_OVSDPDK_QOS_PORT$_OVSDPDK_QOS_NICID egress-policer' in #STEP[-1]"],
1514 ['tools', 'assert', "'cbs: $_OVSDPDK_QOS_CBS' in #STEP[-2]"],
1515 ['tools', 'assert', "'cir: $_OVSDPDK_QOS_CIR' in #STEP[-3]"],
1518 _OVSDPDK_QOS_set_qos_NIC0 = [
1519 ['settings', 'setValue', '_OVSDPDK_QOS_NICID', '0']
1520 ] + _OVSDPDK_QOS_set_qos
1522 _OVSDPDK_QOS_set_qos_NIC1 = [
1523 ['settings', 'setValue', '_OVSDPDK_QOS_NICID', '1']
1524 ] + _OVSDPDK_QOS_set_qos
1526 # macro will set different limiter values and sends traffic to verify proper
1528 _OVSDPDK_QOS_confirm_multiple_qos_setup = [
1529 # Create QoS policy with payload rate of 23*10^6 Bytes/s
1530 ['settings', 'setValue', '_OVSDPDK_QOS_CIR', '23000000']
1531 ] + _OVSDPDK_QOS_set_qos_NIC0 + _OVSDPDK_QOS_set_qos_NIC1 + [
1532 ['trafficgen', 'send_traffic', {}],
1533 ['trafficgen', 'get_results'],
1534 ['tools', 'assert', _OVSDPDK_QOS_CHECK.format("-1", "0", "-1", "0")],
1535 # Create QoS policy with payload rate of 46*10^6 Bytes/s
1536 ['settings', 'setValue', '_OVSDPDK_QOS_CIR', '46000000']
1537 ] + _OVSDPDK_QOS_set_qos_NIC0 + _OVSDPDK_QOS_set_qos_NIC1 + [
1538 ['trafficgen', 'send_traffic', {}],
1539 ['trafficgen', 'get_results'],
1540 ['tools', 'assert', _OVSDPDK_QOS_CHECK.format("-1", "0", "-1", "0")],
1541 # Create QoS policy with payload rate of 92*10^6 Bytes/s
1542 ['settings', 'setValue', '_OVSDPDK_QOS_CIR', '92000000']
1543 ] + _OVSDPDK_QOS_set_qos_NIC0 + _OVSDPDK_QOS_set_qos_NIC1 + [
1544 ['trafficgen', 'send_traffic', {}],
1545 ['trafficgen', 'get_results'],
1546 ['tools', 'assert', _OVSDPDK_QOS_CHECK.format("-1", "0", "-1", "0")],
1549 INTEGRATION_TESTS = INTEGRATION_TESTS + [
1551 "Name": "ovsdpdk_qos_create_phy_port",
1552 "Deployment": "clean",
1553 "Description": "Ensure a QoS policy can be created on a physical DPDK port",
1554 "vSwitch": "OvsDpdkVhost",
1556 ['vswitch', 'add_switch', 'int_br0'],
1557 ['vswitch', 'add_phy_port', 'int_br0'],
1558 ] + _OVSDPDK_QOS_set_qos
1561 "Name": "ovsdpdk_qos_delete_phy_port",
1562 "Deployment": "clean",
1563 "Description": "Ensure an existing QoS policy can be destroyed on a physical DPDK port.",
1564 "vSwitch": "OvsDpdkVhost",
1566 ['vswitch', 'add_switch', 'int_br0'],
1567 ['vswitch', 'add_phy_port', 'int_br0'],
1568 ] + _OVSDPDK_QOS_set_qos + [
1569 # Destroy the QoS policy and check the attributes
1570 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] -- destroy QoS #STEP[1][0] -- clear Port #STEP[1][0] qos'],
1571 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]', 'QoS not configured on #STEP[1][0]'],
1572 ['tools', 'assert', 'len(#STEP[-1])==1'],
1576 "Name": "ovsdpdk_qos_create_vport",
1577 "Deployment": "clean",
1578 "Description": "Ensure a QoS policy can be created on a virtual vhost user port.",
1579 "vSwitch": "OvsDpdkVhost",
1581 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1582 "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1585 ['vswitch', 'add_switch', 'int_br0'],
1586 ['vswitch', 'add_vport', 'int_br0'],
1587 ] + _OVSDPDK_QOS_set_qos
1590 "Name": "ovsdpdk_qos_delete_vport",
1591 "Deployment": "clean",
1592 "Description": "Ensure an existing QoS policy can be destroyed on a vhost user port.",
1593 "vSwitch": "OvsDpdkVhost",
1595 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1596 "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1599 ['vswitch', 'add_switch', 'int_br0'],
1600 ['vswitch', 'add_vport', 'int_br0'],
1601 ] + _OVSDPDK_QOS_set_qos + [
1602 # Destroy the QoS policy and check the attributes
1603 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] -- destroy QoS #STEP[1][0] -- clear Port #STEP[1][0] qos'],
1604 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]', 'QoS not configured on #STEP[1][0]'],
1605 ['tools', 'assert', 'len(#STEP[-1])==1'],
1609 "Name": "ovsdpdk_qos_create_no_cir",
1610 "Deployment": "clean",
1611 "Description": "Ensure that a QoS policy cannot be created if the egress policer cir argument is missing.",
1612 "vSwitch": "OvsDpdkVhost",
1615 # Setup switch,port and logs
1616 ['vswitch', 'add_switch', '$VSWITCH_BRIDGE_NAME'],
1617 ['vswitch', 'add_vport', '$VSWITCH_BRIDGE_NAME'],
1618 ['#LOG_MARK', 'tools', 'exec_shell',
1619 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1621 # Crete QoS policy and check the returned policy ID
1622 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set port #STEP[1][0] qos=@newqos -- '
1623 '--id=@newqos create qos type=egress-policer other-config:cbs=2048',
1624 '\w{8}-\w{4}-\w{4}-\w{4}-\w{12}'],
1625 ['tools', 'assert', 'len(#STEP[-1])==1'],
1627 # Check the OVS logs
1628 ['tools', 'exec_shell', "sed -n '#STEP[LOG_MARK][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1629 'Failed to set QoS type egress-policer on port #STEP[1][0]: Invalid argument'],
1630 ['tools', 'assert', 'len(#STEP[-1])==1'],
1632 # Check the attributes for vhost0
1633 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]',
1634 'QoS not configured on #STEP[1][0]'],
1635 ['tools', 'assert', 'len(#STEP[-1])==1'],
1639 "Name": "ovsdpdk_qos_create_no_cbs",
1640 "Deployment": "clean",
1641 "Description": "Ensure that a QoS policy cannot be created if the egress policer cbs argument is missing.",
1642 "vSwitch": "OvsDpdkVhost",
1645 # Setup switch,port and logs
1646 ['vswitch', 'add_switch', '$VSWITCH_BRIDGE_NAME'],
1647 ['vswitch', 'add_vport', '$VSWITCH_BRIDGE_NAME'],
1648 ['#LOG_MARK', 'tools', 'exec_shell',
1649 'echo $((1+`wc -l $_OVSDPDK_VSWITCH_LOG | cut -d" " -f1`))', '(\d+)'],
1651 # Crete QoS policy and check the returned policy ID
1652 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] set port #STEP[1][0] qos=@newqos -- '
1653 '--id=@newqos create qos type=egress-policer other-config:cir=1250000',
1654 '\w{8}-\w{4}-\w{4}-\w{4}-\w{12}'],
1655 ['tools', 'assert', 'len(#STEP[-1])==1'],
1657 # Check the OVS logs
1658 ['tools', 'exec_shell', "sed -n '#STEP[LOG_MARK][0],$ p' $_OVSDPDK_VSWITCH_LOG",
1659 'Failed to set QoS type egress-policer on port #STEP[1][0]: Invalid argument'],
1660 ['tools', 'assert', 'len(#STEP[-1])==1'],
1662 # Check the attributes for vhost0
1663 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-appctl"] -t ovs-vswitchd qos/show #STEP[1][0]',
1664 'QoS not configured on #STEP[1][0]'],
1665 ['tools', 'assert', 'len(#STEP[-1])==1'],
1669 "Name": "ovsdpdk_qos_p2p",
1670 "Deployment": "p2p",
1671 "Description": "In a p2p setup, ensure when a QoS egress policer is created that the traffic is limited to the specified rate.",
1672 "vSwitch": "OvsDpdkVhost",
1675 "traffic_type" : "rfc2544_continuous",
1680 "TestSteps": _OVSDPDK_QOS_confirm_multiple_qos_setup
1683 "Name": "ovsdpdk_qos_pvp",
1684 "Deployment": "pvp",
1685 "Description": "In a pvp setup, ensure when a QoS egress policer is created that the traffic is limited to the specified rate.",
1686 "vSwitch": "OvsDpdkVhost",
1687 "VNF" : "QemuDpdkVhostUser",
1689 "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1690 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1692 "traffic_type" : "rfc2544_continuous",
1697 "TestSteps": _OVSDPDK_QOS_confirm_multiple_qos_setup
1699 ############################################################
1703 ############################################################
1705 "Name": "ovsdpdk_custstat_check",
1706 "Deployment": "clean",
1707 "Description": "Test if custom statistics are supported.",
1708 "vSwitch" : "OvsDpdkVhost",
1710 # enable custom statistics
1711 ['vswitch', 'add_switch', 'int_br0', [
1712 'protocols=OpenFlow10,OpenFlow11,OpenFlow12,'
1713 'OpenFlow13,OpenFlow14,OpenFlow15']],
1714 ['#port', 'vswitch', 'add_phy_port', 'int_br0'],
1715 # check that custom statistics are available for given interface
1716 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-ofctl"] -O OpenFlow14 '
1717 'dump-ports int_br0 #STEP[port][1]',
1718 '|CUSTOM Statistics'],
1719 ['tools', 'assert', 'len(#STEP[-1])'],
1720 ['vswitch', 'del_port', 'int_br0', '#STEP[port][0]'],
1721 ['vswitch', 'del_switch', 'int_br0'],
1725 "Name": "ovsdpdk_custstat_rx_error",
1726 "Deployment": "clean",
1727 "Description": "Test bad ethernet CRC counter 'rx_crc_errors' exposed by custom statistics.",
1728 "vSwitch" : "OvsDpdkVhost",
1730 "OVS_OFCTL_ARGS" : [],
1731 "TRAFFICGEN" : "IxNet",
1733 "traffic_type" : "rfc2544_continuous",
1736 "TRAFFICGEN_DURATION" : 10,
1737 "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544_bad_l2_crc.tcl",
1740 # enable custom statistics
1741 ['vswitch', 'add_switch', 'int_br0', [
1742 'protocols=OpenFlow10,OpenFlow11,OpenFlow12,'
1743 'OpenFlow13,OpenFlow14,OpenFlow15']],
1744 ['#port1', 'vswitch', 'add_phy_port', 'int_br0'],
1745 ['#port2', 'vswitch', 'add_phy_port', 'int_br0'],
1746 ['vswitch', 'add_flow', 'int_br0', {'in_port': '1', 'actions': ['output:2']}],
1747 ['vswitch', 'add_flow', 'int_br0', {'in_port': '2', 'actions': ['output:1']}],
1748 ['#crc_old', 'tools', 'exec_shell', 'sudo $TOOLS["ovs-ofctl"] -O OpenFlow14 '
1749 'dump-ports int_br0 #STEP[port1][1]',
1750 '|rx_crc_errors=(\d+)'],
1751 # frames will be dropped by NIC, so we have to suppress send_traffic validation
1752 # to avoid test failure
1753 ['!trafficgen', 'send_traffic', {}],
1754 # check that custom statistics are available for given interface
1755 ['#crc_new', 'tools', 'exec_shell', 'sudo $TOOLS["ovs-ofctl"] -O OpenFlow14 '
1756 'dump-ports int_br0 #STEP[port1][1]',
1757 '|rx_crc_errors=(\d+)'],
1758 ['tools', 'assert', '#STEP[crc_new] > #STEP[crc_old]'],
1759 # tear down the environment
1760 ['vswitch', 'dump_flows', 'int_br0'],
1761 ['vswitch', 'del_flow', 'int_br0', {}],
1762 ['vswitch', 'del_port', 'int_br0', '#STEP[port1][0]'],
1763 ['vswitch', 'del_port', 'int_br0', '#STEP[port2][0]'],
1764 ['vswitch', 'del_switch', 'int_br0'],