| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 1 | #!/bin/bash | 
 | 2 | # Subnet IP version | 
 | 3 | IP_VERSION=${IP_VERSION:-"4+6"} | 
 | 4 | # Validate IP_VERSION | 
 | 5 | if [[ $IP_VERSION != "4" ]] && [[ $IP_VERSION != "6" ]] && [[ $IP_VERSION != "4+6" ]]; then | 
 | 6 |     die $LINENO "IP_VERSION must be either 4, 6, or 4+6" | 
 | 7 | fi | 
 | 8 | # Specify if the initial private and external networks should be created | 
 | 9 | NEUTRON_CREATE_INITIAL_NETWORKS=${NEUTRON_CREATE_INITIAL_NETWORKS:-True} | 
 | 10 |  | 
 | 11 | ## Provider Network Information | 
 | 12 | PROVIDER_SUBNET_NAME=${PROVIDER_SUBNET_NAME:-"provider_net"} | 
 | 13 | IPV6_PROVIDER_SUBNET_NAME=${IPV6_PROVIDER_SUBNET_NAME:-"provider_net_v6"} | 
 | 14 | IPV6_PROVIDER_FIXED_RANGE=${IPV6_PROVIDER_FIXED_RANGE:-} | 
 | 15 | IPV6_PROVIDER_NETWORK_GATEWAY=${IPV6_PROVIDER_NETWORK_GATEWAY:-} | 
 | 16 |  | 
 | 17 | PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex} | 
| Ihar Hrachyshka | 7b5c7dc | 2016-07-15 20:17:13 +0200 | [diff] [blame] | 18 | PUBLIC_BRIDGE_MTU=${PUBLIC_BRIDGE_MTU:-1500} | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 19 |  | 
| Kevin Benton | 1554ade | 2016-07-22 09:40:19 -0700 | [diff] [blame] | 20 | # If Q_ASSIGN_GATEWAY_TO_PUBLIC_BRIDGE=True, assign the gateway IP of the public | 
 | 21 | # subnet to the public bridge interface even if Q_USE_PROVIDERNET_FOR_PUBLIC is | 
 | 22 | # used. | 
 | 23 | Q_ASSIGN_GATEWAY_TO_PUBLIC_BRIDGE=${Q_ASSIGN_GATEWAY_TO_PUBLIC_BRIDGE:-True} | 
 | 24 |  | 
| YAMAMOTO Takashi | 1aa4368 | 2016-07-21 19:37:04 +0900 | [diff] [blame] | 25 | # The name of the default router | 
 | 26 | Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1} | 
 | 27 |  | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 28 | # If Q_USE_PUBLIC_VETH=True, create and use a veth pair instead of | 
 | 29 | # PUBLIC_BRIDGE.  This is intended to be used with | 
 | 30 | # Q_USE_PROVIDERNET_FOR_PUBLIC=True. | 
 | 31 | Q_USE_PUBLIC_VETH=${Q_USE_PUBLIC_VETH:-False} | 
 | 32 | Q_PUBLIC_VETH_EX=${Q_PUBLIC_VETH_EX:-veth-pub-ex} | 
 | 33 | Q_PUBLIC_VETH_INT=${Q_PUBLIC_VETH_INT:-veth-pub-int} | 
 | 34 |  | 
| vsaienko | d894221 | 2016-05-13 12:51:30 +0300 | [diff] [blame] | 35 | # The next variable is configured by plugin | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 36 | # e.g.  _configure_neutron_l3_agent or lib/neutron_plugins/* | 
 | 37 | # | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 38 | # L3 routers exist per tenant | 
 | 39 | Q_L3_ROUTER_PER_TENANT=${Q_L3_ROUTER_PER_TENANT:-True} | 
 | 40 |  | 
 | 41 |  | 
 | 42 | # Use flat providernet for public network | 
 | 43 | # | 
 | 44 | # If Q_USE_PROVIDERNET_FOR_PUBLIC=True, use a flat provider network | 
 | 45 | # for external interface of neutron l3-agent.  In that case, | 
 | 46 | # PUBLIC_PHYSICAL_NETWORK specifies provider:physical_network value | 
 | 47 | # used for the network.  In case of ofagent, you should add the | 
 | 48 | # corresponding entry to your OFAGENT_PHYSICAL_INTERFACE_MAPPINGS. | 
 | 49 | # For openvswitch agent, you should add the corresponding entry to | 
 | 50 | # your OVS_BRIDGE_MAPPINGS. | 
 | 51 | # | 
 | 52 | # eg.  (ofagent) | 
 | 53 | #    Q_USE_PROVIDERNET_FOR_PUBLIC=True | 
 | 54 | #    Q_USE_PUBLIC_VETH=True | 
 | 55 | #    PUBLIC_PHYSICAL_NETWORK=public | 
 | 56 | #    OFAGENT_PHYSICAL_INTERFACE_MAPPINGS=public:veth-pub-int | 
 | 57 | # | 
 | 58 | # eg.  (openvswitch agent) | 
 | 59 | #    Q_USE_PROVIDERNET_FOR_PUBLIC=True | 
 | 60 | #    PUBLIC_PHYSICAL_NETWORK=public | 
 | 61 | #    OVS_BRIDGE_MAPPINGS=public:br-ex | 
