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
12 elsif distro == 'ubuntu1804'
13 config.vm.box = "bento/ubuntu-18.04"
15 config.vm.box = "puppetlabs/ubuntu-16.04-64-nocm"
17 config.vm.box_check_update = false
19 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh")
20 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant"
22 post_build = ( ENV['VPP_VAGRANT_POST_BUILD'] )
23 if post_build == "test"
24 config.vm.provision "shell", inline: "echo Testing VPP; cd /vpp; make test"
25 elsif post_build == "install"
26 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp"
27 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh")
28 config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh")
31 # Add .gnupg dir in so folks can sign patches
32 # Note, as gnupg puts socket files in that dir, we have
33 # to be cautious and make sure we are dealing with a plain file
34 homedir = File.expand_path("~/")
35 Dir["#{homedir}/.gnupg/**/*"].each do |fname|
37 destname = fname.sub(Regexp.escape("#{homedir}/"),'')
38 config.vm.provision "file", source: fname, destination: destname
42 # Copy in the .gitconfig if it exists
43 if File.file?(File.expand_path("~/.gitconfig"))
44 config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
47 # vagrant-cachier caches apt/yum etc to speed subsequent
50 # vagrant plugin install vagrant-cachier
52 if Vagrant.has_plugin?("vagrant-cachier")
53 config.cache.scope = :box
56 # Define some physical ports for your VMs to be used by DPDK
57 nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10)
59 config.vm.network "private_network", type: "dhcp"
62 # use http proxy if avaiable
63 if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
64 config.proxy.http = ENV['http_proxy']
65 config.proxy.https = ENV['https_proxy']
66 config.proxy.no_proxy = "localhost,127.0.0.1"
69 vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2)
70 vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096)
72 config.ssh.forward_agent = true
73 config.ssh.forward_x11 = true
75 config.vm.provider "virtualbox" do |vb|
76 vb.customize ["modifyvm", :id, "--ioapic", "on"]
77 vb.memory = "#{vmram}"
80 # rsync the vpp directory if provision hasn't happened yet
81 unless File.exist? (".vagrant/machines/default/virtualbox/action_provision")
82 config.vm.synced_folder "../../", "/vpp", type: "rsync",
86 "build-root/install*/",
87 "build-root/images*/",
90 "build-root/*.changes",
92 "build-root/deb/debian/*.dkms",
93 "build-root/deb/debian/*.install",
94 "build-root/deb/debian/changes",
98 #support for the SSE4.x instruction is required in some versions of VB.
99 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
100 vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
102 config.vm.provider "vmware_fusion" do |fusion,override|
103 fusion.vmx["memsize"] = "#{vmram}"
104 fusion.vmx["numvcpus"] = "#{vmcpu}"
106 config.vm.provider "libvirt" do |lv|
107 lv.memory = "#{vmram}"
110 config.vm.provider "vmware_workstation" do |vws,override|
111 vws.vmx["memsize"] = "#{vmram}"
112 vws.vmx["numvcpus"] = "#{vmcpu}"