From b633f4ebf7878ae968e27b71da69b6cde0265904 Mon Sep 17 00:00:00 2001 From: Fangyin Hu Date: Fri, 25 Nov 2016 03:52:22 -0800 Subject: [PATCH] Add the DPDK l2fwd performance test cases. Change-Id: I996847a4871ed994cd9b5edb459fb079ff39c86d Signed-off-by: Fangyin Hu --- bootstrap-verify-perf-DPDK.sh | 30 +- dpdk-tests/dpdk_scripts/cleanup_dpdk.sh | 39 ++ dpdk-tests/dpdk_scripts/init_dpdk.sh | 17 + dpdk-tests/dpdk_scripts/install_dpdk.sh | 49 +++ dpdk-tests/dpdk_scripts/run_l2fwd.sh | 48 +++ .../perf/10ge2p1x520-eth-l2xcbase-ndrdisc.robot | 399 +++++++++++++++++++++ dpdk-tests/perf/__init__.robot | 18 + resources/libraries/python/DPDK/DPDKTools.py | 83 +++++ resources/libraries/python/DPDK/L2fwdTest.py | 54 +++ resources/libraries/python/DPDK/SetupDPDKTest.py | 218 +++++++++++ resources/libraries/python/DPDK/__init__.py | 16 + resources/libraries/robot/DPDK/default.robot | 58 +++ resources/libraries/robot/performance.robot | 97 ++++- 13 files changed, 1093 insertions(+), 33 deletions(-) create mode 100755 dpdk-tests/dpdk_scripts/cleanup_dpdk.sh create mode 100755 dpdk-tests/dpdk_scripts/init_dpdk.sh create mode 100755 dpdk-tests/dpdk_scripts/install_dpdk.sh create mode 100755 dpdk-tests/dpdk_scripts/run_l2fwd.sh create mode 100644 dpdk-tests/perf/10ge2p1x520-eth-l2xcbase-ndrdisc.robot create mode 100644 dpdk-tests/perf/__init__.robot create mode 100644 resources/libraries/python/DPDK/DPDKTools.py create mode 100644 resources/libraries/python/DPDK/L2fwdTest.py create mode 100644 resources/libraries/python/DPDK/SetupDPDKTest.py create mode 100644 resources/libraries/python/DPDK/__init__.py create mode 100644 resources/libraries/robot/DPDK/default.robot diff --git a/bootstrap-verify-perf-DPDK.sh b/bootstrap-verify-perf-DPDK.sh index c8b3dba53c..957ac46d5c 100755 --- a/bootstrap-verify-perf-DPDK.sh +++ b/bootstrap-verify-perf-DPDK.sh @@ -79,10 +79,10 @@ case "$TEST_TAG" in pybot ${PYBOT_ARGS} \ -L TRACE \ -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \ - -v DPDK_TEST:True + -v DPDK_TEST:True \ -s "dpdk-tests.perf" \ --exclude SKIP_PATCH \ - -i perftest_long \ + -i NDRPDRDISC \ dpdk-tests/ RETURN_STATUS=$(echo $?) ;; @@ -90,27 +90,9 @@ case "$TEST_TAG" in pybot ${PYBOT_ARGS} \ -L TRACE \ -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \ - -v DPDK_TEST:True + -v DPDK_TEST:True \ -s "dpdk-tests.perf" \ - -i perftest_short \ - dpdk-tests/ - RETURN_STATUS=$(echo $?) - ;; - PERFTEST_NDR ) - pybot ${PYBOT_ARGS} \ - -L TRACE \ - -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \ - -v DPDK_TEST:True - -s "dpdk-tests.perf" -i NDR \ - dpdk-tests/ - RETURN_STATUS=$(echo $?) - ;; - PERFTEST_PDR ) - pybot ${PYBOT_ARGS} \ - -L TRACE \ - -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \ - -v DPDK_TEST:True - -s "dpdk-tests.perf" -i PDR \ + -i NDRCHK \ dpdk-tests/ RETURN_STATUS=$(echo $?) ;; @@ -119,7 +101,7 @@ case "$TEST_TAG" in pybot ${PYBOT_ARGS} \ -L TRACE \ -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \ - -v DPDK_TEST:True + -v DPDK_TEST:True \ -s "dpdk-tests.perf" \ dpdk-tests/ RETURN_STATUS=$(echo $?) @@ -129,7 +111,7 @@ case "$TEST_TAG" in pybot ${PYBOT_ARGS} \ -L TRACE \ -v TOPOLOGY_PATH:${WORKING_TOPOLOGY} \ - -v DPDK_TEST:True + -v DPDK_TEST:True \ -s "dpdk-tests.perf" \ dpdk-tests/ RETURN_STATUS=$(echo $?) diff --git a/dpdk-tests/dpdk_scripts/cleanup_dpdk.sh b/dpdk-tests/dpdk_scripts/cleanup_dpdk.sh new file mode 100755 index 0000000000..8ab9c6f676 --- /dev/null +++ b/dpdk-tests/dpdk_scripts/cleanup_dpdk.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +ROOTDIR=/tmp/openvpp-testing +PWDDIR=$(pwd) + +TESTPMD_LOG=/tmp/testpmd.log +TESTPMD_PID=/tmp/testpmd.pid + +port1_driver=$1 +port1_pci=$2 +port2_driver=$3 +port2_pci=$4 + +#kill the dpdk application +sudo pkill testpmd +sudo pkill l2fwd +sudo pkill l3fwd +sudo rm -f ${TESTPMD_PID} +sudo rm -f /dev/hugepages/* +cat ${TESTPMD_LOG} + +sleep 2 + +cd ${ROOTDIR}/dpdk-16.07/ +./tools/dpdk-devbind.py -b ${port1_driver} ${port1_pci} +./tools/dpdk-devbind.py -b ${port2_driver} ${port2_pci} + +sleep 2 + +if1_name=`./tools/dpdk-devbind.py --s | grep "${port1_pci}" | sed -n 's/.*if=\(\S\)/\1/p' | awk -F' ' '{print $1}'` +if2_name=`./tools/dpdk-devbind.py --s | grep "${port2_pci}" | sed -n 's/.*if=\(\S\)/\1/p' | awk -F' ' '{print $1}'` + +ifconfig ${if1_name} up +ifconfig ${if2_name} up + +rmmod igb_uio +rmmod uio + +cd ${PWDDIR} diff --git a/dpdk-tests/dpdk_scripts/init_dpdk.sh b/dpdk-tests/dpdk_scripts/init_dpdk.sh new file mode 100755 index 0000000000..b0bd426021 --- /dev/null +++ b/dpdk-tests/dpdk_scripts/init_dpdk.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +ROOTDIR=/tmp/openvpp-testing +PWDDIR=$(pwd) + +cd ${ROOTDIR}/dpdk-16.07/ +modprobe uio +lsmod | grep igb_uio +if [ $? -eq 1 ]; +then + insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko || exit 1 +else + rmmod igb_uio + insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko || exit 1 +fi +./tools/dpdk-devbind.py -b igb_uio $1 $2 +cd ${PWDDIR} diff --git a/dpdk-tests/dpdk_scripts/install_dpdk.sh b/dpdk-tests/dpdk_scripts/install_dpdk.sh new file mode 100755 index 0000000000..99fa957d59 --- /dev/null +++ b/dpdk-tests/dpdk_scripts/install_dpdk.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +DPDK_VERSION=16.07 +DPDK_DIR=dpdk-${DPDK_VERSION} +DPDK_PACKAGE=${DPDK_DIR}.tar.xz + +ROOTDIR=/tmp/openvpp-testing +PWDDIR=$(pwd) + +#download the DPDK package +#compile and install the DPDK +cd ${ROOTDIR} +wget -q "fast.dpdk.org/rel/${DPDK_PACKAGE}" || exit 1 +tar xJf ${DPDK_PACKAGE} +cd ./${DPDK_DIR} +make install T=x86_64-native-linuxapp-gcc -j || exit 1 +cd ${PWDDIR} + +#compile the l3fwd +export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/ +export RTE_TARGET=x86_64-native-linuxapp-gcc +cd ${RTE_SDK}/examples/l3fwd +make -j || exit 1 +cd ${PWDDIR} + +#check and setup the hugepages +SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages) +if [ ${SYS_HUGEPAGE} -lt 4096 ]; then + MOUNT=$(mount | grep /mnt/huge) + while [ "${MOUNT}" != "" ] + do + sudo umount /mnt/huge + sleep 1 + MOUNT=$(mount | grep /mnt/huge) + done + + echo 2048 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages + echo 2048 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages + + sudo mkdir -p /mnt/huge + sudo mount -t hugetlbfs nodev /mnt/huge/ + test $? -eq 0 || exit 1 +fi + +#check and set the max map count +SYS_MAP=$(cat /proc/sys/vm/max_map_count) +if [ ${SYS_MAP} -lt 200000 ]; then + echo 200000 | sudo tee /proc/sys/vm/max_map_count +fi diff --git a/dpdk-tests/dpdk_scripts/run_l2fwd.sh b/dpdk-tests/dpdk_scripts/run_l2fwd.sh new file mode 100755 index 0000000000..6df33a1317 --- /dev/null +++ b/dpdk-tests/dpdk_scripts/run_l2fwd.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +ROOTDIR=/tmp/openvpp-testing +PWDDIR=$(pwd) + +TESTPMD_LOG=/tmp/testpmd.log +TESTPMD_PID=/tmp/testpmd.pid + +cpu_coremask=$1 +nb_cores=$2 +queue_nums=$3 +jumbo_frames=$4 + +#kill the testpmd +sudo pkill testpmd +sudo rm -f ${TESTPMD_PID} + +sleep 2 + +pid=`pgrep testpmd` +if [ "$pid" != "" ]; then + echo "terminate the testpmd failed!" + exit 1 +fi + +#run the testpmd +cd ${ROOTDIR} +if [ "$jumbo_frames" = "yes" ]; then +#sudo sh -c "screen -dmS DPDK-test ./dpdk-16.07/x86_64-native-linuxapp-gcc/app/testpmd -c ${cpu_coremask} \ +# -n 4 -- --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \ +# --max-pkt-len=9000 --txqflags=0 --forward-mode=io --rxq=${queue_nums} \ +# --txq=${queue_nums} --auto-start" +tail -f /dev/null | nohup ./dpdk-16.07/x86_64-native-linuxapp-gcc/app/testpmd -c ${cpu_coremask} \ + -n 4 -- --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \ + --max-pkt-len=9000 --txqflags=0 --forward-mode=io --rxq=${queue_nums} \ + --txq=${queue_nums} --auto-start > ${TESTPMD_LOG} 2>&1 & +echo $! > ${TESTPMD_PID} +else +#sudo sh -c "screen -dmS DPDK-test ./dpdk-16.07/x86_64-native-linuxapp-gcc/app/testpmd -c ${cpu_coremask} \ +# -n 4 -- --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \ +# --forward-mode=io --rxq=${queue_nums} --txq=${queue_nums} --auto-start" +tail -f /dev/null | nohup ./dpdk-16.07/x86_64-native-linuxapp-gcc/app/testpmd -c ${cpu_coremask} \ + -n 4 -- --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \ + --forward-mode=io --rxq=${queue_nums} --txq=${queue_nums} --auto-start > ${TESTPMD_LOG} 2>&1 & +echo $! > ${TESTPMD_PID} +fi + +cd ${PWDDIR} diff --git a/dpdk-tests/perf/10ge2p1x520-eth-l2xcbase-ndrdisc.robot b/dpdk-tests/perf/10ge2p1x520-eth-l2xcbase-ndrdisc.robot new file mode 100644 index 0000000000..44c4472663 --- /dev/null +++ b/dpdk-tests/perf/10ge2p1x520-eth-l2xcbase-ndrdisc.robot @@ -0,0 +1,399 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Resource | resources/libraries/robot/performance.robot +| Resource | resources/libraries/robot/DPDK/default.robot +| Library | resources.libraries.python.topology.Topology +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.InterfaceUtil +| Library | resources.libraries.python.DPDK.DPDKTools +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | HW_ENV | PERFTEST | NDRPDRDISC | 1NUMA +| ... | NIC_Intel-X520-DA2 | DPDK | ETH | L2XCFWD | BASE +| Suite Setup | DPDK 3-node Performance Suite Setup with DUT's NIC model +| ... | L2 | Intel-X520-DA2 +| Suite Teardown | DPDK 3-node Performance Suite Teardown +| Documentation | *RFC2544: Pkt throughput IPv4 routing test cases* +| ... +| ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\ +| ... | with single links between nodes. +| ... | *[Enc] Packet Encapsulations:* Eth-IPv4 for L2 frame forwarding. +| ... | *[Cfg] DUT configuration:* DUT1 and DUT2 run the DPDK testpmd\ +| ... | application and use the io forwarding mode. DUT1 and DUT2 tested with\ +| ... | 2p10GE NIC X520 Niantic by Intel. +| ... | *[Ver] TG verification:* TG finds and reports throughput NDR (Non Drop\ +| ... | Rate) with zero packet loss tolerance or throughput PDR (Partial Drop\ +| ... | Rate) with non-zero packet loss tolerance (LT) expressed in percentage\ +| ... | of packets transmitted. NDR and PDR are discovered for different\ +| ... | Ethernet L2 frame sizes using either binary search or linear search\ +| ... | algorithms with configured starting rate and final step that determines\ +| ... | throughput measurement resolution. Test packets are generated by TG on\ +| ... | links to DUTs. TG traffic profile contains two L3 flow-groups\ +| ... | (flow-group per direction, 253 flows per flow-group) with all packets\ +| ... | containing Ethernet header, IPv4 header with IP protocol=61 and static\ +| ... | payload. MAC addresses are matching MAC addresses of the TG node\ +| ... | interfaces. +| ... | *[Ref] Applicable standard specifications:* RFC2544. + +*** Variables *** +#X520-DA2 bandwidth limit +| ${s_limit} | ${10000000000} + +*** Test Cases *** +| TC01: 64B NDR binary search - DUT l2fwd - 1thread 1core 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 1 thread, 1 phy core,\ +| | ... | 1 receive queue per NIC port. [Ver] Find NDR for 64 Byte frames\ +| | ... | using binary search start at 10GE linerate, step 100kpps. +| | [Tags] | 1T1C | STHREAD | NDRDISC +| | ${framesize}= | Set Variable | ${64} +| | ${min_rate}= | Set Variable | ${100000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '1' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC02: 64B PDR binary search - DUT l2fwd - 1thread 1core 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 1 thread, 1 phy core,\ +| | ... | 1 receive queue per NIC port. [Ver] Find PDR for 64 Byte frames\ +| | ... | using binary search start at 10GE linerate, step 100kpps, LT=0.5%. +| | [Tags] | 1T1C | STHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${64} +| | ${min_rate}= | Set Variable | ${100000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '1' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC03: 1518B NDR binary search - DUT l2fwd - 1thread 1core 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 1 thread, 1 phy core,\ +| | ... | 1 receive queue per NIC port. [Ver] Find NDR for 1518 Byte frames\ +| | ... | using binary search start at 10GE linerate, step 10kpps. +| | [Tags] | 1T1C | STHREAD | NDRDISC +| | ${framesize}= | Set Variable | ${1518} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '1' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC04: 1518B PDR binary search - DUT l2fwd - 1thread 1core 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 1 thread, 1 phy core,\ +| | ... | 1 receive queue per NIC port. [Ver] Find PDR for 1518 Byte frames\ +| | ... | using binary search start at 10GE linerate, step 10kpps, LT=0.5%. +| | [Tags] | 1T1C | STHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${1518} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '1' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC05: 9000B NDR binary search - DUT l2fwd - 1thread 1core 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 1 thread, 1 phy core,\ +| | ... | 1 receive queue per NIC port. [Ver] Find NDR for 9000 Byte frames\ +| | ... | using binary search start at 10GE linerate, step 10kpps. +| | [Tags] | 1T1C | STHREAD | NDRDISC +| | ${framesize}= | Set Variable | ${9000} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '1' worker threads and rxqueues '1' with jumbo frames 'yes' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC06: 9000B PDR binary search - DUT l2fwd - 1thread 1core 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 1 thread, 1 phy core,\ +| | ... | 1 receive queue per NIC port. [Ver] Find PDR for 9000 Byte frames\ +| | ... | using binary search start at 10GE linerate, step 10kpps, LT=0.5%. +| | [Tags] | 1T1C | STHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${9000} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '1' worker threads and rxqueues '1' with jumbo frames 'yes' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC07: 64B NDR binary search - DUT l2fwd - 2threads 2cores 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 2 threads, 2 phy\ +| | ... | cores, 1 receive queue per NIC port. [Ver] Find NDR for 64 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 100kpps. +| | [Tags] | 2T2C | MTHREAD | NDRDISC +| | ${framesize}= | Set Variable | ${64} +| | ${min_rate}= | Set Variable | ${100000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '2' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC08: 64B PDR binary search - DUT l2fwd - 2threads 2cores 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 2 threads, 2 phy\ +| | ... | cores, 1 receive queue per NIC port. [Ver] Find PDR for 64 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 100kpps,\ +| | ... | LT=0.5%. +| | [Tags] | 2T2C | MTHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${64} +| | ${min_rate}= | Set Variable | ${100000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '2' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC09: 1518B NDR binary search - DUT l2fwd - 2threads 2cores 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 2 threads, 2 phy\ +| | ... | cores, 1 receive queue per NIC port. [Ver] Find NDR for 1518 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 10kpps. +| | [Tags] | 2T2C | MTHREAD | NDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${1518} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '2' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC10: 1518B PDR binary search - DUT l2fwd - 2threads 2cores 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 2 threads, 2 phy\ +| | ... | cores, 1 receive queue per NIC port. [Ver] Find PDR for 1518 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 10kpps,\ +| | ... | LT=0.5%. +| | [Tags] | 2T2C | MTHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${1518} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '2' worker threads and rxqueues '1' with jumbo frames 'no' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC11: 9000B NDR binary search - DUT l2fwd - 2threads 2cores 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 2 threads, 2 phy\ +| | ... | cores, 1 receive queue per NIC port. [Ver] Find NDR for 9000 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 10kpps. +| | [Tags] | 2T2C | MTHREAD | NDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${9000} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '2' worker threads and rxqueues '1' with jumbo frames 'yes' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC12: 9000B PDR binary search - DUT l2fwd - 2threads 2cores 1rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 2 threads, 2 phy\ +| | ... | cores, 1 receive queue per NIC port. [Ver] Find PDR for 9000 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 10kpps,\ +| | ... | LT=0.5%. +| | [Tags] | 2T2C | MTHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${9000} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '2' worker threads and rxqueues '1' with jumbo frames 'yes' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC13: 64B NDR binary search - DUT l2fwd - 4threads 4cores 2rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 4 threads, 4 phy\ +| | ... | cores, 2 receive queues per NIC port. [Ver] Find NDR for 64 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 100kpps. +| | [Tags] | 4T4C | MTHREAD | NDRDISC +| | ${framesize}= | Set Variable | ${64} +| | ${min_rate}= | Set Variable | ${100000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '4' worker threads and rxqueues '2' with jumbo frames 'no' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC14: 64B PDR binary search - DUT l2fwd - 4threads 4cores 2rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 4 threads, 4 phy\ +| | ... | cores, 2 receive queues per NIC port. [Ver] Find PDR for 64 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 100kpps,\ +| | ... | LT=0.5%. +| | [Tags] | 4T4C | MTHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${64} +| | ${min_rate}= | Set Variable | ${100000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '4' worker threads and rxqueues '2' with jumbo frames 'no' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC15: 1518B NDR binary search - DUT l2fwd - 4threads 4cores 2rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 4 threads, 4 phy\ +| | ... | cores, 2 receive queues per NIC port. [Ver] Find NDR for 1518 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 10kpps. +| | [Tags] | 4T4C | MTHREAD | NDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${1518} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '4' worker threads and rxqueues '2' with jumbo frames 'no' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC16: 1518B PDR binary search - DUT l2fwd - 4threads 4cores 2rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 4 threads, 4 phy\ +| | ... | cores, 2 receive queues per NIC port. [Ver] Find PDR for 1518 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 10kpps,\ +| | ... | LT=0.5%. +| | [Tags] | 4T4C | MTHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${1518} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '4' worker threads and rxqueues '2' with jumbo frames 'no' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} + +| TC17: 9000B NDR binary search - DUT l2fwd - 4threads 4cores 2rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 4 threads, 4 phy\ +| | ... | cores, 2 receive queues per NIC port. [Ver] Find NDR for 9000 Byte\ +| | ... | frames using binary search start at 10GE linerate, step 10kpps. +| | [Tags] | 4T4C | MTHREAD | NDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${9000} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '4' worker threads and rxqueues '2' with jumbo frames 'yes' +| | Then Find NDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} + +| TC18: 9000B PDR binary search - DUT l2fwd - 4threads 4cores 2rxq +| | [Documentation] +| | ... | [Cfg] DUT runs L2 frame forwarding config with 4 threads, 4 phy\ +| | ... | cores, 2 receive queues per NIC port. [Ver] Find PDR for 9000 Byte +| | ... | frames using binary search start at 10GE linerate, step 5kpps,\ +| | ... | LT=0.5%. +| | [Tags] | 4T4C | MTHREAD | PDRDISC | SKIP_PATCH +| | ${framesize}= | Set Variable | ${9000} +| | ${min_rate}= | Set Variable | ${10000} +| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize} +| | ${binary_min}= | Set Variable | ${min_rate} +| | ${binary_max}= | Set Variable | ${max_rate} +| | ${threshold}= | Set Variable | ${min_rate} +| | Given Start L2FWD '4' worker threads and rxqueues '2' with jumbo frames 'yes' +| | Then Find PDR using binary search and pps | ${framesize} | ${binary_min} +| | ... | ${binary_max} | 3-node-bridge +| | ... | ${min_rate} | ${max_rate} +| | ... | ${threshold} +| | ... | ${glob_loss_acceptance} +| | ... | ${glob_loss_acceptance_type} diff --git a/dpdk-tests/perf/__init__.robot b/dpdk-tests/perf/__init__.robot new file mode 100644 index 0000000000..6358151fcb --- /dev/null +++ b/dpdk-tests/perf/__init__.robot @@ -0,0 +1,18 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Resource | resources/libraries/robot/default.robot +| Resource | resources/libraries/robot/interfaces.robot +| Library | resources.libraries.python.DPDK.SetupDPDKTest +| Suite Setup | Run Keyword | Setup DPDK Test | ${nodes} diff --git a/resources/libraries/python/DPDK/DPDKTools.py b/resources/libraries/python/DPDK/DPDKTools.py new file mode 100644 index 0000000000..e7fa2f4e76 --- /dev/null +++ b/resources/libraries/python/DPDK/DPDKTools.py @@ -0,0 +1,83 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +""" +This module exists to provide the init DPDK. +""" + +from resources.libraries.python.ssh import SSH +from resources.libraries.python.constants import Constants as con +from resources.libraries.python.topology import Topology + +class DPDKTools(object): + """Test the DPDK l2fwd performance.""" + + @staticmethod + def initialize_dpdk_environment(dut_node, dut_if1, dut_if2): + """ + Initialize the DPDK test environment on the dut_node. + Load the module uio and igb_uio, then bind the test NIC to the igb_uio. + + :param dut_node: Will init the DPDK on this node. + :param dut_if1: DUT interface name. + :param dut_if2: DUT interface name. + :type dut_node: dict + :type dut_if1: str + :type dut_if2: str + :returns: none + """ + pci_address1 = Topology.get_interface_pci_addr(dut_node, dut_if1) + pci_address2 = Topology.get_interface_pci_addr(dut_node, dut_if2) + + ssh = SSH() + ssh.connect(dut_node) + + cmd = 'cd {0}/dpdk-tests/dpdk_scripts/ && sudo ./init_dpdk.sh {1} {2}' \ + .format(con.REMOTE_FW_DIR, pci_address1, pci_address2) + + (ret_code, _, _) = ssh.exec_command(cmd, timeout=600) + if ret_code != 0: + raise Exception('Failed to bind the interfaces to igb_uio ' \ + 'at node {0}'.format(dut_node['host'])) + + @staticmethod + def cleanup_dpdk_environment(dut_node, dut_if1, dut_if2): + """ + Cleanup the DPDK test environment on the DUT node. + Unbind the NIC from the igb_uio and bind them to the kernel driver. + + :param dut_node: Will cleanup the DPDK on this node. + :param dut_if1: DUT interface name. + :param dut_if2: DUT interface name. + :type dut_node: dict + :type dut_if1: str + :type dut_if2: str + :returns: none + """ + pci_address1 = Topology.get_interface_pci_addr(dut_node, dut_if1) + if1_driver = Topology.get_interface_driver(dut_node, dut_if1) + pci_address2 = Topology.get_interface_pci_addr(dut_node, dut_if2) + if2_driver = Topology.get_interface_driver(dut_node, dut_if2) + + ssh = SSH() + ssh.connect(dut_node) + + cmd = 'cd {0}/dpdk-tests/dpdk_scripts/ && sudo ./cleanup_dpdk.sh ' \ + '{1} {2} {3} {4}'.format(con.REMOTE_FW_DIR, if1_driver, \ + pci_address1, if2_driver, pci_address2) + + (ret_code, _, _) = ssh.exec_command(cmd, timeout=600) + if ret_code != 0: + raise Exception('Failed to cleanup the dpdk at node {0}' + .format(dut_node['host'])) diff --git a/resources/libraries/python/DPDK/L2fwdTest.py b/resources/libraries/python/DPDK/L2fwdTest.py new file mode 100644 index 0000000000..fa2f879492 --- /dev/null +++ b/resources/libraries/python/DPDK/L2fwdTest.py @@ -0,0 +1,54 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +""" +This module exists to provide the l2fwd test for DPDK on topology nodes. +""" + +from resources.libraries.python.ssh import SSH +from resources.libraries.python.constants import Constants as con + +class L2fwdTest(object): + """Test the DPDK l2fwd performance.""" + + @staticmethod + def start_the_l2fwd_test(dut_node, cpu_coremask, nb_cores, queue_nums, + jumbo_frames): + """ + Execute the l2fwd on the dut_node. + + :param dut_node: Will execute the l2fwd on this node. + :param cpu_coremask: The DPDK run core mask. + :param nb_cores: The cores number for the forwarding. + :param queue_nums: The queues number for the NIC. + :param jumbo_frames: Is jumbo frames or not. + :type dut_node: dict + :type cpu_coremask: str + :type nb_cores: str + :type queue_nums: str + :type jumbo_frames: str + :returns: none + """ + ssh = SSH() + ssh.connect(dut_node) + + cmd = 'cd {0}/dpdk-tests/dpdk_scripts/ && sudo ./run_l2fwd.sh ' \ + '{1} {2} {3} {4}'.format(con.REMOTE_FW_DIR, cpu_coremask, \ + nb_cores, queue_nums, jumbo_frames) + + (ret_code, _, _) = ssh.exec_command(cmd, timeout=600) + if ret_code != 0: + raise Exception('Failed to execute l2fwd test at node {0}' + .format(dut_node['host'])) + diff --git a/resources/libraries/python/DPDK/SetupDPDKTest.py b/resources/libraries/python/DPDK/SetupDPDKTest.py new file mode 100644 index 0000000000..06bb9ee9eb --- /dev/null +++ b/resources/libraries/python/DPDK/SetupDPDKTest.py @@ -0,0 +1,218 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This module exists to provide setup utilities for the framework on topology +nodes. All tasks required to be run before the actual tests are started is +supposed to end up here. +""" + +from shlex import split +from subprocess import Popen, PIPE, call +from multiprocessing import Pool +from tempfile import NamedTemporaryFile +from os.path import basename + +from robot.api import logger +from robot.libraries.BuiltIn import BuiltIn + +from resources.libraries.python.ssh import SSH +from resources.libraries.python.constants import Constants as con +from resources.libraries.python.topology import NodeType + +__all__ = ["SetupDPDKTest"] + + +def pack_framework_dir(): + """Pack the testing WS into temp file, return its name.""" + + tmpfile = NamedTemporaryFile(suffix=".tgz", prefix="DPDK-testing-") + file_name = tmpfile.name + tmpfile.close() + + proc = Popen( + split("tar --exclude-vcs -zcf {0} .".format(file_name)), + stdout=PIPE, stderr=PIPE) + (stdout, stderr) = proc.communicate() + + logger.debug(stdout) + logger.debug(stderr) + + return_code = proc.wait() + if return_code != 0: + raise Exception("Could not pack testing framework.") + + return file_name + + +def copy_tarball_to_node(tarball, node): + """Copy tarball file from local host to remote node. + + :param tarball: Path to tarball to upload. + :param node: Dictionary created from topology. + :type tarball: str + :type node: dict + :returns: nothing + """ + logger.console('Copying tarball to {0}'.format(node['host'])) + ssh = SSH() + ssh.connect(node) + + ssh.scp(tarball, "/tmp/") + + +def extract_tarball_at_node(tarball, node): + """Extract tarball at given node. + + Extracts tarball using tar on given node to specific CSIT loocation. + + :param tarball: Path to tarball to upload. + :param node: Dictionary created from topology. + :type tarball: str + :type node: dict + :returns: nothing + """ + logger.console('Extracting tarball to {0} on {1}'.format( + con.REMOTE_FW_DIR, node['host'])) + ssh = SSH() + ssh.connect(node) + + cmd = 'sudo rm -rf {1}; mkdir {1} ; tar -zxf {0} -C {1}; ' \ + 'rm -f {0}'.format(tarball, con.REMOTE_FW_DIR) + (ret_code, _, stderr) = ssh.exec_command(cmd, timeout=30) + if ret_code != 0: + logger.error('Unpack error: {0}'.format(stderr)) + raise Exception('Failed to unpack {0} at node {1}'.format( + tarball, node['host'])) + + +def create_env_directory_at_node(node): + """ + Create fresh virtualenv to a directory, install pip requirements. + + :param node: Dictionary created from topology, will only install in the TG + :type node: dict + :returns: nothing + """ + logger.console('Extracting virtualenv, installing requirements.txt ' + 'on {0}'.format(node['host'])) + ssh = SSH() + ssh.connect(node) + (ret_code, stdout, stderr) = ssh.exec_command( + 'cd {0} && rm -rf env && virtualenv env && ' + '. env/bin/activate && pip install -r requirements.txt' + .format(con.REMOTE_FW_DIR), timeout=100) + if ret_code != 0: + logger.error('Virtualenv creation error: {0}'.format(stdout + stderr)) + raise Exception('Virtualenv setup failed') + else: + logger.console('Virtualenv created on {0}'.format(node['host'])) + +def install_dpdk_test(node): + """ + Prepare the DPDK test envrionment + + :param node: Dictionary created from topology + :type node: dict + :returns: nothing + """ + logger.console('Install the DPDK on {0}'.format(node['host'])) + + ssh = SSH() + ssh.connect(node) + + (ret_code, _, stderr) = ssh.exec_command( + 'cd {0}/dpdk-tests/dpdk_scripts/ && ./install_dpdk.sh' + .format(con.REMOTE_FW_DIR), timeout=600) + + if ret_code != 0: + logger.error('Install the DPDK error: {0}'.format(stderr)) + raise Exception('Install the DPDK failed') + else: + logger.console('Install the DPDK on {0} success!'.format(node['host'])) + +#pylint: disable=broad-except +def setup_node(args): + """Run all set-up methods for a node. + + This method is used as map_async parameter. It receives tuple with all + parameters as passed to map_async function. + + :param args: All parameters needed to setup one node. + :type args: tuple + :returns: True - success, False - error + :rtype: bool + """ + tarball, remote_tarball, node = args + try: + copy_tarball_to_node(tarball, node) + extract_tarball_at_node(remote_tarball, node) + if node['type'] == NodeType.DUT: + install_dpdk_test(node) + if node['type'] == NodeType.TG: + create_env_directory_at_node(node) + except Exception as exc: + logger.error("Node setup failed, error:'{0}'".format(exc.message)) + return False + else: + logger.console('Setup of node {0} done'.format(node['host'])) + return True + +def delete_local_tarball(tarball): + """Delete local tarball to prevent disk pollution. + + :param tarball: Path to tarball to upload. + :type tarball: str + :returns: nothing + """ + call(split('sh -c "rm {0} > /dev/null 2>&1"'.format(tarball))) + + +class SetupDPDKTest(object): + """Setup suite run on topology nodes. + + Many VAT/CLI based tests need the scripts at remote hosts before executing + them. This class packs the whole testing directory and copies it over + to all nodes in topology under /tmp/ + """ + + @staticmethod + def setup_dpdk_test(nodes): + """Pack the whole directory and extract in temp on each node.""" + + tarball = pack_framework_dir() + msg = 'Framework packed to {0}'.format(tarball) + logger.console(msg) + logger.trace(msg) + remote_tarball = "/tmp/{0}".format(basename(tarball)) + + # Turn off logging since we use multiprocessing + log_level = BuiltIn().set_log_level('NONE') + params = ((tarball, remote_tarball, node) for node in nodes.values()) + pool = Pool(processes=len(nodes)) + result = pool.map_async(setup_node, params) + pool.close() + pool.join() + + # Turn on logging + BuiltIn().set_log_level(log_level) + + logger.info( + 'Executed node setups in parallel, waiting for processes to end') + result.wait() + + logger.info('Results: {0}'.format(result.get())) + + logger.trace('Test framework copied to all topology nodes') + delete_local_tarball(tarball) + logger.console('All nodes are ready') + diff --git a/resources/libraries/python/DPDK/__init__.py b/resources/libraries/python/DPDK/__init__.py new file mode 100644 index 0000000000..03bc4c1006 --- /dev/null +++ b/resources/libraries/python/DPDK/__init__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +__init__ file for directory resources/libraries/python/DPDK +""" diff --git a/resources/libraries/robot/DPDK/default.robot b/resources/libraries/robot/DPDK/default.robot new file mode 100644 index 0000000000..bf01aec429 --- /dev/null +++ b/resources/libraries/robot/DPDK/default.robot @@ -0,0 +1,58 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Variables | resources/libraries/python/topology.py +| Library | resources.libraries.python.topology.Topology +| Library | resources.libraries.python.CpuUtils +| Library | resources.libraries.python.DUTSetup +| Library | resources.libraries.python.TGSetup +| Library | resources.libraries.python.DPDK.L2fwdTest +| Library | Collections + +*** Keywords *** +| Start L2FWD '${m}' worker threads and rxqueues '${n}' with jumbo frames '${b}' +| | [Documentation] | Start the l2fwd with M worker threads without HTT +| | ... | and rxqueues N and B(yes or no) jumbo frames in all DUTs +| | ${nb-cores}= | Catenate | ${m} +| | ${cpu}= | Run Keyword If | '${m}' == '1' | Catenate | 0x3 +| | ... | ELSE IF | '${m}' == '2' | Catenate | 0x403 +| | ... | ELSE IF | '${m}' == '4' | Catenate | 0xc07 +| | ... | ELSE IF | '${m}' == '6' | Catenate | 0x1c0f +| | ... | ELSE IF | '${m}' == '8' | Catenate | 0x3c1f +| | ... | ELSE | Fail | Not supported combination +| | ${rxqueues}= | Catenate | ${n} +| | ${jumbo_frames}= | Catenate | ${b} +| | Start l2fwd to all DUTs | ${cpu} | ${nb-cores} +| | ... | ${rxqueues} | ${jumbo_frames} + +| Start l2fwd to all DUTs +| | [Documentation] | Setup worker threads and rxqueues in l2fwd startup +| | ... | configuration to all DUTs +| | ... +| | ... | *Arguments:* +| | ... | - ${cpu} - CPU configuration. Type: string +| | ... | - ${nb-cores} - cores for the packet forwarding. Type: string +| | ... | - ${rxqueues} - rxqueues configuration. Type: string +| | ... | - ${jumbo_frames} - Enable the jumbo frames or not. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Start l2fwd to all DUTs \| 0x403 \| 2 \ +| | ... | \| 1 \| no +| | [Arguments] | ${cpu} | ${nb-cores} | ${rxqueues} | ${jumbo_frames} +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | :FOR | ${dut} | IN | @{duts} +| | | Start the l2fwd test | ${nodes['${dut}']} +| | | ... | ${cpu} | ${nb-cores} | ${rxqueues} | ${jumbo_frames} + diff --git a/resources/libraries/robot/performance.robot b/resources/libraries/robot/performance.robot index a42a889cd1..ebacc30e64 100644 --- a/resources/libraries/robot/performance.robot +++ b/resources/libraries/robot/performance.robot @@ -167,7 +167,7 @@ | | Append Node | ${nodes['TG']} | | Append Node | ${nodes['DUT1']} | filter_list=${iface_model_list} | | Append Node | ${nodes['TG']} -| | Compute Path +| | Compute Path | always_same_link=${FALSE} | | ${tg_if1} | ${tg}= | Next Interface | | ${dut1_if1} | ${dut1}= | Next Interface | | ${dut1_if2} | ${dut1}= | Next Interface @@ -1139,10 +1139,11 @@ | | ... | \| Measure latency \| 10 \| 4.0 \| 64 \| 3-node-IPv4 | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type} | | Return From Keyword If | ${rate} <= 10000 | ${-1} -| | Clear all counters on all DUTs +| | ${ret}= | For DPDK Performance Test +| | Run Keyword If | ${ret}==${FALSE} | Clear all counters on all DUTs | | Send traffic on tg | ${duration} | ${rate}pps | ${framesize} | | ... | ${topology_type} | warmup_time=0 -| | Show statistics on all DUTs +| | Run Keyword If | ${ret}==${FALSE} | Show statistics on all DUTs | | Run keyword and return | Get latency | Traffic should pass with no loss @@ -1164,10 +1165,11 @@ | | ... | ${fail_on_loss}=${True} | | Clear and show runtime counters with running traffic | ${duration} | | ... | ${rate} | ${framesize} | ${topology_type} -| | Clear all counters on all DUTs +| | ${ret}= | For DPDK Performance Test +| | Run Keyword If | ${ret}==${FALSE} | Clear all counters on all DUTs | | Send traffic on tg | ${duration} | ${rate} | ${framesize} | | ... | ${topology_type} | warmup_time=0 -| | Show statistics on all DUTs +| | Run Keyword If | ${ret}==${FALSE} | Show statistics on all DUTs | | Run Keyword If | ${fail_on_loss} | No traffic loss occurred | Traffic should pass with partial loss @@ -1192,10 +1194,11 @@ | | ... | ${fail_on_loss}=${True} | | Clear and show runtime counters with running traffic | ${duration} | | ... | ${rate} | ${framesize} | ${topology_type} -| | Clear all counters on all DUTs +| | ${ret}= | For DPDK Performance Test +| | Run Keyword If | ${ret}==${FALSE} | Clear all counters on all DUTs | | Send traffic on tg | ${duration} | ${rate} | ${framesize} | | ... | ${topology_type} | warmup_time=0 -| | Show statistics on all DUTs +| | Run Keyword If | ${ret}==${FALSE} | Show statistics on all DUTs | | Run Keyword If | ${fail_on_loss} | Partial traffic loss accepted | | ... | ${loss_acceptance} | ${loss_acceptance_type} @@ -1219,9 +1222,10 @@ | | Send traffic on tg | -1 | ${rate} | ${framesize} | | ... | ${topology_type} | warmup_time=0 | async_call=${True} | | ... | latency=${False} -| | Clear runtime counters on all DUTs +| | ${ret}= | For DPDK Performance Test +| | Run Keyword If | ${ret}==${FALSE} | Clear runtime counters on all DUTs | | Sleep | ${duration} -| | Show runtime counters on all DUTs +| | Run Keyword If | ${ret}==${FALSE} | Show runtime counters on all DUTs | | Stop traffic on tg | Add PCI devices to DUTs from 3-node single link topology @@ -1571,3 +1575,78 @@ | | dut1_v4.set_arp | ${dut1_if2} | ${dut2_dut1_ip4_address} | ${dut2_if1_mac} | | dut2_v4.set_arp | ${dut2_if1} | ${dut1_dut2_ip4_address} | ${dut1_if2_mac} +DPDK 2-node Performance Suite Setup with DUT's NIC model +| | [Documentation] +| | ... | Updates interfaces on all nodes and setup global +| | ... | variables used in test cases based on interface model provided as an +| | ... | argument. Initializes traffic generator. Initializes DPDK test +| | ... | environment. +| | ... +| | ... | *Arguments:* +| | ... | - topology_type - Topology type. Type: string +| | ... | - nic_model - Interface model. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| DPDK 2-node Performance Suite Setup with DUT's NIC model \ +| | ... | \| L2 \| Intel-X520-DA2 \| +| | [Arguments] | ${topology_type} | ${nic_model} +| | Setup performance global Variables +| | 2-node circular Topology Variables Setup with DUT interface model +| | ... | ${nic_model} +| | Initialize traffic generator | ${tg} | ${tg_if1} | ${tg_if2} +| | ... | ${dut1} | ${dut1_if1} +| | ... | ${dut1} | ${dut1_if2} +| | ... | ${topology_type} +| | Initialize DPDK Environment | ${dut1} | ${dut1_if1} | ${dut1_if2} + +DPDK 3-node Performance Suite Setup with DUT's NIC model +| | [Documentation] +| | ... | Updates interfaces on all nodes and setup global +| | ... | variables used in test cases based on interface model provided as an +| | ... | argument. Initializes traffic generator. Initializes DPDK test +| | ... | environment. +| | ... +| | ... | *Arguments:* +| | ... | - topology_type - Topology type. Type: string +| | ... | - nic_model - Interface model. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| 3-node Performance Suite Setup \| L2 \| Intel-X520-DA2 \| +| | [Arguments] | ${topology_type} | ${nic_model} +| | Setup performance global Variables +| | 3-node circular Topology Variables Setup with DUT interface model +| | ... | ${nic_model} +| | Initialize traffic generator | ${tg} | ${tg_if1} | ${tg_if2} +| | ... | ${dut1} | ${dut1_if1} +| | ... | ${dut2} | ${dut2_if2} +| | ... | ${topology_type} +| | Initialize DPDK Environment | ${dut1} | ${dut1_if1} | ${dut1_if2} +| | Initialize DPDK Environment | ${dut2} | ${dut2_if1} | ${dut2_if2} + +DPDK 3-node Performance Suite Teardown +| | [Documentation] +| | ... | Suite teardown phase with traffic generator teardown. +| | ... | Cleanup DPDK test environment. +| | ... +| | Teardown traffic generator | ${tg} +| | Cleanup DPDK Environment | ${dut1} | ${dut1_if1} | ${dut1_if2} +| | Cleanup DPDK Environment | ${dut2} | ${dut2_if1} | ${dut2_if2} + +DPDK 2-node Performance Suite Teardown +| | [Documentation] +| | ... | Suite teardown phase with traffic generator teardown. +| | ... | Cleanup DPDK test environment. +| | ... +| | Teardown traffic generator | ${tg} +| | Cleanup DPDK Environment | ${dut1} | ${dut1_if1} | ${dut1_if2} + +For DPDK Performance Test +| | [Documentation] +| | ... | Return TRUE if variable DPDK_TEST exist, otherwise FALSE. +| | ${ret} | ${tmp}= | Run Keyword And Ignore Error +| | ... | Variable Should Exist | ${DPDK_TEST} +| | Return From Keyword If | "${ret}" == "PASS" | ${TRUE} +| | Return From Keyword | ${FALSE} + -- 2.16.6