* Move networktests.sh and networkstress.sh parameters to network.sh. Both network scripts have the same settings (e.g. RHOST), and some of the stress test parameters can be used by other net-tests, such as LHOST_INTERFACE and RHOST_INTERFACE variables. * Add network features group to networkstress.sh. * Add network features group to 'whole' group.
New test_net.sh functions: * 'tst_get_ifaces TYPE' get test interface names for local/remote host (Note that it returns already defined iface list); * 'tst_get_hwaddrs TYPE' get addresses from defined test interface names; * 'tst_hwaddr TYPE LINK' get test HW address; * 'tst_iface TYPE LINK' get test interface name; TYPE can be 'rhost' or 'lhost' (default). LINK is the test link number starting from 0 (default). Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com> --- v3: rename *HOST_INTERFACES to *HOST_IFACES add support for multi-links (new function) remove unused 'Nn' option in networkstress.sh move setting LTPROOT to network.sh v2: Add net features tests to 'whole' group tst_rhost_hwaddr(): run 'awk' on local machine runtest/network_stress.features | 9 +++++ runtest/network_stress.tcp | 2 - runtest/network_stress.udp | 4 -- runtest/network_stress.whole | 10 ++++++ testcases/lib/test_net.sh | 62 +++++++++++++++++++++++++++++++++++++ testscripts/network.sh | 65 +++++++++++++++++++++++++++++++++++++++ testscripts/networkstress.sh | 48 ++++------------------------ testscripts/networktests.sh | 21 +----------- 8 files changed, 155 insertions(+), 66 deletions(-) create mode 100644 runtest/network_stress.features create mode 100755 testscripts/network.sh diff --git a/runtest/network_stress.features b/runtest/network_stress.features new file mode 100644 index 0000000..14fa2d9 --- /dev/null +++ b/runtest/network_stress.features @@ -0,0 +1,9 @@ +# +# Stress tests for various network features +# + +tcp_fastopen tcp_fastopen_run.sh + +vxlan01 vxlan01.sh +vxlan02 vxlan02.sh +vxlan03 vxlan03.sh diff --git a/runtest/network_stress.tcp b/runtest/network_stress.tcp index 9795d2a..7206b3a 100644 --- a/runtest/network_stress.tcp +++ b/runtest/network_stress.tcp @@ -331,5 +331,3 @@ tcp6-multi-diffnic11 tcp6-multi-diffnic11 tcp6-multi-diffnic12 tcp6-multi-diffnic12 tcp6-multi-diffnic13 tcp6-multi-diffnic13 tcp6-multi-diffnic14 tcp6-multi-diffnic14 - -tcp_fastopen tcp_fastopen_run.sh diff --git a/runtest/network_stress.udp b/runtest/network_stress.udp index 2f62c14..bfe9d85 100644 --- a/runtest/network_stress.udp +++ b/runtest/network_stress.udp @@ -65,7 +65,3 @@ udp6-multi-diffnic04 udp6-multi-diffnic04 udp6-multi-diffnic05 udp6-multi-diffnic05 udp6-multi-diffnic06 udp6-multi-diffnic06 udp6-multi-diffnic07 udp6-multi-diffnic07 - -vxlan01 vxlan01.sh -vxlan02 vxlan02.sh -vxlan03 vxlan03.sh diff --git a/runtest/network_stress.whole b/runtest/network_stress.whole index 35c219f..7b0dfa3 100644 --- a/runtest/network_stress.whole +++ b/runtest/network_stress.whole @@ -551,3 +551,13 @@ ftp6-download-stress ftp6-download-stress ftp4-upload-stress ftp4-upload-stress ftp6-upload-stress ftp6-upload-stress + +# +# Stress tests for various network features +# + +tcp_fastopen tcp_fastopen_run.sh + +vxlan01 vxlan01.sh +vxlan02 vxlan02.sh +vxlan03 vxlan03.sh diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh index 51b3e38..e4a36d7 100644 --- a/testcases/lib/test_net.sh +++ b/testcases/lib/test_net.sh @@ -75,3 +75,65 @@ tst_rhost_run() return $ret } + +# Get test interface names for local/remote host. +# tst_get_ifaces [TYPE] +# TYPE: { lhost | rhost }; Default value is 'lhost'. +tst_get_ifaces() +{ + local type=${1:-"lhost"} + if [ "$type" = "lhost" ]; then + echo "$LHOST_IFACES" + else + echo "$RHOST_IFACES" + fi +} + +# Get HW addresses from defined test interface names. +# tst_get_hwaddrs [TYPE] +# TYPE: { lhost | rhost }; Default value is 'lhost'. +tst_get_hwaddrs() +{ + local type=${1:-"lhost"} + local addr= + local list= + + for eth in $(tst_get_ifaces $type); do + case $type in + lhost) + addr=$(ip link show $eth | awk 'NR==2 { print $2 }') + ;; + rhost) + addr=$(tst_rhost_run -s -c "ip link show $eth" | \ + awk 'NR==2 { print $2 }') + esac + [ -z "$list" ] && list="$addr" || list="$list $addr" + done + echo "$list" +} + +# Get test HW address. +# tst_hwaddr [TYPE] [LINK] +# TYPE: { lhost | rhost }; Default value is 'lhost'. +# LINK: link number starting from 0. Default value is '0'. +tst_hwaddr() +{ + local type=${1:-"lhost"} + local link_num=${2:-"0"} + local hwaddrs= + link_num=$(( $link_num + 1 )) + [ "$type" = "lhost" ] && hwaddrs=$LHOST_HWADDRS || hwaddrs=$RHOST_HWADDRS + echo "$hwaddrs" | awk '{ print $'"$link_num"' }' +} + +# Get test interface name. +# tst_iface [TYPE] [LINK] +# TYPE: { lhost | rhost }; Default value is 'lhost'. +# LINK: link number starting from 0. Default value is '0'. +tst_iface() +{ + local type=${1:-"lhost"} + local link_num=${2:-"0"} + link_num=$(( $link_num + 1 )) + echo "$(tst_get_ifaces $type)" | awk '{ print $'"$link_num"' }' +} diff --git a/testscripts/network.sh b/testscripts/network.sh new file mode 100755 index 0000000..30a4f02 --- /dev/null +++ b/testscripts/network.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +TST_TOTAL=1 +TCID="network_settings" +. test_net.sh + +# Network Test Parameters +# +# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****--- + +export RHOST=${RHOST:-""} +export PASSWD= + +# ---***************************************************--- +# More information about network parameters can be found +# in the following document: testcases/network/stress/README + +export LTP_RSH=${LTP_RSH:-"rsh -n"} + +# Set names for test interfaces, e.g. "eth0 eth1" +export LHOST_IFACES=${LHOST_IFACES:-"eth0"} +export RHOST_IFACES=${RHOST_IFACES:-"eth0"} + +# Set corresponding HW addresses, e.g. "00:00:00:00:00:01 00:00:00:00:00:02" +export LHOST_HWADDRS=${LHOST_HWADDRS:-"$(tst_get_hwaddrs lhost)"} +export RHOST_HWADDRS=${RHOST_HWADDRS:-"$(tst_get_hwaddrs rhost)"} + +# Set first three octets of the network address, default is '10.0.0' +export IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"} +# Set local host last octet, default is '2' +export LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"} +# Set remote host last octet, default is '1' +export RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"} +# Set the reverse of IPV4_NETWORK +export IPV4_NETWORK_REVERSE=${IPV4_NETWORK_REVERSE:-"0.0.10"} +# Set first three octets of the network address, default is 'fd00:1:1:1' +export IPV6_NETWORK=${IPV6_NETWORK:-"fd00:1:1:1"} +# Set local host last octet, default is '2' +export LHOST_IPV6_HOST=${LHOST_IPV6_HOST:-":2"} +# Set remote host last octet, default is '1' +export RHOST_IPV6_HOST=${RHOST_IPV6_HOST:-":1"} + +export HTTP_DOWNLOAD_DIR= +export FTP_DOWNLOAD_DIR= +export FTP_UPLOAD_DIR= +export FTP_UPLOAD_URLDIR= + +export TMPDIR=/tmp/netpan-$$ +mkdir -p $TMPDIR +CMDFILE=${TMPDIR}/network.tests +VERBOSE="no" + +export LTPROOT=${PWD} +echo $LTPROOT | grep testscripts > /dev/null 2>&1 +if [ $? -eq 0 ]; then + cd .. + export LTPROOT=${PWD} +fi + +export PATH="${PATH}:${LTPROOT}/testcases/bin" + +# Reset variables. +# Don't break the tests which are using 'testcases/lib/cmdlib.sh' +export TCID= +export TST_LIB_LOADED= diff --git a/testscripts/networkstress.sh b/testscripts/networkstress.sh index b40af72..5e46787 100755 --- a/testscripts/networkstress.sh +++ b/testscripts/networkstress.sh @@ -4,40 +4,11 @@ # # Please read ltp-yyyymmdd/testcases/network/stress/README before running -cd `dirname $0` -export LTPROOT=${PWD} -echo $LTPROOT | grep testscripts > /dev/null 2>&1 -if [ $? -eq 0 ]; then - cd .. - export LTPROOT=${PWD} -fi - -export TMPDIR=/tmp/netst-$$ -mkdir $TMPDIR -VERBOSE="no" -INTERFACE="eth0" - -#=========================================================================== -# Network parameters -export RHOST= -export RHOST_HWADDRS= -export HTTP_DOWNLOAD_DIR= -export FTP_DOWNLOAD_DIR= -export FTP_UPLOAD_DIR= -export FTP_UPLOAD_URLDIR= - -# Set firt three octets of the network address, by default 10.0.0 -export IPV4_NETWORK= -# Set local host last octet, by default 2 -export LHOST_IPV4_HOST= -# Set remote host last octet, by default 1 -export RHOST_IPV4_HOST= -# Set the reverse of IPV4_NETWORK, by default 0.0.10 -export IPV4_NETWORK_REVERSE= +cd $(dirname $0) +. ./network.sh #=========================================================================== # Default Test Settings -# export LTP_RSH=rsh # export NS_DURATION=3600 # 1 hour # export NS_TIMES=10000 # export CONNECTION_TOTAL=4000 @@ -67,17 +38,17 @@ usage () { echo " -R|r: Stress test for routing table" echo " -B|b: Stress Broken IP packets" echo " -M|m: Multicast stress tests" + echo " -F|f: Stress test for network features" echo " -S|s: Run selected tests" echo " -W|w: Run whole network stress tests" echo " -D|d: Test duration (default ${NS_DURATION} sec)" - echo " -N|n: Select the network interface (default: $INTERFACE)" echo " -V|v: Enable verbose" echo " -H|h: This Usage" echo "" exit 1 } -while getopts AaEeTtIiUuRrMmSsWwBbVvN:n:D:d: OPTION +while getopts AaEeTtIiUuRrMmFfSsWwBbVvD:d: OPTION do case $OPTION in A|a) TEST_CASE="network_stress.appl";; @@ -88,10 +59,10 @@ do U|u) TEST_CASE="network_stress.udp";; R|r) TEST_CASE="network_stress.route";; M|m) TEST_CASE="network_stress.multicast";; + F|f) TEST_CASE="network_stress.features";; S|s) TEST_CASE="network_stress.selected";; W|w) TEST_CASE="network_stress.whole";; V|v) VERBOSE="yes";; - N|n) INTERFACE=${OPTARG};; D|d) NS_DURATION=${OPTARG};; H|h) usage;; *) echo "Error: invalid option..."; usage; exit 1 ;; @@ -102,8 +73,6 @@ if [ -z ${TEST_CASE} ]; then usage fi -export LHOST_HWADDRS=`ifconfig | grep ${INTERFACE} | grep HWaddr |awk '{print $5}'` - if [ -z ${RHOST} ]; then ## Just a silly check echo "Error: pay attention to configure" @@ -115,13 +84,10 @@ cat ${LTPROOT}/runtest/${TEST_CASE} > $TMPDIR/network_stress.tests cd $TMPDIR -export PATH="${PATH}:${LTPROOT}/testcases/bin" - if [ ${VERBOSE} = "yes" ]; then echo "Network parameters:" - echo " - ${INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})" - echo " - Remote IP address: ${RHOST}" - echo " - Remote MAC address: ${RHOST_HWADDRS}" + echo " - ${LHOST_IFACES} local interface (MAC address: ${LHOST_HWADDRS})" + echo " - ${RHOST_IFACES} remote interface (MAC address: ${RHOST_HWADDRS})" cat $TMPDIR/network_stress.tests ${LTPROOT}/ver_linux diff --git a/testscripts/networktests.sh b/testscripts/networktests.sh index b136749..308bd9a 100755 --- a/testscripts/networktests.sh +++ b/testscripts/networktests.sh @@ -1,23 +1,8 @@ #!/bin/sh # This will run all the network tests, with the status logged in /tmp/netpan.log -# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****--- -export RHOST= -export PASSWD= -# ---***************************************************--- - -cd `dirname $0` -export LTPROOT=${PWD} -echo $LTPROOT | grep testscripts > /dev/null 2>&1 -if [ $? -eq 0 ]; then - cd .. - export LTPROOT=${PWD} -fi - -export TMPDIR=/tmp/netpan-$$ -mkdir -p $TMPDIR -CMDFILE=${TMPDIR}/network.tests -VERBOSE="no" +cd $(dirname $0) +. ./network.sh # For bitwise operation to determine which testsets run CMD_IPV6=1 # 0x0001 @@ -110,8 +95,6 @@ fi cd $TMPDIR -export PATH="${PATH}:${LTPROOT}/testcases/bin" - if [ ${VERBOSE} = "yes" ]; then echo "Network parameters:" echo " - Remote Host: ${RHOST}" -- 1.7.1 ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce. Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list