-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-tput.sh
executable file
·75 lines (60 loc) · 2.04 KB
/
test-tput.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
# This script measures throughput for different chain lenghts
# and several packet sizes for each length.
function measure_throughput {
name="$1"
echo "Starting pktgen..."
sudo $pktgen $pktgen_args -f tput-vs-pktsz.lua
cat ${tmpfile} | tail -n+2 | awk -v name=$name '{printf "%s;%s\n", name, $0}' >> $outfile
}
source common.sh
outfile="${logdir}/throughput.csv"
tmpfile="${logdir}/tput.res"
cfgdir="chains-config"
# Experiment type
experiment="$1"
# Write CSV headers to results file
echo "name;pkt size;trial number;tx packets;rx packets;dropped packets;duration(ms)" > $outfile
tests=()
# Generate test cases based on the experiment we want
if [ "$experiment" == "lengths" ]; then
# Generate config files for different lengths
for len in `seq 1 1 10`; do
noveth="$tmpcfgdir/len-${len}-noveth.json"
${cfgdir}/gen-len-tests.sh $len 100 true > $noveth
tests+=($noveth)
veth="$tmpcfgdir/len-${len}-veth.json"
${cfgdir}/gen-len-tests.sh $len 100 false > $veth
tests+=($veth)
done
# elif [ "$experiment" == "star" ]; then
# Generate config files for different lengths in a start topology
# for len in `seq 1 1 6`; do
# star="$tmpcfgdir/len-${len}-star.json"
# ${cfgdir}/gen-star-tests.sh $len 100 true > $star
# tests+=($star)
#
# linear="$tmpcfgdir/len-${len}-linear.json"
# ${cfgdir}/gen-len-tests.sh $len 100 true > $linear
# tests+=($linear)
# done
else
echo "Unknown experiment type: '$experiment'" && exit 1
fi
for t in ${tests[@]}; do
# Setup environment
cbox_deploy_ovs $t
# strip dir path and extension
simple_name="$(bname=$(basename $t); echo ${bname%.*})"
measure_throughput ${simple_name}
if [ $? -ne 0 ]; then
echo "Something went wrong, trying again..."
cbox_deploy_ovs $t
measure_throughput ${simple_name}
fi
done
# Measure throughput without the chaining
# This needs to come last as we need to use the bridge created by a previous test
sudo ovs-ofctl del-flows cbox-br
sudo ovs-ofctl add-flow cbox-br "actions=NORMAL"
measure_throughput "baseline"