forked from Beacon-Unime/Federation-Agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-fa-ovs.sh
executable file
·63 lines (48 loc) · 2.04 KB
/
setup-fa-ovs.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
#!/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
echo "host ip = $HOST_IP"
# || [ -z "$OVN_DB_IP" ||]]; then
if [ -z "$HOST_IP" ]; then
echo "Usage: setup-ovs.sh <host_ip>"
exit
fi
sudo killall ovsdb-server
sudo ovs-appctl exit
sudo rm -rf /usr/local/etc/openvswitch/conf.db
sudo mkdir -p /usr/local/etc/openvswitch
sudo ovsdb-tool create /usr/local/etc/openvswitch/conf.db $OVS_DIR/vswitchd/vswitch.ovsschema
echo "run ovsdb-server"
sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--pidfile --detach
echo -n "Waiting for ovsdb-server to start ... "
while ! test -e /usr/local/var/run/openvswitch/db.sock ; do
sleep 1
done
echo "done."
sudo ovs-vsctl --no-wait init
sudo modprobe openvswitch || die $LINENO "Failed to load openvswitch module"
sudo modprobe geneve || true
sudo modprobe vport_geneve || die $LINENO "Failed to load vport_geneve module"
echo "kernel module loaded"
echo "Start ovs deamon"
sudo ovs-vswitchd --pidfile --detach --log-file
sudo ovs-vsctl add-br br-fa
sudo ovs-vsctl -- --may-exist add-port br-fa fa-tun -- set Interface fa-tun type=vxlan options:remote_ip=flow options:key=flow
sudo ovs-vsctl set-controller br-fa tcp:127.0.0.1:1234