blob: 7c64126b23d442ff5447f981b0cc3742328d2e94 [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 Leenheer270088c2015-01-15 10:42:45 -080029Exec=/usr/bin/lxterminal -t 'ONOS' -e 'Applications/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 Leenheer3d22b3f2015-01-14 18:53:32 -0800124# -------------- Setup and install Apache Karaf ---------------
125mkdir -p Applications
126mkdir -p Downloads
127cd Downloads
128wget http://download.nextag.com/apache/karaf/3.0.2/apache-karaf-3.0.2.tar.gz
129tar -zxvf apache-karaf-3.0.2.tar.gz -C ../Applications/
130cd
131sed -i s/features$/features,mvn:org.onosproject\\/onos-features\\/1.0.1-SNAPSHOT\\/xml\\/features/ ~/Applications/apache-karaf-3.0.2/etc/org.apache.karaf.features.cfg
132sed -i s/management$/management,webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-gui,onos-app-optical,onos-app-proxyarp/ ~/Applications/apache-karaf-3.0.2/etc/org.apache.karaf.features.cfg
133
Marc De Leenheer604e34f2015-01-13 14:11:06 -0800134# -------------- Setup and install ONOS ---------------
Marc De Leenheere58c0782015-01-13 09:59:21 -0800135git clone https://gerrit.onosproject.org/onos -b onos-1.0
Marc De Leenheere58c0782015-01-13 09:59:21 -0800136
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800137export ONOS_USER=$CURRENT_USER
138
139export ONOS_ROOT=~/onos
Marc De Leenheer3d22b3f2015-01-14 18:53:32 -0800140export KARAF_ROOT=~/Applications/apache-karaf-3.0.2
Marc De Leenheer6122c5e2015-01-13 17:50:42 -0800141source onos/tools/dev/bash_profile
Marc De Leenheer59b0ced2015-01-15 14:35:44 -0800142unset $JAVA_HOME
Marc De Leenheer6122c5e2015-01-13 17:50:42 -0800143cd onos && mvn clean install && mvn dependency:go-offline && cd -
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800144
Marc De Leenheer7af30a22015-01-15 14:12:17 -0800145cp onos/tools/package/branding/target/onos-branding-1.0.1-SNAPSHOT.jar Applications/apache-karaf-3.0.2/lib/
Marc De Leenheer270088c2015-01-15 10:42:45 -0800146
Marc De Leenheer67b5fd52015-01-14 14:40:56 -0800147# Configure cell
148cat << EOF >> onos/tools/test/cells/optical
149export ONOS_NIC=127.0.0.*
150export OC1="127.0.0.1"
151export OCI="${OC1}"
152export ONOS_FEATURES="webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-gui,onos-app-optical,onos-app-proxyarp"
153export ONOS_USER="optical"
154EOF
Marc De Leenheer1e3d3a02015-01-12 20:13:54 -0800155
Marc De Leenheer604e34f2015-01-13 14:11:06 -0800156# Setup profile
157echo "source $ONOS_ROOT/tools/dev/bash_profile" >> ~/.profile
Marc De Leenheer59b0ced2015-01-15 14:35:44 -0800158echo "unset JAVA_HOME" >> ~/.profile
Marc De Leenheer604e34f2015-01-13 14:11:06 -0800159echo "sudo service onos stop > /dev/null 2>&1" >> ~/.profile
Marc De Leenheer4ceca5c2015-01-14 16:22:28 -0800160echo "cell optical > /dev/null 2>&1" >> ~/.profile
Marc De Leenheer9a531962015-01-14 16:42:11 -0800161
162# Allow user full access to wireshark
163sudo usermod -a -G wireshark optical