9a08b098a4e1af3c11b3ee811f1a9032e97a5b1d
[yardstick.git] / yardstick / benchmark / scenarios / networking / ping6_benchmark.bash
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 # Run a single ping6 command towards a ipv6 router
13 set -e
14 ping6_options=$1
15 source /opt/admin-openrc.sh
16 chmod 600 vRouterKey
17 # TODO find host
18 wait_vm_ok() {
19     retry=0
20     until timeout 100s sudo ip netns exec qdhcp-$(neutron net-list | grep -w ipv4-int-network1 | awk '{print $2}') ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i vRouterKey fedora@20.0.0.4  "exit" >/dev/null 2>&1
21     do
22         sleep 10
23         let retry+=1
24         if [ $retry -ge 40 ];
25         then
26             echo "vm ssh  start timeout !!!"
27             exit 0
28         fi
29     done
30 }
31 wait_vm_ok
32 sleep 360
33 sudo ip netns exec qdhcp-$(neutron net-list | grep -w ipv4-int-network1 | awk '{print $2}') ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i vRouterKey fedora@20.0.0.4 "ping6 $ping6_options 2001:db8:0:1::1 | grep rtt | awk -F [\/\ ] '{printf \$8}'"