| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 1 | # Neutron MidoNet plugin | 
|  | 2 | # ---------------------- | 
|  | 3 |  | 
| Ryu Ishimoto | 18d5c83 | 2014-02-19 00:33:46 +0900 | [diff] [blame] | 4 | MIDONET_DIR=${MIDONET_DIR:-$DEST/midonet} | 
|  | 5 | MIDONET_API_PORT=${MIDONET_API_PORT:-8080} | 
|  | 6 | MIDONET_API_URL=${MIDONET_API_URL:-http://localhost:$MIDONET_API_PORT/midonet-api} | 
|  | 7 |  | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 8 | # Save trace setting | 
|  | 9 | MY_XTRACE=$(set +o | grep xtrace) | 
|  | 10 | set +o xtrace | 
|  | 11 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 12 | function is_neutron_ovs_base_plugin { | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 13 | # MidoNet does not use l3-agent | 
|  | 14 | # 0 means True here | 
|  | 15 | return 1 | 
|  | 16 | } | 
|  | 17 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 18 | function neutron_plugin_create_nova_conf { | 
| Joe Mills | a2fd222 | 2013-10-04 11:46:10 +0000 | [diff] [blame] | 19 | NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 20 | } | 
|  | 21 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 22 | function neutron_plugin_install_agent_packages { | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 23 | : | 
|  | 24 | } | 
|  | 25 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 26 | function neutron_plugin_configure_common { | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 27 | Q_PLUGIN_CONF_PATH=etc/neutron/plugins/midonet | 
|  | 28 | Q_PLUGIN_CONF_FILENAME=midonet.ini | 
|  | 29 | Q_DB_NAME="neutron_midonet" | 
|  | 30 | Q_PLUGIN_CLASS="neutron.plugins.midonet.plugin.MidonetPluginV2" | 
|  | 31 | } | 
|  | 32 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 33 | function neutron_plugin_configure_debug_command { | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 34 | : | 
|  | 35 | } | 
|  | 36 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 37 | function neutron_plugin_configure_dhcp_agent { | 
| Ryu Ishimoto | 35f0966 | 2013-08-27 18:32:00 +0900 | [diff] [blame] | 38 | DHCP_DRIVER=${DHCP_DRIVER:-"neutron.plugins.midonet.agent.midonet_driver.DhcpNoOpDriver"} | 
| Joe Mills | e4a523f | 2013-10-28 07:38:55 +0000 | [diff] [blame] | 39 | neutron_plugin_setup_interface_driver $Q_DHCP_CONF_FILE | 
| Ryu Ishimoto | 35f0966 | 2013-08-27 18:32:00 +0900 | [diff] [blame] | 40 | iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_driver $DHCP_DRIVER | 
| Ryu Ishimoto | 35f0966 | 2013-08-27 18:32:00 +0900 | [diff] [blame] | 41 | iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces True | 
|  | 42 | iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 43 | } | 
|  | 44 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 45 | function neutron_plugin_configure_l3_agent { | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 46 | die $LINENO "q-l3 must not be executed with MidoNet plugin!" | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 47 | } | 
|  | 48 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 49 | function neutron_plugin_configure_plugin_agent { | 
| Sean Dague | 3bdb922 | 2013-10-22 08:36:16 -0400 | [diff] [blame] | 50 | die $LINENO "q-agt must not be executed with MidoNet plugin!" | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 51 | } | 
|  | 52 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 53 | function neutron_plugin_configure_service { | 
| Ryu Ishimoto | 18d5c83 | 2014-02-19 00:33:46 +0900 | [diff] [blame] | 54 | if [[ "$MIDONET_API_URL" != "" ]]; then | 
|  | 55 | iniset /$Q_PLUGIN_CONF_FILE MIDONET midonet_uri $MIDONET_API_URL | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 56 | fi | 
|  | 57 | if [[ "$MIDONET_USERNAME" != "" ]]; then | 
|  | 58 | iniset /$Q_PLUGIN_CONF_FILE MIDONET username $MIDONET_USERNAME | 
|  | 59 | fi | 
|  | 60 | if [[ "$MIDONET_PASSWORD" != "" ]]; then | 
|  | 61 | iniset /$Q_PLUGIN_CONF_FILE MIDONET password $MIDONET_PASSWORD | 
|  | 62 | fi | 
|  | 63 | if [[ "$MIDONET_PROJECT_ID" != "" ]]; then | 
|  | 64 | iniset /$Q_PLUGIN_CONF_FILE MIDONET project_id $MIDONET_PROJECT_ID | 
|  | 65 | fi | 
| Tomoe Sugihara | 81fe5f5 | 2013-11-14 20:04:44 +0000 | [diff] [blame] | 66 |  | 
|  | 67 | Q_L3_ENABLED=True | 
|  | 68 | Q_L3_ROUTER_PER_TENANT=True | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 69 | } | 
|  | 70 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 71 | function neutron_plugin_setup_interface_driver { | 
| Joe Mills | e4a523f | 2013-10-28 07:38:55 +0000 | [diff] [blame] | 72 | local conf_file=$1 | 
|  | 73 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.MidonetInterfaceDriver | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 74 | } | 
|  | 75 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 76 | function has_neutron_plugin_security_group { | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 77 | # 0 means True here | 
|  | 78 | return 0 | 
|  | 79 | } | 
|  | 80 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 81 | function neutron_plugin_check_adv_test_requirements { | 
| av-mido | 2c3428b | 2013-07-11 14:59:00 +0900 | [diff] [blame] | 82 | # 0 means True here | 
|  | 83 | return 1 | 
|  | 84 | } | 
|  | 85 |  | 
|  | 86 | # Restore xtrace | 
|  | 87 | $MY_XTRACE |