-
Notifications
You must be signed in to change notification settings - Fork 51
/
vBNG_vm_test.sh
executable file
路59 lines (50 loc) 路 1.7 KB
/
vBNG_vm_test.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
#! /bin/bash
parse_string() {
# Stores array output in "out_arr"
cleaned=$(echo $1 | sed 's/^|//; s/|$//; s/[ ]*|[ ]*/|/g;')
out_arr=$(awk '{split($0,arr,"|")} END {for(n in arr){ print arr[n] }}' <<< $cleaned)
}
config_file="vBNG_vm.conf"
# Update VPP configuration to match vBNG test case
if ! cmp -s "/etc/vpp/setup.gate" "VPP_Configs/${config_file}" ; then
echo "Updating VPP configuration"
cp VPP_Configs/${config_file} /etc/vpp/setup.gate
service vpp restart
sleep 5
fi
input="$1"
./vBNG/run_vm.sh "$input"
exit 0
## BELOW PART IS NOT USED WHEN RUNNING PKTGEN ON SEPARATE MACHINE
./Pktgen/run_vm.sh "$input" 2>&1 | tee /tmp/nfvbench.output
if [[ "$input" == *"pps"* ]]; then
# Collect throughput stats
## 1-2:Req_TX_bps 3-4:Act_TX_bps
## 5-6:RX_bps 7-8:Req_TX_pps
## 9-10:Act_TX_pps 11-12:RX_pps
parse_string "$(cat /tmp/nfvbench.output | grep Total)"
pkt_stats=(${out_arr[@]})
parse_string "$(cat /tmp/nfvbench.output | grep '68 |')"
pkt_loss=(${out_arr[@]})
# Collect memory (RSS) stats
VID=$(virsh list | grep vBNG_vBNG | awk '{print $1}')
rss_val=$(virsh dommemstat ${VID} | \
grep "rss" | awk '{print $2}')
rss_val=$(bc -l <<< "scale=2; ${rss_val}/976.5625")
# Print output
echo ""
echo "##### Stat Summary #####"
echo ""
echo "Throughput:"
echo " Requested TX: ${pkt_stats[7]} ${pkt_stats[8]}"\
"(${pkt_stats[1]} ${pkt_stats[2]})"
echo " Actual TX: ${pkt_stats[9]} ${pkt_stats[10]}"\
"(${pkt_stats[3]} ${pkt_stats[4]})"
echo " Throughput: ${pkt_stats[11]} ${pkt_stats[12]}"\
"(${pkt_stats[5]} ${pkt_stats[6]})"
echo " Packet loss: ${pkt_loss[1]}"
echo ""
echo "Memory:"
echo " RSS: ${rss_val} MB"
echo ""
fi