blob: f34e86216085b5fa55b94c0fdb2260a6afad27b8 [file] [log] [blame]
Isaku Yamahata0dd34df2012-12-28 13:15:31 +09001# common functions for ovs based plugin
2# -------------------------------------
3
4# Save trace setting
5XTRACE=$(set +o | grep xtrace)
6set +o xtrace
7
8function is_quantum_ovs_base_plugin() {
9 # Yes, we use OVS.
10 return 0
11}
12
13function _quantum_ovs_base_setup_bridge() {
14 local bridge=$1
Davanum Srinivas88a3bc12013-02-04 09:16:14 -050015 quantum-ovs-cleanup
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090016 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
20function _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
35function _quantum_ovs_base_configure_debug_command() {
36 iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
37}
38
39function _quantum_ovs_base_configure_l3_agent() {
40 iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
41
Davanum Srinivas88a3bc12013-02-04 09:16:14 -050042 quantum-ovs-cleanup
Isaku Yamahata0dd34df2012-12-28 13:15:31 +090043 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
49$XTRACE