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 | 270088c | 2015-01-15 10:42:45 -0800 | [diff] [blame] | 29 | Exec=/usr/bin/lxterminal -t 'ONOS' -e 'Applications/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 | 3d22b3f | 2015-01-14 18:53:32 -0800 | [diff] [blame] | 124 | # -------------- Setup and install Apache Karaf --------------- |
| 125 | mkdir -p Applications |
| 126 | mkdir -p Downloads |
| 127 | cd Downloads |
| 128 | wget http://download.nextag.com/apache/karaf/3.0.2/apache-karaf-3.0.2.tar.gz |
| 129 | tar -zxvf apache-karaf-3.0.2.tar.gz -C ../Applications/ |
| 130 | cd |
| 131 | sed -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 |
| 132 | sed -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 Leenheer | 604e34f | 2015-01-13 14:11:06 -0800 | [diff] [blame] | 134 | # -------------- Setup and install ONOS --------------- |
Marc De Leenheer | e58c078 | 2015-01-13 09:59:21 -0800 | [diff] [blame] | 135 | git clone https://gerrit.onosproject.org/onos -b onos-1.0 |
Marc De Leenheer | e58c078 | 2015-01-13 09:59:21 -0800 | [diff] [blame] | 136 | |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 137 | export ONOS_USER=$CURRENT_USER |
| 138 | |
| 139 | export ONOS_ROOT=~/onos |
Marc De Leenheer | 3d22b3f | 2015-01-14 18:53:32 -0800 | [diff] [blame] | 140 | export KARAF_ROOT=~/Applications/apache-karaf-3.0.2 |
Marc De Leenheer | 6122c5e | 2015-01-13 17:50:42 -0800 | [diff] [blame] | 141 | source onos/tools/dev/bash_profile |
Marc De Leenheer | 59b0ced | 2015-01-15 14:35:44 -0800 | [diff] [blame] | 142 | unset $JAVA_HOME |
Marc De Leenheer | 6122c5e | 2015-01-13 17:50:42 -0800 | [diff] [blame] | 143 | cd onos && mvn clean install && mvn dependency:go-offline && cd - |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 144 | |
Marc De Leenheer | 7af30a2 | 2015-01-15 14:12:17 -0800 | [diff] [blame] | 145 | cp onos/tools/package/branding/target/onos-branding-1.0.1-SNAPSHOT.jar Applications/apache-karaf-3.0.2/lib/ |
Marc De Leenheer | 270088c | 2015-01-15 10:42:45 -0800 | [diff] [blame] | 146 | |
Marc De Leenheer | 67b5fd5 | 2015-01-14 14:40:56 -0800 | [diff] [blame] | 147 | # Configure cell |
| 148 | cat << EOF >> onos/tools/test/cells/optical |
| 149 | export ONOS_NIC=127.0.0.* |
| 150 | export OC1="127.0.0.1" |
| 151 | export OCI="${OC1}" |
| 152 | export ONOS_FEATURES="webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-gui,onos-app-optical,onos-app-proxyarp" |
| 153 | export ONOS_USER="optical" |
| 154 | EOF |
Marc De Leenheer | 1e3d3a0 | 2015-01-12 20:13:54 -0800 | [diff] [blame] | 155 | |
Marc De Leenheer | 604e34f | 2015-01-13 14:11:06 -0800 | [diff] [blame] | 156 | # Setup profile |
| 157 | echo "source $ONOS_ROOT/tools/dev/bash_profile" >> ~/.profile |
Marc De Leenheer | 59b0ced | 2015-01-15 14:35:44 -0800 | [diff] [blame] | 158 | echo "unset JAVA_HOME" >> ~/.profile |
Marc De Leenheer | 604e34f | 2015-01-13 14:11:06 -0800 | [diff] [blame] | 159 | echo "sudo service onos stop > /dev/null 2>&1" >> ~/.profile |
Marc De Leenheer | 4ceca5c | 2015-01-14 16:22:28 -0800 | [diff] [blame] | 160 | echo "cell optical > /dev/null 2>&1" >> ~/.profile |
Marc De Leenheer | 9a53196 | 2015-01-14 16:42:11 -0800 | [diff] [blame] | 161 | |
| 162 | # Allow user full access to wireshark |
| 163 | sudo usermod -a -G wireshark optical |