summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolas Hermanns <nikolas.hermanns@ericsson.com>2017-04-06 15:54:59 +0200
committerNikolas Hermanns <nikolas.hermanns@ericsson.com>2017-04-06 15:54:59 +0200
commit2bfbe25b1df24d562789faa641c41e9cafec7efa (patch)
tree0037c07971e70a79320df43c5c743f172d6e14ec
parent9a52d17d9ac79c358647d87b5d540e869b25769d (diff)
Checking if hacked quagga bridge exsists and contiune
Change-Id: I8983ed687dabba0af2128c0ce06bd53aba22c819 Signed-off-by: Nikolas Hermanns <nikolas.hermanns@ericsson.com>
-rw-r--r--sdnvpn/lib/utils.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index eb59446..03fea54 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -488,13 +488,15 @@ def attach_instance_to_ext_br(instance, compute_node):
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
+ if ! brctl show |grep -q ^br-quagga;then
+ 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
+ fi
"""
compute_node.run_cmd(cmd.format(bridge=bridge))