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