Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 1 | # common functions for ovs based plugin |
| 2 | # ------------------------------------- |
| 3 | |
| 4 | # Save trace setting |
Dean Troyer | 8d55be3 | 2013-02-07 17:16:35 -0600 | [diff] [blame] | 5 | MY_XTRACE=$(set +o | grep xtrace) |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 6 | set +o xtrace |
| 7 | |
| 8 | function is_quantum_ovs_base_plugin() { |
| 9 | # Yes, we use OVS. |
| 10 | return 0 |
| 11 | } |
| 12 | |
| 13 | function _quantum_ovs_base_setup_bridge() { |
| 14 | local bridge=$1 |
Davanum Srinivas | 88a3bc1 | 2013-02-04 09:16:14 -0500 | [diff] [blame] | 15 | quantum-ovs-cleanup |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 16 | sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
| 17 | sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
| 18 | } |
| 19 | |
| 20 | function _quantum_ovs_base_install_agent_packages() { |
| 21 | local kernel_version |
| 22 | # Install deps |
| 23 | # FIXME add to ``files/apts/quantum``, but don't install if not needed! |
| 24 | if is_ubuntu; then |
| 25 | kernel_version=`cat /proc/version | cut -d " " -f3` |
| 26 | install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
Gary Kotton | 5452b18 | 2013-02-25 13:02:38 +0000 | [diff] [blame^] | 27 | elif is_fedora; then |
| 28 | install_package openvswitch |
| 29 | # Ensure that the service is started |
| 30 | restart_service openvswitch |
| 31 | elif is_suse; then |
| 32 | ### FIXME: Find RPMs for OpenVSwitch |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 33 | echo "OpenVSwitch packages need to be located" |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 34 | restart_service openvswitch |
| 35 | fi |
| 36 | } |
| 37 | |
| 38 | function _quantum_ovs_base_configure_debug_command() { |
| 39 | iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
| 40 | } |
| 41 | |
| 42 | function _quantum_ovs_base_configure_l3_agent() { |
| 43 | iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
| 44 | |
Davanum Srinivas | 88a3bc1 | 2013-02-04 09:16:14 -0500 | [diff] [blame] | 45 | quantum-ovs-cleanup |
Isaku Yamahata | 0dd34df | 2012-12-28 13:15:31 +0900 | [diff] [blame] | 46 | sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
| 47 | # ensure no IP is configured on the public bridge |
| 48 | sudo ip addr flush dev $PUBLIC_BRIDGE |
| 49 | } |
| 50 | |
| 51 | # Restore xtrace |
Dean Troyer | 8d55be3 | 2013-02-07 17:16:35 -0600 | [diff] [blame] | 52 | $MY_XTRACE |