blob: 1f8cf9ab7c267199d3990ed64838f6e3e53d4e0d [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
Keith Burns (alagalah)e0965d42016-06-19 07:58:51 -07007 distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1404")
Ed Warnickecb9cada2015-12-08 15:45:58 -07008 if distro == 'centos7'
Ed Warnickec841eac2016-03-22 16:10:07 -05009 config.vm.box = "puppetlabs/centos-7.2-64-nocm"
Thomas F Herbert7b75d212016-08-01 18:33:48 -040010 config.ssh.insert_key = false
Ed Warnickecb9cada2015-12-08 15:45:58 -070011 else
12 config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
Ed Warnickecb9cada2015-12-08 15:45:58 -070013 end
Thomas Monjalon9d6c0ab2016-06-01 10:02:04 +020014 config.vm.box_check_update = false
Ed Warnickecb9cada2015-12-08 15:45:58 -070015
Ed Warnicke30aff242016-05-06 12:58:31 -050016 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh")
Ray Kinsellaee49bf82016-12-21 12:10:43 +000017 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant"
18 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp"
Ed Warnicke30aff242016-05-06 12:58:31 -050019 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh")
20 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh")
Ed Warnicked6a0fc52016-04-12 17:34:48 -050021
Ed Warnickeeeee9e22016-02-02 17:47:17 -080022 # Add .gnupg dir in so folks can sign patches
23 # Note, as gnupg puts socket files in that dir, we have
24 # to be cautious and make sure we are dealing with a plain file
25 homedir = File.expand_path("~/")
26 Dir["#{homedir}/.gnupg/**/*"].each do |fname|
27 if File.file?(fname)
28 destname = fname.sub(Regexp.escape("#{homedir}/"),'')
29 config.vm.provision "file", source: fname, destination: destname
30 end
31 end
32
33 # Copy in the .gitconfig if it exists
34 if File.file?(File.expand_path("~/.gitconfig"))
35 config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
36 end
37
Ed Warnickecb9cada2015-12-08 15:45:58 -070038 # vagrant-cachier caches apt/yum etc to speed subsequent
39 # vagrant up
40 # to enable, run
41 # vagrant plugin install vagrant-cachier
42 #
43 if Vagrant.has_plugin?("vagrant-cachier")
44 config.cache.scope = :box
45 end
46
Vincent JARDIN1d3be192016-01-14 17:01:08 -080047 # Define some physical ports for your VMs to be used by DPDK
Srivatsa Sangli010972a2016-06-21 12:58:19 -070048 nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10)
Vincent JARDIN1d3be192016-01-14 17:01:08 -080049 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
Keith Burns (alagalah)e0965d42016-06-19 07:58:51 -070060 vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2)
Keith Burns (alagalah)f8035642016-06-25 03:50:28 -070061 vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096)
Ed Warnicke3ba4d362016-09-01 11:54:27 -070062
63 config.ssh.forward_agent = true
64
Ray Kinsellaee49bf82016-12-21 12:10:43 +000065 config.vm.synced_folder "../../", "/vpp", type: "rsync",
66 rsync__auto: false,
67 rsync__exclude: [
68 "build-root/build*/",
69 "build-root/install*/",
70 "build-root/images*/",
71 "build-root/*.deb",
72 "build-root/*.rpm",
73 "build-root/*.changes",
74 "build-root/python",
75 "build-root/deb/debian/*.dkms",
76 "build-root/deb/debian/*.install",
77 "build-root/deb/debian/changes",
78 "build-root/tools"]
Ed Warnicke3ba4d362016-09-01 11:54:27 -070079
Ed Warnickecb9cada2015-12-08 15:45:58 -070080 config.vm.provider "virtualbox" do |vb|
Keith Burns (alagalah)3d5916d2016-05-01 09:12:18 -070081 vb.customize ["modifyvm", :id, "--ioapic", "on"]
Keith Burns (alagalah)e0965d42016-06-19 07:58:51 -070082 vb.memory = "#{vmram}"
83 vb.cpus = "#{vmcpu}"
Ray9387e512016-07-20 13:13:18 +010084
85 #support for the SSE4.x instruction is required in some versions of VB.
86 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
87 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
Ed Warnickecb9cada2015-12-08 15:45:58 -070088 end
89 config.vm.provider "vmware_fusion" do |fusion,override|
Keith Burns (alagalah)e0965d42016-06-19 07:58:51 -070090 fusion.vmx["memsize"] = "#{vmram}"
91 fusion.vmx["numvcpus"] = "#{vmcpu}"
Ed Warnickecb9cada2015-12-08 15:45:58 -070092 end
Jeff Shawecec2792016-04-05 10:23:17 -070093 config.vm.provider "libvirt" do |lv|
Keith Burns (alagalah)e0965d42016-06-19 07:58:51 -070094 lv.memory = "#{vmram}"
95 lv.cpus = "#{vmcpu}"
Jeff Shawecec2792016-04-05 10:23:17 -070096 end
Ed Warnickecb9cada2015-12-08 15:45:58 -070097 config.vm.provider "vmware_workstation" do |vws,override|
Keith Burns (alagalah)e0965d42016-06-19 07:58:51 -070098 vws.vmx["memsize"] = "#{vmram}"
99 vws.vmx["numvcpus"] = "#{vmcpu}"
Ed Warnickecb9cada2015-12-08 15:45:58 -0700100 end
101end