| Kevin Benton | 1554ade | 2016-07-22 09:40:19 -0700 | [diff] [blame] | 62 | Q_USE_PROVIDERNET_FOR_PUBLIC=${Q_USE_PROVIDERNET_FOR_PUBLIC:-True} | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 63 | PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK:-public} | 
 | 64 |  | 
 | 65 | # Generate 40-bit IPv6 Global ID to comply with RFC 4193 | 
 | 66 | IPV6_GLOBAL_ID=`uuidgen | sed s/-//g | cut -c 23- | sed -e "s/\(..\)\(....\)\(....\)/\1:\2:\3/"` | 
 | 67 |  | 
 | 68 | # IPv6 gateway and subnet defaults, in case they are not customized in localrc | 
 | 69 | IPV6_RA_MODE=${IPV6_RA_MODE:-slaac} | 
 | 70 | IPV6_ADDRESS_MODE=${IPV6_ADDRESS_MODE:-slaac} | 
 | 71 | IPV6_PUBLIC_SUBNET_NAME=${IPV6_PUBLIC_SUBNET_NAME:-ipv6-public-subnet} | 
 | 72 | IPV6_PRIVATE_SUBNET_NAME=${IPV6_PRIVATE_SUBNET_NAME:-ipv6-private-subnet} | 
| Kevin Benton | 4bfbc29 | 2016-11-15 17:26:05 -0800 | [diff] [blame] | 73 | IPV6_ADDRS_SAFE_TO_USE=${IPV6_ADDRS_SAFE_TO_USE:-fd$IPV6_GLOBAL_ID::/56} | 
 | 74 | # if we got larger than a /64 safe to use, we only use the first /64 to | 
 | 75 | # avoid side effects outlined in rfc7421 | 
| Clark Boylan | a5afa7d | 2016-11-18 12:32:19 -0800 | [diff] [blame] | 76 | FIXED_RANGE_V6=${FIXED_RANGE_V6:-$(echo $IPV6_ADDRS_SAFE_TO_USE | awk -F '/' '{ print $1"/"($2>63 ? $2 : 64) }')} | 
| Brian Haley | 31813e9 | 2016-08-22 15:39:22 -0400 | [diff] [blame] | 77 | IPV6_PRIVATE_NETWORK_GATEWAY=${IPV6_PRIVATE_NETWORK_GATEWAY:-} | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 78 | IPV6_PUBLIC_RANGE=${IPV6_PUBLIC_RANGE:-2001:db8::/64} | 
 | 79 | IPV6_PUBLIC_NETWORK_GATEWAY=${IPV6_PUBLIC_NETWORK_GATEWAY:-2001:db8::2} | 
 | 80 | IPV6_ROUTER_GW_IP=${IPV6_ROUTER_GW_IP:-2001:db8::1} | 
 | 81 |  | 
 | 82 | # Gateway and subnet defaults, in case they are not customized in localrc | 
| Brian Haley | 31813e9 | 2016-08-22 15:39:22 -0400 | [diff] [blame] | 83 | NETWORK_GATEWAY=${NETWORK_GATEWAY:-} | 
 | 84 | PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-} | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 85 | PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"} | 
 | 86 | PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"} | 
 | 87 |  | 
 | 88 | # Subnetpool defaults | 
| rajinir | c58a155 | 2016-09-27 17:14:59 -0500 | [diff] [blame] | 89 | USE_SUBNETPOOL=${USE_SUBNETPOOL:-True} | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 90 | SUBNETPOOL_NAME=${SUBNETPOOL_NAME:-"shared-default-subnetpool"} | 
 | 91 |  | 
