Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1 | # Neutron Ryu plugin |
| 2 | # ------------------ |
| 3 | |
| 4 | # Save trace setting |
Dean Troyer | e3a9160 | 2014-03-28 12:40:56 -0500 | [diff] [blame^] | 5 | RYU_XTRACE=$(set +o | grep xtrace) |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 6 | set +o xtrace |
| 7 | |
| 8 | source $TOP_DIR/lib/neutron_plugins/ovs_base |
| 9 | source $TOP_DIR/lib/neutron_thirdparty/ryu # for configuration value |
| 10 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 11 | function neutron_plugin_create_nova_conf { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 12 | _neutron_ovs_base_configure_nova_vif_driver |
| 13 | iniset $NOVA_CONF DEFAULT libvirt_ovs_integration_bridge "$OVS_BRIDGE" |
| 14 | } |
| 15 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 16 | function neutron_plugin_install_agent_packages { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 17 | _neutron_ovs_base_install_agent_packages |
| 18 | |
| 19 | # neutron_ryu_agent requires ryu module |
| 20 | install_package $(get_packages "ryu") |
| 21 | install_ryu |
| 22 | configure_ryu |
| 23 | } |
| 24 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 25 | function neutron_plugin_configure_common { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 26 | Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ryu |
| 27 | Q_PLUGIN_CONF_FILENAME=ryu.ini |
| 28 | Q_DB_NAME="ovs_neutron" |
| 29 | Q_PLUGIN_CLASS="neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2" |
| 30 | } |
| 31 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 32 | function neutron_plugin_configure_debug_command { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 33 | _neutron_ovs_base_configure_debug_command |
| 34 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
| 35 | } |
| 36 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 37 | function neutron_plugin_configure_dhcp_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 38 | iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
| 39 | } |
| 40 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 41 | function neutron_plugin_configure_l3_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 42 | iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
| 43 | _neutron_ovs_base_configure_l3_agent |
| 44 | } |
| 45 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 46 | function neutron_plugin_configure_plugin_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 47 | # Set up integration bridge |
| 48 | _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
| 49 | if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
| 50 | sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
| 51 | fi |
| 52 | iniset /$Q_PLUGIN_CONF_FILE ovs integration_bridge $OVS_BRIDGE |
| 53 | AGENT_BINARY="$NEUTRON_DIR/neutron/plugins/ryu/agent/ryu_neutron_agent.py" |
| 54 | |
| 55 | _neutron_ovs_base_configure_firewall_driver |
| 56 | } |
| 57 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 58 | function neutron_plugin_configure_service { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 59 | iniset /$Q_PLUGIN_CONF_FILE ovs openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
| 60 | |
| 61 | _neutron_ovs_base_configure_firewall_driver |
| 62 | } |
| 63 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 64 | function neutron_plugin_setup_interface_driver { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 65 | local conf_file=$1 |
| 66 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
| 67 | iniset $conf_file DEFAULT ovs_use_veth True |
| 68 | } |
| 69 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 70 | function has_neutron_plugin_security_group { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 71 | # 0 means True here |
| 72 | return 0 |
| 73 | } |
| 74 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 75 | function neutron_plugin_check_adv_test_requirements { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 76 | is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
| 77 | } |
| 78 | |
| 79 | # Restore xtrace |
Dean Troyer | e3a9160 | 2014-03-28 12:40:56 -0500 | [diff] [blame^] | 80 | $RYU_XTRACE |