Consolidate two /sbin/ip commands into a single one

When determining the primary IP/IPv6 addresses on a system,
we can use the /sbin/ip command to filter them for us.  The
resulting address is parsed the same way for both address
families, so we can use just a single command.

Change-Id: I0471ff5a258a16a23061941ac38063dbf3d7c233
diff --git a/lib/neutron-legacy b/lib/neutron-legacy
index 85f7fc0..978943d 100644
--- a/lib/neutron-legacy
+++ b/lib/neutron-legacy
@@ -801,13 +801,7 @@
         DEFAULT_ROUTE_GW=$(ip -f $af r | awk "/default.+$from_intf/ { print \$3; exit }")
         local ADD_OVS_PORT=""
 
-        if [[ $af == "inet" ]]; then
-            IP_BRD=$(ip -f $af a s dev $from_intf | grep inet | awk '{ print $2, $3, $4; exit }')
-        fi
-
-        if [[ $af == "inet6" ]]; then
-            IP_BRD=$(ip -f $af a s dev $from_intf | grep 'scope global' | sed '/temporary/d' | awk '{ print $2, $3, $4; exit }')
-        fi
+        IP_BRD=$(ip -f $af a s dev $from_intf scope global primary | grep inet | awk '{ print $2, $3, $4; exit }')
 
         if [ "$DEFAULT_ROUTE_GW" != "" ]; then
             ADD_DEFAULT_ROUTE="sudo ip -f $af r replace default via $DEFAULT_ROUTE_GW dev $to_intf"