| Kevin Benton | 4bfbc29 | 2016-11-15 17:26:05 -0800 | [diff] [blame] | 92 | SUBNETPOOL_PREFIX_V4=${SUBNETPOOL_PREFIX_V4:-$IPV4_ADDRS_SAFE_TO_USE} | 
 | 93 | SUBNETPOOL_PREFIX_V6=${SUBNETPOOL_PREFIX_V6:-$IPV6_ADDRS_SAFE_TO_USE} | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 94 |  | 
| Kevin Benton | 4bfbc29 | 2016-11-15 17:26:05 -0800 | [diff] [blame] | 95 | SUBNETPOOL_SIZE_V4=${SUBNETPOOL_SIZE_V4:-26} | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 96 | SUBNETPOOL_SIZE_V6=${SUBNETPOOL_SIZE_V6:-64} | 
 | 97 |  | 
| Henry Gessau | 734f144 | 2016-09-17 19:28:53 -0400 | [diff] [blame] | 98 | default_v4_route_devs=$(ip -4 route | grep ^default | awk '{print $5}') | 
 | 99 | die_if_not_set $LINENO default_v4_route_devs "Failure retrieving default IPv4 route devices" | 
 | 100 |  | 
 | 101 | default_v6_route_devs=$(ip -6 route | grep ^default | awk '{print $5}') | 
| Monty Taylor | c12d1d9 | 2016-08-23 19:07:57 -0500 | [diff] [blame] | 102 |  | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 103 | function _determine_config_l3 { | 
| Angus Lees | a1c70f2 | 2016-05-31 14:43:14 +1000 | [diff] [blame] | 104 |     local opts="--config-file $NEUTRON_CONF --config-file $Q_L3_CONF_FILE" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 105 |     echo "$opts" | 
 | 106 | } | 
 | 107 |  | 
 | 108 | function _configure_neutron_l3_agent { | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 109 |  | 
 | 110 |     cp $NEUTRON_DIR/etc/l3_agent.ini.sample $Q_L3_CONF_FILE | 
 | 111 |  | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 112 |     iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL | 
| Sean M. Collins | a2ed055 | 2016-05-11 15:35:10 -0400 | [diff] [blame] | 113 |     iniset $Q_L3_CONF_FILE AGENT root_helper "$Q_RR_COMMAND" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 114 |     if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then | 
| Sean M. Collins | a2ed055 | 2016-05-11 15:35:10 -0400 | [diff] [blame] | 115 |         iniset $Q_L3_CONF_FILE AGENT root_helper_daemon "$Q_RR_DAEMON_COMMAND" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 116 |     fi | 
 | 117 |  | 
 | 118 |     _neutron_setup_interface_driver $Q_L3_CONF_FILE | 
 | 119 |  | 
| Stephen Finucane | 24e29f2 | 2016-06-15 14:31:51 +0100 | [diff] [blame] | 120 |     neutron_plugin_configure_l3_agent $Q_L3_CONF_FILE | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 121 |  | 
| Sean Dague | 6a008fa | 2016-08-03 15:09:01 -0400 | [diff] [blame] | 122 |     # If we've given a PUBLIC_INTERFACE to take over, then we assume | 
 | 123 |     # that we can own the whole thing, and privot it into the OVS | 
 | 124 |     # bridge. If we are not, we're probably on a single interface | 
 | 125 |     # machine, and we just setup NAT so that fixed guests can get out. | 
 | 126 |     if [[ -n "$PUBLIC_INTERFACE" ]]; then | 
 | 127 |         _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True False "inet" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 128 |  | 
| Sean Dague | 6a008fa | 2016-08-03 15:09:01 -0400 | [diff] [blame] | 129 |         if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then | 
 | 130 |             _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False False "inet6" | 
 | 131 |         fi | 
 | 132 |     else | 
| Henry Gessau | 734f144 | 2016-09-17 19:28:53 -0400 | [diff] [blame] | 133 |         for d in $default_v4_route_devs; do | 
 | 134 |             sudo iptables -t nat -A POSTROUTING -o $d -s $FLOATING_RANGE -j MASQUERADE | 
 | 135 |         done | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 136 |     fi | 
 | 137 | } | 
 | 138 |  | 
 | 139 | # Explicitly set router id in l3 agent configuration | 
 | 140 | function _neutron_set_router_id { | 
 | 141 |     if [[ "$Q_L3_ROUTER_PER_TENANT" == "False" ]]; then | 
 | 142 |         iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID | 
 | 143 |     fi | 
 | 144 | } | 
 | 145 |  | 
 | 146 | # Get ext_gw_interface depending on value of Q_USE_PUBLIC_VETH | 
 | 147 | function _neutron_get_ext_gw_interface { | 
 | 148 |     if [[ "$Q_USE_PUBLIC_VETH" == "True" ]]; then | 
 | 149 |         echo $Q_PUBLIC_VETH_EX | 
 | 150 |     else | 
 | 151 |         # Disable in-band as we are going to use local port | 
 | 152 |         # to communicate with VMs | 
 | 153 |         sudo ovs-vsctl set Bridge $PUBLIC_BRIDGE \ | 
 | 154 |             other_config:disable-in-band=true | 
 | 155 |         echo $PUBLIC_BRIDGE | 
 | 156 |     fi | 
 | 157 | } | 
 | 158 |  | 
 | 159 | function create_neutron_initial_network { | 
 | 160 |     local project_id | 
 | 161 |     project_id=$(openstack project list | grep " demo " | get_field 1) | 
 | 162 |     die_if_not_set $LINENO project_id "Failure retrieving project_id for demo" | 
 | 163 |  | 
 | 164 |     # Allow drivers that need to create an initial network to do so here | 
 | 165 |     if type -p neutron_plugin_create_initial_network_profile > /dev/null; then | 
 | 166 |         neutron_plugin_create_initial_network_profile $PHYSICAL_NETWORK | 
 | 167 |     fi | 
 | 168 |  | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 169 |     if is_networking_extension_supported "auto-allocated-topology"; then | 
| rajinir | c58a155 | 2016-09-27 17:14:59 -0500 | [diff] [blame] | 170 |         if [[ "$USE_SUBNETPOOL" == "True" ]]; then | 
 | 171 |             if [[ "$IP_VERSION" =~ 4.* ]]; then | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 172 |                 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) | 
