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