blob: 6e42bf272ca2540916fa9e6b1d7fcf4b83d62090 [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 config.vm.provision 'shell', path: 'bootstrap.centos7.sh'
11 else
12 config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
13 config.vm.provision 'shell', path: 'bootstrap.ubuntu1404.sh'
14 end
15
Ed Warnickeeeee9e22016-02-02 17:47:17 -080016 # Add .gnupg dir in so folks can sign patches
17 # Note, as gnupg puts socket files in that dir, we have
18 # to be cautious and make sure we are dealing with a plain file
19 homedir = File.expand_path("~/")
20 Dir["#{homedir}/.gnupg/**/*"].each do |fname|
21 if File.file?(fname)
22 destname = fname.sub(Regexp.escape("#{homedir}/"),'')
23 config.vm.provision "file", source: fname, destination: destname
24 end
25 end
26
27 # Copy in the .gitconfig if it exists
28 if File.file?(File.expand_path("~/.gitconfig"))
29 config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
30 end
31
Ed Warnickecb9cada2015-12-08 15:45:58 -070032 # vagrant-cachier caches apt/yum etc to speed subsequent
33 # vagrant up
34 # to enable, run
35 # vagrant plugin install vagrant-cachier
36 #
37 if Vagrant.has_plugin?("vagrant-cachier")
38 config.cache.scope = :box
39 end
40
Vincent JARDIN1d3be192016-01-14 17:01:08 -080041 # Define some physical ports for your VMs to be used by DPDK
42 nics = 0
43 if ENV.key?('VPP_VAGRANT_NICS')
44 nics = ENV['VPP_VAGRANT_NICS'].to_i(10)
45 end
46 for i in 1..nics
47 config.vm.network "private_network", type: "dhcp"
48 end
49
Ed Warnickeb73f2672015-12-14 16:08:45 -070050 # use http proxy if avaiable
51 if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
Jeff Shawecec2792016-04-05 10:23:17 -070052 config.proxy.http = ENV['http_proxy']
53 config.proxy.https = ENV['https_proxy']
Ed Warnickeb73f2672015-12-14 16:08:45 -070054 config.proxy.no_proxy = "localhost,127.0.0.1"
55 end
56
Ed Warnickecb9cada2015-12-08 15:45:58 -070057 config.vm.synced_folder "../../", "/vpp", disabled: false
58 config.vm.provider "virtualbox" do |vb|
59 vb.memory = "4096"
60 end
61 config.vm.provider "vmware_fusion" do |fusion,override|
62 fusion.vmx["memsize"] = "4096"
63 end
Jeff Shawecec2792016-04-05 10:23:17 -070064 config.vm.provider "libvirt" do |lv|
65 lv.memory = 4096
66 lv.cpus = 8
67 end
Ed Warnickecb9cada2015-12-08 15:45:58 -070068 config.vm.provider "vmware_workstation" do |vws,override|
69 vws.vmx["memsize"] = "8192"
70 vws.vmx["numvcpus"] = "4"
71 end
72end