blob: 2be98c302d1a6c47aa7d0cd9d796965b2169c7a3 [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
29Exec=/usr/bin/lxterminal -e '/opt/onos/apache-karaf-3.0.2/bin/client -u karaf'
30Comment[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 Leenheerf59c17e2015-01-12 18:23:16 -080040Exec=/usr/bin/lxterminal -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 Leenheerf59c17e2015-01-12 18:23:16 -080051Exec=/usr/bin/lxterminal -e 'sudo -E python ~/onos/tools/test/topos/opticalTestBig.py'
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080052Comment[en_US]=
53EOF
54
55cat > ${DESKTOP}/Tutorial << EOF
56[Desktop Entry]
57Encoding=UTF-8
58Type=Application
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -080059Name=Tutorial
60Name[en_US]=Tutorial
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080061Icon=internet-web-browser
62Exec=/usr/bin/chromium-browser https://wiki.onosproject.org/display/ONOS/Packet+Optical+Tutorial
63Comment[en_US]=
64EOF
65
66cat > ${DESKTOP}/GUI << EOF
67[Desktop Entry]
68Encoding=UTF-8
69Type=Application
70Name=ONOS GUI
71Name[en_US]=ONOS GUI
72Icon=internet-web-browser
73Exec=/usr/bin/chromium-browser http://localhost:8181/onos/ui/index.html#topo
74Comment[en_US]=
75EOF
76
77cat > ${DESKTOP}/Wireshark << EOF
78[Desktop Entry]
79Encoding=UTF-8
80Type=Application
81Name=Wireshark
82Name[en_US]=Wireshark
83Icon=wireshark
84Exec=/usr/bin/wireshark
85Comment[en_US]=
86EOF
87
88cat > ${DESKTOP}/Reset << EOF
89[Desktop Entry]
90Encoding=UTF-8
91Type=Application
92Name=Reset
93Name[en_US]=Reset
94Icon=konsole
95Exec=/usr/bin/lxterminal -t 'Resetting; please wait' -e 'sudo service onos restart'
96Comment[en_US]=
97EOF
98
Marc De Leenheera95a4622015-01-09 17:57:16 -080099# -------------- Setup LINC & dependencies ---------------
100git clone https://github.com/FlowForwarding/LINC-config-generator.git
101cd ~/LINC-config-generator
102git checkout oe-0.4
103make
104cd
105
106git clone https://github.com/FlowForwarding/LINC-Switch.git linc-oe
107cd linc-oe
Marc De Leenheer19ec1312015-01-12 11:46:05 -0800108sed -i s/3000/300000/ rel/files/vm.args
Marc De Leenheera95a4622015-01-09 17:57:16 -0800109cp rel/files/sys.config.orig rel/files/sys.config
110make rel
111cd
Marc De Leenheerf59c17e2015-01-12 18:23:16 -0800112
Marc De Leenheer604e34f2015-01-13 14:11:06 -0800113# -------------- Setup and install ONOS ---------------
Marc De Leenheere58c0782015-01-13 09:59:21 -0800114git clone https://gerrit.onosproject.org/onos -b onos-1.0
Marc De Leenheere58c0782015-01-13 09:59:21 -0800115
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800116export ONOS_USER=$CURRENT_USER
117
118export ONOS_ROOT=~/onos
119export KARAF_ROOT=/opt/onos/apache-karaf-3.0.2
120source $ONOS_ROOT/tools/dev/bash_profile
121echo $JAVA_HOME
122export JAVA_HOME=""
123cd $ONOS_ROOT && mvn clean install && mvn dependency:go-offline && cd -
124
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800125# Sleep a little to let the features load up
126sleep 20
127
Marc De Leenheer604e34f2015-01-13 14:11:06 -0800128# Setup profile
129echo "source $ONOS_ROOT/tools/dev/bash_profile" >> ~/.profile
130echo "sudo service onos stop > /dev/null 2>&1" >> ~/.profile