-
Notifications
You must be signed in to change notification settings - Fork 0
/
odl.sh
executable file
·84 lines (65 loc) · 1.73 KB
/
odl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
local_ip=""
bridge_mappings=""
odl_ip=""
function usage {
local rc=$1
local outstr=$2
if [ "$outstr" != "" ]; then
echo "$outstr"
echo
fi
echo "Usage: `basename $0` [OPTION...]"
echo
echo "Script options:"
echo " --local_ip IP IP address of the node, will be used as tunnel endpoint"
echo " --bridge_mappings MAPPINGS physical provider mappings, i.e physnet1:eth1,physnet2:eth2"
echo " --odl_ip IP IP address of OpenDaylight controller"
echo
echo "Help options:"
echo " -?, -h, --h, --help Display this help and exit"
echo
exit $rc
}
function parse_options {
while true ; do
case "$1" in
--local_ip)
shift; local_ip="$1"; shift
;;
--bridge_mappings)
shift; bridge_mappings="$1"; shift
;;
--odl_ip)
shift; odl_ip="$1"; shift
;;
-? | -h | --h | --help)
usage 0
;;
"")
break
;;
*)
echo "Ignoring unknown option: $1"; shift;
esac
done
}
parse_options "$@"
if [ `whoami` != "root" ]; then
usage 1 "Please execute this script as superuser or with sudo previleges."
fi
if [ -n "$odl_ip" ]; then
echo "setting odl_ip=$odl_ip"
ovs-vsctl set-manager tcp:$odl_ip:6640
fi
read ovstbl <<< $(ovs-vsctl get Open_vSwitch . _uuid)
if [ -n "$bridge_mappings" ]; then
sudo ovs-vsctl set Open_vSwitch $ovstbl other_config:bridge_mappings=$bridge_mappings
fi
if [ -n "$local_ip" ]; then
sudo ovs-vsctl set Open_vSwitch $ovstbl other_config:local_ip=$local_ip
fi
ovs-vsctl list Manager
echo
ovs-vsctl list Open_vSwitch .
exit 0