Updating and fixing vagrant ONOS VM
Change-Id: I75313d7e254aa08d8567ae5701c219677f279991
diff --git a/tools/dev/vagrant/Vagrantfile b/tools/dev/vagrant/Vagrantfile
index e694f75..7148376 100644
--- a/tools/dev/vagrant/Vagrantfile
+++ b/tools/dev/vagrant/Vagrantfile
@@ -13,6 +13,9 @@
v.customize ["modifyvm", :id, "--vram", "32"]
end
+ # Creates an ONOS tutorial VM.
+ # It contains Mininet, three LXC containers used as ONOS target machines, the tutorial files.
+ # The machine comes also with the Ubuntu GUI to support tutorials.
config.vm.define "onostutorial" do |d|
d.vm.box = "ubuntu/xenial64"
d.vm.hostname = "onostutorial"
@@ -33,9 +36,12 @@
end
end
- config.vm.define "onosdev" do |d|
+ # Creates a VM with three LXC containers inside.
+ # Miniet is installed on the virtual machine itself.
+ # The three LXC containers serve as ONOS target machines.
+ config.vm.define "onosdevmn" do |d|
d.vm.box = "ubuntu/xenial64"
- d.vm.hostname = "onosdev"
+ d.vm.hostname = "onosmn"
d.vm.network "private_network", ip: "10.100.198.200"
d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /vagrant/ansible/basic.yml -c local"
@@ -48,6 +54,22 @@
end
end
+ # Creates a VM with three LXC containers inside, to be used as ONOS target machines.
+ config.vm.define "onosdev" do |d|
+ d.vm.box = "ubuntu/xenial64"
+ d.vm.hostname = "onosdev"
+ d.vm.network "private_network", ip: "10.100.198.200"
+ d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
+ d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /vagrant/ansible/basic.yml -c local"
+ d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /vagrant/ansible/mn.yml -c local"
+ d.vm.provider "virtualbox" do |v|
+ v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
+ v.memory = 4096
+ v.cpus = 2
+ end
+ end
+
+ # Creates a VM and installs Mininet in it.
config.vm.define "mn" do |d|
d.vm.box = "ubuntu/xenial64"
d.vm.hostname = "mn"
diff --git a/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml b/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml
index 63969c2..2b74f4a 100644
--- a/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml
@@ -4,14 +4,14 @@
#
- name: Making sure Application folder is present
file:
- path: "{{ app_dir }}"
+ path: "/home/ubuntu/{{ app_dir }}"
state: directory
mode: 0777
- name: Downloading IntelliJ
get_url:
url: "{{ intellij.url }}"
- dest: "{{ app_dir }}/intellij.tar.gz"
+ dest: "/home/ubuntu/{{ app_dir }}/intellij.tar.gz"
- name: Extracting IntelliJ
unarchive:
@@ -21,5 +21,5 @@
- name: Removing IntelliJ tar.gz archive
file:
- path: "{{ app_dir }}/intellij.tar.gz"
+ path: "/home/ubuntu/{{ app_dir }}/intellij.tar.gz"
state: absent
\ No newline at end of file
diff --git a/tools/dev/vagrant/ansible/roles/onos-install/tasks/main.yml b/tools/dev/vagrant/ansible/roles/onos-install/tasks/main.yml
index b48901c..45f6600 100644
--- a/tools/dev/vagrant/ansible/roles/onos-install/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/onos-install/tasks/main.yml
@@ -1,50 +1,12 @@
---
#
-# Installs ONOS and downloads the related dependencies. It then compiles the code.
+# Installs ONOS and downloads the related dependencies.
#
-- name: Installing Maven
- apt:
- name: maven
- force: yes
- tags: [common]
-
-- name: Creating Application folder
- file:
- path: "{{ app_dir }}"
- state: directory
- mode: 0777
-
-- name: Creating Download folder
- file:
- path: "{{ download_dir }}"
- state: directory
- mode: 0777
-
-- name: Downloading Apache Karaf
- get_url:
- url: "http://archive.apache.org/dist/karaf/{{ karaf_version }}/apache-karaf-{{ karaf_version }}.tar.gz"
- dest: "{{ download_dir }}"
- mode: 0777
-
-- name: Copying Apache Karaf in the Application directory
- copy:
- src: "/home/ubuntu/{{ download_dir }}/apache-karaf-{{ karaf_version }}.tar.gz"
- dest: "/home/ubuntu/{{ app_dir }}/apache-karaf-{{ karaf_version }}.tar.gz"
- mode: 0777
-
-- name: Extracting Apache Karaf
- unarchive:
- src: "/home/ubuntu/{{ download_dir }}/apache-karaf-{{ karaf_version }}.tar.gz"
- dest: "/home/ubuntu/{{ app_dir }}"
- mode: 0777
-
- name: Cloning ONOS repository
git:
repo: "{{ onos_repo_url }}"
- dest: onos
- version: onos-"{{ onos_version }}"
- become: true
- become_user: ubuntu
+ dest: "{{ onos_dir }}"
+ version: "onos-{{ onos_version }}"
- name: Changing ONOS repository permissions
file:
@@ -63,19 +25,9 @@
- name: Compiling ONOS
shell: "{{ item }}"
args:
- chdir: "/home/ubuntu/onos"
+ chdir: "/home/ubuntu/onos/tools/build"
with_items:
- - mvn clean install
- become: true
- become_user: ubuntu
-
-- name: Changing .m2 repository permissions
- file:
- path: "/home/ubuntu/.m2"
- state: directory
- owner: ubuntu
- group: ubuntu
- mode: 0777
+ - "./onos-buck build onos"
- name: Creating 1 node ONOS cell
template:
@@ -101,14 +53,30 @@
group: ubuntu
mode: 0777
+- name: Changing ONOS repository permissions
+ file:
+ path: "/home/ubuntu/onos"
+ state: directory
+ owner: ubuntu
+ group: ubuntu
+ mode: 0777
+
+- name: Changing /tmp/stc dir permissions
+ file:
+ path: "/tmp/stc"
+ state: directory
+ owner: ubuntu
+ group: ubuntu
+ mode: 0777
+
- name: Deploying ONOS
+ become: yes
+ become_user: ubuntu
shell: "/home/ubuntu/onos_deploy.sh"
environment:
ONOS_ROOT: /home/ubuntu/onos
args:
executable: /bin/bash
- become: true
- become_user: ubuntu
- name: Adding ONOS to startup
become: yes
diff --git a/tools/dev/vagrant/ansible/roles/onos-install/templates/onos_deploy.j2 b/tools/dev/vagrant/ansible/roles/onos-install/templates/onos_deploy.j2
index 01d49ba..ac68522 100644
--- a/tools/dev/vagrant/ansible/roles/onos-install/templates/onos_deploy.j2
+++ b/tools/dev/vagrant/ansible/roles/onos-install/templates/onos_deploy.j2
@@ -3,4 +3,4 @@
source $ONOS_ROOT/tools/dev/bash_profile
cell 3node
-onos-test
\ No newline at end of file
+stc setup
\ No newline at end of file
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml b/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml
index a24be78..6ef9430 100644
--- a/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml
@@ -75,9 +75,6 @@
create: yes
block: |
export ONOS_ROOT=/home/ubuntu/onos
- export KARAF_ROOT=/home/ubuntu/Applications/apache-karaf-{{ karaf_version }}
- export KARAF_TAR=/home/ubuntu/Applications/apache-karaf-{{ karaf_version }}.tar.gz
- export M2_REPO=/home/ubuntu/.m2/repository
. /home/ubuntu/onos/tools/dev/bash_profile
cell {{ item.value.cell }} > /dev/null
with_dict: "{{ tutorials }}"
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_one_node.j2 b/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_one_node.j2
index 1ab3b7a..47bb431 100644
--- a/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_one_node.j2
+++ b/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_one_node.j2
@@ -3,23 +3,15 @@
sudo rm -rf /tmp/*
export ONOS_ROOT=/home/ubuntu/onos
-export M2_REPO=/home/ubuntu/.m2/repository
-export KARAF_TAR=/home/ubuntu/{{ app_dir }}/apache-karaf-{{ karaf_version }}.tar.gz
-export KARAF_ROOT=/home/ubuntu/Applications/apache-karaf-{{ karaf_version }}
source ${ONOS_ROOT}/tools/dev/bash_profile
sudo mn -c
sudo chmod -R 777 /home/ubuntu/onos
-sudo chmod -R 777 /home/ubuntu/.m2
cell 3node
onos-service --cell stop
cell 1node
-if [ -n "$1" ]; then
- export ONOS_APPS=$ONOS_APPS,$1
-fi
-
onos-test
\ No newline at end of file
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_three_node.j2 b/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_three_node.j2
index b6c5de5..b7d589b 100644
--- a/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_three_node.j2
+++ b/tools/dev/vagrant/ansible/roles/tutorial-common/templates/reset_three_node.j2
@@ -3,20 +3,12 @@
sudo rm -rf /tmp/*
export ONOS_ROOT=/home/ubuntu/onos
-export M2_REPO=/home/ubuntu/.m2/repository
-export KARAF_TAR=/home/ubuntu/{{ app_dir }}/apache-karaf-{{ karaf_version }}.tar.gz
-export KARAF_ROOT=/home/ubuntu/{{ app_dir }}/apache-karaf-{{ karaf_version }}
source ${ONOS_ROOT}/tools/dev/bash_profile
sudo mn -c
sudo chmod -R 777 /home/ubuntu/onos
-sudo chmod -R 777 /home/ubuntu/.m2
cell 3node
-if [ -n "$1" ]; then
- export ONOS_APPS=$ONOS_APPS,$1
-fi
-
onos-test
\ No newline at end of file
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-common/templates/run_onos.j2 b/tools/dev/vagrant/ansible/roles/tutorial-common/templates/run_onos.j2
index 01265ae..975a3bb 100755
--- a/tools/dev/vagrant/ansible/roles/tutorial-common/templates/run_onos.j2
+++ b/tools/dev/vagrant/ansible/roles/tutorial-common/templates/run_onos.j2
@@ -1,9 +1,6 @@
#!/bin/bash
export ONOS_ROOT=/home/ubuntu/onos
-export M2_REPO=/home/ubuntu/.m2/repository
-export KARAF_TAR=/home/ubuntu/"{{ app_dir }}"/apache-karaf-"{{ karaf_version }}".tar.gz
-export KARAF_ROOT=/home/ubuntu/"{{ app_dir }}"/apache-karaf-"{{ karaf_version }}"
source ${ONOS_ROOT}/tools/dev/bash_profile
cell 1node
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml b/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml
index 3f5a116..9ff2d6b 100644
--- a/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml
@@ -9,10 +9,16 @@
update_cache: yes
with_items: "{{ tutorials.optical.packages }}"
+- name: Making sure Application folder is present
+ file:
+ path: "/home/ubuntu/{{ app_dir }}"
+ state: directory
+ mode: 0777
+
- name: Downloading ERLANG package
get_url:
url: "{{ tutorials.optical.erlang.package_url }}"
- dest: "{{ app_dir }}"
+ dest: "/home/ubuntu/{{ app_dir }}"
- name: Extracting ERLANG package
unarchive:
diff --git a/tools/dev/vagrant/ansible/vars/global_vars.yml b/tools/dev/vagrant/ansible/vars/global_vars.yml
index 3e9a018..c54f130 100644
--- a/tools/dev/vagrant/ansible/vars/global_vars.yml
+++ b/tools/dev/vagrant/ansible/vars/global_vars.yml
@@ -31,10 +31,6 @@
name: "onosbr0"
ip: "{{ dev_host.ip }}/24"
-# ONOS Applications and Downloads folders
-app_dir: "Applications"
-download_dir: "Downloads"
-
# Basic packages to be installed
basic_packages:
- "bridge-utils"
@@ -44,18 +40,18 @@
- "lxc-dev"
- "python-dev"
- "python-pip"
+ - "unzip"
+ - "zip"
# ONOS
onos_repo_url: "https://gerrit.onosproject.org/onos"
-onos_version: "1.6"
+onos_dir: "/home/ubuntu/onos"
+onos_version: "1.9"
onos_nic: "10.100.198.*"
onos_variables:
- "export ONOS_ROOT=~/onos"
- "source $ONOS_ROOT/tools/dev/bash_profile"
-# Karaf
-karaf_version: "3.0.8"
-
# Tutorial reset files
reset_files:
- "/home/ubuntu/reset-to-1.sh"
@@ -69,6 +65,10 @@
# URL where the ONOS Desktop background is downloaded from
onos_background_url: "https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;f=onos.png;hb=refs/heads/master"
+# ONOS app dir
+app_dir: "Application"
+download_dir: "Downloads"
+
# Wireshark
wireshark:
plugins_dir: ".config/wireshark/plugins"
@@ -80,8 +80,8 @@
# IDEs configuration
intellij:
- dir_name: "idea-IC-162.1628.40"
- url: "https://download.jetbrains.com/idea/ideaIC-2016.2.2.tar.gz"
+ dir_name: "idea-IC-171.3780.107"
+ url: "https://download.jetbrains.com/idea/ideaIC-2017.1.tar.gz"
# Tutorials configuration
tutorials: