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 = "centos/7"
10 config.vm.box_version = "1708.01"
11 config.ssh.insert_key = false
13 config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm"
15 config.vm.box_check_update = false
17 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh")
18 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant"
20 # Create VCL client and server VM's
21 config.vm.define "vcl-server" do |server|
22 server.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"vcl_test.sh"), :args => "/vpp vagrant vcl-server"
24 config.vm.define "vcl-client" do |client|
25 client.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"vcl_test.sh"), :args => "/vpp vagrant vcl-client"
28 # Add .gnupg dir in so folks can sign patches
29 # Note, as gnupg puts socket files in that dir, we have
30 # to be cautious and make sure we are dealing with a plain file
31 homedir = File.expand_path("~/")
32 Dir["#{homedir}/.gnupg/**/*"].each do |fname|
34 destname = fname.sub(Regexp.escape("#{homedir}/"),'')
35 config.vm.provision "file", source: fname, destination: destname
39 # Copy in the .gitconfig if it exists
40 if File.file?(File.expand_path("~/.gitconfig"))
41 config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
44 # vagrant-cachier caches apt/yum etc to speed subsequent
47 # vagrant plugin install vagrant-cachier
49 if Vagrant.has_plugin?("vagrant-cachier")
50 config.cache.scope = :box
53 # Define some physical ports for your VMs to be used by DPDK
54 nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10)
56 config.vm.network "private_network", type: "dhcp"
59 # use http proxy if avaiable
60 if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
61 config.proxy.http = ENV['http_proxy']
62 config.proxy.https = ENV['https_proxy']
63 config.proxy.no_proxy = "localhost,127.0.0.1"
66 vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2)
67 vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096)
69 config.ssh.forward_agent = true
70 config.ssh.forward_x11 = true
72 config.vm.provider "virtualbox" do |vb|
73 vb.customize ["modifyvm", :id, "--ioapic", "on"]
74 vb.memory = "#{vmram}"
77 # rsync the vpp directory if provision hasn't happened yet
78 unless File.exist? (".vagrant/machines/client/virtualbox/action_provision")
79 config.vm.synced_folder "../../", "/vpp", type: "rsync",
83 "build-root/install*/",
84 "build-root/images*/",
87 "build-root/*.changes",
89 "build-root/deb/debian/*.dkms",
90 "build-root/deb/debian/*.install",
91 "build-root/deb/debian/changes",
95 #support for the SSE4.x instruction is required in some versions of VB.
96 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
97 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
99 config.vm.provider "vmware_fusion" do |fusion,override|
100 fusion.vmx["memsize"] = "#{vmram}"
101 fusion.vmx["numvcpus"] = "#{vmcpu}"
103 config.vm.provider "libvirt" do |lv|
104 lv.memory = "#{vmram}"
107 config.vm.provider "vmware_workstation" do |vws,override|
108 vws.vmx["memsize"] = "#{vmram}"
109 vws.vmx["numvcpus"] = "#{vmcpu}"