fix bug caused by Shell command in OSX system.

Change-Id: Ifb2fadbac38ba0c28a3d4c61a703ed217c32beb2
diff --git a/tools/test/scenarios/net-setup-odtn.xml b/tools/test/scenarios/net-setup-odtn.xml
index 8d6f811..1f69aed 100644
--- a/tools/test/scenarios/net-setup-odtn.xml
+++ b/tools/test/scenarios/net-setup-odtn.xml
@@ -40,7 +40,7 @@
     </group>
     <!-- include 2 or more docker emulators to setup the network for phase 1.0-->
     <group name="ODTN-Net-Setup.Init-network" requires="ODTN-Net-Setup.Verify-Logs-1">
-      <step name="ODTN-Net-Setup.Start-emulators" exec="docker-compose -f /home/sdn/emulator/docker-compose.yaml up -d"/>
+      <step name="ODTN-Net-Setup.Start-emulators" exec="docker-compose -f ${HOME}/emulator/docker-compose.yaml up -d"/>
       <step name="ODTN-Net-Setup.Generate-cfg-files" requires="ODTN-Net-Setup.Start-emulators" exec="${ONOS_SCENARIOS}/odtn/createNetCfg.sh"/>
       <step name="ODTN-Net-Setup.Put-nodes" requires="ODTN-Net-Setup.Generate-cfg-files" exec="onos-netcfg ${OC1} /tmp/odtn/openconfig-devices.json"/>
       <group name="ODTN-Net-Setup.Wait-nodes" requires="ODTN-Net-Setup.Put-nodes">
diff --git a/tools/test/scenarios/odtn/checkNetInit.sh b/tools/test/scenarios/odtn/checkNetInit.sh
index 25524bb..9d9914b 100755
--- a/tools/test/scenarios/odtn/checkNetInit.sh
+++ b/tools/test/scenarios/odtn/checkNetInit.sh
@@ -9,8 +9,9 @@
 if [[ $# == 3 ]];then
     summary=$3
 fi
-
-line_num=`cat $summary | wc -l`
+# The 'sed'command behind 'wc -l' is uset to strip leading spaces.
+# Because in some scenarios, 'wc -l' always outputs leading spaces (https://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00029.html).
+line_num=`cat $summary | wc -l | sed -e 's/^[ ]*//g'`
 if [[ "$line_num" != "1" ]]; then
     echo "JSON file should have only 1 line."
     exit 1
@@ -39,14 +40,14 @@
     "device" )
         eval get_json_value '$content' device_num
         device_num=$?
-        num_in_topo=`onos $2 devices | wc -l`
-        num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<node>" | wc -l`
+        num_in_topo=`onos $2 devices | wc -l | sed -e 's/^[ ]*//g'`
+        num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<node>" | wc -l | sed -e 's/^[ ]*//g'`
         while [[ "$num_in_topo" != "$device_num" || "$num_in_tapi" != "$device_num" ]]
         do
             echo "On ONOS $2, current device num in topo:$num_in_topo, num in tapi:$num_in_tapi, expected $device_num. Waiting..."
             sleep 10
-            num_in_topo=`onos $2 devices | wc -l`
-                num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<node>" | wc -l`
+            num_in_topo=`onos $2 devices | wc -l | sed -e 's/^[ ]*//g'`
+                num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<node>" | wc -l | sed -e 's/^[ ]*//g'`
             let "tried=tried+1"
             if [[ "$tried" == "10" ]]; then
                 exit 99
@@ -58,16 +59,16 @@
         port_num=$?
         eval get_json_value '$content' device_num
         device_num=$?
-        num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<owned-node-edge-point>" | wc -l`
-        num_in_topo=`onos $2 ports | wc -l`
+        num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<owned-node-edge-point>" | wc -l | sed -e 's/^[ ]*//g'`
+        num_in_topo=`onos $2 ports | wc -l | sed -e 's/^[ ]*//g'`
         num_in_topo=$[num_in_topo-device_num]
         while [[ "$num_in_topo" != "$port_num" || "$num_in_tapi" != "$port_num" ]]
             do
             echo "On ONOS $2, current port num in topo: $num_in_topo, num in tapi: $num_in_tapi, expected $port_num. Waiting..."
                     sleep 10
-            num_in_topo=`onos $2 ports | wc -l`
+            num_in_topo=`onos $2 ports | wc -l | sed -e 's/^[ ]*//g'`
             num_in_topo=$[num_in_topo-device_num]
-            num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<owned-node-edge-point>" | wc -l`
+            num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<owned-node-edge-point>" | wc -l | sed -e 's/^[ ]*//g'`
             let "tried=tried+1"
             if [[ "$tried" == "10" ]]; then
                 exit 99
@@ -77,14 +78,14 @@
     "link" )
         eval get_json_value '$content' link_num
         link_num=$?
-        num_in_topo=`onos $2 links | wc -l`
-        num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<link>" | wc -l`
+        num_in_topo=`onos $2 links | wc -l | sed -e 's/^[ ]*//g'`
+        num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<link>" | wc -l | sed -e 's/^[ ]*//g'`
             while [[ "$num_in_topo" != "$link_num" || "$num_in_tapi" != "$link_num" ]]
             do
                     echo "On ONOS $2, current link num: $num_in_topo, expected $link_num. Waiting..."
             sleep 10
-                    num_in_topo=`onos $2 links | wc -l`
-            num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<link>" | wc -l`
+                    num_in_topo=`onos $2 links | wc -l | sed -e 's/^[ ]*//g'`
+            num_in_tapi=`onos $2 odtn-show-tapi-context | grep "<link>" | wc -l | sed -e 's/^[ ]*//g'`
             let "tried=tried+1"
             if [[ "$tried" == "10" ]]; then
                 exit 99