/
client_ipvlan_udp
28 lines (26 loc) · 1.01 KB
/
client_ipvlan_udp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "run ./script <number of containers> <mtu> <number of times to run>"
exit 1
fi
for (( i=1; i <= $1; i++ ))
do
echo "Creating client iperf3_c_$i ..."
docker run -dit --net=none --name=iperf3_c_$i iperf/iperf
wait
echo "Attaching pipework ipvlan interface 10.0.2.$i/16"
sudo ./pipework/pipework enp5s0 --ipvlan iperf3_c_$i 10.0.2.$i/16
done
wait
sleep 5
for (( j=1; j <= $3; j++ )); do
for (( i=1; i <= $1; i++ )); do
echo "Running iperf3 on client iperf3_c_$i for time $j..."
docker exec iperf3_c_$i iperf3 -u -c 10.0.1.$i -p 5201 -f m -O 1 -M $2 -b 10000M > iperf3_$i.log &
done
wait
for (( i=1; i <= $1; i++ )); do
cat iperf3_$i.log | awk 'FNR == 17 {print}' | awk -F" " '{print $5,",",$6","$7,",",$8,","$9,",",$10,",",$11,",",$12}' >> ~/output_$1_$2_$3_$i.csv
cat iperf3_$i.log | awk 'FNR == 17 {print}' | awk -F" " '{print $5,",",$6","$7,",",$8,","$9,",",$10,",",$11,",",$12}' >> ~/output_ipvlan_total_$1_$2_$3.csv
done
done