Fix install Mininet and ONOS for ONOS-7638
Change-Id: Id250b6a8f6a7883d7332d2f7d8781cb8a7fa9c27
diff --git a/tools/dev/vagrant/Vagrantfile b/tools/dev/vagrant/Vagrantfile
index 7148376..8670d65 100644
--- a/tools/dev/vagrant/Vagrantfile
+++ b/tools/dev/vagrant/Vagrantfile
@@ -53,6 +53,25 @@
v.cpus = 2
end
end
+
+ # Creates an ONOS VM.
+ # It contains Mininet and three LXC containers used as ONOS target machines.
+ config.vm.define "onosvm" do |d|
+ d.vm.box = "ubuntu/xenial64"
+ d.vm.hostname = "onosvm"
+ 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/onos-dev-clean.yml -c local"
+ d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /vagrant/ansible/mn.yml -c local"
+ d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /vagrant/ansible/onos-install.yml -c local"
+ d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /vagrant/ansible/machine-restart.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 with three LXC containers inside, to be used as ONOS target machines.
config.vm.define "onosdev" do |d|
diff --git a/tools/dev/vagrant/ansible/roles/mininet/tasks/main.yml b/tools/dev/vagrant/ansible/roles/mininet/tasks/main.yml
index 0ed5b4c..a24ea98 100644
--- a/tools/dev/vagrant/ansible/roles/mininet/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/mininet/tasks/main.yml
@@ -3,9 +3,13 @@
# Clones the Mininet repository and does a full Mininet installation, including Wireshark
#
- name: Cloning the mininet repository
- git: repo=https://github.com/mininet/mininet.git dest=mininet
+ git: repo=https://github.com/mininet/mininet.git dest=/home/ubuntu/mininet
become: true
become_user: ubuntu
- name: Installing mininet
- command: mininet/util/install.sh -a
\ No newline at end of file
+ command: mininet/util/install.sh -a
+ args:
+ chdir: /home/ubuntu
+ become: true
+ become_user: ubuntu
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 45f6600..89a705c 100644
--- a/tools/dev/vagrant/ansible/roles/onos-install/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/onos-install/tasks/main.yml
@@ -15,6 +15,7 @@
owner: ubuntu
group: ubuntu
mode: 0777
+ recurse: yes
- name: Exporting ONOS variables
lineinfile:
@@ -24,8 +25,12 @@
- name: Compiling ONOS
shell: "{{ item }}"
+ environment:
+ ONOS_ROOT: /home/ubuntu/onos
args:
chdir: "/home/ubuntu/onos/tools/build"
+ become: yes
+ become_user: ubuntu
with_items:
- "./onos-buck build onos"
@@ -81,4 +86,4 @@
- name: Adding ONOS to startup
become: yes
shell: "lxc-attach --name {{ item.value.name }} -- systemctl enable onos"
- with_dict: "{{ lxc }}"
\ No newline at end of file
+ with_dict: "{{ lxc }}"