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 '
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\) '
600 "TRAFFICGEN_DURATION" : 5,
602 "traffic_type" : "rfc2544_continuous",
604 "stream_type" : "L3",
613 "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
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', {}],
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'],
635 ############################################################
639 ############################################################
641 "Name": "ovsdpdk_vhostuser_client",
643 "Description": "Test vhost-user client mode",
644 "vSwitch" : "OvsDpdkVhost",
645 "VNF" : "QemuDpdkVhostUser",
648 "traffic_type" : "rfc2544_continuous",
652 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
653 "TRAFFICGEN_DURATION" : 1,
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', {}],
666 "Name": "ovsdpdk_vhostuser_client_reconnect",
668 "Description": "Test vhost-user client mode reconnect feature",
669 "vSwitch" : "OvsDpdkVhost",
670 "VNF" : "QemuDpdkVhostUser",
673 "traffic_type" : "rfc2544_continuous",
677 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
678 "TRAFFICGEN_DURATION" : 1,
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', {}],
699 "Name": "ovsdpdk_vhostuser_server",
701 "Description": "Test vhost-user server mode",
702 "vSwitch" : "OvsDpdkVhost",
703 "VNF" : "QemuDpdkVhostUser",
706 "traffic_type" : "rfc2544_continuous",
710 "VSWITCH_VHOSTUSER_SERVER_MODE" : True,
711 "TRAFFICGEN_DURATION" : 1,
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', {}],
724 "Name": "ovsdpdk_vhostuser_sock_dir",
725 "Deployment": "clean",
726 "Description": "Verify functionality of vhost-sock-dir flag",
727 "vSwitch" : "OvsDpdkVhost",
729 "VSWITCH_VHOSTUSER_SERVER_MODE" : True,
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',
741 ['tools', 'assert', 'len(#STEP[-1])'],
745 ############################################################
747 # Virtual Devices Support
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'],
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'],
771 ['tools', 'exec_shell', 'sudo $TOOLS["ovs-vsctl"] show', '|Error attaching device'],
772 ['tools', 'assert', 'not len(#STEP[-1])'],
775 INTEGRATION_TESTS = INTEGRATION_TESTS + [
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
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])'],
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",
801 # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
802 'WHITELIST_NICS' : [],
805 "TestSteps": _OVSDPDK_VDEV_ADD_AF_PACKET
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",
813 # suppress DPDK configuration, so physical interfaces are not bound to DPDK driver
814 'WHITELIST_NICS' : [],
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])'],
824 ############################################################
828 ############################################################
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",
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']
844 "TestSteps": STEP_VSWITCH_PVP_INIT +
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])+'
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]")]
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])+'
870 ['tools', 'assert', '#STEP[-1][0]==1'],
873 STEP_VSWITCH_PVP_FINIT
875 ############################################################
877 # Jumbo Frame Support
879 ############################################################
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",
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'],
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",
901 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
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'],
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",
919 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
920 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
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'],
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",
938 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
939 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
940 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
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'],
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",
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'],
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",
973 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
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'],
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",
991 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
992 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
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'],
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",
1010 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1011 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1012 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
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'],
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",
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'],
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",
1051 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
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'],
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",
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'],
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",
1097 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
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'],
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",
1122 "traffic_type" : "rfc2544_continuous",
1125 'learning_frames' : False,
1127 "TRAFFICGEN_PKT_SIZES" : (9018,),
1128 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1129 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
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'],
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",
1153 "traffic_type" : "rfc2544_continuous",
1156 'learning_frames' : False,
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],
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
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'],
1186 ] + STEP_VSWITCH_PVP_FLOWS_FINIT
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",
1195 "traffic_type" : "rfc2544_continuous",
1198 'learning_frames' : False,
1200 "VSWITCH_JUMBO_FRAMES_ENABLED" : 'True',
1201 "VSWITCH_JUMBO_FRAMES_SIZE" : 9000,
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'],
1226 ############################################################
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
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')
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]'],
1267 _OVSDPDK_RATE_set_rate_limiter_NIC0 = [
1268 ['settings', 'setValue', '_OVSDPDK_RATE_NICID', '0']
1269 ] + _OVSDPDK_RATE_set_rate_limiter
1271 _OVSDPDK_RATE_set_rate_limiter_NIC1 = [
1272 ['settings', 'setValue', '_OVSDPDK_RATE_NICID', '1']
1273 ] + _OVSDPDK_RATE_set_rate_limiter
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'],
1310 INTEGRATION_TESTS = INTEGRATION_TESTS + [
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",
1317 ['vswitch', 'add_switch', 'int_br0'],
1318 ['vswitch', 'add_phy_port', 'int_br0'],
1319 ] + _OVSDPDK_RATE_set_rate_limiter
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",
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
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",
1341 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1342 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1345 ['vswitch', 'add_switch', 'int_br0'],
1346 ['vswitch', 'add_vport', 'int_br0'],
1347 ] + _OVSDPDK_RATE_set_rate_limiter
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",
1355 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1356 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
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
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",
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',
1380 ['vswitch', 'add_switch', 'int_br0'],
1381 ['vswitch', 'add_vport', 'int_br0'],
1382 ] + _OVSDPDK_RATE_set_rate_limiter
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",
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',
1397 ['vswitch', 'add_switch', 'int_br0'],
1398 ['vswitch', 'add_vport', 'int_br0'],
1399 ] + _OVSDPDK_RATE_set_rate_limiter
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",
1407 "_OVSDPDK_RATE_PORT" : 'dpdk',
1409 "traffic_type" : "rfc2544_continuous",
1414 "TestSteps": _OVSDPDK_RATE_confirm_multiple_rate_limit_setup
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",
1423 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1424 "_OVSDPDK_RATE_PORT" : 'dpdkvhostuserclient',
1426 "traffic_type" : "rfc2544_continuous",
1431 "TestSteps": _OVSDPDK_RATE_confirm_multiple_rate_limit_setup
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",
1439 "_OVSDPDK_RATE_PORT" : 'dpdk',
1440 "_OVSDPDK_RATE_RATE" : '10000',
1441 "TRAFFICGEN_PKT_SIZES" : _OVSDPDK_PKT_SIZES,
1443 "traffic_type" : "rfc2544_continuous",
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")],
1465 ############################################################
1467 # Quality of Service
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'
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')
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+)'],
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'],
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]"],
1510 _OVSDPDK_QOS_set_qos_NIC0 = [
1511 ['settings', 'setValue', '_OVSDPDK_QOS_NICID', '0']
1512 ] + _OVSDPDK_QOS_set_qos
1514 _OVSDPDK_QOS_set_qos_NIC1 = [
1515 ['settings', 'setValue', '_OVSDPDK_QOS_NICID', '1']
1516 ] + _OVSDPDK_QOS_set_qos
1518 # macro will set different limiter values and sends traffic to verify proper
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")],
1541 INTEGRATION_TESTS = INTEGRATION_TESTS + [
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",
1548 ['vswitch', 'add_switch', 'int_br0'],
1549 ['vswitch', 'add_phy_port', 'int_br0'],
1550 ] + _OVSDPDK_QOS_set_qos
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",
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'],
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",
1573 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1574 "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1577 ['vswitch', 'add_switch', 'int_br0'],
1578 ['vswitch', 'add_vport', 'int_br0'],
1579 ] + _OVSDPDK_QOS_set_qos
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",
1587 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1588 "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
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'],
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",
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+)'],
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'],
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'],
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'],
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",
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+)'],
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'],
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'],
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'],
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",
1667 "traffic_type" : "rfc2544_continuous",
1672 "TestSteps": _OVSDPDK_QOS_confirm_multiple_qos_setup
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",
1681 "_OVSDPDK_QOS_PORT" : 'dpdkvhostuserclient',
1682 "VSWITCH_VHOSTUSER_SERVER_MODE" : False,
1684 "traffic_type" : "rfc2544_continuous",
1689 "TestSteps": _OVSDPDK_QOS_confirm_multiple_qos_setup
1691 ############################################################
1695 ############################################################
1697 "Name": "ovsdpdk_custstat_check",
1698 "Deployment": "clean",
1699 "Description": "Test if custom statistics are supported.",
1700 "vSwitch" : "OvsDpdkVhost",
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'],
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",
1722 "OVS_OFCTL_ARGS" : [],
1723 "TRAFFICGEN" : "IxNet",
1725 "traffic_type" : "rfc2544_continuous",
1728 "TRAFFICGEN_DURATION" : 10,
1729 "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544_bad_l2_crc.tcl",
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'],