aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorsharath <sharathkumarboyanapally@gmail.com>2018-10-09 14:59:08 +0530
committersharath <sharathkumarboyanapally@gmail.com>2018-10-09 19:21:12 +0530
commitdd82eab81846cbccaa1ab84c5a9919dc0b41f9c9 (patch)
tree9faf3b5ef55c58541b6cb6d50e3639b69c06af60 /scripts
parent31ea86798426cf236d70c9de1944c723a6cb1d95 (diff)
Feat: Migration of CSIT scripts to DMM repo
Change-Id: I4b38cbc9c1d801e3c91ff3d4dd8fed7e747db46e Signed-off-by: sharath <sharathkumarboyanapally@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/csit/README.txt34
-rwxr-xr-xscripts/csit/install_prereq.sh28
-rwxr-xr-xscripts/csit/kill_given_proc.sh31
-rwxr-xr-xscripts/csit/run/run_dmm.sh87
-rwxr-xr-xscripts/csit/run/run_dmm_with_lwip.sh94
-rwxr-xr-xscripts/csit/setup_hugepage.sh38
-rw-r--r--scripts/csit/template.sh83
7 files changed, 395 insertions, 0 deletions
diff --git a/scripts/csit/README.txt b/scripts/csit/README.txt
new file mode 100644
index 0000000..0f91dbb
--- /dev/null
+++ b/scripts/csit/README.txt
@@ -0,0 +1,34 @@
+#################################################
+# Considerations:
+
+ 1. Considers each file inside the path "dmm/scripts/csit/run/" as a single test case.
+ 2. Considers all files inside "dmm/scripts/csit/run/" as Test scripts,
+ So any helper files can be written in the path "dmm/scripts/csit/"
+ 3. Considers a test case as SUCCESS only when both the client and server echoes
+ DMM_CSIT_TEST_PASSED during verification.
+
+#################################################
+# Call stack of each test script from CSIT script:
+
+===============================================================================
+./test_script.sh action which_node interface_name dut1_ip dut2_ip
+===============================================================================
+./test_script.sh setup 0 dut1_to_dut2_if_name dut1_ip dut2_ip
+./test_script.sh setup 1 dut2_to_dut1_if_name dut1_ip dut2_ip
+./test_script.sh run 0 dut1_to_dut2_if_name dut1_ip dut2_ip
+./test_script.sh run 1 dut2_to_dut1_if_name dut1_ip dut2_ip
+./test_script.sh verify 0
+./test_script.sh verify 1
+./test_script.sh log 0
+./test_script.sh log 1
+./test_script.sh cleanup 0
+./test_script.sh cleanup 1
+
+[0-dut1, 1-dut2]
+
+#################################################
+# Want to write a new Test case ?
+
+ 1. make a new script in "dmm/scripts/csit/run/" with the help of
+ "dmm/scripts/csit/template.sh".
+ 2. And handle all the actions in it(can go through existing scripts for reference). \ No newline at end of file
diff --git a/scripts/csit/install_prereq.sh b/scripts/csit/install_prereq.sh
new file mode 100755
index 0000000..b03769b
--- /dev/null
+++ b/scripts/csit/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/scripts/csit/kill_given_proc.sh b/scripts/csit/kill_given_proc.sh
new file mode 100755
index 0000000..772643a
--- /dev/null
+++ b/scripts/csit/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/scripts/csit/run/run_dmm.sh b/scripts/csit/run/run_dmm.sh
new file mode 100755
index 0000000..fb65f65
--- /dev/null
+++ b/scripts/csit/run/run_dmm.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+set -x
+
+#################################################
+# Store arguments values
+# verify, log, cleanup actions gets first two arguments
+
+action=$1 #action: [setup, run, verify, cleanup]
+node=$2 #node: [0 - dut1 node, 1 - dut2 node]
+ifname=$3 #dut1 interface name when node is 0 /dut2 interface name when node is 1
+dut1_if_ip=$4 #dut1 interface ip
+dut2_if_ip=$5 #dut2 interface ip
+
+#################################################
+# Get path details
+
+RUN_DIR=`dirname $(readlink -f $0)`
+CSIT_SCRIPT_DIR=$RUN_DIR/..
+ROOTDIR=$CSIT_SCRIPT_DIR/../../../
+APP_DIR=${ROOTDIR}/dmm/config/app_test
+LIB_PATH=${ROOTDIR}/dmm/release/lib64
+DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts
+
+#################################################
+# Setup preparation
+
+if [ "x$action" == "xsetup" ]; then
+ ip addr
+ lspci -nn
+ lsmod | grep uio
+ bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll
+ bash $CSIT_SCRIPT_DIR/setup_hugepage.sh
+
+ 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
+fi
+
+#################################################
+# Execution
+
+if [ "x$action" == "xrun" ]; then
+ cd $APP_DIR
+ ls -l
+ #only for kernal stack
+ if [ "x$node" == "x0" ]; then
+ 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_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
+fi
+
+#################################################
+# Verification
+
+if [ "x$action" == "xverify" ]; then
+ if [ "x$node" == "x1" ]; then
+ sudo cat $RUN_DIR/log_$(basename $0).txt | grep "send 50000"
+ if [ $? == 0 ]; then
+ echo "DMM_CSIT_TEST_PASSED"
+ else
+ echo "DMM_CSIT_TEST_FAILED"
+ fi
+ elif [ "x$node" == "x0" ]; then
+ echo "DMM_CSIT_TEST_PASSED"
+ fi
+fi
+
+#################################################
+# Print Log
+
+if [ "x$action" == "xlog" ]; then
+ echo "print log"
+fi
+
+#################################################
+# Cleanup
+
+if [ "x$action" == "xcleanup" ]; then
+ if [ "x$node" == "x0" ]; then
+ bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll
+ fi
+fi
+
+exit 0 \ No newline at end of file
diff --git a/scripts/csit/run/run_dmm_with_lwip.sh b/scripts/csit/run/run_dmm_with_lwip.sh
new file mode 100755
index 0000000..1174697
--- /dev/null
+++ b/scripts/csit/run/run_dmm_with_lwip.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+set -x
+
+#################################################
+# Store arguments values
+# verify, log, cleanup actions gets first two arguments[action, node]
+
+action=$1 #action: [setup, run, verify, cleanup]
+node=$2 #node: [0 - dut1 node, 1 - dut2 node]
+ifname=$3 #dut1 interface name(when node is 0)/dut2 interface name(when node is 1)
+dut1_if_ip=$4 #dut1 interface ip
+dut2_if_ip=$5 #dut2 interface ip
+
+#################################################
+# Get path details
+
+RUN_DIR=`dirname $(readlink -f $0)`
+CSIT_SCRIPT_DIR=$RUN_DIR/..
+ROOTDIR=$CSIT_SCRIPT_DIR/../../../
+APP_DIR=${ROOTDIR}/dmm/stacks/lwip_stack/app_test/
+LIB_PATH=${APP_DIR}/../release/lib64/
+VAG_DIR=${ROOTDIR}/dmm/stacks/lwip_stack/vagrant
+LOG_PATH=/var/log/nStack
+
+#################################################
+# Setup preparation
+
+if [ "x$action" == "xsetup" ]; then
+ bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll
+ bash $CSIT_SCRIPT_DIR/setup_hugepage.sh
+ 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
+fi
+
+#################################################
+# Execution
+
+if [ "x$action" == "xrun" ]; then
+ cd ${APP_DIR}
+ if [ "x$node" == "x0" ]; then
+ 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_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
+fi
+
+#################################################
+# Verification
+
+if [ "x$action" == "xverify" ]; then
+ if [ "x$node" == "x1" ]; then
+ cat $RUN_DIR/log_$(basename $0).txt | grep "send 50"
+ if [ $? == 0 ]; then
+ echo "DMM_CSIT_TEST_PASSED"
+ else
+ echo "DMM_CSIT_TEST_FAILED"
+ fi
+ elif [ "x$node" == "x0" ]; then
+ echo "DMM_CSIT_TEST_PASSED"
+ fi
+fi
+
+#################################################
+# Print Log
+
+if [ "x$action" == "xlog" ]; then
+ cat $LOG_PATH/running.log
+fi
+
+#################################################
+# Cleanup
+
+if [ "x$action" == "xcleanup" ]; then
+ if [ "x$node" == "x0" ]; then
+ bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll
+ fi
+ sudo bash $APP_DIR/../release/stop_nstack.sh
+ sudo rm $LOG_PATH/running.log
+fi
+
+exit 0
diff --git a/scripts/csit/setup_hugepage.sh b/scripts/csit/setup_hugepage.sh
new file mode 100755
index 0000000..b03c100
--- /dev/null
+++ b/scripts/csit/setup_hugepage.sh
@@ -0,0 +1,38 @@
+#!/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)
+
+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
+
+if [ ${SYS_HUGEPAGE} -lt 1536 ] || [ $hugepageFree -eq 0 ]; then
+
+ 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/scripts/csit/template.sh b/scripts/csit/template.sh
new file mode 100644
index 0000000..106167c
--- /dev/null
+++ b/scripts/csit/template.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+set -x
+#################################################
+# Store arguments values
+# verify, log, cleanup actions gets first two arguments
+
+action=$1 #action: [setup, run, verify, cleanup]
+node=$2 #node: [0 - dut1 node, 1 - dut2 node]
+ifname=$3 #dut1 interface name when node is 0 /dut2 interface name when node is 1
+dut1_if_ip=$4 #dut1 interface ip
+dut2_if_ip=$5 #dut2 interface ip
+
+#################################################
+# Get path details
+
+RUN_DIR=`dirname $(readlink -f $0)`
+CSIT_SCRIPT_DIR=$RUN_DIR/..
+ROOTDIR=$CSIT_SCRIPT_DIR/../../../
+APP_DIR=${ROOTDIR}/dmm/config/app_test
+LIB_PATH=${ROOTDIR}/dmm/release/lib64
+DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts
+
+#################################################
+# Setup preparation
+
+if [ "x$action" == "xsetup" ]; then
+ #Handle setup preparation here
+ echo "performing setup"
+fi
+
+#################################################
+# Execution
+
+if [ "x$action" == "xrun" ]; then
+ # Call your executables here to run the test case
+ if [ "x$node" == "x0" ]; then
+ #call server executable
+ echo "server execution "
+ elif [ "x$node" == "x1" ]; then
+ #call client executable
+ echo "client execution"
+ fi
+fi
+
+#################################################
+# Verification
+
+if [ "x$action" == "xverify" ]; then
+ if [ "x$node" == "x1" ]; then
+ #Handle client verification
+ if [ $? == 0 ]; then
+ echo "DMM_CSIT_TEST_PASSED" #must echo this
+ else
+ echo "DMM_CSIT_TEST_FAILED"
+ fi
+ elif [ "x$node" == "x0" ]; then
+ #Handle server verification
+ if [ $? == 0 ]; then
+ echo "DMM_CSIT_TEST_PASSED" #must echo this
+ else
+ echo "DMM_CSIT_TEST_FAILED"
+ fi
+ fi
+fi
+
+#################################################
+# Print Log
+
+if [ "x$action" == "xlog" ]; then
+ #Handle print log
+ echo "DMM logs"
+fi
+
+#################################################
+# Cleanup
+
+if [ "x$action" == "xcleanup" ]; then
+ #Handle cleanup
+ echo "performing cleanup"
+fi
+
+exit 0 \ No newline at end of file