diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh
index a3a14eb5e4..36524ede4b 100755
--- a/exercises/boot_from_volume.sh
+++ b/exercises/boot_from_volume.sh
@@ -174,7 +174,8 @@ if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | g
 fi
 
 # Get the instance IP
-IP=$(nova show $VM_UUID | grep "$PRIVATE_NETWORK_NAME" | get_field 2)
+IP=$(get_instance_ip $VM_UUID $PRIVATE_NETWORK_NAME)
+
 die_if_not_set $LINENO IP "Failure retrieving IP address"
 
 # Private IPs can be pinged in single node deployments
diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh
index ac65cf7772..f93a727df6 100755
--- a/exercises/floating_ips.sh
+++ b/exercises/floating_ips.sh
@@ -132,7 +132,7 @@ if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | g
 fi
 
 # Get the instance IP
-IP=$(nova show $VM_UUID | grep "$PRIVATE_NETWORK_NAME" | get_field 2)
+IP=$(get_instance_ip $VM_UUID $PRIVATE_NETWORK_NAME)
 die_if_not_set $LINENO IP "Failure retrieving IP address"
 
 # Private IPs can be pinged in single node deployments
diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh
index 4367e2e3c1..abb29cf333 100755
--- a/exercises/neutron-adv-test.sh
+++ b/exercises/neutron-adv-test.sh
@@ -272,12 +272,12 @@ function create_vms {
 }
 
 function ping_ip {
-   # Test agent connection.  Assumes namespaces are disabled, and
-   # that DHCP is in use, but not L3
-   local VM_NAME=$1
-   local NET_NAME=$2
-   IP=`nova show $VM_NAME | grep 'network' | awk '{print $5}'`
-   ping_check $NET_NAME $IP $BOOT_TIMEOUT
+     # Test agent connection.  Assumes namespaces are disabled, and
+     # that DHCP is in use, but not L3
+     local VM_NAME=$1
+     local NET_NAME=$2
+     IP=$(get_instance_ip $VM_NAME $NET_NAME)
+     ping_check $NET_NAME $IP $BOOT_TIMEOUT
 }
 
 function check_vm {
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index b2b391c5d7..028d19b36a 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -135,7 +135,8 @@ if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | g
 fi
 
 # Get the instance IP
-IP=$(nova show $VM_UUID | grep "$PRIVATE_NETWORK_NAME" | get_field 2)
+IP=$(get_instance_ip $VM_UUID $PRIVATE_NETWORK_NAME)
+
 die_if_not_set $LINENO IP "Failure retrieving IP address"
 
 # Private IPs can be pinged in single node deployments
diff --git a/functions b/functions
index 087a0ea844..b56df08673 100644
--- a/functions
+++ b/functions
@@ -1433,6 +1433,19 @@ function _ping_check_novanet() {
     fi
 }
 
+# Get ip of instance
+function get_instance_ip(){
+    local vm_id=$1
+    local network_name=$2
+    local nova_result="$(nova show $vm_id)"
+    local ip=$(echo "$nova_result" | grep "$network_name" | get_field 2)
+    if [[ $ip = "" ]];then
+        echo "$nova_result"
+        die $LINENO "[Fail] Coudn't get ipaddress of VM"
+        exit 1
+    fi
+    echo $ip
+}
 
 # ssh check