Added functions for get a ip on an instance

The cause of some gating failure looks like
because of getting ip address on instance.
However current exercise didn't log the return value.
In this commit, we add get_instance_ip function with
error hanlding support, and apply it on the execise.

Change-Id: I8e17ba68093faafe58a98eb780a032368eea38aa
diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh
index 4367e2e..abb29cf 100755
--- a/exercises/neutron-adv-test.sh
+++ b/exercises/neutron-adv-test.sh
@@ -272,12 +272,12 @@
 }
 
 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 {