Browse code

Add a more accurate expression for obtaining (IPV6_)ROUTER_GW_IP

neutron port-list returns a dictionary that's of random order in python 3.
This expression sometimes returns a NULL value thus failing devstack.
Add an expression that always returns a consistent ROUTER_GW_IP.

Change-Id: Id23d9afda275051ca68bcba2dfd1b6e30f02c628

Sirushti Murugesan authored on 2015/10/07 18:36:51
Showing 1 changed files
... ...
@@ -1318,7 +1318,7 @@ function _neutron_configure_router_v4 {
1318 1318
                 sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface
1319 1319
                 sudo ip link set $ext_gw_interface up
1320 1320
             fi
1321
-            ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' -v subnet_id=$PUB_SUBNET_ID '$4 == subnet_id { print $8; }'`
1321
+            ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F'ip_address'  '{ print $2 }' | cut -f3 -d\" | tr '\n' ' '`
1322 1322
             die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
1323 1323
             sudo ip route replace  $FIXED_RANGE via $ROUTER_GW_IP
1324 1324
         fi
... ...
@@ -1349,7 +1349,7 @@ function _neutron_configure_router_v6 {
1349 1349
         sudo sysctl -w net.ipv6.conf.all.forwarding=1
1350 1350
         # Configure and enable public bridge
1351 1351
         # Override global IPV6_ROUTER_GW_IP with the true value from neutron
1352
-        IPV6_ROUTER_GW_IP=`neutron port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F '"' -v subnet_id=$ipv6_pub_subnet_id '$4 == subnet_id { print $8; }'`
1352
+        IPV6_ROUTER_GW_IP=`neutron port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F'ip_address' '{ print $2 }' | cut -f3 -d\" | tr '\n' ' '`
1353 1353
         die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP"
1354 1354
 
1355 1355
         if is_neutron_ovs_base_plugin; then