| rajinir | c58a155 | 2016-09-27 17:14:59 -0500 | [diff] [blame] | 173 |             fi | 
 | 174 |             if [[ "$IP_VERSION" =~ .*6 ]]; then | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 175 |                 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) | 
| rajinir | c58a155 | 2016-09-27 17:14:59 -0500 | [diff] [blame] | 176 |             fi | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 177 |         fi | 
 | 178 |     fi | 
 | 179 |  | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 180 |     if is_provider_network; then | 
 | 181 |         die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK" | 
 | 182 |         die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specify the PROVIDER_NETWORK_TYPE" | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 183 |         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) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 184 |         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $project_id" | 
 | 185 |  | 
 | 186 |         if [[ "$IP_VERSION" =~ 4.* ]]; then | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 187 |             if [ -z $SUBNETPOOL_V4_ID ]; then | 
 | 188 |                 fixed_range_v4=$FIXED_RANGE | 
 | 189 |             fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 190 |             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) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 191 |             die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id" | 
 | 192 |         fi | 
 | 193 |  | 
| Sean M. Collins | e34ec99 | 2016-06-07 12:36:50 -0400 | [diff] [blame] | 194 |         if [[ "$IP_VERSION" =~ .*6 ]]; then | 
 | 195 |             die_if_not_set $LINENO IPV6_PROVIDER_FIXED_RANGE "IPV6_PROVIDER_FIXED_RANGE has not been set, but Q_USE_PROVIDERNET_FOR_PUBLIC is true and IP_VERSION includes 6" | 
 | 196 |             die_if_not_set $LINENO IPV6_PROVIDER_NETWORK_GATEWAY "IPV6_PROVIDER_NETWORK_GATEWAY has not been set, but Q_USE_PROVIDERNET_FOR_PUBLIC is true and IP_VERSION includes 6" | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 197 |             if [ -z $SUBNETPOOL_V6_ID ]; then | 
 | 198 |                 fixed_range_v6=$IPV6_PROVIDER_FIXED_RANGE | 
 | 199 |             fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 200 |             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) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 201 |             die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id" | 
 | 202 |         fi | 
 | 203 |  | 
 | 204 |         if [[ $Q_AGENT == "openvswitch" ]]; then | 
 | 205 |             sudo ip link set $OVS_PHYSICAL_BRIDGE up | 
 | 206 |             sudo ip link set br-int up | 
 | 207 |             sudo ip link set $PUBLIC_INTERFACE up | 
 | 208 |         fi | 
 | 209 |     else | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 210 |         NET_ID=$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" network create --project $project_id "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 211 |         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id" | 
 | 212 |  | 
 | 213 |         if [[ "$IP_VERSION" =~ 4.* ]]; then | 
 | 214 |             # Create IPv4 private subnet | 
 | 215 |             SUBNET_ID=$(_neutron_create_private_subnet_v4 $project_id) | 
 | 216 |         fi | 
 | 217 |  | 
 | 218 |         if [[ "$IP_VERSION" =~ .*6 ]]; then | 
 | 219 |             # Create IPv6 private subnet | 
 | 220 |             IPV6_SUBNET_ID=$(_neutron_create_private_subnet_v6 $project_id) | 
 | 221 |         fi | 
 | 222 |     fi | 
 | 223 |  | 
