Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # vm-setup.sh |
| 3 | # |
| 4 | # This script installs ONOS dependencies for packet/optical use case. |
| 5 | |
| 6 | |
Marc De Leenheer | 06aae54 | 2015-01-09 14:47:41 -0800 | [diff] [blame] | 7 | export CURRENT_USER=optical |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 8 | export USER_HOME=/home/${CURRENT_USER} |
| 9 | |
| 10 | # -------------- Setup keys ------------------- |
| 11 | |
| 12 | mkdir -p ~/.ssh |
| 13 | ssh-keygen -t dsa -P "" -f .ssh/id_dsa |
| 14 | cp .ssh/id_dsa.pub .ssh/authorized_keys |
| 15 | |
| 16 | # -------------- Setup Desktop --------------- |
| 17 | |
| 18 | DESKTOP=${USER_HOME}/Desktop |
| 19 | |
| 20 | mkdir -p ${DESKTOP} |
| 21 | |
| 22 | cat > ${DESKTOP}/ONOS << EOF |
| 23 | [Desktop Entry] |
| 24 | Encoding=UTF-8 |
| 25 | Type=Application |
| 26 | Name=ONOS |
| 27 | Name[en_US]=ONOS |
| 28 | Icon=konsole |
Marc De Leenheer | 67b5fd5 | 2015-01-14 14:40:56 -0800 | [diff] [blame^] | 29 | Exec=/usr/bin/lxterminal -t 'ONOS' -e 'sudo -u tutorial1 /opt/onos/apache-karaf-3.0.2/bin/karaf clean' |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 30 | Comment[en_US]= |
| 31 | EOF |
| 32 | |
Marc De Leenheer | f59c17e | 2015-01-12 18:23:16 -0800 | [diff] [blame] | 33 | cat > "${DESKTOP}/Mininet Small" << EOF |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 34 | [Desktop Entry] |
| 35 | Encoding=UTF-8 |
| 36 | Type=Application |
Marc De Leenheer | f59c17e | 2015-01-12 18:23:16 -0800 | [diff] [blame] | 37 | Name=Mininet Small |
| 38 | Name[en_US]=Mininet Small |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 39 | Icon=konsole |
Marc De Leenheer | 67b5fd5 | 2015-01-14 14:40:56 -0800 | [diff] [blame^] | 40 | Exec=/usr/bin/lxterminal -t 'Mininet Small Topology' -e 'sudo -E python onos/tools/test/topos/opticalTest.py' |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 41 | Comment[en_US]= |
| 42 | EOF |
| 43 | |
Marc De Leenheer | f59c17e | 2015-01-12 18:23:16 -0800 | [diff] [blame] | 44 | cat > "${DESKTOP}/Mininet Large" << EOF |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 45 | [Desktop Entry] |
| 46 | Encoding=UTF-8 |
| 47 | Type=Application |
Marc De Leenheer | f59c17e | 2015-01-12 18:23:16 -0800 | [diff] [blame] | 48 | Name=Mininet Large |
| 49 | Name[en_US]=Mininet Large |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 50 | Icon=konsole |
Marc De Leenheer | 67b5fd5 | 2015-01-14 14:40:56 -0800 | [diff] [blame^] | 51 | Exec=/usr/bin/lxterminal -t 'Mininet Large Topology' -e 'sudo -E python onos/tools/test/topos/opticalTestBig.py' |
| 52 | Comment[en_US]= |
| 53 | EOF |
| 54 | |
| 55 | cat > "${DESKTOP}/LINC-OE" << EOF |
| 56 | [Desktop Entry] |
| 57 | Encoding=UTF-8 |
| 58 | Type=Application |
| 59 | Name=LINC-OE |
| 60 | Name[en_US]=LINC-OE |
| 61 | Icon=konsole |
| 62 | Exec=/usr/bin/lxterminal -t 'LINC-OE' -e 'sudo linc-oe/rel/linc/bin/linc attach' |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 63 | Comment[en_US]= |
| 64 | EOF |
| 65 | |
| 66 | cat > ${DESKTOP}/Tutorial << EOF |
| 67 | [Desktop Entry] |
| 68 | Encoding=UTF-8 |
| 69 | Type=Application |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 70 | Name=Tutorial |
| 71 | Name[en_US]=Tutorial |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 72 | Icon=internet-web-browser |
| 73 | Exec=/usr/bin/chromium-browser https://wiki.onosproject.org/display/ONOS/Packet+Optical+Tutorial |
| 74 | Comment[en_US]= |
| 75 | EOF |
| 76 | |
| 77 | cat > ${DESKTOP}/GUI << EOF |
| 78 | [Desktop Entry] |
| 79 | Encoding=UTF-8 |
| 80 | Type=Application |
| 81 | Name=ONOS GUI |
| 82 | Name[en_US]=ONOS GUI |
| 83 | Icon=internet-web-browser |
| 84 | Exec=/usr/bin/chromium-browser http://localhost:8181/onos/ui/index.html#topo |
| 85 | Comment[en_US]= |
| 86 | EOF |
| 87 | |
| 88 | cat > ${DESKTOP}/Wireshark << EOF |
| 89 | [Desktop Entry] |
| 90 | Encoding=UTF-8 |
| 91 | Type=Application |
| 92 | Name=Wireshark |
| 93 | Name[en_US]=Wireshark |
| 94 | Icon=wireshark |
| 95 | Exec=/usr/bin/wireshark |
| 96 | Comment[en_US]= |
| 97 | EOF |
| 98 | |
| 99 | cat > ${DESKTOP}/Reset << EOF |
| 100 | [Desktop Entry] |
| 101 | Encoding=UTF-8 |
| 102 | Type=Application |
| 103 | Name=Reset |
| 104 | Name[en_US]=Reset |
| 105 | Icon=konsole |
Marc De Leenheer | f54522c | 2015-01-14 11:23:39 -0800 | [diff] [blame] | 106 | Exec=/usr/bin/lxterminal -t 'Resetting; please wait' -e 'sudo mn -c' |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 107 | Comment[en_US]= |
| 108 | EOF |
| 109 | |
Marc De Leenheer | a95a462 | 2015-01-09 17:57:16 -0800 | [diff] [blame] | 110 | # -------------- Setup LINC & dependencies --------------- |
| 111 | git clone https://github.com/FlowForwarding/LINC-config-generator.git |
| 112 | cd ~/LINC-config-generator |
| 113 | git checkout oe-0.4 |
| 114 | make |
| 115 | cd |
| 116 | |
| 117 | git clone https://github.com/FlowForwarding/LINC-Switch.git linc-oe |
| 118 | cd linc-oe |
Marc De Leenheer | 19ec131 | 2015-01-12 11:46:05 -0800 | [diff] [blame] | 119 | sed -i s/3000/300000/ rel/files/vm.args |
Marc De Leenheer | a95a462 | 2015-01-09 17:57:16 -0800 | [diff] [blame] | 120 | cp rel/files/sys.config.orig rel/files/sys.config |
| 121 | make rel |
| 122 | cd |
Marc De Leenheer | f59c17e | 2015-01-12 18:23:16 -0800 | [diff] [blame] | 123 | |
Marc De Leenheer | 604e34f | 2015-01-13 14:11:06 -0800 | [diff] [blame] | 124 | # -------------- Setup and install ONOS --------------- |
Marc De Leenheer | e58c078 | 2015-01-13 09:59:21 -0800 | [diff] [blame] | 125 | git clone https://gerrit.onosproject.org/onos -b onos-1.0 |
Marc De Leenheer | e58c078 | 2015-01-13 09:59:21 -0800 | [diff] [blame] | 126 | |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 127 | export ONOS_USER=$CURRENT_USER |
| 128 | |
| 129 | export ONOS_ROOT=~/onos |
| 130 | export KARAF_ROOT=/opt/onos/apache-karaf-3.0.2 |
Marc De Leenheer | 6122c5e | 2015-01-13 17:50:42 -0800 | [diff] [blame] | 131 | source onos/tools/dev/bash_profile |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 132 | echo $JAVA_HOME |
| 133 | export JAVA_HOME="" |
Marc De Leenheer | 6122c5e | 2015-01-13 17:50:42 -0800 | [diff] [blame] | 134 | cd onos && mvn clean install && mvn dependency:go-offline && cd - |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 135 | |
Marc De Leenheer | 67b5fd5 | 2015-01-14 14:40:56 -0800 | [diff] [blame^] | 136 | # Configure cell |
| 137 | cat << EOF >> onos/tools/test/cells/optical |
| 138 | export ONOS_NIC=127.0.0.* |
| 139 | export OC1="127.0.0.1" |
| 140 | export OCI="${OC1}" |
| 141 | export ONOS_FEATURES="webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-gui,onos-app-optical,onos-app-proxyarp" |
| 142 | export ONOS_USER="optical" |
| 143 | EOF |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 144 | |
Marc De Leenheer | 604e34f | 2015-01-13 14:11:06 -0800 | [diff] [blame] | 145 | # Setup profile |
| 146 | echo "source $ONOS_ROOT/tools/dev/bash_profile" >> ~/.profile |
| 147 | echo "sudo service onos stop > /dev/null 2>&1" >> ~/.profile |
Marc De Leenheer | 67b5fd5 | 2015-01-14 14:40:56 -0800 | [diff] [blame^] | 148 | echo "cell docker > /dev/null 2>&1" >> ~/.profile |