Merge "Neutron: check if a plugin has the l3 API extension"

This commit is contained in:
Jenkins 2016-06-07 13:54:33 +00:00 committed by Gerrit Code Review
commit a45b40a630
2 changed files with 10 additions and 8 deletions

View File

@ -174,9 +174,7 @@ function create_neutron_initial_network {
fi
fi
AUTO_ALLOCATE_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'auto-allocated-topology' | get_field 1)
SUBNETPOOL_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'subnet_allocation' | get_field 1)
if is_service_enabled q-l3; then
if is_networking_extension_supported "router" && is_networking_extension_supported "external-net"; then
# Create a router, and add the private subnet as one of its interfaces
if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
# create a tenant-owned router.
@ -188,10 +186,8 @@ function create_neutron_initial_network {
die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME"
fi
# if the extension is available, then mark the external
# network as default, and provision default subnetpools
EXTERNAL_NETWORK_FLAGS="--router:external"
if [[ -n $AUTO_ALLOCATE_EXT && -n $SUBNETPOOL_EXT ]]; then
if is_networking_extension_supported "auto-allocated-topology" && is_networking_extension_supported "subnet_allocation"; then
EXTERNAL_NETWORK_FLAGS="$EXTERNAL_NETWORK_FLAGS --is-default"
if [[ "$IP_VERSION" =~ 4.* ]]; then
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)
@ -363,3 +359,10 @@ function is_provider_network {
fi
return 1
}
function is_networking_extension_supported {
local extension=$1
# TODO(sc68cal) cache this instead of calling every time
EXT_LIST=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list -c alias -f value)
[[ $EXT_LIST =~ $extension ]] && return 0
}

View File

@ -240,8 +240,7 @@ function configure_tempest {
# the public network (for floating ip access) is only available
# if the extension is enabled.
EXTERNAL_NETWORK_EXT=$(neutron ext-list | grep 'external-net' | get_field 1)
if [[ -n $EXTERNAL_NETWORK_EXT ]]; then
if is_networking_extension_supported 'external-net'; then
public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \
awk '{print $2}')
fi