@@ -174,25 +174,25 @@ function create_neutron_initial_network {
174174 if is_networking_extension_supported " auto-allocated-topology" ; then
175175 if [[ " $USE_SUBNETPOOL " == " True" ]]; then
176176 if [[ " $IP_VERSION " =~ 4.* ]]; then
177- 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)
177+ SUBNETPOOL_V4_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet pool create $SUBNETPOOL_NAME --default-prefix-length $SUBNETPOOL_SIZE_V4 --pool-prefix $SUBNETPOOL_PREFIX_V4 --share --default | grep ' id ' | get_field 2)
178178 fi
179179 if [[ " $IP_VERSION " =~ .* 6 ]]; then
180- 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)
180+ SUBNETPOOL_V6_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet pool create $SUBNETPOOL_NAME --default-prefix-length $SUBNETPOOL_SIZE_V6 --pool-prefix $SUBNETPOOL_PREFIX_V6 --share --default | grep ' id ' | get_field 2)
181181 fi
182182 fi
183183 fi
184184
185185 if is_provider_network; then
186186 die_if_not_set $LINENO PHYSICAL_NETWORK " You must specify the PHYSICAL_NETWORK"
187187 die_if_not_set $LINENO PROVIDER_NETWORK_TYPE " You must specify the PROVIDER_NETWORK_TYPE"
188- 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)
188+ NET_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " network create $PHYSICAL_NETWORK --project $project_id --provider-network-type $PROVIDER_NETWORK_TYPE --provider-physical-network " $PHYSICAL_NETWORK " ${SEGMENTATION_ID: +--provider-segment $SEGMENTATION_ID } --share | grep ' id ' | get_field 2)
189189 die_if_not_set $LINENO NET_ID " Failure creating NET_ID for $PHYSICAL_NETWORK $project_id "
190190
191191 if [[ " $IP_VERSION " =~ 4.* ]]; then
192192 if [ -z $SUBNETPOOL_V4_ID ]; then
193193 fixed_range_v4=$FIXED_RANGE
194194 fi
195- 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 ${SUBNETPOOL_V4_ID: +--subnetpool $SUBNETPOOL_V4_ID } $NET_ID $fixed_range_v4 | grep ' id ' | get_field 2)
195+ SUBNET_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet create --project $project_id --ip-version 4 ${ALLOCATION_POOL: +--allocation-pool $ALLOCATION_POOL } $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY ${SUBNETPOOL_V4_ID: +--subnet-pool $SUBNETPOOL_V4_ID } --network $NET_ID --subnet-range $fixed_range_v4 | grep ' id ' | get_field 2)
196196 die_if_not_set $LINENO SUBNET_ID " Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id "
197197 fi
198198
@@ -202,7 +202,7 @@ function create_neutron_initial_network {
202202 if [ -z $SUBNETPOOL_V6_ID ]; then
203203 fixed_range_v6=$IPV6_PROVIDER_FIXED_RANGE
204204 fi
205- 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 ${SUBNETPOOL_V6_ID: +--subnetpool $SUBNETPOOL_V6_ID } $NET_ID $fixed_range_v6 | grep ' id' | get_field 2)
205+ SUBNET_V6_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet create --project $project_id --ip-version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $IPV6_PROVIDER_NETWORK_GATEWAY $IPV6_PROVIDER_SUBNET_NAME ${SUBNETPOOL_V6_ID: +--subnet-pool $SUBNETPOOL_V6_ID } --network $NET_ID $fixed_range_v6 | grep ' id' | get_field 2)
206206 die_if_not_set $LINENO SUBNET_V6_ID " Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id "
207207 fi
208208
@@ -212,7 +212,7 @@ function create_neutron_initial_network {
212212 sudo ip link set $PUBLIC_INTERFACE up
213213 fi
214214 else
215- 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)
215+ NET_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " network create --project $project_id " $PRIVATE_NETWORK_NAME " | grep ' id ' | get_field 2)
216216 die_if_not_set $LINENO NET_ID " Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id "
217217
218218 if [[ " $IP_VERSION " =~ 4.* ]]; then
@@ -230,23 +230,23 @@ function create_neutron_initial_network {
230230 # Create a router, and add the private subnet as one of its interfaces
231231 if [[ " $Q_L3_ROUTER_PER_TENANT " == " True" ]]; then
232232 # create a tenant-owned router.
233- 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)
233+ ROUTER_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " router create --project $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
234234 die_if_not_set $LINENO ROUTER_ID " Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME "
235235 else
236236 # Plugin only supports creating a single router, which should be admin owned.
237- ROUTER_ID=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router- create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
237+ ROUTER_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " router create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
238238 die_if_not_set $LINENO ROUTER_ID " Failure creating ROUTER_ID for $Q_ROUTER_NAME "
239239 fi
240240
241- EXTERNAL_NETWORK_FLAGS=" --router: external"
241+ EXTERNAL_NETWORK_FLAGS=" --external"
242242 if is_networking_extension_supported " auto-allocated-topology" ; then
243- EXTERNAL_NETWORK_FLAGS=" $EXTERNAL_NETWORK_FLAGS --is- default"
243+ EXTERNAL_NETWORK_FLAGS=" $EXTERNAL_NETWORK_FLAGS --default"
244244 fi
245245 # Create an external network, and a subnet. Configure the external network as router gw
246246 if [ " $Q_USE_PROVIDERNET_FOR_PUBLIC " = " True" ]; then
247- 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)
247+ EXT_NET_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " network create " $PUBLIC_NETWORK_NAME " $EXTERNAL_NETWORK_FLAGS --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
248248 else
249- 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)
249+ EXT_NET_ID=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " network create " $PUBLIC_NETWORK_NAME " $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
250250 fi
251251 die_if_not_set $LINENO EXT_NET_ID " Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME "
252252
@@ -268,16 +268,16 @@ function _neutron_create_private_subnet_v4 {
268268 if [ -z $SUBNETPOOL_V4_ID ]; then
269269 fixed_range_v4=$FIXED_RANGE
270270 fi
271- local subnet_params=" --tenant-id $project_id "
272- subnet_params+=" --ip_version 4 "
271+ local subnet_params=" --project $project_id "
272+ subnet_params+=" --ip-version 4 "
273273 if [[ -n " $NETWORK_GATEWAY " ]]; then
274274 subnet_params+=" --gateway $NETWORK_GATEWAY "
275275 fi
276- subnet_params+=" --name $PRIVATE_SUBNET_NAME "
277- subnet_params+=" ${SUBNETPOOL_V4_ID : +--subnetpool $SUBNETPOOL_V4_ID } "
278- subnet_params+=" $NET_ID $fixed_range_v4 "
276+ subnet_params+=" ${SUBNETPOOL_V4_ID : +--subnet-pool $SUBNETPOOL_V4_ID } "
277+ subnet_params+=" ${fixed_range_v4 : +--subnet-range $fixed_range_v4 } "
278+ subnet_params+=" --network $NET_ID $PRIVATE_SUBNET_NAME "
279279 local subnet_id
280- subnet_id=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet- create $subnet_params | grep ' id ' | get_field 2)
280+ subnet_id=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet create $subnet_params | grep ' id ' | get_field 2)
281281 die_if_not_set $LINENO subnet_id " Failure creating private IPv4 subnet for $project_id "
282282 echo $subnet_id
283283}
@@ -291,52 +291,50 @@ function _neutron_create_private_subnet_v6 {
291291 if [ -z $SUBNETPOOL_V6_ID ]; then
292292 fixed_range_v6=$FIXED_RANGE_V6
293293 fi
294- local subnet_params=" --tenant-id $project_id "
295- subnet_params+=" --ip_version 6 "
294+ local subnet_params=" --project $project_id "
295+ subnet_params+=" --ip-version 6 "
296296 if [[ -n " $IPV6_PRIVATE_NETWORK_GATEWAY " ]]; then
297297 subnet_params+=" --gateway $IPV6_PRIVATE_NETWORK_GATEWAY "
298298 fi
299- subnet_params+=" --name $IPV6_PRIVATE_SUBNET_NAME "
300- subnet_params+=" ${SUBNETPOOL_V6_ID : +--subnetpool $SUBNETPOOL_V6_ID } "
301- subnet_params+=" $NET_ID $fixed_range_v6 $ipv6_modes "
299+ subnet_params+=" ${SUBNETPOOL_V6_ID : +--subnet-pool $SUBNETPOOL_V6_ID } "
300+ subnet_params+=" ${fixed_range_v6 : +--subnet-range $fixed_range_v6 $ipv6_modes } "
301+ subnet_params+=" --network $NET_ID $IPV6_PRIVATE_SUBNET_NAME "
302302 local ipv6_subnet_id
303- ipv6_subnet_id=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet- create $subnet_params | grep ' id ' | get_field 2)
303+ ipv6_subnet_id=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet create $subnet_params | grep ' id ' | get_field 2)
304304 die_if_not_set $LINENO ipv6_subnet_id " Failure creating private IPv6 subnet for $project_id "
305305 echo $ipv6_subnet_id
306306}
307307
308308# Create public IPv4 subnet
309309function _neutron_create_public_subnet_v4 {
310- local subnet_params=" --ip_version 4 "
310+ local subnet_params=" --ip-version 4 "
311311 subnet_params+=" ${Q_FLOATING_ALLOCATION_POOL: +--allocation-pool $Q_FLOATING_ALLOCATION_POOL } "
312312 if [[ -n " $PUBLIC_NETWORK_GATEWAY " ]]; then
313313 subnet_params+=" --gateway $PUBLIC_NETWORK_GATEWAY "
314314 fi
315- subnet_params+=" --name $PUBLIC_SUBNET_NAME "
316- subnet_params+=" $EXT_NET_ID $FLOATING_RANGE "
317- subnet_params+=" -- --enable_dhcp=False"
315+ subnet_params+=" --network $EXT_NET_ID --subnet-range $FLOATING_RANGE --no-dhcp "
316+ subnet_params+=" $PUBLIC_SUBNET_NAME "
318317 local id_and_ext_gw_ip
319- id_and_ext_gw_ip=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet- create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
318+ id_and_ext_gw_ip=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
320319 die_if_not_set $LINENO id_and_ext_gw_ip " Failure creating public IPv4 subnet"
321320 echo $id_and_ext_gw_ip
322321}
323322
324323# Create public IPv6 subnet
325324function _neutron_create_public_subnet_v6 {
326- local subnet_params=" --ip_version 6 "
325+ local subnet_params=" --ip-version 6 "
327326 subnet_params+=" --gateway $IPV6_PUBLIC_NETWORK_GATEWAY "
328- subnet_params+=" --name $IPV6_PUBLIC_SUBNET_NAME "
329- subnet_params+=" $EXT_NET_ID $IPV6_PUBLIC_RANGE "
330- subnet_params+=" -- --enable_dhcp=False"
327+ subnet_params+=" --network $EXT_NET_ID --subnet-range $IPV6_PUBLIC_RANGE --no-dhcp "
328+ subnet_params+=" $IPV6_PUBLIC_SUBNET_NAME "
331329 local ipv6_id_and_ext_gw_ip
332- 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 ' )
330+ ipv6_id_and_ext_gw_ip=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " subnet create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
333331 die_if_not_set $LINENO ipv6_id_and_ext_gw_ip " Failure creating an IPv6 public subnet"
334332 echo $ipv6_id_and_ext_gw_ip
335333}
336334
337335# Configure neutron router for IPv4 public access
338336function _neutron_configure_router_v4 {
339- neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-interface- add $ROUTER_ID $SUBNET_ID
337+ openstack --os-cloud devstack-admin --os-region " $REGION_NAME " router add subnet $ROUTER_ID $SUBNET_ID
340338 # Create a public subnet on the external network
341339 local id_and_ext_gw_ip
342340 id_and_ext_gw_ip=$( _neutron_create_public_subnet_v4 $EXT_NET_ID )
@@ -371,7 +369,7 @@ function _neutron_configure_router_v4 {
371369 sudo ip addr add $ext_gw_ip /$cidr_len dev $ext_gw_interface
372370 sudo ip link set $ext_gw_interface up
373371 fi
374- 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' ' ' )
372+ ROUTER_GW_IP=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " port list -c ' Fixed IP Addresses ' --device-owner network: router_gateway | awk -F' ip_address' ' { print $2 }' | cut -f2 -d\' | tr ' \n' ' ' )
375373 die_if_not_set $LINENO ROUTER_GW_IP " Failure retrieving ROUTER_GW_IP"
376374 local replace_range=${SUBNETPOOL_PREFIX_V4}
377375 if [[ -z " ${SUBNETPOOL_V4_ID} " ]]; then
@@ -385,7 +383,7 @@ function _neutron_configure_router_v4 {
385383
386384# Configure neutron router for IPv6 public access
387385function _neutron_configure_router_v6 {
388- neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-interface- add $ROUTER_ID $IPV6_SUBNET_ID
386+ openstack --os-cloud devstack-admin --os-region " $REGION_NAME " router add subnet $ROUTER_ID $IPV6_SUBNET_ID
389387 # Create a public subnet on the external network
390388 local ipv6_id_and_ext_gw_ip
391389 ipv6_id_and_ext_gw_ip=$( _neutron_create_public_subnet_v6 $EXT_NET_ID )
@@ -416,7 +414,7 @@ function _neutron_configure_router_v6 {
416414 sudo sysctl -w net.ipv6.conf.all.forwarding=1
417415 # Configure and enable public bridge
418416 # Override global IPV6_ROUTER_GW_IP with the true value from neutron
419- 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' ' ' )
417+ IPV6_ROUTER_GW_IP=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " port list -c ' Fixed IP Addresses ' | grep $ipv6_pub_subnet_id | awk -F' ip_address' ' { print $2 }' | cut -f2 -d\' | tr ' \n' ' ' )
420418 die_if_not_set $LINENO IPV6_ROUTER_GW_IP " Failure retrieving IPV6_ROUTER_GW_IP"
421419
422420 if is_neutron_ovs_base_plugin; then
@@ -446,6 +444,6 @@ function is_provider_network {
446444function is_networking_extension_supported {
447445 local extension=$1
448446 # TODO(sc68cal) cache this instead of calling every time
449- EXT_LIST=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " ext- list -c alias -f value)
447+ EXT_LIST=$( openstack --os-cloud devstack-admin --os-region " $REGION_NAME " extension list --network -c Alias -f value)
450448 [[ $EXT_LIST =~ $extension ]] && return 0
451449}
0 commit comments