alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # vm-setup.sh |
| 3 | # |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 4 | # This script installs ONOS dependencies and installs a desktop environment on a Mininet VM. |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 5 | |
| 6 | |
| 7 | USER=tutorial1 |
| 8 | USER_HOME=/home/${USER} |
| 9 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 10 | export ONOS_USER=$USER |
| 11 | |
Jonathan Hart | 622597b | 2014-12-04 13:15:50 -0800 | [diff] [blame] | 12 | export ONOS_ROOT=~/onos |
Jonathan Hart | d47bc10 | 2014-12-11 15:15:34 -0800 | [diff] [blame] | 13 | export KARAF_ROOT=/opt/onos/apache-karaf-3.0.2 |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 14 | source $ONOS_ROOT/tools/dev/bash_profile |
alshabib | 343d160 | 2014-11-18 14:49:52 -0800 | [diff] [blame] | 15 | sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java |
| 16 | sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac |
alshabib | fbbb90a | 2014-11-18 14:52:54 -0800 | [diff] [blame] | 17 | java -version |
| 18 | javac -version |
alshabib | 36510ef | 2014-11-18 15:11:15 -0800 | [diff] [blame] | 19 | echo $JAVA_HOME |
alshabib | a984a3a | 2014-11-18 15:14:42 -0800 | [diff] [blame] | 20 | export JAVA_HOME="" |
Jonathan Hart | 5e2514d | 2014-12-12 11:50:58 -0800 | [diff] [blame] | 21 | cd $ONOS_ROOT && mvn clean install && mvn dependency:go-offline && cd - |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 22 | |
Jonathan Hart | 622597b | 2014-12-04 13:15:50 -0800 | [diff] [blame] | 23 | sed -i -e s/sdn/$USER/ onos/tools/package/debian/onos.conf |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 24 | |
Jonathan Hart | 622597b | 2014-12-04 13:15:50 -0800 | [diff] [blame] | 25 | cat << EOF >> onos/tools/test/cells/tutorial |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 26 | export ONOS_NIC=127.0.0.* |
| 27 | export OC1="127.0.0.1" |
| 28 | export OCI="${OC1}" |
Jonathan Hart | 019d4a8 | 2014-12-10 13:30:08 -0800 | [diff] [blame] | 29 | export ONOS_FEATURES="webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow" |
| 30 | export ONOS_USER="tutorial1" |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 31 | EOF |
| 32 | |
alshabib | 343d160 | 2014-11-18 14:49:52 -0800 | [diff] [blame] | 33 | cell tutorial |
| 34 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 35 | onos-package |
alshabib | ff061ee | 2014-11-17 15:57:10 -0800 | [diff] [blame] | 36 | onos-install -f $OC1 |
Jonathan Hart | 019d4a8 | 2014-12-10 13:30:08 -0800 | [diff] [blame] | 37 | onos-wait-for-start $OC1 |
Jonathan Hart | 80c2030 | 2014-12-15 13:48:11 -0800 | [diff] [blame] | 38 | onos $OC1 "feature:install onos-app-fwd" |
| 39 | onos $OC1 "feature:install onos-app-ifwd" |
| 40 | onos $OC1 "feature:install onos-app-sdnip" |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 41 | |
Jonathan Hart | e7d8a25 | 2014-12-11 14:06:52 -0800 | [diff] [blame] | 42 | # Sleep a little to let the features load up |
Jonathan Hart | 80c2030 | 2014-12-15 13:48:11 -0800 | [diff] [blame] | 43 | sleep 20 |
Jonathan Hart | e7d8a25 | 2014-12-11 14:06:52 -0800 | [diff] [blame] | 44 | |
alshabib | a66571a | 2014-12-01 19:29:41 -0800 | [diff] [blame] | 45 | sudo echo 'export ONOS_OPTS="clean debug"' > /opt/onos/options |
alshabib | 6389949 | 2014-12-01 14:53:10 -0800 | [diff] [blame] | 46 | |
alshabib | 96d222e | 2014-12-01 17:35:48 -0800 | [diff] [blame] | 47 | sudo su -c 'echo GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash\" >> /etc/default/grub' |
alshabib | efbdd93 | 2014-12-01 17:05:00 -0800 | [diff] [blame] | 48 | sudo su -c update-grub |
Jonathan Hart | 8886ac2 | 2014-12-01 22:47:18 -0800 | [diff] [blame] | 49 | |
| 50 | #--------------- Copy SDNIP code to home ----- |
| 51 | |
Jonathan Hart | f0f5029 | 2014-12-04 11:06:36 -0800 | [diff] [blame] | 52 | sudo -u sdnip cp -r /home/tutorial1/onos/tools/tutorials/sdnip /home/sdnip/ |
Jonathan Hart | 9acae33 | 2014-12-01 23:31:21 -0800 | [diff] [blame] | 53 | sudo -u sdnip cp -r /home/sdnip/sdnip/configs /home/sdnip/ |
Jonathan Hart | 8886ac2 | 2014-12-01 22:47:18 -0800 | [diff] [blame] | 54 | |
| 55 | # -------------- Copy SDN-IP config ---------- |
| 56 | |
| 57 | sudo -u tutorial1 cp /home/sdnip/configs/addresses.json /opt/onos/config/ |
| 58 | sudo -u tutorial1 cp /home/sdnip/configs/sdnip.json /opt/onos/config/ |