Merge branch 'onos-tutorial' of ssh://gerrit.onlab.us:29418/ONOS-VM into onos-tutorial
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e4e5f6c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*~
\ No newline at end of file
diff --git a/onos-setup.sh b/onos-setup.sh
index 7d19677..dadc83f 100644
--- a/onos-setup.sh
+++ b/onos-setup.sh
@@ -37,3 +37,13 @@
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-next/tools/test/topos/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/
diff --git a/sdnip-setup.sh b/sdnip-setup.sh
new file mode 100644
index 0000000..ccb5e71
--- /dev/null
+++ b/sdnip-setup.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+# vm-setup.sh
+#
+# This script installs ONOS dependencies and installs a desktop environment on a Miniet VM.
+
+
+export CURRENT_USER=sdnip
+export USER_HOME=/home/${CURRENT_USER}
+
+# -------------- Setup keys -------------------
+
+mkdir -p ~/.ssh
+ssh-keygen -t dsa -P "" -f .ssh/id_dsa
+cp .ssh/id_dsa.pub .ssh/authorized_keys
+
+# -------------- Setup Desktop ---------------
+
+DESKTOP=${USER_HOME}/Desktop
+
+mkdir -p ${DESKTOP}
+
+cat > ${DESKTOP}/ONOS << EOF
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=ONOS
+Name[en_US]=ONOS
+Icon=konsole
+Exec=/usr/bin/lxterminal -e '/opt/onos/apache-karaf-3.0.2/bin/client -u karaf'
+Comment[en_US]=
+EOF
+
+cat > "${DESKTOP}/SDN-IP Mininet" << EOF
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=SDN-IP Mininet
+Name[en_US]=SDN-IP Mininet
+Icon=konsole
+Exec=/usr/bin/lxterminal -e 'sudo mn --custom /home/sdnip/sdnip/tutorial.py --topo sdnip --controller remote --nolistenport'
+Comment[en_US]=
+EOF
+
+cat > ${DESKTOP}/Tutorial << EOF
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=SDN-IP Tutorial
+Name[en_US]=SDN-IP Tutorial
+Icon=internet-web-browser
+Exec=/usr/bin/chromium-browser https://wiki.onosproject.org/display/ONOS/SDN-IP+Tutorial
+Comment[en_US]=
+EOF
+
+cat > ${DESKTOP}/GUI << EOF
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=ONOS GUI
+Name[en_US]=ONOS GUI
+Icon=internet-web-browser
+Exec=/usr/bin/chromium-browser http://localhost:8181/onos/ui/index.html#topo
+Comment[en_US]=
+EOF
+
+cat > ${DESKTOP}/Wireshark << EOF
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=Wireshark
+Name[en_US]=Wireshark
+Icon=wireshark
+Exec=/usr/bin/wireshark
+Comment[en_US]=
+EOF
+
+cat > ${DESKTOP}/Reset << EOF
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=Reset
+Name[en_US]=Reset
+Icon=konsole
+Exec=/usr/bin/lxterminal -t 'Resetting; please wait' -e 'sudo service onos restart'
+Comment[en_US]=
+EOF
+
diff --git a/vm-setup.sh b/vm-setup.sh
index 5512659..b2c94a2 100644
--- a/vm-setup.sh
+++ b/vm-setup.sh
@@ -9,9 +9,10 @@
export USER_HOME=/home/${CURRENT_USER}
URL='https://gerrit.onosproject.org/gitweb?p=ONOS-VM.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=tutorial1-setup.sh'
+SDNIP_URL='https://gerrit.onosproject.org/gitweb?p=ONOS-VM.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=sdnip-setup.sh'
sudo /usr/sbin/useradd -c "Basic ONOS Tutorial" -d /home/${CURRENT_USER} -U -m -p $(openssl passwd -1 ${CURRENT_USER}) -s /bin/bash ${CURRENT_USER}
-sudo /usr/sbin/useradd -c "Basic SDN-ip Tutorial" -d /home/${SDN_IP_USER} -U -m -p $(openssl passwd -1 ${SDN_IP_USER}) -s /bin/bash ${SDN_IP_USER}
+sudo /usr/sbin/useradd -c "Basic SDN-IP Tutorial" -d /home/${SDN_IP_USER} -U -m -p $(openssl passwd -1 ${SDN_IP_USER}) -s /bin/bash ${SDN_IP_USER}
echo "${CURRENT_USER} ALL=(ALL) NOPASSWD:ALL" >> tutorial1
@@ -41,3 +42,6 @@
sudo -u ${CURRENT_USER} -H sh -c 'cp tutorial1-setup.sh ~/ && cd ~/ && sh tutorial1-setup.sh'
+wget -O sdnip-setup.sh $SDNIP_URL
+
+sudo -u ${SDN_IP_USER} -H sh -c 'cp sdnip-setup.sh ~/ && cd ~/ && sh sdnip-setup.sh'