4 Vagrant.configure(2) do |config|
6 # Pick the right distro and bootstrap, default is ubuntu1604
7 distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1604")
9 config.vm.box = "puppetlabs/centos-7.2-64-nocm"
10 config.ssh.insert_key = false
11 elsif distro == 'ubuntu1404'
12 config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
14 config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm"
16 config.vm.box_check_update = false
18 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh")
19 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant"
21 post_build = ( ENV['VPP_VAGRANT_POST_BUILD'] )
22 if post_build == "test"
23 config.vm.provision "shell", inline: "echo Testing VPP; cd /vpp; make test"
24 elsif post_build == "install"
25 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp"
26 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh")
27 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh")
30 # Add .gnupg dir in so folks can sign patches
31 # Note, as gnupg puts socket files in that dir, we have
32 # to be cautious and make sure we are dealing with a plain file
33 homedir = File.expand_path("~/")
34 Dir["#{homedir}/.gnupg/**/*"].each do |fname|
36 destname = fname.sub(Regexp.escape("#{homedir}/"),'')
37 config.vm.provision "file", source: fname, destination: destname
41 # Copy in the .gitconfig if it exists
42 if File.file?(File.expand_path("~/.gitconfig"))
43 config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
46 # vagrant-cachier caches apt/yum etc to speed subsequent
49 # vagrant plugin install vagrant-cachier
51 if Vagrant.has_plugin?("vagrant-cachier")
52 config.cache.scope = :box
55 # Define some physical ports for your VMs to be used by DPDK
56 nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10)
58 config.vm.network "private_network", type: "dhcp"
61 # use http proxy if avaiable
62 if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
63 config.proxy.http = ENV['http_proxy']
64 config.proxy.https = ENV['https_proxy']
65 config.proxy.no_proxy = "localhost,127.0.0.1"
68 vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2)
69 vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096)
71 config.ssh.forward_agent = true
72 config.ssh.forward_x11 = true
74 config.vm.provider "virtualbox" do |vb|
75 vb.customize ["modifyvm", :id, "--ioapic", "on"]
76 vb.memory = "#{vmram}"
79 # rsync the vpp directory if provision hasn't happened yet
80 unless File.exist? (".vagrant/machines/default/virtualbox/action_provision")
81 config.vm.synced_folder "../../", "/vpp", type: "rsync",
85 "build-root/install*/",
86 "build-root/images*/",
89 "build-root/*.changes",
91 "build-root/deb/debian/*.dkms",
92 "build-root/deb/debian/*.install",
93 "build-root/deb/debian/changes",
97 #support for the SSE4.x instruction is required in some versions of VB.
98 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
99 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
101 config.vm.provider "vmware_fusion" do |fusion,override|
102 fusion.vmx["memsize"] = "#{vmram}"
103 fusion.vmx["numvcpus"] = "#{vmcpu}"
105 config.vm.provider "libvirt" do |lv|
106 lv.memory = "#{vmram}"
109 config.vm.provider "vmware_workstation" do |vws,override|
110 vws.vmx["memsize"] = "#{vmram}"
111 vws.vmx["numvcpus"] = "#{vmcpu}"