diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | bootstrap-DMM.sh | 7 | ||||
-rw-r--r-- | resources/libraries/python/DMM/SetupDMMTest.py | 7 | ||||
-rw-r--r-- | resources/libraries/python/DMM/SingleCliSer.py | 213 | ||||
-rw-r--r-- | resources/libraries/robot/dmm/dmm_utils.robot | 18 | ||||
-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 |
12 files changed, 366 insertions, 315 deletions
diff --git a/.gitignore b/.gitignore index 41ac50afaa..e12f651b29 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ report.html *~ *.log .idea +dmm/** diff --git a/bootstrap-DMM.sh b/bootstrap-DMM.sh index fd212c51ef..4828868d84 100755 --- a/bootstrap-DMM.sh +++ b/bootstrap-DMM.sh @@ -180,13 +180,16 @@ echo "Selected VIRL servers: ${VIRL_SERVER[@]}" DMM_TAR_FILE="dmm_depends.tar.gz" cd dmm/scripts/ -./build.sh +./build.sh all cd - -mv /tmp/dpdk/dpdk-18.02.tar.xz . +DPDK_DOWNLOAD_PATH=$(cat dmm/scripts/build_dpdk.sh | grep DPDK_DOWNLOAD_PATH= | cut -d "=" -f2) +mv $DPDK_DOWNLOAD_PATH/dpdk-18.02.tar.xz . wget http://security.ubuntu.com/ubuntu/pool/main/n/numactl/libnuma1_2.0.11-1ubuntu1.1_amd64.deb wget http://security.ubuntu.com/ubuntu/pool/main/n/numactl/libnuma-dev_2.0.11-1ubuntu1.1_amd64.deb +wget http://security.ubuntu.com/ubuntu/pool/main/e/ethtool/ethtool_4.5-1_amd64.deb +wget http://security.ubuntu.com/ubuntu/pool/main/l/lsof/lsof_4.89+dfsg-0.1_amd64.deb tar zcf ${DMM_TAR_FILE} dpdk-18.02.tar.xz ./dmm/ libnuma*.deb diff --git a/resources/libraries/python/DMM/SetupDMMTest.py b/resources/libraries/python/DMM/SetupDMMTest.py index 7d219fcfd4..7bb596546c 100644 --- a/resources/libraries/python/DMM/SetupDMMTest.py +++ b/resources/libraries/python/DMM/SetupDMMTest.py @@ -100,14 +100,15 @@ def install_dmm_test(node): ssh = SSH() ssh.connect(node) (ret_code, _, stderr) = ssh.exec_command( - 'cd {0}/{1} && ./install_dmm.sh {2} 2>&1 | tee log_install_dmm.txt' + 'cd {0}/{1} && ./install_prereq.sh {2} 2>&1 | tee ' + 'log_install_prereq.txt' .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS, arch), timeout=600) if ret_code != 0: logger.error('Install the DMM error: {0}'.format(stderr)) - raise RuntimeError('Install the DMM failed') + raise RuntimeError('Install prereq failed') else: - logger.console('Install the DMM on {0} success!'.format(node['host'])) + logger.console('Install prereq on {0} success!'.format(node['host'])) def setup_node(args): """Run all set-up methods for a node. diff --git a/resources/libraries/python/DMM/SingleCliSer.py b/resources/libraries/python/DMM/SingleCliSer.py index 9bf18bb9eb..e96843ac36 100644 --- a/resources/libraries/python/DMM/SingleCliSer.py +++ b/resources/libraries/python/DMM/SingleCliSer.py @@ -17,98 +17,191 @@ This module exists to provide the vs_epoll ping test for DMM on topology nodes. """ import time -from resources.libraries.python.ssh import SSH +from resources.libraries.python.ssh import exec_cmd_no_error from resources.libraries.python.DMM.DMMConstants import DMMConstants as con from resources.libraries.python.topology import Topology -from robot.api import logger class SingleCliSer(object): """Test the DMM vs_epoll ping function.""" @staticmethod - def exec_the_base_vs_epoll_test(dut1_node, dut2_node): - """Execute the vs_epoll on the dut1_node. - - :param dut1_node: Will execute the vs_epoll on this node. - :param dut2_node: Will execute the vc_epoll on this node. + def exec_the_base_vs_epoll_test(dut1_node, dut2_node, + dut1_if_name, dut2_if_name, + dut1_if_ip, dut2_if_ip): + """ + Perform base vs_epoll test on DUT's. + + :param dut1_node: Node to execute vs_epoll on. + :param dut2_node: Node to execute vc_common on. + :param dut1_if_name: DUT1 to DUT2 interface name. + :param dut2_if_name: DUT2 to DUT1 interface name. + :param dut1_if_ip: DUT1 to DUT2 interface ip. + :param dut2_if_ip: DUT2 to DUT1 interface ip. :type dut1_node: dict :type dut2_node: dict - :returns: positive value if packets are sent and received - :raises RuntimeError:If failed to execute vs_epoll test on dut1_node. + :type dut1_if_name: str + :type dut2_if_name: str + :type dut1_if_ip: str + :type dut2_if_ip: str """ - dut1_ip = Topology.get_node_hostname(dut1_node) - dut2_ip = Topology.get_node_hostname(dut2_node) - - ssh = SSH() - ssh.connect(dut1_node) - - cmd = 'cd {0}/{1} && ./run_dmm.sh {2} {3} {4} ' \ - .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS, dut1_ip, dut2_ip, 0) + cmd = 'cd {0}/{1} && ./run_dmm.sh {2} {3} {4} {5} ' \ + .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS, 0, dut1_if_name, + dut1_if_ip, dut2_if_ip) cmd += '2>&1 | tee log_run_dmm.txt &' - - (ret_code, _, _) = ssh.exec_command(cmd, timeout=6000) - if ret_code != 0: - raise RuntimeError('Failed to execute vs_epoll test at node {0}' - .format(dut1_node['host'])) - + exec_cmd_no_error(dut1_node, cmd) time.sleep(10) - ssh = SSH() - ssh.connect(dut2_node) - - cmd = 'cd {0}/{1} && ./run_dmm.sh {2} {3} {4} ' \ - .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS, dut1_ip, dut2_ip, 1) + cmd = 'cd {0}/{1} && ./run_dmm.sh {2} {3} {4} {5} ' \ + .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS, 1, dut2_if_name, + dut1_if_ip, dut2_if_ip) cmd += '2>&1 | tee log_run_dmm.txt' - - (ret_code, stdout_cli, _) = ssh.exec_command(cmd, timeout=6000) - if ret_code != 0: - raise RuntimeError('Failed to execute vs_epoll test at node {0}' - .format(dut1_node['host'])) - - return stdout_cli.find("send 50000") + exec_cmd_no_error(dut2_node, cmd) @staticmethod def get_the_test_result(dut_node): """ After executing exec_the_base_vs_epoll_test, use this - to get the test result + to get the test result. - :param dut_node: will get the test result in this dut node + :param dut_node: Node to get the test result on. :type dut_node: dict - :returns: str. - :rtype: str. - :raises RuntimeError: If failed to get the test result. + :returns: Word count of "send 50000" in the log. + :rtype: str """ - ssh = SSH() - ssh.connect(dut_node) cmd = 'cat {0}/{1}/log_run_dmm.txt | grep "send 50000" | wc -l' \ .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS) - - (ret_code, stdout, _) = ssh.exec_command(cmd, timeout=100) - if ret_code != 0: - raise RuntimeError('Failed to get test result at node {0}' - .format(dut_node['host'])) - + (stdout, _) = exec_cmd_no_error(dut_node, cmd) return stdout @staticmethod def echo_dmm_logs(dut_node): """ - :param dut_node: - :return: + Get the prerequisites installation log from DUT. + + :param dut_node: Node to get the installation log on. + :type dut_node: dict """ - ssh = SSH() - ssh.connect(dut_node) - cmd = 'cat {0}/{1}/log_install_dmm.txt' \ + cmd = 'cat {0}/{1}/log_install_prereq.txt' \ .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS) + exec_cmd_no_error(dut_node, cmd) + + @staticmethod + def exec_the_base_lwip_test(dut1_node, dut2_node, + dut1_if_name, dut2_if_name, + dut1_if_ip, dut2_if_ip): + """Test DMM with LWIP. + + :param dut1_node: Node to execute vs_epoll on. + :param dut2_node: Node to execute vc_common on. + :param dut1_if_name: DUT1 to DUT2 interface name. + :param dut2_if_name: DUT2 to DUT1 interface name. + :param dut1_if_ip: DUT1 to DUT2 interface ip. + :param dut2_if_ip: DUT2 to DUT1 interface ip. + :type dut1_node: dict + :type dut2_node: dict + :type dut1_if_name: str + :type dut2_if_name: str + :type dut1_if_ip: str + :type dut2_if_ip: str + """ + cmd = 'cd {0}/{1} && ./run_dmm_with_lwip.sh {2} {3} {4} {5} ' \ + .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS, 0, dut1_if_name, + dut1_if_ip, dut2_if_ip) + + cmd += '2>&1 | tee log_run_dmm_with_lwip.txt &' + exec_cmd_no_error(dut1_node, cmd) + time.sleep(10) + + cmd = 'cd {0}/{1} && ./run_dmm_with_lwip.sh {2} {3} {4} {5} ' \ + .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS, 1, dut2_if_name, + dut1_if_ip, dut2_if_ip) - (ret_code, stdout, _) = ssh.exec_command(cmd, timeout=100) - if ret_code != 0: - raise RuntimeError('Failed to get log_install_dmm at node {0}' - .format(dut_node['host'])) - else: - logger.console('....log_install_dmm on node {1}.... {0}' - .format(stdout, dut_node['host'])) + cmd += '2>&1 | tee log_run_dmm_with_lwip.txt' + exec_cmd_no_error(dut2_node, cmd) + + @staticmethod + def get_lwip_test_result(dut_node): + """ + After executing exec_the_base_lwip_test, use this + to get the test result. + + :param dut_node: Node to get the test result on. + :type dut_node: dict + :returns: Word count of "send 50" in the log. + :rtype: str + """ + cmd = 'cat {0}/{1}/log_run_dmm_with_lwip.txt | grep "send 50" | wc -l' \ + .format(con.REMOTE_FW_DIR, con.DMM_SCRIPTS) + (stdout, _) = exec_cmd_no_error(dut_node, cmd) + return stdout + + @staticmethod + def echo_running_log(dut1_node, dut2_node): + """ + Get the running log. + + :param dut1_node: Node to get the running log on. + :param dut2_node: Node to get the running log on. + :type dut1_node: dict + :type dut2_node: dict + """ + cmd = 'cat /var/log/nStack/running.log' + exec_cmd_no_error(dut1_node, cmd) + exec_cmd_no_error(dut2_node, cmd) + + @staticmethod + def echo_dpdk_log(dut1_node, dut2_node): + """ + Get the dpdk log. + + :param dut1_node: Node to get the DPDK log on. + :param dut2_node: Node to get the DPDK log on. + :type dut1_node: dict + :type dut2_node: dict + """ + cmd = 'cat /var/log/nstack-dpdk/nstack_dpdk.log' + exec_cmd_no_error(dut1_node, cmd) + exec_cmd_no_error(dut2_node, cmd) + + @staticmethod + def dmm_get_interface_name(dut_node, dut_interface): + """ + Get the interface name. + + :param dut_node: Node to get the interface name on. + :param dut_interface: Interface key. + :type dut_node: dict + :type dut_interface: str + :returns: Interface name. + :rtype: str + """ + mac = Topology.get_interface_mac(dut_node, dut_interface) + cmd = 'ifconfig -a | grep {0}'.format(mac) + (stdout, _) = exec_cmd_no_error(dut_node, cmd) + interface_name = stdout.split(' ', 1)[0] + return interface_name + + @staticmethod + def set_dmm_interface_address(dut_node, ifname, ip_addr, ip4_prefix): + """ + Flush ip, set ip, set interface up. + + :param dut_node: Node to set the interface address on. + :param ifname: Interface name. + :param ip_addr: IP address to configure. + :param ip4_prefix: Prefix length. + :type dut_node: dict + :type ifname: str + :type ip_addr: str + :type ip4_prefix: int + """ + cmd = 'sudo ip -4 addr flush dev {}'.format(ifname) + exec_cmd_no_error(dut_node, cmd) + cmd = 'sudo ip addr add {}/{} dev {}'\ + .format(ip_addr, ip4_prefix, ifname) + exec_cmd_no_error(dut_node, cmd) + cmd = 'sudo ip link set {0} up'.format(ifname) + exec_cmd_no_error(dut_node, cmd) diff --git a/resources/libraries/robot/dmm/dmm_utils.robot b/resources/libraries/robot/dmm/dmm_utils.robot index 24931768fb..231c92a4f1 100644 --- a/resources/libraries/robot/dmm/dmm_utils.robot +++ b/resources/libraries/robot/dmm/dmm_utils.robot @@ -51,13 +51,15 @@ | | ... | | ... | \| Pick out the port used to execute test \| | | ... -| | ${tg_port} | ${tg_node}= | First Interface -| | ${dut1_port} | ${dut1_node}= | Next Interface -| | ${dut2_port} | ${dut2_node}= | Last Interface -| | Set Suite Variable | ${tg_node} +| | ${dut1_to_dut2_if} | ${dut1_node}= | Next Interface +| | ${dut2_to_dut1_if} | ${dut2_node}= | Next Interface +| | ${dut1_to_dut2_if_name}= | DMM Get Interface Name +| | ... | ${dut1_node} | ${dut1_to_dut2_if} +| | ${dut2_to_dut1_if_name}= | DMM Get Interface Name +| | ... | ${dut2_node} | ${dut2_to_dut1_if} | | Set Suite Variable | ${dut1_node} | | Set Suite Variable | ${dut2_node} -| | Set Suite Variable | ${tg_port} -| | Set Suite Variable | ${dut1_port} -| | Set Suite Variable | ${dut2_port} - +| | Set Suite Variable | ${dut1_to_dut2_if} +| | Set Suite Variable | ${dut2_to_dut1_if} +| | Set Suite Variable | ${dut1_to_dut2_if_name} +| | Set Suite Variable | ${dut2_to_dut1_if_name} 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} |