Fix getting local ip address in CSIT setup scripts
Assumption that last field in routing entry is the
local src address is no longer valide in the latest
iproute2 releases as it adds UID information.
The correct way is to get the 7th field, not the last.
Change-Id: Id2289fbf9b916ccab3ac7949d4f8118ef0571935
Issue-ID: INT-1497
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
diff --git a/plans/dcaegen2-collectors-restconf/testsuites/setup.sh b/plans/dcaegen2-collectors-restconf/testsuites/setup.sh
index 2b01817..ad96796 100755
--- a/plans/dcaegen2-collectors-restconf/testsuites/setup.sh
+++ b/plans/dcaegen2-collectors-restconf/testsuites/setup.sh
@@ -1,7 +1,7 @@
#!/bin/bash
#get current host IP addres
-HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
CONTAINER_NAME=rcc
RCC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.restconfcollector:latest
echo RCC_IMAGE=${RCC_IMAGE}
diff --git a/plans/dcaegen2/testsuites/setup.sh b/plans/dcaegen2/testsuites/setup.sh
index 781e205..26585c2 100755
--- a/plans/dcaegen2/testsuites/setup.sh
+++ b/plans/dcaegen2/testsuites/setup.sh
@@ -19,7 +19,7 @@
#get current host IP addres
-HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
VESC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest
diff --git a/plans/portal-sdk/testsuite/setup.sh b/plans/portal-sdk/testsuite/setup.sh
index 6510311..c75e078 100644
--- a/plans/portal-sdk/testsuite/setup.sh
+++ b/plans/portal-sdk/testsuite/setup.sh
@@ -11,7 +11,7 @@
# Get pid of this spawned process to make sure we kill the correct process later
#Get current IP of VM
-HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
export HOST_IP=${HOST_IP}
@@ -172,7 +172,7 @@
#Get current IP of VM
-HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
export HOST_IP=${HOST_IP}
#docker logs deliveries_portal-db_1
diff --git a/plans/portal/testsuite/setup.sh b/plans/portal/testsuite/setup.sh
index 76cf5f3..8932007 100644
--- a/plans/portal/testsuite/setup.sh
+++ b/plans/portal/testsuite/setup.sh
@@ -11,7 +11,7 @@
# Get pid of this spawned process to make sure we kill the correct process later
#Get current IP of VM
-HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
export HOST_IP=${HOST_IP}
@@ -172,7 +172,7 @@
#Get current IP of VM
-HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
export HOST_IP=${HOST_IP}
docker logs deliveries_portal-db_1
diff --git a/plans/usecases/5G-bulkpm/setup.sh b/plans/usecases/5G-bulkpm/setup.sh
index 9fbd2ef..e0d7b80 100644
--- a/plans/usecases/5G-bulkpm/setup.sh
+++ b/plans/usecases/5G-bulkpm/setup.sh
@@ -71,7 +71,7 @@
sleep 10
CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul )
sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml
-HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
sed -i -e '/DMAAPHOST:/ s/:.*/: '$DMAAP_MR_IP'/' docker-compose.yml
MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb )
diff --git a/plans/vfc-nfvo-wfengine/sanity-check/setup.sh b/plans/vfc-nfvo-wfengine/sanity-check/setup.sh
index e7c755f..387ccf8 100644
--- a/plans/vfc-nfvo-wfengine/sanity-check/setup.sh
+++ b/plans/vfc-nfvo-wfengine/sanity-check/setup.sh
@@ -49,7 +49,7 @@
IMAGE_ACTIVITI_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
#get current host IP addres
-SERVICE_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
+SERVICE_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}')
# start wfengine-activiti
# docker run -d --name vfc_wfengine_activiti -p 8804:8080 -e SERVICE_IP=$SERVICE_IP -e SERVICE_PORT=8804 -e OPENPALETTE_MSB_IP=${MSB_IAG_IP} -e OPENPALETTE_MSB_PORT=80 ${IMAGE_ACTIVITI_NAME}