diff options
author | sharath <sharathkumarboyanapally@gmail.com> | 2018-08-21 11:01:26 +0530 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2018-09-27 08:18:41 +0000 |
commit | 19947738140e71d8d9fa90349e68f6261f5a612f (patch) | |
tree | 663ccab317082bf17dd5382fda754f56a57848c8 /tests/dmm | |
parent | ebd0c7defaffdd6cd3ff2b5f580c86601917a0c7 (diff) |
integration of DMM+lwip testscripts
Change-Id: Ifb1a0702353e71c61a694dea5164df41f4e23389
Signed-off-by: sharath <sharathkumarboyanapally@gmail.com>
Diffstat (limited to 'tests/dmm')
-rwxr-xr-x | tests/dmm/dmm_scripts/install_dmm.sh | 128 | ||||
-rwxr-xr-x | tests/dmm/dmm_scripts/install_prereq.sh | 28 | ||||
-rwxr-xr-x | tests/dmm/dmm_scripts/kill_given_proc.sh | 31 | ||||
-rwxr-xr-x | tests/dmm/dmm_scripts/run_dmm.sh | 136 | ||||
-rwxr-xr-x | tests/dmm/dmm_scripts/run_dmm_with_lwip.sh | 44 | ||||
-rwxr-xr-x | tests/dmm/dmm_scripts/setup_hugepage.sh | 37 | ||||
-rw-r--r-- | tests/dmm/func/SingleCliSer-func.robot | 31 |
7 files changed, 193 insertions, 242 deletions
diff --git a/tests/dmm/dmm_scripts/install_dmm.sh b/tests/dmm/dmm_scripts/install_dmm.sh deleted file mode 100755 index d6b7a862eb..0000000000 --- a/tests/dmm/dmm_scripts/install_dmm.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash - -set -x - -TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S) -OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') -ROOTDIR=/tmp/DMM-testing - -DMM_DIR=${ROOTDIR}/dmm/ - -#DPDK download path -DPDK_DOWNLOAD_PATH=/tmp/dpdk - -#dpdk installation path -DPDK_INSTALL_PATH=/usr - -# compile and install the DPDK -echo "DPDK build started....." -cd ${ROOTDIR} -chmod +x *.deb -sudo dpkg -i libnuma1_2.0.11-1ubuntu1.1_amd64.deb -sudo dpkg -i libnuma-dev_2.0.11-1ubuntu1.1_amd64.deb - -#DPDK will be having dependancy on linux headers -if [ "$OS_ID" == "ubuntu" ]; then - sudo apt-get -y install git build-essential linux-headers-`uname -r` - sudo apt-get install libnuma-dev -elif [ "$OS_ID" == "debian" ]; then - sudo apt-get -y install git build-essential linux-headers-`uname -r` -elif [ "$OS_ID" == "centos" ]; then - sudo yum groupinstall -y "Development Tools" - sudo yum install -y kernel-headers -elif [ "$OS_ID" == "opensuse" ]; then - sudo yum groupinstall -y "Development Tools" - sudo yum install -y kernel-headers -fi - -#===========build DPDK================ -mkdir -p $DPDK_DOWNLOAD_PATH - -DPDK_FOLDER=$DPDK_DOWNLOAD_PATH/dpdk-18.02-$TIMESTAMP -cd $DPDK_DOWNLOAD_PATH -mkdir $DPDK_FOLDER -tar xvf /tmp/DMM-testing/dpdk-18.02.tar.xz -C $DPDK_FOLDER -cd $DPDK_FOLDER/dpdk-18.02 - -sed -i 's!CONFIG_RTE_EXEC_ENV=.*!CONFIG_RTE_EXEC_ENV=y!1' config/common_base -sed -i 's!CONFIG_RTE_BUILD_SHARED_LIB=.*!CONFIG_RTE_BUILD_SHARED_LIB=y!1' config/common_base -sed -i 's!CONFIG_RTE_LIBRTE_EAL=.*!CONFIG_RTE_LIBRTE_EAL=y!1' config/common_base -sed -i 's!CONFIG_RTE_EAL_PMD_PATH=.*!CONFIG_RTE_EAL_PMD_PATH="/tmp/dpdk/drivers/"!1' config/common_base - -sudo make install T=x86_64-native-linuxapp-gcc DESTDIR=${DPDK_INSTALL_PATH} -j 4 -if [ $? -eq 0 ] -then - echo "DPDK build is SUCCESS" -else - echo "DPDK build has FAILED" - exit 1 -fi - -mkdir -p /tmp/dpdk/drivers/ -cp -f /usr/lib/librte_mempool_ring.so /tmp/dpdk/drivers/ - -export NSTACK_LOG_ON=DBG - -# Try to kill the vs_epoll -sudo killall vs_epoll - -sudo pgrep vs_epoll -if [ $? -eq "0" ]; then - success=false - sudo pkill vs_epoll - echo "RC = $?" - for attempt in {1..5}; do - echo "Checking if vs_epoll is still alive, attempt nr ${attempt}" - sudo pgrep vs_epoll - if [ $? -eq "1" ]; then - echo "vs_epoll is dead" - success=true - break - fi - echo "vs_epoll is still alive, waiting 1 second" - sleep 1 - done - if [ "$success" = false ]; then - echo "The command sudo pkill vs_epoll failed" - sudo pkill -9 vs_epoll - echo "RC = $?" - exit 1 - fi -else - echo "vs_epoll is not running" -fi - -# check and setup the hugepages -SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages) -hugepageFree=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages) - -if [ ${SYS_HUGEPAGE} -lt 1024 ] || [ $hugepageFree -eq 0 ]; then - MOUNT=$(mount | grep /mnt/nstackhuge) - count=$(mount | grep /mnt/nstackhuge | wc -l) - - while [ "${MOUNT}" != "" ] || [ "${count}" -ne 0 ] - do - sudo umount /mnt/nstackhuge - sleep 1 - MOUNT=$(mount | grep /mnt/nstackhuge) - count=$[$count -1] - done - - sock_count=$(lscpu | grep 'Socket(s):' | head -1 | awk '{print $2}') - ls -l /sys/devices/system/node/ - - while [ "${sock_count}" -ne 0 ] - do - sock_count=$[$sock_count - 1] - echo 1024 | sudo tee /sys/devices/system/node/node"$sock_count"/hugepages/hugepages-2048kB/nr_hugepages - done - - sudo mkdir -p /mnt/nstackhuge - sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ - test $? -eq 0 || exit 1 -else - sudo mkdir -p /mnt/nstackhuge - sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ -fi - -sudo mkdir -p /var/run/ip_module/ diff --git a/tests/dmm/dmm_scripts/install_prereq.sh b/tests/dmm/dmm_scripts/install_prereq.sh new file mode 100755 index 0000000000..b03769ba6a --- /dev/null +++ b/tests/dmm/dmm_scripts/install_prereq.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -x +SCRIPT_DIR=`dirname $(readlink -f $0)` +ROOTDIR=$SCRIPT_DIR/../../../ + +cd ${ROOTDIR} +chmod +x *.deb +sudo dpkg -i libnuma1_2.0.11-1ubuntu1.1_amd64.deb +sudo dpkg -i libnuma-dev_2.0.11-1ubuntu1.1_amd64.deb +sudo dpkg -i ethtool_4.5-1_amd64.deb +sudo dpkg -i lsof_4.89+dfsg-0.1_amd64.deb + +DPDK_DOWNLOAD_PATH=$(cat $ROOTDIR/dmm/scripts/build_dpdk.sh | grep DPDK_DOWNLOAD_PATH= | cut -d "=" -f2) +sudo rm /tmp/dpdk +mkdir -p $DPDK_DOWNLOAD_PATH +mv $ROOTDIR/dpdk-18.02.tar.xz $DPDK_DOWNLOAD_PATH +# install DPDK +cp -f $ROOTDIR/dmm/scripts/build_dpdk.sh $ROOTDIR/dmm/scripts/build_dpdk_csit.sh +sed -i 's!wget.*!#comment wget!1' $ROOTDIR/dmm/scripts/build_dpdk_csit.sh +bash -x $ROOTDIR/dmm/scripts/build_dpdk_csit.sh + +sudo modprobe uio +sudo modprobe uio_pci_generic +sudo insmod $DPDK_DOWNLOAD_PATH/dpdk-18.02/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko + +bash $SCRIPT_DIR/kill_given_proc.sh vs_epoll +bash $SCRIPT_DIR/setup_hugepage.sh diff --git a/tests/dmm/dmm_scripts/kill_given_proc.sh b/tests/dmm/dmm_scripts/kill_given_proc.sh new file mode 100755 index 0000000000..772643a316 --- /dev/null +++ b/tests/dmm/dmm_scripts/kill_given_proc.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +proc_name=$1 +sudo pgrep $proc_name +if [ $? -eq "0" ]; then + success=false + sudo pkill $proc_name + echo "RC = $?" + for attempt in {1..5}; do + echo "Checking if '$proc_name' is still alive, attempt nr ${attempt}" + sudo pgrep $proc_name + if [ $? -eq "1" ]; then + echo "'$proc_name' is dead" + success=true + break + fi + echo "'$proc_name' is still alive, waiting 1 second" + sleep 1 + done + if [ "$success" = false ]; then + echo "The command sudo pkill '$proc_name' failed" + sudo pkill -9 $proc_name + echo "RC = $?" + exit 1 + fi +else + echo "'$proc_name' is not running" +fi + +sleep 2 +exit 0
\ No newline at end of file diff --git a/tests/dmm/dmm_scripts/run_dmm.sh b/tests/dmm/dmm_scripts/run_dmm.sh index 456be1fa25..fd61fe842a 100755 --- a/tests/dmm/dmm_scripts/run_dmm.sh +++ b/tests/dmm/dmm_scripts/run_dmm.sh @@ -2,121 +2,35 @@ set -x -OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') -ROOTDIR=/tmp/DMM-testing -PWDDIR=$(pwd) -APP_DIR=${ROOTDIR}/dmm/release/bin/ -LIB_PATH=${APP_DIR}/../lib64 -dut1_ip=$1 -dut2_ip=$2 -proc_name=$3 -#proc_name => 0 = server, 1= client - -# Try to kill the vs_epoll -sudo killall vs_epoll - -sudo pgrep vs_epoll -if [ $? -eq "0" ]; then - success=false - sudo pkill vs_epoll - echo "RC = $?" - for attempt in {1..5}; do - echo "Checking if vs_epoll is still alive, attempt nr ${attempt}" - sudo pgrep vs_epoll - if [ $? -eq "1" ]; then - echo "vs_epoll is dead" - success=true - break - fi - echo "vs_epoll is still alive, waiting 1 second" - sleep 1 - done - if [ "$success" = false ]; then - echo "The command sudo pkill vs_epoll failed" - sudo pkill -9 vs_epoll - echo "RC = $?" - exit 1 - fi -else - echo "vs_epoll is not running" -fi - -sleep 2 - -cat /proc/meminfo - -cd ${LIB_PATH} -chmod 777 * -ls -l - -cd ${APP_DIR} -cp -r ${LIB_PATH}/* . -cp -r ../configure/* . -chmod 777 * - -if [ "$OS_ID" == "ubuntu" ]; then - ifaddress1=$(ifconfig eth1 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}') - echo $ifaddress1 - ifaddress2=$(ifconfig eth2 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}') - echo $ifaddress2 -elif [ "$OS_ID" == "centos" ]; then - ifaddress1=$(ifconfig enp0s8 | grep 'inet' | cut -d: -f2 | awk '{print $2}') - echo $ifaddress1 - ifaddress2=$(ifconfig enp0s9 | grep 'inet' | cut -d: -f2 | awk '{print $2}') - echo $ifaddress2 -fi - -echo '{ - "default_stack_name": "kernel", - "module_list": [ - { - "stack_name": "kernel", - "function_name": "kernel_stack_register", - "libname": "./", - "loadtype": "static", - "deploytype": "1", - "maxfd": "1024", - "minfd": "0", - "priorty": "1", - "stackid": "0", - }, - ] -}' | tee module_config.json - -echo '{ - "ip_route": [ - { - "subnet": "'$ifaddress1'/24", - "type": "nstack-kernel", - }, - { - "subnet": "'$ifaddress2'/24", - "type": "nstack-kernel", - }, - ], - "prot_route": [ - { - "proto_type": "1", - "type": "nstack-kernel", - }, - { - "proto_type": "2", - "type": "nstack-kernel", - } - ], -}' | tee rd_config.json +CUR_DIR=`dirname $(readlink -f $0)` +ROOTDIR=$CUR_DIR/../../../ +APP_DIR=${ROOTDIR}/dmm/config/app_test +LIB_PATH=${ROOTDIR}/dmm/release/lib64 +DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts +#proc_name => 0 = server, 1= client +proc_name=$1 +ifname=$2 +dut1_if_ip=$3 +dut2_if_ip=$4 + +ip addr +lspci -nn +lsmod | grep uio +bash kill_given_proc.sh vs_epoll + +cp -f $DMM_SCRIPT_DIR/prep_app_test.sh $DMM_SCRIPT_DIR/prep_app_test_csit.sh +sed -i 's!.*check_hugepage.sh!#skip hugepage check!1' $DMM_SCRIPT_DIR/prep_app_test_csit.sh +sed -i 's!enp0s8!'$ifname'!1' $DMM_SCRIPT_DIR/prep_app_test_csit.sh +bash -x $DMM_SCRIPT_DIR/prep_app_test_csit.sh + +cd $APP_DIR ls -l - #only for kernal stack if [ ${proc_name} -eq 0 ]; then -sudo LD_LIBRARY_PATH=${LIB_PATH} ./vs_epoll -p 20000 -d ${dut2_ip} -a 10000 -s ${dut1_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 +sudo LD_LIBRARY_PATH=${LIB_PATH} ./vs_epoll -p 20000 -d ${dut2_if_ip} -a 10000 -s ${dut1_if_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 else -sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_common -p 20000 -d ${dut1_ip} -a 10000 -s ${dut2_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 +sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_common -p 20000 -d ${dut1_if_ip} -a 10000 -s ${dut2_if_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 fi -cd ${PWDDIR} - -ps -elf | grep vs_epoll - -sleep 10 +exit 0
\ No newline at end of file diff --git a/tests/dmm/dmm_scripts/run_dmm_with_lwip.sh b/tests/dmm/dmm_scripts/run_dmm_with_lwip.sh new file mode 100755 index 0000000000..38b4c20978 --- /dev/null +++ b/tests/dmm/dmm_scripts/run_dmm_with_lwip.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -x +CUR_DIR=`dirname $(readlink -f $0)` +ROOTDIR=$CUR_DIR/../../../ +APP_DIR=${ROOTDIR}/dmm/stacks/lwip_stack/app_test/ +LIB_PATH=${APP_DIR}/../release/lib64/ +VAG_DIR=${ROOTDIR}/dmm/stacks/lwip_stack/vagrant +#proc_name => 0 = server, 1= client +proc_name=$1 +ifname=$2 +dut1_if_ip=$3 +dut2_if_ip=$4 + +# Try to kill the vs_epoll +bash $CUR_DIR/kill_given_proc.sh vs_epoll +cat /proc/meminfo + +cp -f $VAG_DIR/start_nstackMain.sh $VAG_DIR/start_nstackMain_csit.sh +sed -i 's!.*check_hugepage.sh!#skip hugepage check!1' $VAG_DIR/start_nstackMain_csit.sh +sed -i 's!ifname=.*!ifname='$ifname'!1' $VAG_DIR/start_nstackMain_csit.sh +sudo LD_LIBRARY_PATH=${LIB_PATH} bash $VAG_DIR/start_nstackMain_csit.sh || exit 1 + +sleep 5 + +#after nstackmain +echo "after nstackmain" +ip addr +lspci -nn +lsmod | grep uio +cat /proc/meminfo | grep Huge +/tmp/dpdk/dpdk-18.02/usertools/dpdk-devbind.py --status + +cd ${APP_DIR} + +if [ ${proc_name} -eq 0 ]; then +sudo NSTACK_LOG_ON=DBG LD_LIBRARY_PATH=${LIB_PATH} ./vs_epoll -p 20000 -d ${dut2_if_ip} -a 10000 -s ${dut1_if_ip} -l 200 -t 50000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 +else +sudo NSTACK_LOG_ON=DBG LD_LIBRARY_PATH=${LIB_PATH} ./vc_common -p 20000 -d ${dut1_if_ip} -a 10000 -s ${dut2_if_ip} -l 200 -t 50 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 +fi + +cd $APP_DIR/../release/ +sudo ./stop_nstack.sh +exit 0 diff --git a/tests/dmm/dmm_scripts/setup_hugepage.sh b/tests/dmm/dmm_scripts/setup_hugepage.sh new file mode 100755 index 0000000000..be25709e01 --- /dev/null +++ b/tests/dmm/dmm_scripts/setup_hugepage.sh @@ -0,0 +1,37 @@ +#!/bin/bash -x + +# check and setup the hugepages +SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages) +hugepageFree=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages) + +if [ ${SYS_HUGEPAGE} -lt 1536 ] || [ $hugepageFree -eq 0 ]; then + MOUNT=$(mount | grep /mnt/nstackhuge) + count=$(mount | grep /mnt/nstackhuge | wc -l) + + while [ "${MOUNT}" != "" ] || [ "${count}" -ne 0 ] + do + sudo umount /mnt/nstackhuge + sleep 1 + MOUNT=$(mount | grep /mnt/nstackhuge) + count=$[$count -1] + done + + sock_count=$(lscpu | grep 'Socket(s):' | head -1 | awk '{print $2}') + ls -l /sys/devices/system/node/ + + while [ "${sock_count}" -ne 0 ] + do + sock_count=$[$sock_count - 1] + echo 1536 | sudo tee /sys/devices/system/node/node"$sock_count"/hugepages/hugepages-2048kB/nr_hugepages + done + + sudo mkdir -p /mnt/nstackhuge + sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ + test $? -eq 0 || exit 1 +else + sudo mkdir -p /mnt/nstackhuge + sudo mount -t hugetlbfs -o pagesize=2M none /mnt/nstackhuge/ +fi + +cat /proc/meminfo +exit 0 diff --git a/tests/dmm/func/SingleCliSer-func.robot b/tests/dmm/func/SingleCliSer-func.robot index fbe651dbfa..4cfa6a0259 100644 --- a/tests/dmm/func/SingleCliSer-func.robot +++ b/tests/dmm/func/SingleCliSer-func.robot @@ -27,11 +27,36 @@ | ... | between nodes. From this topology only DUT1 and DUT2 nodes are used. | ... | here we test the 1. test the vs_epool and vc_epoll +*** Variables *** +| ${ip4_net1_1}= | 172.28.128.3 +| ${ip4_net2_1}= | 172.28.128.4 +| ${ip4_prefix}= | 24 + *** Test Cases *** | TC01: DMM base vs epoll test case -| | Given Path for 2-node testing is set | ${nodes['DUT1']} | ${nodes['DUT2']} -| | And Pick out the port used to execute test +| | Given DMM Basic Test Setup | | When Exec the base vs epoll test | ${dut1_node} | ${dut2_node} +| | ... | ${dut1_to_dut2_if_name} | ${dut2_to_dut1_if_name} +| | ... | ${ip4_net1_1} | ${ip4_net2_1} | | Echo DMM logs | ${dut2_node} | | ${no_packet_loss} = | Get the test result | ${dut2_node} -| | Then Should Not Be Equal As Integers | ${no_packet_loss} | 0
\ No newline at end of file +| | Then Should Not Be Equal As Integers | ${no_packet_loss} | 0 + +| TC02: DMM LWIP integration test case +| | Given DMM Basic Test Setup +| | When Exec the base lwip test | ${dut1_node} | ${dut2_node} +| | ... | ${dut1_to_dut2_if_name} | ${dut2_to_dut1_if_name} +| | ... | ${ip4_net1_1} | ${ip4_net2_1} +| | Echo running log | ${dut1_node} | ${dut2_node} +| | Echo dpdk log | ${dut1_node} | ${dut2_node} +| | ${no_packet_loss_lwip} = | Get lwip test result | ${dut2_node} +| | Then Should Not Be Equal As Integers | ${no_packet_loss_lwip} | 0 + +*** Keywords *** +| DMM Basic Test Setup +| | Path for 2-node testing is set | ${nodes['DUT1']} | ${nodes['DUT2']} +| | Pick out the port used to execute test +| | Set DMM Interface Address | ${dut1_node} | +| | ... | ${dut1_to_dut2_if_name} | ${ip4_net1_1} | ${ip4_prefix} +| | Set DMM Interface Address | ${dut2_node} +| | ... | ${dut2_to_dut1_if_name} | ${ip4_net2_1} | ${ip4_prefix} |