From d4b0a17bcd1be6478523ccc0ff25c057ff40f511 Mon Sep 17 00:00:00 2001 From: charan makkina Date: Mon, 15 Oct 2018 18:55:36 +0530 Subject: Test:Test cases for file transfer and fork for both kernel and lwip_stacks. Change-Id: I04744d4d12e403f9df9f522953b8f7b8b30246d8 Signed-off-by: charan makkina --- scripts/csit/README.txt | 3 +- scripts/csit/common.sh | 87 ++++++++++++++++++++++ scripts/csit/file.txt | 12 +++ scripts/csit/run/run_dmm.sh | 38 +++------- scripts/csit/run/run_dmm_fork.sh | 68 +++++++++++++++++ scripts/csit/run/run_dmm_fork_with_lwip.sh | 68 +++++++++++++++++ scripts/csit/run/run_dmm_tcp_filetrans.sh | 68 +++++++++++++++++ .../csit/run/run_dmm_tcp_filetrans_with_lwip.sh | 69 +++++++++++++++++ scripts/csit/run/run_dmm_udp_filetrans.sh | 68 +++++++++++++++++ .../csit/run/run_dmm_udp_filetrans_with_lwip.sh | 70 +++++++++++++++++ scripts/csit/run/run_dmm_with_lwip.sh | 42 ++--------- 11 files changed, 529 insertions(+), 64 deletions(-) create mode 100755 scripts/csit/common.sh create mode 100755 scripts/csit/file.txt create mode 100755 scripts/csit/run/run_dmm_fork.sh create mode 100755 scripts/csit/run/run_dmm_fork_with_lwip.sh create mode 100755 scripts/csit/run/run_dmm_tcp_filetrans.sh create mode 100755 scripts/csit/run/run_dmm_tcp_filetrans_with_lwip.sh create mode 100755 scripts/csit/run/run_dmm_udp_filetrans.sh create mode 100755 scripts/csit/run/run_dmm_udp_filetrans_with_lwip.sh (limited to 'scripts') diff --git a/scripts/csit/README.txt b/scripts/csit/README.txt index 0f91dbb..66cb214 100644 --- a/scripts/csit/README.txt +++ b/scripts/csit/README.txt @@ -31,4 +31,5 @@ 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 + 2. The functions in dmm/scripts/csit/run/common.sh can be reused in the new script. + 3. And handle all the actions in it(can go through existing scripts for reference). diff --git a/scripts/csit/common.sh b/scripts/csit/common.sh new file mode 100755 index 0000000..110273a --- /dev/null +++ b/scripts/csit/common.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +set -x +setup_preparation(){ + ip addr + lspci -nn + lsmod | grep uio + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh $1 + 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 +} + +setup_preparation_lwip(){ + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh $1 + 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 +} + + +execution(){ + cd $APP_DIR + ls -l + if [ "x$node" == "x0" ]; then + eval $1 + else + eval $2 + fi +} + +verification(){ + flag=0 + for var in "$@" + do + eval $var + if [ $? != 0 ]; then + flag=1 + break + fi + done + if [ "x$flag" == "x0" ]; then + echo "DMM_CSIT_TEST_PASSED" + else + echo "DMM_CSIT_TEST_FAILED" + fi +} + +print_log(){ + if [ "x$node" == "x0" ]; then + cat $LOG_PATH/app_$1*.log + elif [ "x$node" == "x1" ]; then + cat $LOG_PATH/app_$2*.log + fi +} + +cleanup(){ + if [ "x$node" == "x0" ]; then + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh $1 + rm $LOG_PATH/app_$1*.log + elif [ "x$node" == "x1" ]; then + rm $LOG_PATH/app_$2*.log + fi +} + +cleanup_lwip(){ + if [ "x$node" == "x0" ]; then + bash $CSIT_SCRIPT_DIR/kill_given_proc.sh $1 + fi + sudo bash $APP_DIR/../release/stop_nstack.sh + sudo rm $LOG_PATH/running.log +} diff --git a/scripts/csit/file.txt b/scripts/csit/file.txt new file mode 100755 index 0000000..45973dd --- /dev/null +++ b/scripts/csit/file.txt @@ -0,0 +1,12 @@ +172.28.128.3 +172.28.128.5 + + #server + ./vs_epoll -p 20000 -d 172.28.128.5 -a 10000 -s 172.28.128.3 -l 200 -t 5000000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 + + #client + ./vc_epoll -p 20000 -d 172.28.128.3 -a 10000 -s 172.28.128.5 -l 200 -t 50000 -i 1000 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 + + sudo LD_LIBRARY_PATH=/DMM/stacks/lwip_stack/release/lib64/ ./vs_epoll -p 20000 -d 172.28.128.5 -a 10000 -s 172.28.128.3 -l 200 - t 5000000 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 + +sudo LD_LIBRARY_PATH=/DMM/stacks/lwip_stack/release/lib64/ ./vc_common -p 20000 -d 172.28.128.3 -a 10000 -s 172.28.128.5 -l 200 -t 50 -i 0 -f 1 -r 20000 -n 1 -w 10 -u 10000 -e 10 -x 1 \ No newline at end of file diff --git a/scripts/csit/run/run_dmm.sh b/scripts/csit/run/run_dmm.sh index fb65f65..8bada97 100755 --- a/scripts/csit/run/run_dmm.sh +++ b/scripts/csit/run/run_dmm.sh @@ -21,35 +21,22 @@ ROOTDIR=$CSIT_SCRIPT_DIR/../../../ APP_DIR=${ROOTDIR}/dmm/config/app_test LIB_PATH=${ROOTDIR}/dmm/release/lib64 DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts +LOG_PATH=/var/log +source $DMM_SCRIPT_DIR/csit/common.sh ################################################# # 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 + setup_preparation vs_epoll 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 + execution "sudo LD_LIBRARY_PATH=${LIB_PATH} NSTACK_LOG_FILE_FLAG=1 ./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" \ + "sudo LD_LIBRARY_PATH=${LIB_PATH} NSTACK_LOG_FILE_FLAG=1 ./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 ################################################# @@ -57,14 +44,9 @@ fi 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 + verification "sudo cat $RUN_DIR/log_$(basename $0).txt | grep \"send 50000\"" elif [ "x$node" == "x0" ]; then - echo "DMM_CSIT_TEST_PASSED" + verification fi fi @@ -72,16 +54,14 @@ fi # Print Log if [ "x$action" == "xlog" ]; then - echo "print log" + print_log vs_epoll vc_common fi ################################################# # Cleanup if [ "x$action" == "xcleanup" ]; then - if [ "x$node" == "x0" ]; then - bash $CSIT_SCRIPT_DIR/kill_given_proc.sh vs_epoll - fi + cleanup vs_epoll vc_common fi exit 0 \ No newline at end of file diff --git a/scripts/csit/run/run_dmm_fork.sh b/scripts/csit/run/run_dmm_fork.sh new file mode 100755 index 0000000..b406ba5 --- /dev/null +++ b/scripts/csit/run/run_dmm_fork.sh @@ -0,0 +1,68 @@ +#!/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 +LOG_PATH=/var/log + +source $DMM_SCRIPT_DIR/csit/common.sh +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + setup_preparation vtcp_fork_server +fi + +################################################# +# Execution +#execution "sudo LD_LIBRARY_PATH=${LIB_PATH} ./ktcp_fork_server -a 10000 -s ${dut1_if_ip} -t 50000" +# "sudo LD_LIBRARY_PATH=${LIB_PATH} ./ktcp_client -p 10000 -d ${dut1_if_ip} -a 10000 -s ${dut2_if_ip} -t 50000" +if [ "x$action" == "xrun" ]; then + execution "sudo LD_LIBRARY_PATH=${LIB_PATH} NSTACK_LOG_FILE_FLAG=1 ./vtcp_fork_server -a 10000 -s ${dut1_if_ip} -t 50000" \ + "sudo LD_LIBRARY_PATH=${LIB_PATH} NSTACK_LOG_FILE_FLAG=1 ./vtcp_client -p 10000 -d ${dut1_if_ip} -a 10000 -s ${dut2_if_ip} -t 50000" +fi + +################################################# +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x1" ]; then + verification "sudo cat $RUN_DIR/log_$(basename $0).txt | grep \"Success\"" + elif [ "x$node" == "x0" ]; then + verification + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + print_log vtcp_fork_server vtcp_client +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + cleanup vtcp_fork_server vtcp_client +fi + +exit 0 diff --git a/scripts/csit/run/run_dmm_fork_with_lwip.sh b/scripts/csit/run/run_dmm_fork_with_lwip.sh new file mode 100755 index 0000000..0ee9d07 --- /dev/null +++ b/scripts/csit/run/run_dmm_fork_with_lwip.sh @@ -0,0 +1,68 @@ +#!/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 +DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts + +source $DMM_SCRIPT_DIR/csit/common.sh +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + setup_preparation_lwip vtcp_fork_server +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + execution "sudo LD_LIBRARY_PATH=${LIB_PATH} ./vtcp_fork_server -a 10000 -s ${dut1_if_ip} -t 50000" \ + "sudo LD_LIBRARY_PATH=${LIB_PATH} ./vtcp_client -p 10000 -d ${dut1_if_ip} -a 10000 -s ${dut2_if_ip} -t 50000" +fi + +################################################# +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x1" ]; then + verification "cat $RUN_DIR/log_$(basename $0).txt | grep \"Success\"" + elif [ "x$node" == "x0" ]; then + verification + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + cat $LOG_PATH/running.log +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + cleanup_lwip vtcp_fork_server +fi + +exit 0 diff --git a/scripts/csit/run/run_dmm_tcp_filetrans.sh b/scripts/csit/run/run_dmm_tcp_filetrans.sh new file mode 100755 index 0000000..fddc017 --- /dev/null +++ b/scripts/csit/run/run_dmm_tcp_filetrans.sh @@ -0,0 +1,68 @@ +#!/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 +LOG_PATH=/var/log + +source $DMM_SCRIPT_DIR/csit/common.sh +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + setup_preparation vc_serv_file +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + execution "cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} NSTACK_LOG_FILE_FLAG=1 ./vc_serv_file tcp ${dut1_if_ip} 1234" \ + "cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} NSTACK_LOG_FILE_FLAG=1 ./vc_cli_file tcp ${dut1_if_ip} 1234 file.txt ${dut2_if_ip}" +fi + +################################################# +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x0" ]; then + verification "diff $APP_DIR/file.txt $APP_DIR/receive_file.txt >/dev/null" + elif [ "x$node" == "x1" ]; then + verification + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + print_log vc_serv_file vc_cli_file +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + cleanup vc_serv_file vc_cli_file +fi + +exit 0 \ No newline at end of file diff --git a/scripts/csit/run/run_dmm_tcp_filetrans_with_lwip.sh b/scripts/csit/run/run_dmm_tcp_filetrans_with_lwip.sh new file mode 100755 index 0000000..5713d50 --- /dev/null +++ b/scripts/csit/run/run_dmm_tcp_filetrans_with_lwip.sh @@ -0,0 +1,69 @@ +#!/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 +DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts + +source $DMM_SCRIPT_DIR/csit/common.sh +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + setup_preparation_lwip vc_serv_file +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + execution "sudo cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_serv_file tcp ${dut1_if_ip} 1234" \ + "sudo cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_cli_file tcp ${dut1_if_ip} 1234 file.txt ${dut2_if_ip}" +fi + +################################################# + +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x0" ]; then + verification "diff $APP_DIR/file.txt $APP_DIR/receive_file.txt >/dev/null" + elif [ "x$node" == "x1" ]; then + verification + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + cat $LOG_PATH/running.log +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + cleanup_lwip vc_serv_file +fi + +exit 0 diff --git a/scripts/csit/run/run_dmm_udp_filetrans.sh b/scripts/csit/run/run_dmm_udp_filetrans.sh new file mode 100755 index 0000000..b8838bb --- /dev/null +++ b/scripts/csit/run/run_dmm_udp_filetrans.sh @@ -0,0 +1,68 @@ +#!/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 +LOG_PATH=/var/log + +source $DMM_SCRIPT_DIR/csit/common.sh +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + setup_preparation vc_serv_file +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + execution "cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_serv_file udp ${dut1_if_ip} 1235 file.txt 256" \ + "cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_cli_file udp ${dut1_if_ip} 1235 ${dut2_if_ip} file.txt receive_file.txt 256" +fi + +################################################# +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x0" ]; then + verification "diff $APP_DIR/file.txt $APP_DIR/receive_file.txt >/dev/null" + elif [ "x$node" == "x1" ]; then + verification + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + print_log vc_serv_file vc_cli_file +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + cleanup vc_serv_file vc_cli_file +fi + +exit 0 \ No newline at end of file diff --git a/scripts/csit/run/run_dmm_udp_filetrans_with_lwip.sh b/scripts/csit/run/run_dmm_udp_filetrans_with_lwip.sh new file mode 100755 index 0000000..b8310dd --- /dev/null +++ b/scripts/csit/run/run_dmm_udp_filetrans_with_lwip.sh @@ -0,0 +1,70 @@ +#!/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 +DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts + +source $DMM_SCRIPT_DIR/csit/common.sh +################################################# +# Setup preparation + +if [ "x$action" == "xsetup" ]; then + setup_preparation_lwip vc_serv_file + sudo sed -i '23s/kernel/lwip/' $APP_DIR/rd_config.json +fi + +################################################# +# Execution + +if [ "x$action" == "xrun" ]; then + execution "sudo cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_serv_file udp ${dut1_if_ip} 1236 file.txt 256" \ + "sudo cp -f $DMM_SCRIPT_DIR/csit/file.txt . ;sudo LD_LIBRARY_PATH=${LIB_PATH} ./vc_cli_file udp ${dut1_if_ip} 1236 ${dut2_if_ip} file.txt receive_file.txt 256" +fi + +################################################# + +# Verification + +if [ "x$action" == "xverify" ]; then + if [ "x$node" == "x0" ]; then + verification "diff $APP_DIR/file.txt $APP_DIR/receive_file.txt >/dev/null" + elif [ "x$node" == "x1" ]; then + verification + fi +fi + +################################################# +# Print Log + +if [ "x$action" == "xlog" ]; then + cat $LOG_PATH/running.log +fi + +################################################# +# Cleanup + +if [ "x$action" == "xcleanup" ]; then + cleanup_lwip vc_serv_file +fi + +exit 0 diff --git a/scripts/csit/run/run_dmm_with_lwip.sh b/scripts/csit/run/run_dmm_with_lwip.sh index 1174697..3b02e28 100755 --- a/scripts/csit/run/run_dmm_with_lwip.sh +++ b/scripts/csit/run/run_dmm_with_lwip.sh @@ -22,39 +22,22 @@ 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 +DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts +source $DMM_SCRIPT_DIR/csit/common.sh ################################################# # 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 + setup_preparation_lwip vs_epoll 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 + execution "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" \ + "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 ################################################# @@ -62,14 +45,9 @@ fi 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 + verification "cat $RUN_DIR/log_$(basename $0).txt | grep \"send 50\"" elif [ "x$node" == "x0" ]; then - echo "DMM_CSIT_TEST_PASSED" + verification fi fi @@ -84,11 +62,7 @@ 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 + cleanup_lwip vs_epoll fi exit 0 -- cgit