d19049aa4e828f4107106faa736c43706595d3f5
[sliver-openvswitch.git] / planetlab / scripts / del_bridge
1 #!/bin/bash
2
3 function error 
4 {
5         echo $1 >&2
6         exit 1
7 }
8
9 function is_switch_running
10 {
11         ovs-appctl version >/dev/null 2>&1
12 }
13
14 if [ -z "$1" ]; then
15         error "Usage: ${0##*/} <bridge name>" 
16 fi
17
18 W=
19 if ! is_switch_running; then
20         W="--no-wait"
21 fi
22
23 if ovs-vsctl br-exists "$1"; then
24         ovs-vsctl $W del-br $1
25 fi