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