@@ -524,16 +524,16 @@ function create_neutron_initial_network {
524524 if is_provider_network; then
525525 die_if_not_set $LINENO PHYSICAL_NETWORK " You must specify the PHYSICAL_NETWORK"
526526 die_if_not_set $LINENO PROVIDER_NETWORK_TYPE " You must specify the PROVIDER_NETWORK_TYPE"
527- NET_ID=$( neutron net-create $PHYSICAL_NETWORK --tenant_id $project_id --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network " $PHYSICAL_NETWORK " ${SEGMENTATION_ID: +--provider: segmentation_id $SEGMENTATION_ID } --shared | grep ' id ' | get_field 2)
527+ NET_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " net-create $PHYSICAL_NETWORK --tenant_id $project_id --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network " $PHYSICAL_NETWORK " ${SEGMENTATION_ID: +--provider: segmentation_id $SEGMENTATION_ID } --shared | grep ' id ' | get_field 2)
528528 die_if_not_set $LINENO NET_ID " Failure creating NET_ID for $PHYSICAL_NETWORK $project_id "
529529
530530 if [[ " $IP_VERSION " =~ 4.* ]]; then
531- SUBNET_ID=$( neutron subnet-create --tenant_id $project_id --ip_version 4 ${ALLOCATION_POOL: +--allocation-pool $ALLOCATION_POOL } --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
531+ SUBNET_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create --tenant_id $project_id --ip_version 4 ${ALLOCATION_POOL: +--allocation-pool $ALLOCATION_POOL } --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
532532 die_if_not_set $LINENO SUBNET_ID " Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id "
533533 fi
534534
535535 if [[ " $IP_VERSION " =~ .* 6 ]] && [[ -n " $IPV6_PROVIDER_FIXED_RANGE " ]] && [[ -n " $IPV6_PROVIDER_NETWORK_GATEWAY " ]]; then
536- SUBNET_V6_ID=$( neutron subnet-create --tenant_id $project_id --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $IPV6_PROVIDER_NETWORK_GATEWAY --name $IPV6_PROVIDER_SUBNET_NAME $NET_ID $IPV6_PROVIDER_FIXED_RANGE | grep ' id' | get_field 2)
536+ SUBNET_V6_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create --tenant_id $project_id --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $IPV6_PROVIDER_NETWORK_GATEWAY --name $IPV6_PROVIDER_SUBNET_NAME $NET_ID $IPV6_PROVIDER_FIXED_RANGE | grep ' id' | get_field 2)
537537 die_if_not_set $LINENO SUBNET_V6_ID " Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id "
538538 fi
539539
@@ -543,7 +543,7 @@ function create_neutron_initial_network {
543543 sudo ip link set $PUBLIC_INTERFACE up
544544 fi
545545 else
546- NET_ID=$( neutron net-create --tenant-id $project_id " $PRIVATE_NETWORK_NAME " | grep ' id ' | get_field 2)
546+ NET_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " net-create --tenant-id $project_id " $PRIVATE_NETWORK_NAME " | grep ' id ' | get_field 2)
547547 die_if_not_set $LINENO NET_ID " Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id "
548548
549549 if [[ " $IP_VERSION " =~ 4.* ]]; then
@@ -557,17 +557,17 @@ function create_neutron_initial_network {
557557 fi
558558 fi
559559
560- AUTO_ALLOCATE_EXT=$( neutron ext-list | grep ' auto-allocated-topology' | get_field 1)
561- SUBNETPOOL_EXT=$( neutron ext-list | grep ' subnet_allocation' | get_field 1)
560+ AUTO_ALLOCATE_EXT=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " ext-list | grep ' auto-allocated-topology' | get_field 1)
561+ SUBNETPOOL_EXT=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " ext-list | grep ' subnet_allocation' | get_field 1)
562562 if [[ " $Q_L3_ENABLED " == " True" ]]; then
563563 # Create a router, and add the private subnet as one of its interfaces
564564 if [[ " $Q_L3_ROUTER_PER_TENANT " == " True" ]]; then
565565 # create a tenant-owned router.
566- ROUTER_ID=$( neutron router-create --tenant-id $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
566+ ROUTER_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-create --tenant-id $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
567567 die_if_not_set $LINENO ROUTER_ID " Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME "
568568 else
569569 # Plugin only supports creating a single router, which should be admin owned.
570- ROUTER_ID=$( neutron router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
570+ ROUTER_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
571571 die_if_not_set $LINENO ROUTER_ID " Failure creating ROUTER_ID for $Q_ROUTER_NAME "
572572 fi
573573
@@ -577,17 +577,17 @@ function create_neutron_initial_network {
577577 if [[ -n $AUTO_ALLOCATE_EXT && -n $SUBNETPOOL_EXT ]]; then
578578 EXTERNAL_NETWORK_FLAGS=" $EXTERNAL_NETWORK_FLAGS --is-default"
579579 if [[ " $IP_VERSION " =~ 4.* ]]; then
580- SUBNETPOOL_V4_ID=$( neutron subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V4 --pool-prefix $SUBNETPOOL_PREFIX_V4 --shared --is-default=True | grep ' id ' | get_field 2)
580+ SUBNETPOOL_V4_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V4 --pool-prefix $SUBNETPOOL_PREFIX_V4 --shared --is-default=True | grep ' id ' | get_field 2)
581581 fi
582582 if [[ " $IP_VERSION " =~ .* 6 ]]; then
583- SUBNETPOOL_V6_ID=$( neutron subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V6 --pool-prefix $SUBNETPOOL_PREFIX_V6 --shared --is-default=True | grep ' id ' | get_field 2)
583+ SUBNETPOOL_V6_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V6 --pool-prefix $SUBNETPOOL_PREFIX_V6 --shared --is-default=True | grep ' id ' | get_field 2)
584584 fi
585585 fi
586586 # Create an external network, and a subnet. Configure the external network as router gw
587587 if [ " $Q_USE_PROVIDERNET_FOR_PUBLIC " = " True" ]; then
588- EXT_NET_ID=$( neutron net-create " $PUBLIC_NETWORK_NAME " -- $EXTERNAL_NETWORK_FLAGS --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
588+ EXT_NET_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " net-create " $PUBLIC_NETWORK_NAME " -- $EXTERNAL_NETWORK_FLAGS --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
589589 else
590- EXT_NET_ID=$( neutron net-create " $PUBLIC_NETWORK_NAME " -- $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
590+ EXT_NET_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " net-create " $PUBLIC_NETWORK_NAME " -- $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
591591 fi
592592 die_if_not_set $LINENO EXT_NET_ID " Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME "
593593
@@ -933,6 +933,9 @@ function _configure_neutron_common {
933933 iniset $NEUTRON_CONF DEFAULT bind_host $Q_LISTEN_ADDRESS
934934 iniset $NEUTRON_CONF oslo_concurrency lock_path $DATA_DIR /neutron/lock
935935
936+ # NOTE(freerunner): Need to adjust Region Name for nova in multiregion installation
937+ iniset $NEUTRON_CONF nova region_name $REGION_NAME
938+
936939 # If addition config files are set, make sure their path name is set as well
937940 if [[ ${# Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == ' ' ]]; then
938941 die $LINENO " Neutron additional plugin config not set.. exiting"
@@ -1233,7 +1236,7 @@ function _neutron_create_private_subnet_v4 {
12331236 subnet_params+=" --name $PRIVATE_SUBNET_NAME "
12341237 subnet_params+=" $NET_ID $FIXED_RANGE "
12351238 local subnet_id
1236- subnet_id=$( neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1239+ subnet_id=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create $subnet_params | grep ' id ' | get_field 2)
12371240 die_if_not_set $LINENO subnet_id " Failure creating private IPv4 subnet for $project_id "
12381241 echo $subnet_id
12391242}
@@ -1250,7 +1253,7 @@ function _neutron_create_private_subnet_v6 {
12501253 subnet_params+=" --name $IPV6_PRIVATE_SUBNET_NAME "
12511254 subnet_params+=" $NET_ID $FIXED_RANGE_V6 $ipv6_modes "
12521255 local ipv6_subnet_id
1253- ipv6_subnet_id=$( neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1256+ ipv6_subnet_id=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create $subnet_params | grep ' id ' | get_field 2)
12541257 die_if_not_set $LINENO ipv6_subnet_id " Failure creating private IPv6 subnet for $project_id "
12551258 echo $ipv6_subnet_id
12561259}
@@ -1264,7 +1267,7 @@ function _neutron_create_public_subnet_v4 {
12641267 subnet_params+=" $EXT_NET_ID $FLOATING_RANGE "
12651268 subnet_params+=" -- --enable_dhcp=False"
12661269 local id_and_ext_gw_ip
1267- id_and_ext_gw_ip=$( neutron subnet-create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
1270+ id_and_ext_gw_ip=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
12681271 die_if_not_set $LINENO id_and_ext_gw_ip " Failure creating public IPv4 subnet"
12691272 echo $id_and_ext_gw_ip
12701273}
@@ -1277,22 +1280,22 @@ function _neutron_create_public_subnet_v6 {
12771280 subnet_params+=" $EXT_NET_ID $IPV6_PUBLIC_RANGE "
12781281 subnet_params+=" -- --enable_dhcp=False"
12791282 local ipv6_id_and_ext_gw_ip
1280- ipv6_id_and_ext_gw_ip=$( neutron subnet-create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
1283+ ipv6_id_and_ext_gw_ip=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
12811284 die_if_not_set $LINENO ipv6_id_and_ext_gw_ip " Failure creating an IPv6 public subnet"
12821285 echo $ipv6_id_and_ext_gw_ip
12831286}
12841287
12851288# Configure neutron router for IPv4 public access
12861289function _neutron_configure_router_v4 {
1287- neutron router-interface-add $ROUTER_ID $SUBNET_ID
1290+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-interface-add $ROUTER_ID $SUBNET_ID
12881291 # Create a public subnet on the external network
12891292 local id_and_ext_gw_ip
12901293 id_and_ext_gw_ip=$( _neutron_create_public_subnet_v4 $EXT_NET_ID )
12911294 local ext_gw_ip
12921295 ext_gw_ip=$( echo $id_and_ext_gw_ip | get_field 2)
12931296 PUB_SUBNET_ID=$( echo $id_and_ext_gw_ip | get_field 5)
12941297 # Configure the external network as the default router gateway
1295- neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1298+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-gateway-set $ROUTER_ID $EXT_NET_ID
12961299
12971300 # This logic is specific to using the l3-agent for layer 3
12981301 if is_service_enabled q-l3; then
@@ -1314,7 +1317,7 @@ function _neutron_configure_router_v4 {
13141317 sudo ip addr add $ext_gw_ip /$cidr_len dev $ext_gw_interface
13151318 sudo ip link set $ext_gw_interface up
13161319 fi
1317- 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' ' ' `
1320+ ROUTER_GW_IP=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F' ip_address' ' { print $2 }' | cut -f3 -d\" | tr ' \n' ' ' )
13181321 die_if_not_set $LINENO ROUTER_GW_IP " Failure retrieving ROUTER_GW_IP"
13191322 sudo ip route replace $FIXED_RANGE via $ROUTER_GW_IP
13201323 fi
@@ -1324,7 +1327,7 @@ function _neutron_configure_router_v4 {
13241327
13251328# Configure neutron router for IPv6 public access
13261329function _neutron_configure_router_v6 {
1327- neutron router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
1330+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
13281331 # Create a public subnet on the external network
13291332 local ipv6_id_and_ext_gw_ip
13301333 ipv6_id_and_ext_gw_ip=$( _neutron_create_public_subnet_v6 $EXT_NET_ID )
@@ -1336,7 +1339,7 @@ function _neutron_configure_router_v6 {
13361339 # If the external network has not already been set as the default router
13371340 # gateway when configuring an IPv4 public subnet, do so now
13381341 if [[ " $IP_VERSION " == " 6" ]]; then
1339- neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1342+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-gateway-set $ROUTER_ID $EXT_NET_ID
13401343 fi
13411344
13421345 # This logic is specific to using the l3-agent for layer 3
@@ -1345,7 +1348,7 @@ function _neutron_configure_router_v6 {
13451348 sudo sysctl -w net.ipv6.conf.all.forwarding=1
13461349 # Configure and enable public bridge
13471350 # Override global IPV6_ROUTER_GW_IP with the true value from neutron
1348- 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' ' ' `
1351+ IPV6_ROUTER_GW_IP=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F' ip_address' ' { print $2 }' | cut -f3 -d\" | tr ' \n' ' ' )
13491352 die_if_not_set $LINENO IPV6_ROUTER_GW_IP " Failure retrieving IPV6_ROUTER_GW_IP"
13501353
13511354 if is_neutron_ovs_base_plugin; then
@@ -1410,7 +1413,7 @@ function teardown_neutron_debug {
14101413}
14111414
14121415function _get_net_id {
1413- neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk ' {print $2}'
1416+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " --os- tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk ' {print $2}'
14141417}
14151418
14161419function _get_probe_cmd_prefix {
0 commit comments