Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
| 4 | Vagrant.configure(2) do |config| |
| 5 | |
| 6 | # Pick the right distro and bootstrap, default is ubuntu1404 |
| 7 | distro = ENV['VPP_VAGRANT_DISTRO'] |
| 8 | if distro == 'centos7' |
Ed Warnicke | c841eac | 2016-03-22 16:10:07 -0500 | [diff] [blame] | 9 | config.vm.box = "puppetlabs/centos-7.2-64-nocm" |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 10 | else |
| 11 | config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 12 | end |
Thomas Monjalon | 9d6c0ab | 2016-06-01 10:02:04 +0200 | [diff] [blame] | 13 | config.vm.box_check_update = false |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 14 | |
Ed Warnicke | 30aff24 | 2016-05-06 12:58:31 -0500 | [diff] [blame] | 15 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") |
| 16 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/vpp vagrant" |
| 17 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/vpp" |
| 18 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") |
| 19 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 20 | |
Ed Warnicke | eeee9e2 | 2016-02-02 17:47:17 -0800 | [diff] [blame] | 21 | # Add .gnupg dir in so folks can sign patches |
| 22 | # Note, as gnupg puts socket files in that dir, we have |
| 23 | # to be cautious and make sure we are dealing with a plain file |
| 24 | homedir = File.expand_path("~/") |
| 25 | Dir["#{homedir}/.gnupg/**/*"].each do |fname| |
| 26 | if File.file?(fname) |
| 27 | destname = fname.sub(Regexp.escape("#{homedir}/"),'') |
| 28 | config.vm.provision "file", source: fname, destination: destname |
| 29 | end |
| 30 | end |
| 31 | |
| 32 | # Copy in the .gitconfig if it exists |
| 33 | if File.file?(File.expand_path("~/.gitconfig")) |
| 34 | config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" |
| 35 | end |
| 36 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 37 | # vagrant-cachier caches apt/yum etc to speed subsequent |
| 38 | # vagrant up |
| 39 | # to enable, run |
| 40 | # vagrant plugin install vagrant-cachier |
| 41 | # |
| 42 | if Vagrant.has_plugin?("vagrant-cachier") |
| 43 | config.cache.scope = :box |
| 44 | end |
| 45 | |
Vincent JARDIN | 1d3be19 | 2016-01-14 17:01:08 -0800 | [diff] [blame] | 46 | # Define some physical ports for your VMs to be used by DPDK |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 47 | nics = 2 |
Vincent JARDIN | 1d3be19 | 2016-01-14 17:01:08 -0800 | [diff] [blame] | 48 | if ENV.key?('VPP_VAGRANT_NICS') |
| 49 | nics = ENV['VPP_VAGRANT_NICS'].to_i(10) |
| 50 | end |
| 51 | for i in 1..nics |
| 52 | config.vm.network "private_network", type: "dhcp" |
| 53 | end |
| 54 | |
Ed Warnicke | b73f267 | 2015-12-14 16:08:45 -0700 | [diff] [blame] | 55 | # use http proxy if avaiable |
| 56 | if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") |
Jeff Shaw | ecec279 | 2016-04-05 10:23:17 -0700 | [diff] [blame] | 57 | config.proxy.http = ENV['http_proxy'] |
| 58 | config.proxy.https = ENV['https_proxy'] |
Ed Warnicke | b73f267 | 2015-12-14 16:08:45 -0700 | [diff] [blame] | 59 | config.proxy.no_proxy = "localhost,127.0.0.1" |
| 60 | end |
| 61 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 62 | config.vm.synced_folder "../../", "/vpp", disabled: false |
| 63 | config.vm.provider "virtualbox" do |vb| |
Keith Burns (alagalah) | 3d5916d | 2016-05-01 09:12:18 -0700 | [diff] [blame] | 64 | vb.customize ["modifyvm", :id, "--ioapic", "on"] |
| 65 | vb.memory = 4096 |
| 66 | vb.cpus = 2 |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 67 | end |
| 68 | config.vm.provider "vmware_fusion" do |fusion,override| |
| 69 | fusion.vmx["memsize"] = "4096" |
| 70 | end |
Jeff Shaw | ecec279 | 2016-04-05 10:23:17 -0700 | [diff] [blame] | 71 | config.vm.provider "libvirt" do |lv| |
| 72 | lv.memory = 4096 |
| 73 | lv.cpus = 8 |
| 74 | end |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 75 | config.vm.provider "vmware_workstation" do |vws,override| |
| 76 | vws.vmx["memsize"] = "8192" |
| 77 | vws.vmx["numvcpus"] = "4" |
| 78 | end |
| 79 | end |