blob: 94e14fc78021ae33c51ac0d02bd0ea73e3b1e5f9 [file] [log] [blame]
#!/bin/bash
# vm-setup.sh
#
# This script installs ONOS dependencies and installs a desktop environment on a Miniet VM.
USER=tutorial1
USER_HOME=/home/${USER}
export ONOS_USER=$USER
export ONOS_ROOT=~/onos
source $ONOS_ROOT/tools/dev/bash_profile
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
java -version
javac -version
echo $JAVA_HOME
export JAVA_HOME=""
cd $ONOS_ROOT && mvn clean install && cd -
sed -i -e s/sdn/$USER/ onos/tools/package/debian/onos.conf
cat << EOF >> onos/tools/test/cells/tutorial
export ONOS_NIC=127.0.0.*
export OC1="127.0.0.1"
export OCI="${OC1}"
export ONOS_FEATURES="webconsole,onos-rest,onos-api,onos-core-trivial,onos-cli,onos-openflow"
export ONOS_USER="tutorial1"
EOF
cell tutorial
onos-package
onos-install -f $OC1
onos-wait-for-start $OC1
onos $OC1 "feature:install onos-app-fwd"
onos $OC1 "feature:install onos-app-ifwd"
onos $OC1 "feature:install onos-app-sdnip"
# Sleep a little to let the features load up
sleep 20
sudo echo 'export ONOS_OPTS="clean debug"' > /opt/onos/options
sudo su -c 'echo GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash\" >> /etc/default/grub'
sudo su -c update-grub
#--------------- Copy SDNIP code to home -----
sudo -u sdnip cp -r /home/tutorial1/onos/tools/tutorials/sdnip /home/sdnip/
sudo -u sdnip cp -r /home/sdnip/sdnip/configs /home/sdnip/
# -------------- Copy SDN-IP config ----------
sudo -u tutorial1 cp /home/sdnip/configs/addresses.json /opt/onos/config/
sudo -u tutorial1 cp /home/sdnip/configs/sdnip.json /opt/onos/config/