blob: 2e29ba730ef0de69896273c71437c5b02358ab7e [file] [log] [blame]
alshabibbca6bf22014-11-15 16:38:45 -08001#!/bin/bash
2# vm-setup.sh
3#
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -08004# This script installs ONOS dependencies and installs a desktop environment on a Mininet VM.
alshabibbca6bf22014-11-15 16:38:45 -08005
6
7USER=tutorial1
8USER_HOME=/home/${USER}
9
alshabibbca6bf22014-11-15 16:38:45 -080010export ONOS_USER=$USER
11
Jonathan Hart622597b2014-12-04 13:15:50 -080012export ONOS_ROOT=~/onos
Jonathan Hartd47bc102014-12-11 15:15:34 -080013export KARAF_ROOT=/opt/onos/apache-karaf-3.0.2
alshabibbca6bf22014-11-15 16:38:45 -080014source $ONOS_ROOT/tools/dev/bash_profile
alshabib343d1602014-11-18 14:49:52 -080015sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
16sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
alshabibfbbb90a2014-11-18 14:52:54 -080017java -version
18javac -version
alshabib36510ef2014-11-18 15:11:15 -080019echo $JAVA_HOME
alshabiba984a3a2014-11-18 15:14:42 -080020export JAVA_HOME=""
Jonathan Hart5e2514d2014-12-12 11:50:58 -080021cd $ONOS_ROOT && mvn clean install && mvn dependency:go-offline && cd -
alshabibbca6bf22014-11-15 16:38:45 -080022
Jonathan Hart622597b2014-12-04 13:15:50 -080023sed -i -e s/sdn/$USER/ onos/tools/package/debian/onos.conf
alshabibbca6bf22014-11-15 16:38:45 -080024
Jonathan Hart622597b2014-12-04 13:15:50 -080025cat << EOF >> onos/tools/test/cells/tutorial
alshabibbca6bf22014-11-15 16:38:45 -080026export ONOS_NIC=127.0.0.*
27export OC1="127.0.0.1"
28export OCI="${OC1}"
Jonathan Hart019d4a82014-12-10 13:30:08 -080029export ONOS_FEATURES="webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow"
30export ONOS_USER="tutorial1"
alshabibbca6bf22014-11-15 16:38:45 -080031EOF
32
alshabib343d1602014-11-18 14:49:52 -080033cell tutorial
34
alshabibbca6bf22014-11-15 16:38:45 -080035onos-package
alshabibff061ee2014-11-17 15:57:10 -080036onos-install -f $OC1
Jonathan Hart019d4a82014-12-10 13:30:08 -080037onos-wait-for-start $OC1
Jonathan Hart80c20302014-12-15 13:48:11 -080038onos $OC1 "feature:install onos-app-fwd"
39onos $OC1 "feature:install onos-app-ifwd"
40onos $OC1 "feature:install onos-app-sdnip"
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080041onos $OC1 "feature:install onos-app-optical"
alshabibbca6bf22014-11-15 16:38:45 -080042
Jonathan Harte7d8a252014-12-11 14:06:52 -080043# Sleep a little to let the features load up
Jonathan Hart80c20302014-12-15 13:48:11 -080044sleep 20
Jonathan Harte7d8a252014-12-11 14:06:52 -080045
alshabiba66571a2014-12-01 19:29:41 -080046sudo echo 'export ONOS_OPTS="clean debug"' > /opt/onos/options
alshabib63899492014-12-01 14:53:10 -080047
alshabib96d222e2014-12-01 17:35:48 -080048sudo su -c 'echo GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash\" >> /etc/default/grub'
alshabibefbdd932014-12-01 17:05:00 -080049sudo su -c update-grub
Jonathan Hart8886ac22014-12-01 22:47:18 -080050
51#--------------- Copy SDNIP code to home -----
52
Jonathan Hartf0f50292014-12-04 11:06:36 -080053sudo -u sdnip cp -r /home/tutorial1/onos/tools/tutorials/sdnip /home/sdnip/
Jonathan Hart9acae332014-12-01 23:31:21 -080054sudo -u sdnip cp -r /home/sdnip/sdnip/configs /home/sdnip/
Jonathan Hart8886ac22014-12-01 22:47:18 -080055
56# -------------- Copy SDN-IP config ----------
57
58sudo -u tutorial1 cp /home/sdnip/configs/addresses.json /opt/onos/config/
59sudo -u tutorial1 cp /home/sdnip/configs/sdnip.json /opt/onos/config/