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 |
| 15 | quantum-ovs-cleanup --ovs_integration_bridge $bridge |
| 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 |
| 27 | else |
| 28 | ### FIXME(dtroyer): Find RPMs for OpenVSwitch |
| 29 | echo "OpenVSwitch packages need to be located" |
| 30 | # Fedora does not started OVS by default |
| 31 | restart_service openvswitch |
| 32 | fi |
| 33 | } |
| 34 | |
| 35 | function _quantum_ovs_base_configure_debug_command() { |
| 36 | iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
| 37 | } |
| 38 | |
| 39 | function _quantum_ovs_base_configure_l3_agent() { |
| 40 | iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
| 41 | |
| 42 | quantum-ovs-cleanup --external_network_bridge $PUBLIC_BRIDGE |
| 43 | sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
| 44 | # ensure no IP is configured on the public bridge |
| 45 | sudo ip addr flush dev $PUBLIC_BRIDGE |
| 46 | } |
| 47 | |
| 48 | # Restore xtrace |
Dean Troyer | 8d55be3 | 2013-02-07 17:16:35 -0600 | [diff] [blame^] | 49 | $MY_XTRACE |