From fbdf448efa7400ff02c0a0fcc74c191b80e2ac0c Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Thu, 26 Jan 2017 21:43:03 -0600 Subject: [PATCH] iperf and bonding tests --- scripts/scan-bonding | 16 ++++++++++ scripts/setup-bonding-degraded | 55 ++++++++++++++++++++++++++++++++++ scripts/setup-iperf | 12 ++++++++ scripts/setup-iperf-massive | 29 ++++++++++++++++++ scripts/test-batch | 20 ++++++++----- scripts/test-iperf | 36 ++++++++++++++++++++++ scripts/test-iperf-massive | 31 +++++++++++++++++++ 7 files changed, 191 insertions(+), 8 deletions(-) create mode 100755 scripts/scan-bonding create mode 100755 scripts/setup-bonding-degraded create mode 100755 scripts/setup-iperf create mode 100755 scripts/setup-iperf-massive create mode 100755 scripts/test-iperf create mode 100755 scripts/test-iperf-massive diff --git a/scripts/scan-bonding b/scripts/scan-bonding new file mode 100755 index 0000000..49b9838 --- /dev/null +++ b/scripts/scan-bonding @@ -0,0 +1,16 @@ +#!/bin/bash + +source scan-netdev + +#echo "scan-bonding: Ping test:" +test-ping | tee $OUTPUT_DIR/test-ping.out \ + | grep error + +for BOND_N in {0..4} ; do + BOND=bond$BOND_N + if [[ -d /sys/class/net/$BOND ]] ; then + cp /sys/class/net/$BOND/bonding/slaves \ + $OUTPUT_DIR/netdev/$BOND.slaves + fi +done + diff --git a/scripts/setup-bonding-degraded b/scripts/setup-bonding-degraded new file mode 100755 index 0000000..4234bfe --- /dev/null +++ b/scripts/setup-bonding-degraded @@ -0,0 +1,55 @@ +#!/bin/bash + +source scan-netdev +sleep_5 () { + for WAIT in 1 2 3 4 5 ; do + echo -n '.' + sleep 1 + done + echo +} + + + +case "$1" in + "1") + SLAVE_NO=1 + ;; + "2") + SLAVE_NO=2 + ;; + *) + echo "usage: $0 <1|2> " + exit 28 + ;; +esac + +case "$2" in + "up") + echo -n "Inserting slave $SLAVE_NO..." + ACTION= + ;; + "down") + echo -n "Removing slave $SLAVE_NO..." + ACTION="-d" + ;; + *) + echo "usage: $0 <1|2> " + exit 29 + ;; +esac + +for BOND_N in {0..4} ; do + BOND=bond$BOND_N + [[ -d /sys/class/net/$BOND ]] || continue + if [[ ! -f $OUTPUT_DIR/netdev/$BOND.slaves ]] ; then + echo "Missing slaves cache file" + exit 30 + fi + SLAVE=`cut -d ' ' -f $SLAVE_NO \ + $OUTPUT_DIR/netdev/$BOND.slaves` + ifenslave $ACTION $BOND $SLAVE + echo -n " $? " +done +echo + diff --git a/scripts/setup-iperf b/scripts/setup-iperf new file mode 100755 index 0000000..63d20e0 --- /dev/null +++ b/scripts/setup-iperf @@ -0,0 +1,12 @@ +#!/bin/bash + +source scan-dmidecode + +mkdir -p $OUTPUT_DIR/iperf + +for PORT in {5257..5261} ; do + iperf3 -p $PORT \ + --logfile $OUTPUT_DIR/iperf/server.$PORT.log \ + --server --daemon +done + diff --git a/scripts/setup-iperf-massive b/scripts/setup-iperf-massive new file mode 100755 index 0000000..f504a27 --- /dev/null +++ b/scripts/setup-iperf-massive @@ -0,0 +1,29 @@ +#!/bin/bash + +source scan-dmidecode + +mkdir -p $OUTPUT_DIR/iperf + +for VLAN in 401 402 403 404 406 ; do + if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then + VLAN_CONF=`grep $SERVER_SERIAL \ + /etc/netdev/vlan.$VLAN.csv` + fi + if [[ -z $VLAN_CONF ]] ; then + continue + fi + IP_LIST=`cat /etc/netdev/vlan.$VLAN.csv \ + | grep -v 'STOC' \ + | cut -d ',' -f 3 \ + | grep '^[0-9]' | sort` + for IP in $IP_LIST; do + PORT=`echo $IP \ + | cut -d '.' -f 3,4 \ + | sed 's/\.//'` + iperf3 -p $PORT \ + --logfile $OUTPUT_DIR/iperf/server.$PORT.log \ + --server --daemon + done +done + + diff --git a/scripts/test-batch b/scripts/test-batch index 72ef1b1..a64256c 100755 --- a/scripts/test-batch +++ b/scripts/test-batch @@ -3,21 +3,25 @@ source scan-dmidecode source test-variables #rm -f /output/hwtests/*/netdev/*.ethtool -source scan-netdev +#source scan-netdev + echo $$ > /run/batch.pid -echo -n "setup-netdev... " -setup-netdev >/dev/null & -sleep 1 -jobs -disown +#scan-bonding + +#echo -n "setup-netdev... " +#setup-netdev +#sleep 1 +#jobs +#disown + #stat-bonding out > $OUTPUT_DIR/stat-bonding.pre.1.out #test-bonding #stat-bonding out > $OUTPUT_DIR/stat-bonding.post.1.out # Take snapshot -#mkdir -p $SNAPSHOT_D -#cp -af $OUTPUT_DIR/* $SNAPSHOT_D/ +mkdir -p $SNAPSHOT_D +cp -af $OUTPUT_DIR/* $SNAPSHOT_D/ rm -f /run/batch.pid #echo '--' diff --git a/scripts/test-iperf b/scripts/test-iperf new file mode 100755 index 0000000..433efe6 --- /dev/null +++ b/scripts/test-iperf @@ -0,0 +1,36 @@ +#!/bin/bash + +source scan-netdev +mkdir -p $OUTPUT_DIR/iperf + +MY_PORT=`cat /etc/netdev/vlan.400.csv \ + | grep $SERVER_SERIAL \ + | cut -d ',' -f 3 \ + | cut -d '.' -f 4` +if [[ -z $MY_PORT ]] ; then + echo "My Port empty" + exit 27 +fi + +for VLAN in 401 402 403 404 406 ; do + if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then + VLAN_CONF=`grep $SERVER_SERIAL \ + /etc/netdev/vlan.$VLAN.csv` + fi + if [[ -z $VLAN_CONF ]] ; then + continue + fi + IP_LIST=`cat /etc/netdev/vlan.$VLAN.csv \ + | grep -v 'STOC' \ + | cut -d ',' -f 3 \ + | grep '^[0-9]' | sort` + for IP in $IP_LIST; do + echo -n "$IP - " + iperf3 -P 4 -p 52$MY_PORT \ + --logfile $OUTPUT_DIR/iperf/client.$IP.slave.2.log \ + -c $IP + echo $? + + done +done + diff --git a/scripts/test-iperf-massive b/scripts/test-iperf-massive new file mode 100755 index 0000000..116f6be --- /dev/null +++ b/scripts/test-iperf-massive @@ -0,0 +1,31 @@ +#!/bin/bash + +source scan-netdev +mkdir -p $OUTPUT_DIR/iperf + +for VLAN in 402 403 404 406 ; do + if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then + VLAN_CONF=`grep $SERVER_SERIAL \ + /etc/netdev/vlan.$VLAN.csv` + fi + [[ -z $VLAN_CONF ]] && continue + MY_PORT=`echo $VLAN_CONF \ + | cut -d ',' -f 3 \ + | cut -d '.' -f 3,4 \ + | sed 's/\.//'` + IP_LIST=`cat /etc/netdev/vlan.$VLAN.csv \ + | grep 'STOC' \ + | cut -d ',' -f 3 \ + | grep '^[0-9]' | sort` + for IP in $IP_LIST; do + #echo "$IP - " + iperf3 -p $MY_PORT -t 60 \ + --logfile $OUTPUT_DIR/iperf/client.$IP.massive.log \ + -c $IP > /dev/null & + disown + #echo $? + + done +done + #--bandwidth 250M \ +