-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup-ovn.sh
executable file
·66 lines (54 loc) · 2.31 KB
/
setup-ovn.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
#!/bin/bash
###########################################################################
#Copyright 2016 Anna Levin, Liran Shour - IBM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################
OVS_DIR=/home/ubuntu/ovs
HOST_IP=$1
OVN_DB_IP=$2
echo "host ip = $HOST_IP ovn db ip = $OVN_DB_IP"
# || [ -z "$OVN_DB_IP" ||]]; then
if [ -z "$HOST_IP" ] || [ -z $OVN_DB_IP ] ; then
echo "Usage: setup-ovn.sh <host_ip> <ovn_db_ip>"
exit
fi
echo "Configuring OVN"
if [ -z "$OVN_UUID" ] ; then
if [ -f ./ovn-uuid ] ; then
OVN_UUID=$(cat ovn-uuid)
else
OVN_UUID=$(uuidgen)
echo $OVN_UUID > ovn-uuid
fi
fi
echo $OVN_UUID > ovn-uuid
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:system-id="$OVN_UUID"
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-remote="tcp:$OVN_DB_IP:6642"
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-bridge="br-int"
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-type="geneve"
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-ip="$HOST_IP"
sudo ovs-vsctl --no-wait -- --may-exist add-br br-int
sudo ovs-vsctl --no-wait br-set-external-id br-int bridge-id br-int
sudo ovs-vsctl --no-wait set bridge br-int fail-mode=secure other-config:disable-in-band=true
echo "Start OVN..."
sudo screen -S ovn -p 0 -X kill
sudo screen -S ovn -p 1 -X kill
sudo screen -S ovn -p 2 -X kill
sudo screen -d -m -S ovn
sudo screen -S ovn -X screen -t ovn-controller
sleep 1
sudo screen -t ovn screen -S ovn -p 0 -X stuff "sudo ovn-controller --log-file unix:/usr/local/var/run/openvswitch/db.sock `echo -ne '\015'`"
sudo screen -S ovn -X screen -t ovn-northd
sleep 1
sudo screen -t ovn screen -S ovn -p 1 -X stuff "sudo ovn-northd --log-file `echo -ne '\015'`"