| Sean M. Collins | c35110e | 2016-05-18 10:38:51 -0400 | [diff] [blame] | 224 |     if is_networking_extension_supported "router" && is_networking_extension_supported "external-net"; then | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 225 |         # Create a router, and add the private subnet as one of its interfaces | 
 | 226 |         if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then | 
 | 227 |             # create a tenant-owned router. | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 228 |             ROUTER_ID=$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" router create --project $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 229 |             die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME" | 
 | 230 |         else | 
 | 231 |             # Plugin only supports creating a single router, which should be admin owned. | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 232 |             ROUTER_ID=$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" router create $Q_ROUTER_NAME | grep ' id ' | get_field 2) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 233 |             die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME" | 
 | 234 |         fi | 
 | 235 |  | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 236 |         EXTERNAL_NETWORK_FLAGS="--external" | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 237 |         if is_networking_extension_supported "auto-allocated-topology"; then | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 238 |             EXTERNAL_NETWORK_FLAGS="$EXTERNAL_NETWORK_FLAGS --default" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 239 |         fi | 
 | 240 |         # Create an external network, and a subnet. Configure the external network as router gw | 
 | 241 |         if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 242 |             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) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 243 |         else | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 244 |             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) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 245 |         fi | 
 | 246 |         die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME" | 
 | 247 |  | 
 | 248 |         if [[ "$IP_VERSION" =~ 4.* ]]; then | 
 | 249 |             # Configure router for IPv4 public access | 
 | 250 |             _neutron_configure_router_v4 | 
 | 251 |         fi | 
 | 252 |  | 
 | 253 |         if [[ "$IP_VERSION" =~ .*6 ]]; then | 
 | 254 |             # Configure router for IPv6 public access | 
 | 255 |             _neutron_configure_router_v6 | 
 | 256 |         fi | 
 | 257 |     fi | 
 | 258 | } | 
 | 259 |  | 
 | 260 | # Create private IPv4 subnet | 
 | 261 | function _neutron_create_private_subnet_v4 { | 
 | 262 |     local project_id=$1 | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 263 |     if [ -z $SUBNETPOOL_V4_ID ]; then | 
 | 264 |         fixed_range_v4=$FIXED_RANGE | 
 | 265 |     fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 266 |     local subnet_params="--project $project_id " | 
 | 267 |     subnet_params+="--ip-version 4 " | 
| Brian Haley | 31813e9 | 2016-08-22 15:39:22 -0400 | [diff] [blame] | 268 |     if [[ -n "$NETWORK_GATEWAY" ]]; then | 
 | 269 |         subnet_params+="--gateway $NETWORK_GATEWAY " | 
 | 270 |     fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 271 |     subnet_params+="${SUBNETPOOL_V4_ID:+--subnet-pool $SUBNETPOOL_V4_ID} " | 
 | 272 |     subnet_params+="${fixed_range_v4:+--subnet-range $fixed_range_v4} " | 
 | 273 |     subnet_params+="--network $NET_ID $PRIVATE_SUBNET_NAME" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 274 |     local subnet_id | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 275 |     subnet_id=$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" subnet create $subnet_params | grep ' id ' | get_field 2) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 276 |     die_if_not_set $LINENO subnet_id "Failure creating private IPv4 subnet for $project_id" | 
 | 277 |     echo $subnet_id | 
 | 278 | } | 
 | 279 |  | 
 | 280 | # Create private IPv6 subnet | 
 | 281 | function _neutron_create_private_subnet_v6 { | 
 | 282 |     local project_id=$1 | 
 | 283 |     die_if_not_set $LINENO IPV6_RA_MODE "IPV6 RA Mode not set" | 
 | 284 |     die_if_not_set $LINENO IPV6_ADDRESS_MODE "IPV6 Address Mode not set" | 
 | 285 |     local ipv6_modes="--ipv6-ra-mode $IPV6_RA_MODE --ipv6-address-mode $IPV6_ADDRESS_MODE" | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 286 |     if [ -z $SUBNETPOOL_V6_ID ]; then | 
 | 287 |         fixed_range_v6=$FIXED_RANGE_V6 | 
 | 288 |     fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 289 |     local subnet_params="--project $project_id " | 
 | 290 |     subnet_params+="--ip-version 6 " | 
| Brian Haley | 31813e9 | 2016-08-22 15:39:22 -0400 | [diff] [blame] | 291 |     if [[ -n "$IPV6_PRIVATE_NETWORK_GATEWAY" ]]; then | 
 | 292 |         subnet_params+="--gateway $IPV6_PRIVATE_NETWORK_GATEWAY " | 
 | 293 |     fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 294 |     subnet_params+="${SUBNETPOOL_V6_ID:+--subnet-pool $SUBNETPOOL_V6_ID} " | 
 | 295 |     subnet_params+="${fixed_range_v6:+--subnet-range $fixed_range_v6 $ipv6_modes} " | 
 | 296 |     subnet_params+="--network $NET_ID $IPV6_PRIVATE_SUBNET_NAME " | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 297 |     local ipv6_subnet_id | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 298 |     ipv6_subnet_id=$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" subnet create $subnet_params | grep ' id ' | get_field 2) | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 299 |     die_if_not_set $LINENO ipv6_subnet_id "Failure creating private IPv6 subnet for $project_id" | 
 | 300 |     echo $ipv6_subnet_id | 
 | 301 | } | 
 | 302 |  | 
 | 303 | # Create public IPv4 subnet | 
 | 304 | function _neutron_create_public_subnet_v4 { | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 305 |     local subnet_params="--ip-version 4 " | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 306 |     subnet_params+="${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} " | 
| Brian Haley | 31813e9 | 2016-08-22 15:39:22 -0400 | [diff] [blame] | 307 |     if [[ -n "$PUBLIC_NETWORK_GATEWAY" ]]; then | 
 | 308 |         subnet_params+="--gateway $PUBLIC_NETWORK_GATEWAY " | 
 | 309 |     fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 310 |     subnet_params+="--network $EXT_NET_ID --subnet-range $FLOATING_RANGE --no-dhcp " | 
 | 311 |     subnet_params+="$PUBLIC_SUBNET_NAME" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 312 |     local id_and_ext_gw_ip | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 313 |     id_and_ext_gw_ip=$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" subnet create $subnet_params | grep -e 'gateway_ip' -e ' id ') | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 314 |     die_if_not_set $LINENO id_and_ext_gw_ip "Failure creating public IPv4 subnet" | 
 | 315 |     echo $id_and_ext_gw_ip | 
 | 316 | } | 
 | 317 |  | 
 | 318 | # Create public IPv6 subnet | 
 | 319 | function _neutron_create_public_subnet_v6 { | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 320 |     local subnet_params="--ip-version 6 " | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 321 |     subnet_params+="--gateway $IPV6_PUBLIC_NETWORK_GATEWAY " | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 322 |     subnet_params+="--network $EXT_NET_ID --subnet-range $IPV6_PUBLIC_RANGE --no-dhcp " | 
 | 323 |     subnet_params+="$IPV6_PUBLIC_SUBNET_NAME" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 324 |     local ipv6_id_and_ext_gw_ip | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 325 |     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 ') | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 326 |     die_if_not_set $LINENO ipv6_id_and_ext_gw_ip "Failure creating an IPv6 public subnet" | 
 | 327 |     echo $ipv6_id_and_ext_gw_ip | 
 | 328 | } | 
 | 329 |  | 
 | 330 | # Configure neutron router for IPv4 public access | 
 | 331 | function _neutron_configure_router_v4 { | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 332 |     openstack --os-cloud devstack-admin --os-region "$REGION_NAME" router add subnet $ROUTER_ID $SUBNET_ID | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 333 |     # Create a public subnet on the external network | 
 | 334 |     local id_and_ext_gw_ip | 
 | 335 |     id_and_ext_gw_ip=$(_neutron_create_public_subnet_v4 $EXT_NET_ID) | 
 | 336 |     local ext_gw_ip | 
 | 337 |     ext_gw_ip=$(echo $id_and_ext_gw_ip  | get_field 2) | 
 | 338 |     PUB_SUBNET_ID=$(echo $id_and_ext_gw_ip | get_field 5) | 
 | 339 |     # Configure the external network as the default router gateway | 
 | 340 |     neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID | 
 | 341 |  | 
 | 342 |     # This logic is specific to using the l3-agent for layer 3 | 
| Sean M. Collins | d00cbb7 | 2016-06-20 13:53:44 -0400 | [diff] [blame] | 343 |     if is_service_enabled q-l3 || is_service_enabled neutron-l3;  then | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 344 |         # Configure and enable public bridge | 
 | 345 |         local ext_gw_interface="none" | 
 | 346 |         if is_neutron_ovs_base_plugin; then | 
 | 347 |             ext_gw_interface=$(_neutron_get_ext_gw_interface) | 
 | 348 |         elif [[ "$Q_AGENT" = "linuxbridge" ]]; then | 
| Kevin Benton | 6a42a85 | 2016-07-21 11:11:54 -0700 | [diff] [blame] | 349 |             # Get the device the neutron router and network for $FIXED_RANGE | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 350 |             # will be using. | 
| Kevin Benton | 6a42a85 | 2016-07-21 11:11:54 -0700 | [diff] [blame] | 351 |             if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then | 
 | 352 |                 # in provider nets a bridge mapping uses the public bridge directly | 
 | 353 |                 ext_gw_interface=$PUBLIC_BRIDGE | 
 | 354 |             else | 
 | 355 |                 # e.x. brq3592e767-da for NET_ID 3592e767-da66-4bcb-9bec-cdb03cd96102 | 
 | 356 |                 ext_gw_interface=brq${EXT_NET_ID:0:11} | 
 | 357 |             fi | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 358 |         fi | 
 | 359 |         if [[ "$ext_gw_interface" != "none" ]]; then | 
 | 360 |             local cidr_len=${FLOATING_RANGE#*/} | 
 | 361 |             local testcmd="ip -o link | grep -q $ext_gw_interface" | 
 | 362 |             test_with_retry "$testcmd" "$ext_gw_interface creation failed" | 
| Kevin Benton | 1554ade | 2016-07-22 09:40:19 -0700 | [diff] [blame] | 363 |             if [[ $(ip addr show dev $ext_gw_interface | grep -c $ext_gw_ip) == 0 && ( $Q_USE_PROVIDERNET_FOR_PUBLIC == "False" || $Q_USE_PUBLIC_VETH == "True" || $Q_ASSIGN_GATEWAY_TO_PUBLIC_BRIDGE == "True" ) ]]; then | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 364 |                 sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface | 
 | 365 |                 sudo ip link set $ext_gw_interface up | 
 | 366 |             fi | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 367 |             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' ' ') | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 368 |             die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP" | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 369 |         fi | 
 | 370 |         _neutron_set_router_id | 
 | 371 |     fi | 
 | 372 | } | 
 | 373 |  | 
 | 374 | # Configure neutron router for IPv6 public access | 
 | 375 | function _neutron_configure_router_v6 { | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 376 |     openstack --os-cloud devstack-admin --os-region "$REGION_NAME" router add subnet $ROUTER_ID $IPV6_SUBNET_ID | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 377 |     # Create a public subnet on the external network | 
 | 378 |     local ipv6_id_and_ext_gw_ip | 
 | 379 |     ipv6_id_and_ext_gw_ip=$(_neutron_create_public_subnet_v6 $EXT_NET_ID) | 
 | 380 |     local ipv6_ext_gw_ip | 
 | 381 |     ipv6_ext_gw_ip=$(echo $ipv6_id_and_ext_gw_ip | get_field 2) | 
 | 382 |     local ipv6_pub_subnet_id | 
 | 383 |     ipv6_pub_subnet_id=$(echo $ipv6_id_and_ext_gw_ip | get_field 5) | 
 | 384 |  | 
 | 385 |     # If the external network has not already been set as the default router | 
 | 386 |     # gateway when configuring an IPv4 public subnet, do so now | 
 | 387 |     if [[ "$IP_VERSION" == "6" ]]; then | 
 | 388 |         neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID | 
 | 389 |     fi | 
 | 390 |  | 
 | 391 |     # This logic is specific to using the l3-agent for layer 3 | 
| Sean M. Collins | d00cbb7 | 2016-06-20 13:53:44 -0400 | [diff] [blame] | 392 |     if is_service_enabled q-l3 || is_service_enabled neutron-l3; then | 
| Henry Gessau | 734f144 | 2016-09-17 19:28:53 -0400 | [diff] [blame] | 393 |         # Ensure IPv6 RAs are accepted on interfaces with a default route. | 
| Monty Taylor | c12d1d9 | 2016-08-23 19:07:57 -0500 | [diff] [blame] | 394 |         # This is needed for neutron-based devstack clouds to work in | 
 | 395 |         # IPv6-only clouds in the gate. Please do not remove this without | 
 | 396 |         # talking to folks in Infra. | 
| Henry Gessau | 734f144 | 2016-09-17 19:28:53 -0400 | [diff] [blame] | 397 |         for d in $default_v6_route_devs; do | 
| Drago Rosson | b34d459 | 2016-09-26 13:23:23 -0500 | [diff] [blame] | 398 |             # Slashes must be used in this sysctl command because route devices | 
 | 399 |             # can have dots in their names. If dots were used, dots in the | 
 | 400 |             # device name would be reinterpreted as a slash, causing an error. | 
 | 401 |             sudo sysctl -w net/ipv6/conf/$d/accept_ra=2 | 
| Henry Gessau | 734f144 | 2016-09-17 19:28:53 -0400 | [diff] [blame] | 402 |         done | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 403 |         # Ensure IPv6 forwarding is enabled on the host | 
 | 404 |         sudo sysctl -w net.ipv6.conf.all.forwarding=1 | 
 | 405 |         # Configure and enable public bridge | 
 | 406 |         # Override global IPV6_ROUTER_GW_IP with the true value from neutron | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 407 |         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' ' ') | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 408 |         die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP" | 
 | 409 |  | 
 | 410 |         if is_neutron_ovs_base_plugin; then | 
 | 411 |             local ext_gw_interface | 
 | 412 |             ext_gw_interface=$(_neutron_get_ext_gw_interface) | 
 | 413 |             local ipv6_cidr_len=${IPV6_PUBLIC_RANGE#*/} | 
 | 414 |  | 
 | 415 |             # Configure interface for public bridge | 
| Yi Zhao | a464ea7 | 2016-05-12 10:32:58 +0800 | [diff] [blame] | 416 |             sudo ip -6 addr replace $ipv6_ext_gw_ip/$ipv6_cidr_len dev $ext_gw_interface | 
| Matt Van Dijk | d7a3f5c | 2016-08-16 15:46:58 +0000 | [diff] [blame] | 417 |             local replace_range=${SUBNETPOOL_PREFIX_V6} | 
 | 418 |             if [[ -z "${SUBNETPOOL_V6_ID}" ]]; then | 
 | 419 |                 replace_range=${FIXED_RANGE_V6} | 
 | 420 |             fi | 
 | 421 |             sudo ip -6 route replace $replace_range via $IPV6_ROUTER_GW_IP dev $ext_gw_interface | 
| Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 422 |         fi | 
 | 423 |         _neutron_set_router_id | 
 | 424 |     fi | 
 | 425 | } | 
| watanabe.isao | 4f4d95a | 2016-05-12 20:35:20 +0900 | [diff] [blame] | 426 |  | 
| Sean M. Collins | c35110e | 2016-05-18 10:38:51 -0400 | [diff] [blame] | 427 | function is_networking_extension_supported { | 
 | 428 |     local extension=$1 | 
 | 429 |     # TODO(sc68cal) cache this instead of calling every time | 
| Armando Migliaccio | 4f11ff3 | 2016-10-27 06:15:23 -0700 | [diff] [blame] | 430 |     EXT_LIST=$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" extension list --network -c Alias -f value) | 
| Sean M. Collins | c35110e | 2016-05-18 10:38:51 -0400 | [diff] [blame] | 431 |     [[ $EXT_LIST =~ $extension ]] && return 0 | 
 | 432 | } |