blob: 5e6fe75580038e6946120b036dbd39037a6724f3 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4Vagrant.configure(2) do |config|
5
6 # Pick the right distro and bootstrap, default is ubuntu1404
7 distro = ENV['VPP_VAGRANT_DISTRO']
8 if distro == 'centos7'
Ed Warnickec841eac2016-03-22 16:10:07 -05009 config.vm.box = "puppetlabs/centos-7.2-64-nocm"
Ed Warnickecb9cada2015-12-08 15:45:58 -070010 else
11 config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
Ed Warnickecb9cada2015-12-08 15:45:58 -070012 end
13
Ed Warnicked6a0fc52016-04-12 17:34:48 -050014 config.vm.provision :shell, :path => "update.sh"
15 config.vm.provision :shell, :path => "build.sh", :args => "/vpp vagrant"
16 config.vm.provision :shell, :path => "clearinterfaces.sh"
17 config.vm.provision :shell, :path => "run.sh"
18
Ed Warnickeeeee9e22016-02-02 17:47:17 -080019 # Add .gnupg dir in so folks can sign patches
20 # Note, as gnupg puts socket files in that dir, we have
21 # to be cautious and make sure we are dealing with a plain file
22 homedir = File.expand_path("~/")
23 Dir["#{homedir}/.gnupg/**/*"].each do |fname|
24 if File.file?(fname)
25 destname = fname.sub(Regexp.escape("#{homedir}/"),'')
26 config.vm.provision "file", source: fname, destination: destname
27 end
28 end
29
30 # Copy in the .gitconfig if it exists
31 if File.file?(File.expand_path("~/.gitconfig"))
32 config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
33 end
34
Ed Warnickecb9cada2015-12-08 15:45:58 -070035 # vagrant-cachier caches apt/yum etc to speed subsequent
36 # vagrant up
37 # to enable, run
38 # vagrant plugin install vagrant-cachier
39 #
40 if Vagrant.has_plugin?("vagrant-cachier")
41 config.cache.scope = :box
42 end
43
Vincent JARDIN1d3be192016-01-14 17:01:08 -080044 # Define some physical ports for your VMs to be used by DPDK
Ed Warnicked6a0fc52016-04-12 17:34:48 -050045 nics = 2
Vincent JARDIN1d3be192016-01-14 17:01:08 -080046 if ENV.key?('VPP_VAGRANT_NICS')
47 nics = ENV['VPP_VAGRANT_NICS'].to_i(10)
48 end
49 for i in 1..nics
50 config.vm.network "private_network", type: "dhcp"
51 end
52
Ed Warnickeb73f2672015-12-14 16:08:45 -070053 # use http proxy if avaiable
54 if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
Jeff Shawecec2792016-04-05 10:23:17 -070055 config.proxy.http = ENV['http_proxy']
56 config.proxy.https = ENV['https_proxy']
Ed Warnickeb73f2672015-12-14 16:08:45 -070057 config.proxy.no_proxy = "localhost,127.0.0.1"
58 end
59
Ed Warnickecb9cada2015-12-08 15:45:58 -070060 config.vm.synced_folder "../../", "/vpp", disabled: false
61 config.vm.provider "virtualbox" do |vb|
62 vb.memory = "4096"
63 end
64 config.vm.provider "vmware_fusion" do |fusion,override|
65 fusion.vmx["memsize"] = "4096"
66 end
Jeff Shawecec2792016-04-05 10:23:17 -070067 config.vm.provider "libvirt" do |lv|
68 lv.memory = 4096
69 lv.cpus = 8
70 end
Ed Warnickecb9cada2015-12-08 15:45:58 -070071 config.vm.provider "vmware_workstation" do |vws,override|
72 vws.vmx["memsize"] = "8192"
73 vws.vmx["numvcpus"] = "4"
74 end
75end