summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Kunzmann <kunzmann@docomolab-euro.com>2016-07-29 10:18:13 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-07-29 10:18:13 +0000
commit4a1d0e285755afc6ae7b441c935d70617ec90ac3 (patch)
tree1444ca52cb0df522bbb31c51985d788f700419c0
parent5048adc29b31864a0a4de5fe3e94602e9d831cfc (diff)
parentcdc9787dafbdf4dd491748c0307ae7240024846a (diff)
Merge "fix bugs to get `CONSUMER_IP`"
-rwxr-xr-xtests/run.sh15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/run.sh b/tests/run.sh
index d693a7ce..2f141f52 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -96,17 +96,12 @@ prepare_compute_ssh() {
}
get_consumer_ip() {
- #get network of the compute_ip address
- network_pre=${COMPUTE_IP%.*}
- network=${network_pre}.0/24
+ CONSUMER_IP=$(ip route get $COMPUTE_IP | awk '/ src /{print $NF}')
- #if there is a dedicated route, use it
- dev=$(ip route |grep $network | awk '{print $3}' |head -n 1)
-
- #if there is no route, use default route
- [[ -z $dev ]] && dev=$(ip route |grep ^default | awk '{print $3}' |head -n 1)
-
- CONSUMER_IP=$(ip addr show $dev |grep inet | grep $network_pre | awk '{print $2}' | cut -d'/' -f1)
+ if [[ -z "$CONSUMER_IP" ]]; then
+ echo "ERROR: Could not get CONSUMER_IP."
+ exit 1
+ fi
}
download_image() {