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 |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 28 | Q_PLUGIN_CLASS="neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2" |
| 29 | } |
| 30 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 31 | function neutron_plugin_configure_debug_command { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 32 | _neutron_ovs_base_configure_debug_command |
| 33 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
| 34 | } |
| 35 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 36 | function neutron_plugin_configure_dhcp_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 37 | iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
| 38 | } |
| 39 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 40 | function neutron_plugin_configure_l3_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 41 | iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
| 42 | _neutron_ovs_base_configure_l3_agent |
| 43 | } |
| 44 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 45 | function neutron_plugin_configure_plugin_agent { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 46 | # Set up integration bridge |
| 47 | _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
| 48 | if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
| 49 | sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
| 50 | fi |
| 51 | iniset /$Q_PLUGIN_CONF_FILE ovs integration_bridge $OVS_BRIDGE |
| 52 | AGENT_BINARY="$NEUTRON_DIR/neutron/plugins/ryu/agent/ryu_neutron_agent.py" |
| 53 | |
| 54 | _neutron_ovs_base_configure_firewall_driver |
| 55 | } |
| 56 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 57 | function neutron_plugin_configure_service { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 58 | iniset /$Q_PLUGIN_CONF_FILE ovs openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
| 59 | |
| 60 | _neutron_ovs_base_configure_firewall_driver |
| 61 | } |
| 62 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 63 | function neutron_plugin_setup_interface_driver { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 64 | local conf_file=$1 |
| 65 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
| 66 | iniset $conf_file DEFAULT ovs_use_veth True |
| 67 | } |
| 68 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 69 | function has_neutron_plugin_security_group { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 70 | # 0 means True here |
| 71 | return 0 |
| 72 | } |
| 73 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 74 | function neutron_plugin_check_adv_test_requirements { |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 75 | is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
| 76 | } |
| 77 | |
| 78 | # Restore xtrace |
Dean Troyer | e3a9160 | 2014-03-28 12:40:56 -0500 | [diff] [blame] | 79 | $RYU_XTRACE |