| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 1 | # Brocade Neutron Plugin | 
|  | 2 | # ---------------------- | 
|  | 3 |  | 
|  | 4 | # Save trace setting | 
|  | 5 | BRCD_XTRACE=$(set +o | grep xtrace) | 
|  | 6 | set +o xtrace | 
|  | 7 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 8 | function is_neutron_ovs_base_plugin { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 9 | return 1 | 
|  | 10 | } | 
|  | 11 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 12 | function neutron_plugin_create_nova_conf { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 13 | NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} | 
|  | 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 | install_package bridge-utils | 
|  | 18 | } | 
|  | 19 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 20 | function neutron_plugin_configure_common { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 21 | Q_PLUGIN_CONF_PATH=etc/neutron/plugins/brocade | 
|  | 22 | Q_PLUGIN_CONF_FILENAME=brocade.ini | 
|  | 23 | Q_DB_NAME="brcd_neutron" | 
|  | 24 | Q_PLUGIN_CLASS="neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2" | 
|  | 25 | } | 
|  | 26 |  | 
| Shiv Haris | 815ef98 | 2014-04-08 15:19:12 -0700 | [diff] [blame] | 27 | function neutron_plugin_configure_service { | 
|  | 28 |  | 
|  | 29 | if [[ "$BROCADE_SWITCH_OS_VERSION" != "" ]]; then | 
|  | 30 | iniset /$Q_PLUGIN_CONF_FILE switch osversion $BROCADE_SWITCH_OS_VERSION | 
|  | 31 | fi | 
|  | 32 |  | 
|  | 33 | if [[ "$BROCADE_SWITCH_OS_TYPE" != "" ]]; then | 
|  | 34 | iniset /$Q_PLUGIN_CONF_FILE switch ostype $BROCADE_SWITCH_OS_TYPE | 
|  | 35 | fi | 
|  | 36 |  | 
|  | 37 | if [[ "$BROCADE_SWITCH_PASSWORD" != "" ]]; then | 
|  | 38 | iniset /$Q_PLUGIN_CONF_FILE switch password $BROCADE_SWITCH_PASSWORD | 
|  | 39 | fi | 
|  | 40 |  | 
|  | 41 | if [[ "$BROCADE_SWITCH_USERNAME" != "" ]]; then | 
|  | 42 | iniset /$Q_PLUGIN_CONF_FILE switch username $BROCADE_SWITCH_USERNAME | 
|  | 43 | fi | 
|  | 44 |  | 
|  | 45 | if [[ "$BROCADE_SWITCH_IPADDR" != "" ]]; then | 
|  | 46 | iniset /$Q_PLUGIN_CONF_FILE switch address $BROCADE_SWITCH_IPADDR | 
|  | 47 | fi | 
|  | 48 |  | 
|  | 49 | } | 
|  | 50 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 51 | function neutron_plugin_configure_debug_command { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 52 | iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge | 
|  | 53 | } | 
|  | 54 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 55 | function neutron_plugin_configure_dhcp_agent { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 56 | iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport | 
|  | 57 | } | 
|  | 58 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 59 | function neutron_plugin_configure_l3_agent { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 60 | iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge | 
|  | 61 | iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport | 
|  | 62 | } | 
|  | 63 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 64 | function neutron_plugin_configure_plugin_agent { | 
| Shiv Haris | 55d9b9a | 2014-01-14 11:33:28 -0800 | [diff] [blame] | 65 | AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent" | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 66 | } | 
|  | 67 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 68 | function neutron_plugin_setup_interface_driver { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 69 | local conf_file=$1 | 
|  | 70 | iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver | 
|  | 71 | } | 
|  | 72 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 73 | function has_neutron_plugin_security_group { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 74 | # 0 means True here | 
|  | 75 | return 0 | 
|  | 76 | } | 
|  | 77 |  | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 78 | function neutron_plugin_check_adv_test_requirements { | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 79 | is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 | 
|  | 80 | } | 
|  | 81 |  | 
|  | 82 | # Restore xtrace | 
|  | 83 | $BRCD_XTRACE |