summaryrefslogtreecommitdiffstats
path: root/sdnvpn/lib
diff options
context:
space:
mode:
authorRomanos Skiadas <rski@intracom-telecom.com>2017-03-17 10:55:28 +0200
committertomsou <soth@intracom-telecom.com>2017-03-22 15:04:11 +0000
commitb5b2a3abd74f84943cf3fab7ca7da591d326661c (patch)
treeea7824d4f69c514f5142354194bbcea5ff92c562 /sdnvpn/lib
parentf7a6f2593a1b99a0bd0459093d606dd4bdbb999a (diff)
Testcase 3 Apex compatibility fixes
- Workaround a bug releng in getting opedaylight nodes - Add some sudo commands because the path is not properly set otherwise it seems - remove needless command that gets ip information from the compute, since that is already available from when the command was ran on the controller - Handle attaching the quagga instance to Apex's br-ex ovs bridge Change-Id: I870f1049d9cce696ec26376a09db5f9e9bac0bf9 Signed-off-by: Romanos Skiadas <rski@intracom-telecom.com>
Diffstat (limited to 'sdnvpn/lib')
-rw-r--r--sdnvpn/lib/utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index 27fd5b3..5dcb8c1 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -437,3 +437,30 @@ def wait_for_cloud_init(instance):
success = False
return success
+
+
+def attach_instance_to_ext_br(instance, compute_node):
+ libvirt_instance_name = getattr(instance, "OS-EXT-SRV-ATTR:instance_name")
+ installer_type = str(os.environ['INSTALLER_TYPE'].lower())
+ if installer_type == "fuel":
+ bridge = "br-ex"
+ elif installer_type == "apex":
+ # In Apex, br-ex is an ovs bridge and virsh attach-interface
+ # won't just work. We work around it by creating a linux
+ # bridge, attaching that to br-ex with a veth pair
+ # and virsh-attaching the instance to the linux-bridge
+ bridge = "br-quagga"
+ cmd = """
+ set -xe
+ sudo brctl addbr {bridge} &&
+ sudo ip link set {bridge} up &&
+ sudo ip link add quagga-tap type veth peer name ovs-quagga-tap &&
+ sudo ip link set dev ovs-quagga-tap up &&
+ sudo ip link set dev quagga-tap up &&
+ sudo ovs-vsctl add-port br-ex ovs-quagga-tap &&
+ sudo brctl addif {bridge} quagga-tap
+ """
+ compute_node.run_cmd(cmd.format(bridge=bridge))
+
+ compute_node.run_cmd("sudo virsh attach-interface %s"
+ " bridge %s" % (libvirt_instance_name, bridge))