| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1 | # lib/neutron | 
| Joe Gordon | 2394605 | 2014-01-15 21:42:32 +0000 | [diff] [blame] | 2 | # functions - functions specific to neutron | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 3 |  | 
|  | 4 | # Dependencies: | 
|  | 5 | # ``functions`` file | 
|  | 6 | # ``DEST`` must be defined | 
| Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 7 | # ``STACK_USER`` must be defined | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 8 |  | 
|  | 9 | # ``stack.sh`` calls the entry points in this order: | 
|  | 10 | # | 
| Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 11 | # - install_neutron | 
|  | 12 | # - install_neutronclient | 
|  | 13 | # - install_neutron_agent_packages | 
|  | 14 | # - install_neutron_third_party | 
|  | 15 | # - configure_neutron | 
|  | 16 | # - init_neutron | 
|  | 17 | # - configure_neutron_third_party | 
|  | 18 | # - init_neutron_third_party | 
|  | 19 | # - start_neutron_third_party | 
| Emilien Macchi | a677b7f | 2013-11-25 23:40:20 +0100 | [diff] [blame] | 20 | # - create_neutron_cache_dir | 
| Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 21 | # - create_nova_conf_neutron | 
|  | 22 | # - start_neutron_service_and_check | 
|  | 23 | # - create_neutron_initial_network | 
|  | 24 | # - setup_neutron_debug | 
|  | 25 | # - start_neutron_agents | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 26 | # | 
|  | 27 | # ``unstack.sh`` calls the entry points in this order: | 
|  | 28 | # | 
| Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 29 | # - stop_neutron | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 30 |  | 
|  | 31 | # Functions in lib/neutron are classified into the following categories: | 
|  | 32 | # | 
|  | 33 | # - entry points (called from stack.sh or unstack.sh) | 
|  | 34 | # - internal functions | 
|  | 35 | # - neutron exercises | 
|  | 36 | # - 3rd party programs | 
|  | 37 |  | 
|  | 38 |  | 
|  | 39 | # Neutron Networking | 
|  | 40 | # ------------------ | 
|  | 41 |  | 
|  | 42 | # Make sure that neutron is enabled in ``ENABLED_SERVICES``.  If you want | 
|  | 43 | # to run Neutron on this host, make sure that q-svc is also in | 
|  | 44 | # ``ENABLED_SERVICES``. | 
|  | 45 | # | 
|  | 46 | # If you're planning to use the Neutron openvswitch plugin, set | 
|  | 47 | # ``Q_PLUGIN`` to "openvswitch" and make sure the q-agt service is enabled | 
|  | 48 | # in ``ENABLED_SERVICES``.  If you're planning to use the Neutron | 
|  | 49 | # linuxbridge plugin, set ``Q_PLUGIN`` to "linuxbridge" and make sure the | 
|  | 50 | # q-agt service is enabled in ``ENABLED_SERVICES``. | 
|  | 51 | # | 
|  | 52 | # See "Neutron Network Configuration" below for additional variables | 
|  | 53 | # that must be set in localrc for connectivity across hosts with | 
|  | 54 | # Neutron. | 
|  | 55 | # | 
|  | 56 | # With Neutron networking the NETWORK_MANAGER variable is ignored. | 
|  | 57 | # | 
|  | 58 | # To enable specific configuration options for either the Open vSwitch or | 
|  | 59 | # LinuxBridge plugin, please see the top level README file under the | 
|  | 60 | # Neutron section. | 
|  | 61 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 62 |  | 
|  | 63 | # Neutron Network Configuration | 
|  | 64 | # ----------------------------- | 
|  | 65 |  | 
|  | 66 | # Gateway and subnet defaults, in case they are not customized in localrc | 
|  | 67 | NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1} | 
| Salvatore Orlando | 90234ac | 2013-11-25 05:44:10 -0800 | [diff] [blame] | 68 | PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.1} | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 69 | PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"} | 
|  | 70 | PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"} | 
|  | 71 |  | 
|  | 72 | # Set up default directories | 
|  | 73 | NEUTRON_DIR=$DEST/neutron | 
|  | 74 | NEUTRONCLIENT_DIR=$DEST/python-neutronclient | 
|  | 75 | NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron} | 
|  | 76 |  | 
|  | 77 | # Support entry points installation of console scripts | 
|  | 78 | if [[ -d $NEUTRON_DIR/bin/neutron-server ]]; then | 
|  | 79 | NEUTRON_BIN_DIR=$NEUTRON_DIR/bin | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 80 | else | 
|  | 81 | NEUTRON_BIN_DIR=$(get_python_exec_prefix) | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 82 | fi | 
|  | 83 |  | 
|  | 84 | NEUTRON_CONF_DIR=/etc/neutron | 
|  | 85 | NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf | 
|  | 86 | export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"} | 
|  | 87 |  | 
|  | 88 | # Default Neutron Plugin | 
| Kyle Mestery | 6d23500 | 2013-09-18 20:27:08 +0000 | [diff] [blame] | 89 | Q_PLUGIN=${Q_PLUGIN:-ml2} | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 90 | # Default Neutron Port | 
|  | 91 | Q_PORT=${Q_PORT:-9696} | 
|  | 92 | # Default Neutron Host | 
|  | 93 | Q_HOST=${Q_HOST:-$SERVICE_HOST} | 
|  | 94 | # Default admin username | 
|  | 95 | Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-neutron} | 
|  | 96 | # Default auth strategy | 
|  | 97 | Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone} | 
|  | 98 | # Use namespace or not | 
|  | 99 | Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True} | 
|  | 100 | # RHEL's support for namespaces requires using veths with ovs | 
|  | 101 | Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False} | 
|  | 102 | Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True} | 
|  | 103 | # Meta data IP | 
|  | 104 | Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST} | 
|  | 105 | # Allow Overlapping IP among subnets | 
|  | 106 | Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True} | 
|  | 107 | # Use neutron-debug command | 
|  | 108 | Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False} | 
|  | 109 | # The name of the default q-l3 router | 
|  | 110 | Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1} | 
| Aaron Rosen | 4540d00 | 2013-10-24 13:59:33 -0700 | [diff] [blame] | 111 | # nova vif driver that all plugins should use | 
|  | 112 | NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} | 
| Terry Wilson | f06c443 | 2014-05-20 10:54:51 -0500 | [diff] [blame] | 113 | Q_NOTIFY_NOVA_PORT_STATUS_CHANGES=${Q_NOTIFY_NOVA_PORT_STATUS_CHANGES:-True} | 
|  | 114 | Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True} | 
| Aaron Rosen | cea32b1 | 2014-03-04 16:20:14 -0800 | [diff] [blame] | 115 | VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True} | 
|  | 116 | VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300} | 
| Aaron Rosen | 4540d00 | 2013-10-24 13:59:33 -0700 | [diff] [blame] | 117 |  | 
| Sean M. Collins | 5ec6f8f | 2014-05-14 17:01:03 -0400 | [diff] [blame] | 118 | ## Provider Network Information | 
|  | 119 | PROVIDER_SUBNET_NAME=${PROVIDER_SUBNET_NAME:-"provider_net"} | 
|  | 120 |  | 
| Tomoe Sugihara | afbc631 | 2013-11-14 20:02:47 +0000 | [diff] [blame] | 121 | # The next two variables are configured by plugin | 
|  | 122 | # e.g.  _configure_neutron_l3_agent or lib/neutron_plugins/* | 
|  | 123 | # | 
|  | 124 | # The plugin supports L3. | 
|  | 125 | Q_L3_ENABLED=${Q_L3_ENABLED:-False} | 
|  | 126 | # L3 routers exist per tenant | 
|  | 127 | Q_L3_ROUTER_PER_TENANT=${Q_L3_ROUTER_PER_TENANT:-False} | 
| Aaron Rosen | 4540d00 | 2013-10-24 13:59:33 -0700 | [diff] [blame] | 128 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 129 | # List of config file names in addition to the main plugin config file | 
|  | 130 | # See _configure_neutron_common() for details about setting it up | 
|  | 131 | declare -a Q_PLUGIN_EXTRA_CONF_FILES | 
|  | 132 |  | 
| Paul Michali | 746dcee | 2014-04-02 19:12:22 +0000 | [diff] [blame] | 133 | # List of (optional) config files for VPN device drivers to use with | 
|  | 134 | # the neutron-q-vpn agent | 
|  | 135 | declare -a Q_VPN_EXTRA_CONF_FILES | 
|  | 136 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 137 |  | 
| Dean Troyer | e2907b4 | 2014-02-26 17:35:37 -0600 | [diff] [blame] | 138 | Q_RR_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf | 
|  | 139 | if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then | 
|  | 140 | Q_RR_COMMAND="sudo" | 
|  | 141 | else | 
|  | 142 | NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron) | 
|  | 143 | Q_RR_COMMAND="sudo $NEUTRON_ROOTWRAP $Q_RR_CONF_FILE" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 144 | fi | 
|  | 145 |  | 
| Brian Haley | eea7621 | 2014-06-27 11:45:50 -0400 | [diff] [blame] | 146 |  | 
|  | 147 | # Distributed Virtual Router (DVR) configuration | 
|  | 148 | # Can be: | 
|  | 149 | #     legacy   - No DVR functionality | 
|  | 150 | #     dvr_snat - Controller or single node DVR | 
|  | 151 | #     dvr      - Compute node in multi-node DVR | 
|  | 152 | Q_DVR_MODE=${Q_DVR_MODE:-legacy} | 
|  | 153 | if [[ "$Q_DVR_MODE" != "legacy" ]]; then | 
|  | 154 | Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch,linuxbridge,l2population | 
|  | 155 | fi | 
|  | 156 |  | 
| Dean Troyer | e2907b4 | 2014-02-26 17:35:37 -0600 | [diff] [blame] | 157 | # Provider Network Configurations | 
|  | 158 | # -------------------------------- | 
|  | 159 |  | 
|  | 160 | # The following variables control the Neutron openvswitch and | 
|  | 161 | # linuxbridge plugins' allocation of tenant networks and | 
|  | 162 | # availability of provider networks. If these are not configured | 
|  | 163 | # in ``localrc``, tenant networks will be local to the host (with no | 
|  | 164 | # remote connectivity), and no physical resources will be | 
|  | 165 | # available for the allocation of provider networks. | 
|  | 166 |  | 
|  | 167 | # To use GRE tunnels for tenant networks, set to True in | 
|  | 168 | # ``localrc``. GRE tunnels are only supported by the openvswitch | 
|  | 169 | # plugin, and currently only on Ubuntu. | 
|  | 170 | ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False} | 
|  | 171 |  | 
|  | 172 | # If using GRE tunnels for tenant networks, specify the range of | 
|  | 173 | # tunnel IDs from which tenant networks are allocated. Can be | 
|  | 174 | # overriden in ``localrc`` in necesssary. | 
| Anant Patil | 3827dc0 | 2014-07-03 21:38:16 +0530 | [diff] [blame] | 175 | TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGES:-1:1000} | 
| Dean Troyer | e2907b4 | 2014-02-26 17:35:37 -0600 | [diff] [blame] | 176 |  | 
|  | 177 | # To use VLANs for tenant networks, set to True in localrc. VLANs | 
|  | 178 | # are supported by the openvswitch and linuxbridge plugins, each | 
|  | 179 | # requiring additional configuration described below. | 
|  | 180 | ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False} | 
|  | 181 |  | 
|  | 182 | # If using VLANs for tenant networks, set in ``localrc`` to specify | 
|  | 183 | # the range of VLAN VIDs from which tenant networks are | 
|  | 184 | # allocated. An external network switch must be configured to | 
|  | 185 | # trunk these VLANs between hosts for multi-host connectivity. | 
|  | 186 | # | 
|  | 187 | # Example: ``TENANT_VLAN_RANGE=1000:1999`` | 
|  | 188 | TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-} | 
|  | 189 |  | 
|  | 190 | # If using VLANs for tenant networks, or if using flat or VLAN | 
|  | 191 | # provider networks, set in ``localrc`` to the name of the physical | 
|  | 192 | # network, and also configure ``OVS_PHYSICAL_BRIDGE`` for the | 
|  | 193 | # openvswitch agent or ``LB_PHYSICAL_INTERFACE`` for the linuxbridge | 
|  | 194 | # agent, as described below. | 
|  | 195 | # | 
|  | 196 | # Example: ``PHYSICAL_NETWORK=default`` | 
|  | 197 | PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-} | 
|  | 198 |  | 
|  | 199 | # With the openvswitch plugin, if using VLANs for tenant networks, | 
|  | 200 | # or if using flat or VLAN provider networks, set in ``localrc`` to | 
|  | 201 | # the name of the OVS bridge to use for the physical network. The | 
|  | 202 | # bridge will be created if it does not already exist, but a | 
|  | 203 | # physical interface must be manually added to the bridge as a | 
|  | 204 | # port for external connectivity. | 
|  | 205 | # | 
|  | 206 | # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1`` | 
|  | 207 | OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-} | 
|  | 208 |  | 
|  | 209 | # With the linuxbridge plugin, if using VLANs for tenant networks, | 
|  | 210 | # or if using flat or VLAN provider networks, set in ``localrc`` to | 
|  | 211 | # the name of the network interface to use for the physical | 
|  | 212 | # network. | 
|  | 213 | # | 
|  | 214 | # Example: ``LB_PHYSICAL_INTERFACE=eth1`` | 
|  | 215 | LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-} | 
|  | 216 |  | 
| Edgar Magana | 6f335b9 | 2014-07-10 15:42:44 -0700 | [diff] [blame] | 217 | # When Neutron tunnels are enabled it is needed to specify the | 
|  | 218 | # IP address of the end point in the local server. This IP is set | 
|  | 219 | # by default to the same IP address that the HOST IP. | 
|  | 220 | # This variable can be used to specify a different end point IP address | 
|  | 221 | # Example: ``TUNNEL_ENDPOINT_IP=1.1.1.1`` | 
|  | 222 | TUNNEL_ENDPOINT_IP=${TUNNEL_ENDPOINT_IP:-$HOST_IP} | 
|  | 223 |  | 
| Dean Troyer | e2907b4 | 2014-02-26 17:35:37 -0600 | [diff] [blame] | 224 | # With the openvswitch plugin, set to True in ``localrc`` to enable | 
|  | 225 | # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False. | 
|  | 226 | # | 
|  | 227 | # Example: ``OVS_ENABLE_TUNNELING=True`` | 
|  | 228 | OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS} | 
|  | 229 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 230 | # Neutron plugin specific functions | 
|  | 231 | # --------------------------------- | 
|  | 232 |  | 
|  | 233 | # Please refer to ``lib/neutron_plugins/README.md`` for details. | 
|  | 234 | source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN | 
|  | 235 |  | 
|  | 236 | # Agent loadbalancer service plugin functions | 
|  | 237 | # ------------------------------------------- | 
|  | 238 |  | 
|  | 239 | # Hardcoding for 1 service plugin for now | 
|  | 240 | source $TOP_DIR/lib/neutron_plugins/services/loadbalancer | 
|  | 241 |  | 
| Emilien Macchi | 40546f7 | 2013-09-24 15:10:25 +0200 | [diff] [blame] | 242 | # Agent metering service plugin functions | 
|  | 243 | # ------------------------------------------- | 
|  | 244 |  | 
|  | 245 | # Hardcoding for 1 service plugin for now | 
|  | 246 | source $TOP_DIR/lib/neutron_plugins/services/metering | 
|  | 247 |  | 
| Nachi Ueno | 69b3ff6 | 2013-06-07 10:28:33 -0700 | [diff] [blame] | 248 | # VPN service plugin functions | 
|  | 249 | # ------------------------------------------- | 
|  | 250 | # Hardcoding for 1 service plugin for now | 
|  | 251 | source $TOP_DIR/lib/neutron_plugins/services/vpn | 
|  | 252 |  | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 253 | # Firewall Service Plugin functions | 
| Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 254 | # --------------------------------- | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 255 | source $TOP_DIR/lib/neutron_plugins/services/firewall | 
|  | 256 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 257 | # Use security group or not | 
|  | 258 | if has_neutron_plugin_security_group; then | 
|  | 259 | Q_USE_SECGROUP=${Q_USE_SECGROUP:-True} | 
|  | 260 | else | 
|  | 261 | Q_USE_SECGROUP=False | 
|  | 262 | fi | 
|  | 263 |  | 
| Dean Troyer | 4237f59 | 2014-01-29 16:22:11 -0600 | [diff] [blame] | 264 | # Tell Tempest this project is present | 
|  | 265 | TEMPEST_SERVICES+=,neutron | 
|  | 266 |  | 
|  | 267 |  | 
| Dean Troyer | e2907b4 | 2014-02-26 17:35:37 -0600 | [diff] [blame] | 268 | # Save trace setting | 
|  | 269 | XTRACE=$(set +o | grep xtrace) | 
|  | 270 | set +o xtrace | 
|  | 271 |  | 
|  | 272 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 273 | # Functions | 
|  | 274 | # --------- | 
|  | 275 |  | 
| Dean Troyer | e4fa721 | 2014-01-15 15:04:49 -0600 | [diff] [blame] | 276 | # Test if any Neutron services are enabled | 
|  | 277 | # is_neutron_enabled | 
|  | 278 | function is_neutron_enabled { | 
|  | 279 | [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0 | 
|  | 280 | return 1 | 
|  | 281 | } | 
|  | 282 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 283 | # configure_neutron() | 
|  | 284 | # Set common config for all neutron server and agents. | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 285 | function configure_neutron { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 286 | _configure_neutron_common | 
|  | 287 | iniset_rpc_backend neutron $NEUTRON_CONF DEFAULT | 
|  | 288 |  | 
|  | 289 | # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES | 
|  | 290 | if is_service_enabled q-lbaas; then | 
|  | 291 | _configure_neutron_lbaas | 
|  | 292 | fi | 
| Emilien Macchi | 40546f7 | 2013-09-24 15:10:25 +0200 | [diff] [blame] | 293 | if is_service_enabled q-metering; then | 
|  | 294 | _configure_neutron_metering | 
|  | 295 | fi | 
| Nachi Ueno | 69b3ff6 | 2013-06-07 10:28:33 -0700 | [diff] [blame] | 296 | if is_service_enabled q-vpn; then | 
|  | 297 | _configure_neutron_vpn | 
|  | 298 | fi | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 299 | if is_service_enabled q-fwaas; then | 
|  | 300 | _configure_neutron_fwaas | 
|  | 301 | fi | 
| Stephen Ma | 9b38eb2 | 2014-04-02 02:13:09 +0000 | [diff] [blame] | 302 | if is_service_enabled q-agt q-svc; then | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 303 | _configure_neutron_service | 
|  | 304 | fi | 
|  | 305 | if is_service_enabled q-agt; then | 
|  | 306 | _configure_neutron_plugin_agent | 
|  | 307 | fi | 
|  | 308 | if is_service_enabled q-dhcp; then | 
|  | 309 | _configure_neutron_dhcp_agent | 
|  | 310 | fi | 
|  | 311 | if is_service_enabled q-l3; then | 
|  | 312 | _configure_neutron_l3_agent | 
|  | 313 | fi | 
|  | 314 | if is_service_enabled q-meta; then | 
|  | 315 | _configure_neutron_metadata_agent | 
|  | 316 | fi | 
|  | 317 |  | 
| Brian Haley | eea7621 | 2014-06-27 11:45:50 -0400 | [diff] [blame] | 318 | if [[ "$Q_DVR_MODE" != "legacy" ]]; then | 
|  | 319 | _configure_dvr | 
|  | 320 | fi | 
| Dina Belova | 58adaa6 | 2014-07-11 18:18:12 +0400 | [diff] [blame] | 321 | if is_service_enabled ceilometer; then | 
|  | 322 | _configure_neutron_ceilometer_notifications | 
|  | 323 | fi | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 324 |  | 
|  | 325 | _configure_neutron_debug_command | 
|  | 326 | } | 
|  | 327 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 328 | function create_nova_conf_neutron { | 
| Yong Sheng Gong | 032e454 | 2013-08-25 10:21:10 +0800 | [diff] [blame] | 329 | iniset $NOVA_CONF DEFAULT network_api_class "nova.network.neutronv2.api.API" | 
| Gary Kotton | 13d385e | 2014-06-17 23:24:53 -0700 | [diff] [blame] | 330 | iniset $NOVA_CONF neutron admin_username "$Q_ADMIN_USERNAME" | 
|  | 331 | iniset $NOVA_CONF neutron admin_password "$SERVICE_PASSWORD" | 
|  | 332 | iniset $NOVA_CONF neutron admin_auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0" | 
|  | 333 | iniset $NOVA_CONF neutron auth_strategy "$Q_AUTH_STRATEGY" | 
|  | 334 | iniset $NOVA_CONF neutron admin_tenant_name "$SERVICE_TENANT_NAME" | 
| Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 335 | iniset $NOVA_CONF neutron region_name "$REGION_NAME" | 
| Gary Kotton | 13d385e | 2014-06-17 23:24:53 -0700 | [diff] [blame] | 336 | iniset $NOVA_CONF neutron url "http://$Q_HOST:$Q_PORT" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 337 |  | 
|  | 338 | if [[ "$Q_USE_SECGROUP" == "True" ]]; then | 
|  | 339 | LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver | 
| Jeff Peeler | 1143f7e | 2013-10-31 16:21:52 -0400 | [diff] [blame] | 340 | iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER | 
| Yong Sheng Gong | 032e454 | 2013-08-25 10:21:10 +0800 | [diff] [blame] | 341 | iniset $NOVA_CONF DEFAULT security_group_api neutron | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 342 | fi | 
|  | 343 |  | 
|  | 344 | # set NOVA_VIF_DRIVER and optionally set options in nova_conf | 
|  | 345 | neutron_plugin_create_nova_conf | 
|  | 346 |  | 
| Gary Kotton | 51c681d | 2014-04-22 01:40:56 -0700 | [diff] [blame] | 347 | iniset $NOVA_CONF libvirt vif_driver "$NOVA_VIF_DRIVER" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 348 | iniset $NOVA_CONF DEFAULT linuxnet_interface_driver "$LINUXNET_VIF_DRIVER" | 
|  | 349 | if is_service_enabled q-meta; then | 
| Yong Sheng Gong | 032e454 | 2013-08-25 10:21:10 +0800 | [diff] [blame] | 350 | iniset $NOVA_CONF DEFAULT service_neutron_metadata_proxy "True" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 351 | fi | 
| Aaron Rosen | cea32b1 | 2014-03-04 16:20:14 -0800 | [diff] [blame] | 352 |  | 
|  | 353 | iniset $NOVA_CONF DEFAULT vif_plugging_is_fatal "$VIF_PLUGGING_IS_FATAL" | 
|  | 354 | iniset $NOVA_CONF DEFAULT vif_plugging_timeout "$VIF_PLUGGING_TIMEOUT" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 355 | } | 
|  | 356 |  | 
| Emilien Macchi | a677b7f | 2013-11-25 23:40:20 +0100 | [diff] [blame] | 357 | # create_neutron_cache_dir() - Part of the _neutron_setup_keystone() process | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 358 | function create_neutron_cache_dir { | 
| Emilien Macchi | a677b7f | 2013-11-25 23:40:20 +0100 | [diff] [blame] | 359 | # Create cache dir | 
|  | 360 | sudo mkdir -p $NEUTRON_AUTH_CACHE_DIR | 
|  | 361 | sudo chown $STACK_USER $NEUTRON_AUTH_CACHE_DIR | 
|  | 362 | rm -f $NEUTRON_AUTH_CACHE_DIR/* | 
|  | 363 | } | 
|  | 364 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 365 | # create_neutron_accounts() - Set up common required neutron accounts | 
|  | 366 |  | 
|  | 367 | # Tenant               User       Roles | 
|  | 368 | # ------------------------------------------------------------------ | 
|  | 369 | # service              neutron    admin        # if enabled | 
|  | 370 |  | 
|  | 371 | # Migrated from keystone_data.sh | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 372 | function create_neutron_accounts { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 373 |  | 
| Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 374 | SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") | 
|  | 375 | ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 376 |  | 
|  | 377 | if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then | 
| Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 378 |  | 
|  | 379 | NEUTRON_USER=$(get_or_create_user "neutron" \ | 
| Gael Chamoulaud | 6dd8a8b | 2014-07-22 01:12:12 +0200 | [diff] [blame] | 380 | "$SERVICE_PASSWORD" $SERVICE_TENANT) | 
| Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 381 | get_or_add_user_role $ADMIN_ROLE $NEUTRON_USER $SERVICE_TENANT | 
|  | 382 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 383 | if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then | 
| Bartosz Górski | 0abde39 | 2014-02-28 14:15:19 +0100 | [diff] [blame] | 384 |  | 
|  | 385 | NEUTRON_SERVICE=$(get_or_create_service "neutron" \ | 
|  | 386 | "network" "Neutron Service") | 
|  | 387 | get_or_create_endpoint $NEUTRON_SERVICE \ | 
|  | 388 | "$REGION_NAME" \ | 
| Aaron Rosen | 186119c | 2014-07-25 15:35:09 -0700 | [diff] [blame^] | 389 | "http://$SERVICE_HOST:$Q_PORT/" \ | 
|  | 390 | "http://$SERVICE_HOST:$Q_PORT/" \ | 
|  | 391 | "http://$SERVICE_HOST:$Q_PORT/" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 392 | fi | 
|  | 393 | fi | 
|  | 394 | } | 
|  | 395 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 396 | function create_neutron_initial_network { | 
| Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 397 | TENANT_ID=$(openstack project list | grep " demo " | get_field 1) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 398 | die_if_not_set $LINENO TENANT_ID "Failure retrieving TENANT_ID for demo" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 399 |  | 
|  | 400 | # Create a small network | 
|  | 401 | # Since neutron command is executed in admin context at this point, | 
| Dirk Mueller | 25049cd | 2014-01-09 13:53:52 +0100 | [diff] [blame] | 402 | # ``--tenant-id`` needs to be specified. | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 403 | if is_baremetal; then | 
| sbauza | e2c4ee2 | 2013-08-29 17:29:46 +0200 | [diff] [blame] | 404 | if [[ "$PUBLIC_INTERFACE" == '' || "$OVS_PHYSICAL_BRIDGE" == '' ]]; then | 
|  | 405 | die $LINENO "Neutron settings for baremetal not set.. exiting" | 
|  | 406 | fi | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 407 | sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE | 
|  | 408 | for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do | 
|  | 409 | sudo ip addr del $IP dev $PUBLIC_INTERFACE | 
|  | 410 | sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE | 
|  | 411 | done | 
| Dirk Mueller | 25049cd | 2014-01-09 13:53:52 +0100 | [diff] [blame] | 412 | NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant-id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 413 | die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID" | 
| Dirk Mueller | 25049cd | 2014-01-09 13:53:52 +0100 | [diff] [blame] | 414 | SUBNET_ID=$(neutron subnet-create --tenant-id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 415 | die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $TENANT_ID" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 416 | sudo ifconfig $OVS_PHYSICAL_BRIDGE up | 
| sbauza | e2c4ee2 | 2013-08-29 17:29:46 +0200 | [diff] [blame] | 417 | sudo route add default gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE | 
| Sean M. Collins | 5ec6f8f | 2014-05-14 17:01:03 -0400 | [diff] [blame] | 418 | elif is_provider_network; then | 
|  | 419 | die_if_not_set $LINENO SEGMENTATION_ID "A SEGMENTATION_ID is required to use provider networking" | 
|  | 420 | die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE" | 
| Sean M. Collins | 21e6c62 | 2014-06-16 11:19:48 -0400 | [diff] [blame] | 421 | NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" --provider:segmentation_id "$SEGMENTATION_ID" --shared | grep ' id ' | get_field 2) | 
| Sean M. Collins | 5ec6f8f | 2014-05-14 17:01:03 -0400 | [diff] [blame] | 422 | SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) | 
| Sean M. Collins | e13fd60 | 2014-05-14 17:01:53 -0400 | [diff] [blame] | 423 | SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode slaac --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2) | 
| Sean M. Collins | 5ec6f8f | 2014-05-14 17:01:03 -0400 | [diff] [blame] | 424 | sudo ip link set $OVS_PHYSICAL_BRIDGE up | 
|  | 425 | sudo ip link set br-int up | 
|  | 426 | sudo ip link set $PUBLIC_INTERFACE up | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 427 | else | 
| Dirk Mueller | 25049cd | 2014-01-09 13:53:52 +0100 | [diff] [blame] | 428 | NET_ID=$(neutron net-create --tenant-id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 429 | die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID" | 
| Dirk Mueller | 25049cd | 2014-01-09 13:53:52 +0100 | [diff] [blame] | 430 | SUBNET_ID=$(neutron subnet-create --tenant-id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 431 | die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $TENANT_ID" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 432 | fi | 
|  | 433 |  | 
|  | 434 | if [[ "$Q_L3_ENABLED" == "True" ]]; then | 
|  | 435 | # Create a router, and add the private subnet as one of its interfaces | 
|  | 436 | if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then | 
|  | 437 | # create a tenant-owned router. | 
| Dirk Mueller | 25049cd | 2014-01-09 13:53:52 +0100 | [diff] [blame] | 438 | ROUTER_ID=$(neutron router-create --tenant-id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 439 | die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $TENANT_ID $Q_ROUTER_NAME" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 440 | else | 
|  | 441 | # Plugin only supports creating a single router, which should be admin owned. | 
|  | 442 | ROUTER_ID=$(neutron router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 443 | die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 444 | fi | 
|  | 445 | neutron router-interface-add $ROUTER_ID $SUBNET_ID | 
|  | 446 | # Create an external network, and a subnet. Configure the external network as router gw | 
|  | 447 | EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 448 | die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 449 | EXT_GW_IP=$(neutron subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} --gateway $PUBLIC_NETWORK_GATEWAY --name $PUBLIC_SUBNET_NAME $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 450 | die_if_not_set $LINENO EXT_GW_IP "Failure creating EXT_GW_IP" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 451 | neutron router-gateway-set $ROUTER_ID $EXT_NET_ID | 
|  | 452 |  | 
|  | 453 | if is_service_enabled q-l3; then | 
|  | 454 | # logic is specific to using the l3-agent for l3 | 
|  | 455 | if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then | 
|  | 456 | CIDR_LEN=${FLOATING_RANGE#*/} | 
|  | 457 | sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE | 
|  | 458 | sudo ip link set $PUBLIC_BRIDGE up | 
|  | 459 | ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'` | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 460 | die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 461 | sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP | 
|  | 462 | fi | 
|  | 463 | if [[ "$Q_USE_NAMESPACE" == "False" ]]; then | 
|  | 464 | # Explicitly set router id in l3 agent configuration | 
|  | 465 | iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID | 
|  | 466 | fi | 
|  | 467 | fi | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 468 | fi | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 469 | } | 
|  | 470 |  | 
|  | 471 | # init_neutron() - Initialize databases, etc. | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 472 | function init_neutron { | 
| Salvatore Orlando | dd64988 | 2013-08-05 08:56:17 -0700 | [diff] [blame] | 473 | recreate_database $Q_DB_NAME utf8 | 
|  | 474 | # Run Neutron db migrations | 
|  | 475 | $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 476 | } | 
|  | 477 |  | 
|  | 478 | # install_neutron() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 479 | function install_neutron { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 480 | git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH | 
|  | 481 | setup_develop $NEUTRON_DIR | 
|  | 482 | } | 
|  | 483 |  | 
|  | 484 | # install_neutronclient() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 485 | function install_neutronclient { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 486 | git_clone $NEUTRONCLIENT_REPO $NEUTRONCLIENT_DIR $NEUTRONCLIENT_BRANCH | 
|  | 487 | setup_develop $NEUTRONCLIENT_DIR | 
| Attila Fazekas | fac533e | 2013-08-14 16:04:01 +0200 | [diff] [blame] | 488 | sudo install -D -m 0644 -o $STACK_USER {$NEUTRONCLIENT_DIR/tools/,/etc/bash_completion.d/}neutron.bash_completion | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 489 | } | 
|  | 490 |  | 
|  | 491 | # install_neutron_agent_packages() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 492 | function install_neutron_agent_packages { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 493 | # install packages that are specific to plugin agent(s) | 
|  | 494 | if is_service_enabled q-agt q-dhcp q-l3; then | 
|  | 495 | neutron_plugin_install_agent_packages | 
|  | 496 | fi | 
|  | 497 |  | 
|  | 498 | if is_service_enabled q-lbaas; then | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 499 | neutron_agent_lbaas_install_agent_packages | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 500 | fi | 
|  | 501 | } | 
|  | 502 |  | 
|  | 503 | # Start running processes, including screen | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 504 | function start_neutron_service_and_check { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 505 | # build config-file options | 
|  | 506 | local cfg_file | 
|  | 507 | local CFG_FILE_OPTIONS="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE" | 
|  | 508 | for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 509 | CFG_FILE_OPTIONS+=" --config-file /$cfg_file" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 510 | done | 
|  | 511 | # Start the Neutron service | 
|  | 512 | screen_it q-svc "cd $NEUTRON_DIR && python $NEUTRON_BIN_DIR/neutron-server $CFG_FILE_OPTIONS" | 
|  | 513 | echo "Waiting for Neutron to start..." | 
| JUN JIE NAN | 0aa8534 | 2013-09-13 15:47:09 +0800 | [diff] [blame] | 514 | if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 515 | die $LINENO "Neutron did not start" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 516 | fi | 
|  | 517 | } | 
|  | 518 |  | 
|  | 519 | # Start running processes, including screen | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 520 | function start_neutron_agents { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 521 | # Start up the neutron agents if enabled | 
|  | 522 | screen_it q-agt "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE" | 
|  | 523 | screen_it q-dhcp "cd $NEUTRON_DIR && python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE" | 
| Nachi Ueno | 584750f | 2013-07-15 18:22:21 -0700 | [diff] [blame] | 524 |  | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 525 | L3_CONF_FILES="--config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE" | 
|  | 526 |  | 
| Sean M. Collins | 5ec6f8f | 2014-05-14 17:01:03 -0400 | [diff] [blame] | 527 | if is_provider_network; then | 
|  | 528 | sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE | 
|  | 529 | sudo ip link set $OVS_PHYSICAL_BRIDGE up | 
|  | 530 | sudo ip link set br-int up | 
|  | 531 | sudo ip link set $PUBLIC_INTERFACE up | 
|  | 532 | fi | 
|  | 533 |  | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 534 | if is_service_enabled q-fwaas; then | 
|  | 535 | L3_CONF_FILES="$L3_CONF_FILES --config-file $Q_FWAAS_CONF_FILE" | 
| Adam Gandelman | cf1ef23 | 2014-04-21 17:09:52 -0700 | [diff] [blame] | 536 | VPN_CONF_FILES="$VPN_CONF_FILES --config-file $Q_FWAAS_CONF_FILE" | 
| Nachi Ueno | 584750f | 2013-07-15 18:22:21 -0700 | [diff] [blame] | 537 | fi | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 538 | if is_service_enabled q-vpn; then | 
| Paul Michali | 746dcee | 2014-04-02 19:12:22 +0000 | [diff] [blame] | 539 | screen_it q-vpn "cd $NEUTRON_DIR && $AGENT_VPN_BINARY $VPN_CONF_FILES" | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 540 | else | 
|  | 541 | screen_it q-l3 "cd $NEUTRON_DIR && python $AGENT_L3_BINARY $L3_CONF_FILES" | 
|  | 542 | fi | 
|  | 543 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 544 | screen_it q-meta "cd $NEUTRON_DIR && python $AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE" | 
|  | 545 |  | 
|  | 546 | if [ "$VIRT_DRIVER" = 'xenserver' ]; then | 
|  | 547 | # For XenServer, start an agent for the domU openvswitch | 
|  | 548 | screen_it q-domua "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE.domU" | 
|  | 549 | fi | 
|  | 550 |  | 
|  | 551 | if is_service_enabled q-lbaas; then | 
|  | 552 | screen_it q-lbaas "cd $NEUTRON_DIR && python $AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME" | 
|  | 553 | fi | 
| Emilien Macchi | 40546f7 | 2013-09-24 15:10:25 +0200 | [diff] [blame] | 554 |  | 
|  | 555 | if is_service_enabled q-metering; then | 
|  | 556 | screen_it q-metering "cd $NEUTRON_DIR && python $AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME" | 
|  | 557 | fi | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 558 | } | 
|  | 559 |  | 
|  | 560 | # stop_neutron() - Stop running processes (non-screen) | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 561 | function stop_neutron { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 562 | if is_service_enabled q-dhcp; then | 
|  | 563 | pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }') | 
|  | 564 | [ ! -z "$pid" ] && sudo kill -9 $pid | 
|  | 565 | fi | 
|  | 566 | if is_service_enabled q-meta; then | 
| Jakub Libosvar | 1f76328 | 2014-01-28 23:01:38 +0100 | [diff] [blame] | 567 | sudo pkill -9 -f neutron-ns-metadata-proxy || : | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 568 | fi | 
| Akihiro Motoki | edddb1f | 2013-12-09 20:21:06 +0900 | [diff] [blame] | 569 |  | 
|  | 570 | if is_service_enabled q-lbaas; then | 
|  | 571 | neutron_lbaas_stop | 
|  | 572 | fi | 
|  | 573 | if is_service_enabled q-fwaas; then | 
|  | 574 | neutron_fwaas_stop | 
|  | 575 | fi | 
|  | 576 | if is_service_enabled q-vpn; then | 
|  | 577 | neutron_vpn_stop | 
|  | 578 | fi | 
|  | 579 | if is_service_enabled q-metering; then | 
|  | 580 | neutron_metering_stop | 
|  | 581 | fi | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 582 | } | 
|  | 583 |  | 
|  | 584 | # cleanup_neutron() - Remove residual data files, anything left over from previous | 
|  | 585 | # runs that a clean run would need to clean up | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 586 | function cleanup_neutron { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 587 | if is_neutron_ovs_base_plugin; then | 
|  | 588 | neutron_ovs_base_cleanup | 
|  | 589 | fi | 
|  | 590 |  | 
|  | 591 | # delete all namespaces created by neutron | 
| Brian Haley | eea7621 | 2014-06-27 11:45:50 -0400 | [diff] [blame] | 592 | for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas|fip|snat)-[0-9a-f-]*'); do | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 593 | sudo ip netns delete ${ns} | 
|  | 594 | done | 
|  | 595 | } | 
|  | 596 |  | 
|  | 597 | # _configure_neutron_common() | 
|  | 598 | # Set common config for all neutron server and agents. | 
|  | 599 | # This MUST be called before other ``_configure_neutron_*`` functions. | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 600 | function _configure_neutron_common { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 601 | # Put config files in ``NEUTRON_CONF_DIR`` for everyone to find | 
|  | 602 | if [[ ! -d $NEUTRON_CONF_DIR ]]; then | 
|  | 603 | sudo mkdir -p $NEUTRON_CONF_DIR | 
|  | 604 | fi | 
|  | 605 | sudo chown $STACK_USER $NEUTRON_CONF_DIR | 
|  | 606 |  | 
|  | 607 | cp $NEUTRON_DIR/etc/neutron.conf $NEUTRON_CONF | 
|  | 608 |  | 
|  | 609 | # Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``. | 
|  | 610 | # For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``. | 
|  | 611 | # For addition plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH``, | 
|  | 612 | # ``Q_PLUGIN_EXTRA_CONF_FILES``.  For example: | 
| Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 613 | # | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 614 | #    ``Q_PLUGIN_EXTRA_CONF_FILES=(file1, file2)`` | 
|  | 615 | neutron_plugin_configure_common | 
|  | 616 |  | 
| sbauza | e2c4ee2 | 2013-08-29 17:29:46 +0200 | [diff] [blame] | 617 | if [[ "$Q_PLUGIN_CONF_PATH" == '' || "$Q_PLUGIN_CONF_FILENAME" == '' || "$Q_PLUGIN_CLASS" == '' ]]; then | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 618 | die $LINENO "Neutron plugin not set.. exiting" | 
|  | 619 | fi | 
|  | 620 |  | 
|  | 621 | # If needed, move config file from ``$NEUTRON_DIR/etc/neutron`` to ``NEUTRON_CONF_DIR`` | 
|  | 622 | mkdir -p /$Q_PLUGIN_CONF_PATH | 
|  | 623 | Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME | 
|  | 624 | cp $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE | 
|  | 625 |  | 
|  | 626 | iniset /$Q_PLUGIN_CONF_FILE database connection `database_connection_url $Q_DB_NAME` | 
|  | 627 | iniset $NEUTRON_CONF DEFAULT state_path $DATA_DIR/neutron | 
|  | 628 |  | 
|  | 629 | # If addition config files are set, make sure their path name is set as well | 
|  | 630 | if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then | 
|  | 631 | die $LINENO "Neutron additional plugin config not set.. exiting" | 
|  | 632 | fi | 
|  | 633 |  | 
|  | 634 | # If additional config files exist, copy them over to neutron configuration | 
|  | 635 | # directory | 
|  | 636 | if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 637 | local f | 
|  | 638 | for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do | 
|  | 639 | Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]} | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 640 | done | 
|  | 641 | fi | 
|  | 642 |  | 
| Joe Gordon | bee5c50 | 2013-08-30 13:48:08 -0400 | [diff] [blame] | 643 | if [ "$VIRT_DRIVER" = 'fake' ]; then | 
|  | 644 | # Disable arbitrary limits | 
|  | 645 | iniset $NEUTRON_CONF quotas quota_network -1 | 
|  | 646 | iniset $NEUTRON_CONF quotas quota_subnet -1 | 
|  | 647 | iniset $NEUTRON_CONF quotas quota_port -1 | 
|  | 648 | iniset $NEUTRON_CONF quotas quota_security_group -1 | 
|  | 649 | iniset $NEUTRON_CONF quotas quota_security_group_rule -1 | 
|  | 650 | fi | 
|  | 651 |  | 
| Salvatore Orlando | 05ae833 | 2013-08-20 14:51:08 -0700 | [diff] [blame] | 652 | # Format logging | 
|  | 653 | if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then | 
| Salvatore Orlando | bc7f643 | 2013-11-25 10:11:14 -0800 | [diff] [blame] | 654 | setup_colorized_logging $NEUTRON_CONF DEFAULT project_id | 
| Salvatore Orlando | 05ae833 | 2013-08-20 14:51:08 -0700 | [diff] [blame] | 655 | fi | 
|  | 656 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 657 | _neutron_setup_rootwrap | 
|  | 658 | } | 
|  | 659 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 660 | function _configure_neutron_debug_command { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 661 | if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then | 
|  | 662 | return | 
|  | 663 | fi | 
|  | 664 |  | 
|  | 665 | cp $NEUTRON_DIR/etc/l3_agent.ini $NEUTRON_TEST_CONFIG_FILE | 
|  | 666 |  | 
|  | 667 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT verbose False | 
|  | 668 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT debug False | 
|  | 669 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 670 | iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND" | 
|  | 671 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 672 | _neutron_setup_interface_driver $NEUTRON_TEST_CONFIG_FILE | 
|  | 673 |  | 
|  | 674 | neutron_plugin_configure_debug_command | 
|  | 675 | } | 
|  | 676 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 677 | function _configure_neutron_dhcp_agent { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 678 | AGENT_DHCP_BINARY="$NEUTRON_BIN_DIR/neutron-dhcp-agent" | 
|  | 679 | Q_DHCP_CONF_FILE=$NEUTRON_CONF_DIR/dhcp_agent.ini | 
|  | 680 |  | 
|  | 681 | cp $NEUTRON_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE | 
|  | 682 |  | 
|  | 683 | iniset $Q_DHCP_CONF_FILE DEFAULT verbose True | 
| Ben Nemec | 0399794 | 2013-08-10 09:56:16 -0500 | [diff] [blame] | 684 | iniset $Q_DHCP_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 685 | iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE | 
|  | 686 | iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" | 
|  | 687 |  | 
| Kyle Mestery | 73b2191 | 2013-08-22 11:25:21 +0000 | [diff] [blame] | 688 | # Define extra "DEFAULT" configuration options when q-dhcp is configured by | 
|  | 689 | # defining the array ``Q_DHCP_EXTRA_DEFAULT_OPTS``. | 
|  | 690 | # For Example: ``Q_DHCP_EXTRA_DEFAULT_OPTS=(foo=true bar=2)`` | 
|  | 691 | for I in "${Q_DHCP_EXTRA_DEFAULT_OPTS[@]}"; do | 
|  | 692 | # Replace the first '=' with ' ' for iniset syntax | 
|  | 693 | iniset $Q_DHCP_CONF_FILE DEFAULT ${I/=/ } | 
|  | 694 | done | 
|  | 695 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 696 | _neutron_setup_interface_driver $Q_DHCP_CONF_FILE | 
|  | 697 |  | 
|  | 698 | neutron_plugin_configure_dhcp_agent | 
|  | 699 | } | 
|  | 700 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 701 | function _configure_neutron_l3_agent { | 
| Paul Michali | 746dcee | 2014-04-02 19:12:22 +0000 | [diff] [blame] | 702 | local cfg_file | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 703 | Q_L3_ENABLED=True | 
|  | 704 | # for l3-agent, only use per tenant router if we have namespaces | 
|  | 705 | Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE | 
| Nachi Ueno | 69b3ff6 | 2013-06-07 10:28:33 -0700 | [diff] [blame] | 706 |  | 
|  | 707 | AGENT_L3_BINARY=${AGENT_L3_BINARY:-"$NEUTRON_BIN_DIR/neutron-l3-agent"} | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 708 | Q_L3_CONF_FILE=$NEUTRON_CONF_DIR/l3_agent.ini | 
|  | 709 |  | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 710 | if is_service_enabled q-fwaas; then | 
|  | 711 | Q_FWAAS_CONF_FILE=$NEUTRON_CONF_DIR/fwaas_driver.ini | 
|  | 712 | fi | 
|  | 713 |  | 
| Paul Michali | 746dcee | 2014-04-02 19:12:22 +0000 | [diff] [blame] | 714 | if is_service_enabled q-vpn; then | 
|  | 715 | Q_VPN_CONF_FILE=$NEUTRON_CONF_DIR/vpn_agent.ini | 
|  | 716 | cp $NEUTRON_DIR/etc/vpn_agent.ini $Q_VPN_CONF_FILE | 
|  | 717 | VPN_CONF_FILES="--config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE --config-file=$Q_VPN_CONF_FILE" | 
|  | 718 | for cfg_file in ${Q_VPN_EXTRA_CONF_FILES[@]}; do | 
|  | 719 | VPN_CONF_FILES+=" --config-file $cfg_file" | 
|  | 720 | done | 
|  | 721 | fi | 
|  | 722 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 723 | cp $NEUTRON_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE | 
|  | 724 |  | 
|  | 725 | iniset $Q_L3_CONF_FILE DEFAULT verbose True | 
| Ben Nemec | 0399794 | 2013-08-10 09:56:16 -0500 | [diff] [blame] | 726 | iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 727 | iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE | 
|  | 728 | iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" | 
|  | 729 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 730 | _neutron_setup_interface_driver $Q_L3_CONF_FILE | 
|  | 731 |  | 
|  | 732 | neutron_plugin_configure_l3_agent | 
|  | 733 | } | 
|  | 734 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 735 | function _configure_neutron_metadata_agent { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 736 | AGENT_META_BINARY="$NEUTRON_BIN_DIR/neutron-metadata-agent" | 
|  | 737 | Q_META_CONF_FILE=$NEUTRON_CONF_DIR/metadata_agent.ini | 
|  | 738 |  | 
|  | 739 | cp $NEUTRON_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE | 
|  | 740 |  | 
|  | 741 | iniset $Q_META_CONF_FILE DEFAULT verbose True | 
| Ben Nemec | 0399794 | 2013-08-10 09:56:16 -0500 | [diff] [blame] | 742 | iniset $Q_META_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 743 | iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP | 
|  | 744 | iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" | 
|  | 745 |  | 
| Jamie Lennox | 3561d7f | 2014-05-21 17:18:43 +1000 | [diff] [blame] | 746 | _neutron_setup_keystone $Q_META_CONF_FILE DEFAULT True True | 
| Maru Newby | bf10ac5 | 2013-08-10 21:27:54 +0000 | [diff] [blame] | 747 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 748 | } | 
|  | 749 |  | 
| Dina Belova | 58adaa6 | 2014-07-11 18:18:12 +0400 | [diff] [blame] | 750 | function _configure_neutron_ceilometer_notifications { | 
|  | 751 | iniset $NEUTRON_CONF DEFAULT notification_driver neutron.openstack.common.notifier.rpc_notifier | 
|  | 752 | } | 
|  | 753 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 754 | function _configure_neutron_lbaas { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 755 | neutron_agent_lbaas_configure_common | 
|  | 756 | neutron_agent_lbaas_configure_agent | 
|  | 757 | } | 
|  | 758 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 759 | function _configure_neutron_metering { | 
| Emilien Macchi | 40546f7 | 2013-09-24 15:10:25 +0200 | [diff] [blame] | 760 | neutron_agent_metering_configure_common | 
|  | 761 | neutron_agent_metering_configure_agent | 
|  | 762 | } | 
|  | 763 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 764 | function _configure_neutron_fwaas { | 
| Ravi Chunduru | 95c93e2 | 2013-07-16 04:18:47 -0700 | [diff] [blame] | 765 | neutron_fwaas_configure_common | 
|  | 766 | neutron_fwaas_configure_driver | 
|  | 767 | } | 
|  | 768 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 769 | function _configure_neutron_vpn { | 
| Nachi Ueno | 69b3ff6 | 2013-06-07 10:28:33 -0700 | [diff] [blame] | 770 | neutron_vpn_install_agent_packages | 
|  | 771 | neutron_vpn_configure_common | 
| Nachi Ueno | 69b3ff6 | 2013-06-07 10:28:33 -0700 | [diff] [blame] | 772 | } | 
|  | 773 |  | 
| Brian Haley | eea7621 | 2014-06-27 11:45:50 -0400 | [diff] [blame] | 774 | function _configure_dvr { | 
|  | 775 | iniset $NEUTRON_CONF DEFAULT router_distributed True | 
|  | 776 | iniset $Q_L3_CONF_FILE DEFAULT agent_mode $Q_DVR_MODE | 
|  | 777 | } | 
|  | 778 |  | 
|  | 779 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 780 | # _configure_neutron_plugin_agent() - Set config files for neutron plugin agent | 
|  | 781 | # It is called when q-agt is enabled. | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 782 | function _configure_neutron_plugin_agent { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 783 | # Specify the default root helper prior to agent configuration to | 
|  | 784 | # ensure that an agent's configuration can override the default | 
|  | 785 | iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND" | 
|  | 786 | iniset $NEUTRON_CONF DEFAULT verbose True | 
| Ben Nemec | 0399794 | 2013-08-10 09:56:16 -0500 | [diff] [blame] | 787 | iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 788 |  | 
|  | 789 | # Configure agent for plugin | 
|  | 790 | neutron_plugin_configure_plugin_agent | 
|  | 791 | } | 
|  | 792 |  | 
|  | 793 | # _configure_neutron_service() - Set config files for neutron service | 
|  | 794 | # It is called when q-svc is enabled. | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 795 | function _configure_neutron_service { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 796 | Q_API_PASTE_FILE=$NEUTRON_CONF_DIR/api-paste.ini | 
|  | 797 | Q_POLICY_FILE=$NEUTRON_CONF_DIR/policy.json | 
|  | 798 |  | 
|  | 799 | cp $NEUTRON_DIR/etc/api-paste.ini $Q_API_PASTE_FILE | 
|  | 800 | cp $NEUTRON_DIR/etc/policy.json $Q_POLICY_FILE | 
|  | 801 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 802 | # Update either configuration file with plugin | 
|  | 803 | iniset $NEUTRON_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS | 
|  | 804 |  | 
|  | 805 | if [[ $Q_SERVICE_PLUGIN_CLASSES != '' ]]; then | 
|  | 806 | iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES | 
|  | 807 | fi | 
|  | 808 |  | 
|  | 809 | iniset $NEUTRON_CONF DEFAULT verbose True | 
| Ben Nemec | 0399794 | 2013-08-10 09:56:16 -0500 | [diff] [blame] | 810 | iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 811 | iniset $NEUTRON_CONF DEFAULT policy_file $Q_POLICY_FILE | 
|  | 812 | iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP | 
|  | 813 |  | 
|  | 814 | iniset $NEUTRON_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY | 
|  | 815 | _neutron_setup_keystone $NEUTRON_CONF keystone_authtoken | 
|  | 816 |  | 
| Simon Pasquier | ca96b0a | 2013-07-09 16:59:12 +0200 | [diff] [blame] | 817 | # Define extra "DEFAULT" configuration options when q-svc is configured by | 
|  | 818 | # defining the array ``Q_SRV_EXTRA_DEFAULT_OPTS``. | 
|  | 819 | # For Example: ``Q_SRV_EXTRA_DEFAULT_OPTS=(foo=true bar=2)`` | 
|  | 820 | for I in "${Q_SRV_EXTRA_DEFAULT_OPTS[@]}"; do | 
|  | 821 | # Replace the first '=' with ' ' for iniset syntax | 
|  | 822 | iniset $NEUTRON_CONF DEFAULT ${I/=/ } | 
|  | 823 | done | 
|  | 824 |  | 
| Aaron Rosen | cea32b1 | 2014-03-04 16:20:14 -0800 | [diff] [blame] | 825 | # Configuration for neutron notifations to nova. | 
| Terry Wilson | f06c443 | 2014-05-20 10:54:51 -0500 | [diff] [blame] | 826 | iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_status_changes $Q_NOTIFY_NOVA_PORT_STATUS_CHANGES | 
|  | 827 | iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_data_changes $Q_NOTIFY_NOVA_PORT_DATA_CHANGES | 
| Aaron Rosen | cea32b1 | 2014-03-04 16:20:14 -0800 | [diff] [blame] | 828 | iniset $NEUTRON_CONF DEFAULT nova_url "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2" | 
| Dirk Mueller | 5ca261a | 2014-04-04 22:48:02 +0200 | [diff] [blame] | 829 | iniset $NEUTRON_CONF DEFAULT nova_admin_username nova | 
| Aaron Rosen | cea32b1 | 2014-03-04 16:20:14 -0800 | [diff] [blame] | 830 | iniset $NEUTRON_CONF DEFAULT nova_admin_password $SERVICE_PASSWORD | 
|  | 831 | ADMIN_TENANT_ID=$(openstack project list | awk "/ service / { print \$2 }") | 
|  | 832 | iniset $NEUTRON_CONF DEFAULT nova_admin_tenant_id $ADMIN_TENANT_ID | 
|  | 833 | iniset $NEUTRON_CONF DEFAULT nova_admin_auth_url  "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0" | 
|  | 834 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 835 | # Configure plugin | 
|  | 836 | neutron_plugin_configure_service | 
|  | 837 | } | 
|  | 838 |  | 
|  | 839 | # Utility Functions | 
|  | 840 | #------------------ | 
|  | 841 |  | 
| Isaku Yamahata | 9e136b4 | 2013-12-16 15:52:03 +0900 | [diff] [blame] | 842 | # _neutron_service_plugin_class_add() - add service plugin class | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 843 | function _neutron_service_plugin_class_add { | 
| Isaku Yamahata | 9e136b4 | 2013-12-16 15:52:03 +0900 | [diff] [blame] | 844 | local service_plugin_class=$1 | 
|  | 845 | if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then | 
|  | 846 | Q_SERVICE_PLUGIN_CLASSES=$service_plugin_class | 
|  | 847 | elif [[ ! ,${Q_SERVICE_PLUGIN_CLASSES}, =~ ,${service_plugin_class}, ]]; then | 
|  | 848 | Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$service_plugin_class" | 
|  | 849 | fi | 
|  | 850 | } | 
|  | 851 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 852 | # _neutron_setup_rootwrap() - configure Neutron's rootwrap | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 853 | function _neutron_setup_rootwrap { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 854 | if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then | 
|  | 855 | return | 
|  | 856 | fi | 
|  | 857 | # Deploy new rootwrap filters files (owned by root). | 
|  | 858 | # Wipe any existing ``rootwrap.d`` files first | 
|  | 859 | Q_CONF_ROOTWRAP_D=$NEUTRON_CONF_DIR/rootwrap.d | 
|  | 860 | if [[ -d $Q_CONF_ROOTWRAP_D ]]; then | 
|  | 861 | sudo rm -rf $Q_CONF_ROOTWRAP_D | 
|  | 862 | fi | 
|  | 863 | # Deploy filters to ``$NEUTRON_CONF_DIR/rootwrap.d`` | 
|  | 864 | mkdir -p -m 755 $Q_CONF_ROOTWRAP_D | 
|  | 865 | cp -pr $NEUTRON_DIR/etc/neutron/rootwrap.d/* $Q_CONF_ROOTWRAP_D/ | 
|  | 866 | sudo chown -R root:root $Q_CONF_ROOTWRAP_D | 
|  | 867 | sudo chmod 644 $Q_CONF_ROOTWRAP_D/* | 
|  | 868 | # Set up ``rootwrap.conf``, pointing to ``$NEUTRON_CONF_DIR/rootwrap.d`` | 
|  | 869 | # location moved in newer versions, prefer new location | 
|  | 870 | if test -r $NEUTRON_DIR/etc/neutron/rootwrap.conf; then | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 871 | sudo cp -p $NEUTRON_DIR/etc/neutron/rootwrap.conf $Q_RR_CONF_FILE | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 872 | else | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 873 | sudo cp -p $NEUTRON_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 874 | fi | 
|  | 875 | sudo sed -e "s:^filters_path=.*$:filters_path=$Q_CONF_ROOTWRAP_D:" -i $Q_RR_CONF_FILE | 
|  | 876 | sudo chown root:root $Q_RR_CONF_FILE | 
|  | 877 | sudo chmod 0644 $Q_RR_CONF_FILE | 
|  | 878 | # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap | 
|  | 879 | ROOTWRAP_SUDOER_CMD="$NEUTRON_ROOTWRAP $Q_RR_CONF_FILE *" | 
|  | 880 |  | 
|  | 881 | # Set up the rootwrap sudoers for neutron | 
|  | 882 | TEMPFILE=`mktemp` | 
| Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 883 | echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 884 | chmod 0440 $TEMPFILE | 
|  | 885 | sudo chown root:root $TEMPFILE | 
|  | 886 | sudo mv $TEMPFILE /etc/sudoers.d/neutron-rootwrap | 
|  | 887 |  | 
|  | 888 | # Update the root_helper | 
|  | 889 | iniset $NEUTRON_CONF agent root_helper "$Q_RR_COMMAND" | 
|  | 890 | } | 
|  | 891 |  | 
|  | 892 | # Configures keystone integration for neutron service and agents | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 893 | function _neutron_setup_keystone { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 894 | local conf_file=$1 | 
|  | 895 | local section=$2 | 
|  | 896 | local use_auth_url=$3 | 
| Maru Newby | bf10ac5 | 2013-08-10 21:27:54 +0000 | [diff] [blame] | 897 | local skip_auth_cache=$4 | 
| Jamie Lennox | 3561d7f | 2014-05-21 17:18:43 +1000 | [diff] [blame] | 898 |  | 
|  | 899 | iniset $conf_file $section auth_uri $KEYSTONE_SERVICE_URI | 
|  | 900 | iniset $conf_file $section identity_uri $KEYSTONE_AUTH_URI | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 901 | iniset $conf_file $section admin_tenant_name $SERVICE_TENANT_NAME | 
|  | 902 | iniset $conf_file $section admin_user $Q_ADMIN_USERNAME | 
|  | 903 | iniset $conf_file $section admin_password $SERVICE_PASSWORD | 
| Maru Newby | bf10ac5 | 2013-08-10 21:27:54 +0000 | [diff] [blame] | 904 | if [[ -z $skip_auth_cache ]]; then | 
|  | 905 | iniset $conf_file $section signing_dir $NEUTRON_AUTH_CACHE_DIR | 
|  | 906 | # Create cache dir | 
| Emilien Macchi | a677b7f | 2013-11-25 23:40:20 +0100 | [diff] [blame] | 907 | create_neutron_cache_dir | 
| Maru Newby | bf10ac5 | 2013-08-10 21:27:54 +0000 | [diff] [blame] | 908 | fi | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 909 | } | 
|  | 910 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 911 | function _neutron_setup_interface_driver { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 912 |  | 
|  | 913 | # ovs_use_veth needs to be set before the plugin configuration | 
|  | 914 | # occurs to allow plugins to override the setting. | 
|  | 915 | iniset $1 DEFAULT ovs_use_veth $Q_OVS_USE_VETH | 
|  | 916 |  | 
|  | 917 | neutron_plugin_setup_interface_driver $1 | 
|  | 918 | } | 
|  | 919 |  | 
|  | 920 | # Functions for Neutron Exercises | 
|  | 921 | #-------------------------------- | 
|  | 922 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 923 | function delete_probe { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 924 | local from_net="$1" | 
|  | 925 | net_id=`_get_net_id $from_net` | 
|  | 926 | probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'` | 
|  | 927 | neutron-debug --os-tenant-name admin --os-username admin probe-delete $probe_id | 
|  | 928 | } | 
|  | 929 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 930 | function setup_neutron_debug { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 931 | if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then | 
|  | 932 | public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME` | 
|  | 933 | neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $public_net_id | 
|  | 934 | private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME` | 
|  | 935 | neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $private_net_id | 
|  | 936 | fi | 
|  | 937 | } | 
|  | 938 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 939 | function teardown_neutron_debug { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 940 | delete_probe $PUBLIC_NETWORK_NAME | 
|  | 941 | delete_probe $PRIVATE_NETWORK_NAME | 
|  | 942 | } | 
|  | 943 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 944 | function _get_net_id { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 945 | neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}' | 
|  | 946 | } | 
|  | 947 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 948 | function _get_probe_cmd_prefix { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 949 | local from_net="$1" | 
|  | 950 | net_id=`_get_net_id $from_net` | 
|  | 951 | probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1` | 
|  | 952 | echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id" | 
|  | 953 | } | 
|  | 954 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 955 | function _ping_check_neutron { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 956 | local from_net=$1 | 
|  | 957 | local ip=$2 | 
|  | 958 | local timeout_sec=$3 | 
|  | 959 | local expected=${4:-"True"} | 
|  | 960 | local check_command="" | 
|  | 961 | probe_cmd=`_get_probe_cmd_prefix $from_net` | 
|  | 962 | if [[ "$expected" = "True" ]]; then | 
|  | 963 | check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done" | 
|  | 964 | else | 
|  | 965 | check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done" | 
|  | 966 | fi | 
|  | 967 | if ! timeout $timeout_sec sh -c "$check_command"; then | 
|  | 968 | if [[ "$expected" = "True" ]]; then | 
|  | 969 | die $LINENO "[Fail] Couldn't ping server" | 
|  | 970 | else | 
|  | 971 | die $LINENO "[Fail] Could ping server" | 
|  | 972 | fi | 
|  | 973 | fi | 
|  | 974 | } | 
|  | 975 |  | 
|  | 976 | # ssh check | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 977 | function _ssh_check_neutron { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 978 | local from_net=$1 | 
|  | 979 | local key_file=$2 | 
|  | 980 | local ip=$3 | 
|  | 981 | local user=$4 | 
|  | 982 | local timeout_sec=$5 | 
|  | 983 | local probe_cmd = "" | 
|  | 984 | probe_cmd=`_get_probe_cmd_prefix $from_net` | 
|  | 985 | if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success; do sleep 1; done"; then | 
|  | 986 | die $LINENO "server didn't become ssh-able!" | 
|  | 987 | fi | 
|  | 988 | } | 
|  | 989 |  | 
|  | 990 | # Neutron 3rd party programs | 
|  | 991 | #--------------------------- | 
|  | 992 |  | 
|  | 993 | # please refer to ``lib/neutron_thirdparty/README.md`` for details | 
|  | 994 | NEUTRON_THIRD_PARTIES="" | 
|  | 995 | for f in $TOP_DIR/lib/neutron_thirdparty/*; do | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 996 | third_party=$(basename $f) | 
|  | 997 | if is_service_enabled $third_party; then | 
|  | 998 | source $TOP_DIR/lib/neutron_thirdparty/$third_party | 
|  | 999 | NEUTRON_THIRD_PARTIES="$NEUTRON_THIRD_PARTIES,$third_party" | 
|  | 1000 | fi | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1001 | done | 
|  | 1002 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 1003 | function _neutron_third_party_do { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1004 | for third_party in ${NEUTRON_THIRD_PARTIES//,/ }; do | 
|  | 1005 | ${1}_${third_party} | 
|  | 1006 | done | 
|  | 1007 | } | 
|  | 1008 |  | 
|  | 1009 | # configure_neutron_third_party() - Set config files, create data dirs, etc | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 1010 | function configure_neutron_third_party { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1011 | _neutron_third_party_do configure | 
|  | 1012 | } | 
|  | 1013 |  | 
|  | 1014 | # init_neutron_third_party() - Initialize databases, etc. | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 1015 | function init_neutron_third_party { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1016 | _neutron_third_party_do init | 
|  | 1017 | } | 
|  | 1018 |  | 
|  | 1019 | # install_neutron_third_party() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 1020 | function install_neutron_third_party { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1021 | _neutron_third_party_do install | 
|  | 1022 | } | 
|  | 1023 |  | 
|  | 1024 | # start_neutron_third_party() - Start running processes, including screen | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 1025 | function start_neutron_third_party { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1026 | _neutron_third_party_do start | 
|  | 1027 | } | 
|  | 1028 |  | 
|  | 1029 | # stop_neutron_third_party - Stop running processes (non-screen) | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 1030 | function stop_neutron_third_party { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1031 | _neutron_third_party_do stop | 
|  | 1032 | } | 
|  | 1033 |  | 
| armando-migliaccio | ef1e080 | 2014-01-02 16:33:53 -0800 | [diff] [blame] | 1034 | # check_neutron_third_party_integration() - Check that third party integration is sane | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 1035 | function check_neutron_third_party_integration { | 
| armando-migliaccio | ef1e080 | 2014-01-02 16:33:53 -0800 | [diff] [blame] | 1036 | _neutron_third_party_do check | 
|  | 1037 | } | 
|  | 1038 |  | 
| Sean M. Collins | 5ec6f8f | 2014-05-14 17:01:03 -0400 | [diff] [blame] | 1039 | function is_provider_network { | 
|  | 1040 | if [ "$Q_USE_PROVIDER_NETWORKING" == "True" ] && [ "$Q_L3_ENABLED" == "False" ]; then | 
|  | 1041 | return 0 | 
|  | 1042 | fi | 
|  | 1043 | return 1 | 
|  | 1044 | } | 
|  | 1045 |  | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1046 |  | 
|  | 1047 | # Restore xtrace | 
|  | 1048 | $XTRACE | 
|  | 1049 |  | 
| Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 1050 | # Tell emacs to use shell-script-mode | 
|  | 1051 | ## Local variables: | 
|  | 1052 | ## mode: shell-script | 
|  | 1053 | ## End: |