61125e3511c57c3ef0c9d85b5e1f581ae06ba973
[csit.git] / resources / tools / vagrant / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 Vagrant.configure("2") do |config|
5
6     # Base box definition, currently using
7     #  Official Ubuntu 18.04 LTS (Bionic Beaver) Daily Build
8     config.vm.box = "ubuntu/bionic64"
9     config.vm.box_version = "20190724.1.0"
10
11     # Disable automatic box update checking
12     config.vm.box_check_update = false
13
14     # Configure cached packages to be shared between instances of the same base box.
15     if Vagrant.has_plugin?("vagrant-cachier")
16         config.cache.scope = :box
17     end
18
19     # Configure proxy if needed
20     if Vagrant.has_plugin?("vagrant-proxyconf")
21         config.proxy.http     = "http://192.168.0.2:3128/"
22         config.proxy.https    = "http://192.168.0.2:3128/"
23         config.proxy.ftp      = "http://192.168.0.2:3128/"
24         config.proxy.no_proxy = "localhost,127.0.0.1"
25     end
26
27     # Configure testing network interfaces (TG)
28     config.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: "link1", nic_type: "82545EM", mac: "0800270fe04d"
29     config.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: "link2", nic_type: "82545EM", mac: "08002761f7ad"
30     config.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: "link3", nic_type: "82545EM", mac: "080027dc5da4"
31
32     # Configure testing network interfaces (SUT)
33     config.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: "link1", nic_type: "82545EM", mac: "080027385e58"
34     config.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: "link2", nic_type: "82545EM", mac: "080027e3f542"
35     config.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: "link3", nic_type: "82545EM", mac: "0800274f7c63"
36
37     # Virtualbox machine configuration
38     config.vm.provider "virtualbox" do |vb|
39         vb.name = "vppdevice-bionic"
40         # Run in headless mode
41         vb.gui = false
42
43         # Customize the amount of memory and CPUs assigned:
44         #   - for VPP at least 3GB RAM and 2 cores is recommended
45         vb.memory = "8192"
46         vb.cpus = "4"
47
48         # Configure network testing interfaces
49         vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
50         vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
51         vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
52         vb.customize ["modifyvm", :id, "--nicpromisc5", "allow-all"]
53         vb.customize ["modifyvm", :id, "--nicpromisc6", "allow-all"]
54         vb.customize ["modifyvm", :id, "--nicpromisc7", "allow-all"]
55     end
56
57     # Provision the box using ansible local (no Ansible installation needed on host)
58     config.vm.provision "ansible_local" do |ansible|
59         ansible.version = "latest"
60         ansible.compatibility_mode = "2.0"
61         ansible.become = true
62         ansible.verbose = false
63         ansible.limit = "all"
64         ansible.inventory_path = "ansible/vppdevice"
65         ansible.playbook = "ansible/master.yml"
66     end
67
68     config.vm.post_up_message = <<-MESSAGE
69
70     Your virtual machine is configured!
71
72     Login to the box using command:
73        vagrant ssh
74
75     To run some tests use the VPP Device bootstrap script, eg:
76         cd /home/vagrant/csit/resources/libraries/bash/entry
77        ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu1804-1n-vbox
78
79     To run only selected tests based on TAGS, export environment variables
80     before running the test suite:
81        export GERRIT_EVENT_TYPE="comment-added"
82        export GERRIT_EVENT_COMMENT_TEXT="devicetest memif"
83        ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu1804-1n-vbox
84
85     For more information please visit:
86        https://docs.fd.io/csit/rls1810/report/index.html
87        https://docs.fd.io/csit/master/trending/
88
89     MESSAGE
90
91 end