blob: f893dde524172dc75c1cd6ba71d67ebd96d8866e [file] [log] [blame]
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -08001#!/bin/bash
2# vm-setup.sh
3#
4# This script installs ONOS dependencies for packet/optical use case.
5
6
Marc De Leenheer06aae542015-01-09 14:47:41 -08007export CURRENT_USER=optical
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -08008export USER_HOME=/home/${CURRENT_USER}
9
10# -------------- Setup keys -------------------
11
12mkdir -p ~/.ssh
13ssh-keygen -t dsa -P "" -f .ssh/id_dsa
14cp .ssh/id_dsa.pub .ssh/authorized_keys
15
16# -------------- Setup Desktop ---------------
17
18DESKTOP=${USER_HOME}/Desktop
19
20mkdir -p ${DESKTOP}
21
22cat > ${DESKTOP}/ONOS << EOF
23[Desktop Entry]
24Encoding=UTF-8
25Type=Application
26Name=ONOS
27Name[en_US]=ONOS
28Icon=konsole
Marc De Leenheer67b5fd52015-01-14 14:40:56 -080029Exec=/usr/bin/lxterminal -t 'ONOS' -e 'sudo -u tutorial1 /opt/onos/apache-karaf-3.0.2/bin/karaf clean'
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080030Comment[en_US]=
31EOF
32
Marc De Leenheerf59c17e2015-01-12 18:23:16 -080033cat > "${DESKTOP}/Mininet Small" << EOF
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080034[Desktop Entry]
35Encoding=UTF-8
36Type=Application
Marc De Leenheerf59c17e2015-01-12 18:23:16 -080037Name=Mininet Small
38Name[en_US]=Mininet Small
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080039Icon=konsole
Marc De Leenheer67b5fd52015-01-14 14:40:56 -080040Exec=/usr/bin/lxterminal -t 'Mininet Small Topology' -e 'sudo -E python onos/tools/test/topos/opticalTest.py'
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080041Comment[en_US]=
42EOF
43
Marc De Leenheerf59c17e2015-01-12 18:23:16 -080044cat > "${DESKTOP}/Mininet Large" << EOF
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080045[Desktop Entry]
46Encoding=UTF-8
47Type=Application
Marc De Leenheerf59c17e2015-01-12 18:23:16 -080048Name=Mininet Large
49Name[en_US]=Mininet Large
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080050Icon=konsole
Marc De Leenheer67b5fd52015-01-14 14:40:56 -080051Exec=/usr/bin/lxterminal -t 'Mininet Large Topology' -e 'sudo -E python onos/tools/test/topos/opticalTestBig.py'
52Comment[en_US]=
53EOF
54
55cat > "${DESKTOP}/LINC-OE" << EOF
56[Desktop Entry]
57Encoding=UTF-8
58Type=Application
59Name=LINC-OE
60Name[en_US]=LINC-OE
61Icon=konsole
62Exec=/usr/bin/lxterminal -t 'LINC-OE' -e 'sudo linc-oe/rel/linc/bin/linc attach'
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080063Comment[en_US]=
64EOF
65
66cat > ${DESKTOP}/Tutorial << EOF
67[Desktop Entry]
68Encoding=UTF-8
69Type=Application
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -080070Name=Tutorial
71Name[en_US]=Tutorial
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080072Icon=internet-web-browser
73Exec=/usr/bin/chromium-browser https://wiki.onosproject.org/display/ONOS/Packet+Optical+Tutorial
74Comment[en_US]=
75EOF
76
77cat > ${DESKTOP}/GUI << EOF
78[Desktop Entry]
79Encoding=UTF-8
80Type=Application
81Name=ONOS GUI
82Name[en_US]=ONOS GUI
83Icon=internet-web-browser
84Exec=/usr/bin/chromium-browser http://localhost:8181/onos/ui/index.html#topo
85Comment[en_US]=
86EOF
87
88cat > ${DESKTOP}/Wireshark << EOF
89[Desktop Entry]
90Encoding=UTF-8
91Type=Application
92Name=Wireshark
93Name[en_US]=Wireshark
94Icon=wireshark
95Exec=/usr/bin/wireshark
96Comment[en_US]=
97EOF
98
99cat > ${DESKTOP}/Reset << EOF
100[Desktop Entry]
101Encoding=UTF-8
102Type=Application
103Name=Reset
104Name[en_US]=Reset
105Icon=konsole
Marc De Leenheerf54522c2015-01-14 11:23:39 -0800106Exec=/usr/bin/lxterminal -t 'Resetting; please wait' -e 'sudo mn -c'
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -0800107Comment[en_US]=
108EOF
109
Marc De Leenheera95a4622015-01-09 17:57:16 -0800110# -------------- Setup LINC & dependencies ---------------
111git clone https://github.com/FlowForwarding/LINC-config-generator.git
112cd ~/LINC-config-generator
113git checkout oe-0.4
114make
115cd
116
117git clone https://github.com/FlowForwarding/LINC-Switch.git linc-oe
118cd linc-oe
Marc De Leenheer19ec1312015-01-12 11:46:05 -0800119sed -i s/3000/300000/ rel/files/vm.args
Marc De Leenheera95a4622015-01-09 17:57:16 -0800120cp rel/files/sys.config.orig rel/files/sys.config
121make rel
122cd
Marc De Leenheerf59c17e2015-01-12 18:23:16 -0800123
Marc De Leenheer604e34f2015-01-13 14:11:06 -0800124# -------------- Setup and install ONOS ---------------
Marc De Leenheere58c0782015-01-13 09:59:21 -0800125git clone https://gerrit.onosproject.org/onos -b onos-1.0
Marc De Leenheere58c0782015-01-13 09:59:21 -0800126
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800127export ONOS_USER=$CURRENT_USER
128
129export ONOS_ROOT=~/onos
130export KARAF_ROOT=/opt/onos/apache-karaf-3.0.2
Marc De Leenheer6122c5e2015-01-13 17:50:42 -0800131source onos/tools/dev/bash_profile
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800132echo $JAVA_HOME
133export JAVA_HOME=""
Marc De Leenheer6122c5e2015-01-13 17:50:42 -0800134cd onos && mvn clean install && mvn dependency:go-offline && cd -
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800135
Marc De Leenheer67b5fd52015-01-14 14:40:56 -0800136# Configure cell
137cat << EOF >> onos/tools/test/cells/optical
138export ONOS_NIC=127.0.0.*
139export OC1="127.0.0.1"
140export OCI="${OC1}"
141export ONOS_FEATURES="webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-gui,onos-app-optical,onos-app-proxyarp"
142export ONOS_USER="optical"
143EOF
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800144
Marc De Leenheer604e34f2015-01-13 14:11:06 -0800145# Setup profile
146echo "source $ONOS_ROOT/tools/dev/bash_profile" >> ~/.profile
147echo "sudo service onos stop > /dev/null 2>&1" >> ~/.profile
Marc De Leenheer67b5fd52015-01-14 14:40:56 -0800148echo "cell docker > /dev/null 2>&1" >> ~/.profile