hw-test/scripts/test-iperf

50 lines
1 KiB
Text
Raw Normal View History

2017-01-26 21:43:03 -06:00
#!/bin/bash
source scan-netdev
#VLANS='110 218 222 226 306 321 480'
2021-09-23 05:21:51 -05:00
CTLPLANE=110
MY_DATE=`date +%Y-%m-%d_%H-%M-%S`
2017-01-26 21:43:03 -06:00
mkdir -p $OUTPUT_DIR/iperf
2021-09-23 05:21:51 -05:00
if [[ -n $1 ]] ; then
LABEL=".$1"
fi
MY_PORT=`grep $SERVER_SERIAL /etc/netdev/vlan.$CTLPLANE.csv \
| cut -d ',' -f 3 | cut -d '.' -f 4`
2017-01-26 21:43:03 -06:00
if [[ -z $MY_PORT ]] ; then
echo "My Port empty"
exit 27
fi
2022-01-25 01:53:03 -06:00
if [[ $MY_PORT -lt 10 ]] ; then
MY_PORT="0$MY_PORT"
fi
for VLAN in {10..4000} ; do
2017-01-26 21:43:03 -06:00
if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then
VLAN_CONF=`grep $SERVER_SERIAL \
/etc/netdev/vlan.$VLAN.csv`
else
continue
2017-01-26 21:43:03 -06:00
fi
if [[ -z $VLAN_CONF ]] ; then
continue
fi
2021-09-23 05:21:51 -05:00
IP_LIST=`sed 's/#.*$//' /etc/netdev/vlan.$VLAN.csv \
2017-01-26 21:43:03 -06:00
| cut -d ',' -f 3 \
2022-01-25 02:04:21 -06:00
| grep '^[0-9]' | sort -n`
2017-01-26 21:43:03 -06:00
for IP in $IP_LIST; do
echo -n "$IP - "
2022-01-25 02:04:21 -06:00
echo "iperf3 -P 4 -p 52$MY_PORT -c $IP" \
> $OUTPUT_DIR/iperf/client.$IP$LABEL.cmd
2017-01-26 21:43:03 -06:00
iperf3 -P 4 -p 52$MY_PORT \
2021-09-23 05:21:51 -05:00
--logfile $OUTPUT_DIR/iperf/client.$IP$LABEL.log \
2017-01-26 21:43:03 -06:00
-c $IP
2022-01-25 01:46:19 -06:00
RES=$?
echo $RES
echo $RES >> $OUTPUT_DIR/iperf/client.$IP$LABEL.cmd
2017-01-26 21:43:03 -06:00
done
done