diff options
author | sharath reddy <sharathkumarboyanapally@gmail.com> | 2018-03-22 12:42:51 +0530 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2018-07-24 08:48:47 +0000 |
commit | 374b35938abf48e742fb3438ae8ed1e9b47d84ce (patch) | |
tree | 300d7e887dfb9055c47a846788f46fb739129018 /tests/dmm/dmm_scripts | |
parent | 298d0a61d75cded31fc0f09d408e7b3e3f9ee4f7 (diff) |
initial CSIT-DMM test scripts
Change-Id: I77a965751010b85d21335932baa5345a095dc4f3
Signed-off-by: sharath reddy <sharathkumarboyanapally@gmail.com>
Signed-off-by: sharath <sharathkumarboyanapally@gmail.com>
Diffstat (limited to 'tests/dmm/dmm_scripts')
-rwxr-xr-x | tests/dmm/dmm_scripts/install_dmm.sh | 128 | ||||
-rwxr-xr-x | tests/dmm/dmm_scripts/run_dmm.sh | 122 |
2 files changed, 250 insertions, 0 deletions
diff --git a/tests/dmm/dmm_scripts/install_dmm.sh b/tests/dmm/dmm_scripts/install_dmm.sh new file mode 100755 index 0000000000..d6b7a862eb --- /dev/null +++ b/tests/dmm/dmm_scripts/install_dmm.sh @@ -0,0 +1,128 @@ +#!/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/run_dmm.sh b/tests/dmm/dmm_scripts/run_dmm.sh new file mode 100755 index 0000000000..f6fa3587e3 --- /dev/null +++ b/tests/dmm/dmm_scripts/run_dmm.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +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}/libnStackAPI.so . +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 + +ls -l + +#only for kernal stack +if [ ${proc_name} -eq 0 ]; then +sudo LD_PRELOAD=${LIB_PATH}/libnStackAPI.so ./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 +else +sudo LD_PRELOAD=${LIB_PATH}/libnStackAPI.so ./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 +fi + +cd ${PWDDIR} + +ps -elf | grep vs_epoll + +sleep 10 |