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 |
Keith Burns (alagalah) | e0965d4 | 2016-06-19 07:58:51 -0700 | [diff] [blame] | 7 | distro = ( ENV['VPP_VAGRANT_DISTRO'] || "ubuntu1404") |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 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" |
Thomas F Herbert | 7b75d21 | 2016-08-01 18:33:48 -0400 | [diff] [blame] | 10 | config.ssh.insert_key = false |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 11 | else |
| 12 | config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm" |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 13 | end |
Thomas Monjalon | 9d6c0ab | 2016-06-01 10:02:04 +0200 | [diff] [blame] | 14 | config.vm.box_check_update = false |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 15 | |
Ed Warnicke | 30aff24 | 2016-05-06 12:58:31 -0500 | [diff] [blame] | 16 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"update.sh") |
Ed Warnicke | 3ba4d36 | 2016-09-01 11:54:27 -0700 | [diff] [blame] | 17 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clone.sh") |
| 18 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"build.sh"), :args => "/home/vagrant/git/vpp vagrant" |
| 19 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"install.sh"), :args => "/home/vagrant/git/vpp" |
Ed Warnicke | 30aff24 | 2016-05-06 12:58:31 -0500 | [diff] [blame] | 20 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"clearinterfaces.sh") |
| 21 | config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"run.sh") |
Ed Warnicke | d6a0fc5 | 2016-04-12 17:34:48 -0500 | [diff] [blame] | 22 | |
Ed Warnicke | eeee9e2 | 2016-02-02 17:47:17 -0800 | [diff] [blame] | 23 | # Add .gnupg dir in so folks can sign patches |
| 24 | # Note, as gnupg puts socket files in that dir, we have |
| 25 | # to be cautious and make sure we are dealing with a plain file |
| 26 | homedir = File.expand_path("~/") |
| 27 | Dir["#{homedir}/.gnupg/**/*"].each do |fname| |
| 28 | if File.file?(fname) |
| 29 | destname = fname.sub(Regexp.escape("#{homedir}/"),'') |
| 30 | config.vm.provision "file", source: fname, destination: destname |
| 31 | end |
| 32 | end |
| 33 | |
| 34 | # Copy in the .gitconfig if it exists |
| 35 | if File.file?(File.expand_path("~/.gitconfig")) |
| 36 | config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" |
| 37 | end |
| 38 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 39 | # vagrant-cachier caches apt/yum etc to speed subsequent |
| 40 | # vagrant up |
| 41 | # to enable, run |
| 42 | # vagrant plugin install vagrant-cachier |
| 43 | # |
| 44 | if Vagrant.has_plugin?("vagrant-cachier") |
| 45 | config.cache.scope = :box |
| 46 | end |
| 47 | |
Vincent JARDIN | 1d3be19 | 2016-01-14 17:01:08 -0800 | [diff] [blame] | 48 | # Define some physical ports for your VMs to be used by DPDK |
Srivatsa Sangli | 010972a | 2016-06-21 12:58:19 -0700 | [diff] [blame] | 49 | nics = (ENV['VPP_VAGRANT_NICS'] || "2").to_i(10) |
Vincent JARDIN | 1d3be19 | 2016-01-14 17:01:08 -0800 | [diff] [blame] | 50 | for i in 1..nics |
| 51 | config.vm.network "private_network", type: "dhcp" |
| 52 | end |
| 53 | |
Ed Warnicke | b73f267 | 2015-12-14 16:08:45 -0700 | [diff] [blame] | 54 | # use http proxy if avaiable |
| 55 | if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf") |
Jeff Shaw | ecec279 | 2016-04-05 10:23:17 -0700 | [diff] [blame] | 56 | config.proxy.http = ENV['http_proxy'] |
| 57 | config.proxy.https = ENV['https_proxy'] |
Ed Warnicke | b73f267 | 2015-12-14 16:08:45 -0700 | [diff] [blame] | 58 | config.proxy.no_proxy = "localhost,127.0.0.1" |
| 59 | end |
| 60 | |
Keith Burns (alagalah) | e0965d4 | 2016-06-19 07:58:51 -0700 | [diff] [blame] | 61 | vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 2) |
Keith Burns (alagalah) | f803564 | 2016-06-25 03:50:28 -0700 | [diff] [blame] | 62 | vmram=(ENV['VPP_VAGRANT_VMRAM'] || 4096) |
Ed Warnicke | 3ba4d36 | 2016-09-01 11:54:27 -0700 | [diff] [blame] | 63 | |
| 64 | config.ssh.forward_agent = true |
| 65 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 66 | config.vm.synced_folder "../../", "/vpp", disabled: false |
Ed Warnicke | 3ba4d36 | 2016-09-01 11:54:27 -0700 | [diff] [blame] | 67 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 68 | config.vm.provider "virtualbox" do |vb| |
Keith Burns (alagalah) | 3d5916d | 2016-05-01 09:12:18 -0700 | [diff] [blame] | 69 | vb.customize ["modifyvm", :id, "--ioapic", "on"] |
Keith Burns (alagalah) | e0965d4 | 2016-06-19 07:58:51 -0700 | [diff] [blame] | 70 | vb.memory = "#{vmram}" |
| 71 | vb.cpus = "#{vmcpu}" |
Ray | 9387e51 | 2016-07-20 13:13:18 +0100 | [diff] [blame] | 72 | |
| 73 | #support for the SSE4.x instruction is required in some versions of VB. |
| 74 | vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] |
| 75 | vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 76 | end |
| 77 | config.vm.provider "vmware_fusion" do |fusion,override| |
Keith Burns (alagalah) | e0965d4 | 2016-06-19 07:58:51 -0700 | [diff] [blame] | 78 | fusion.vmx["memsize"] = "#{vmram}" |
| 79 | fusion.vmx["numvcpus"] = "#{vmcpu}" |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 80 | end |
Jeff Shaw | ecec279 | 2016-04-05 10:23:17 -0700 | [diff] [blame] | 81 | config.vm.provider "libvirt" do |lv| |
Keith Burns (alagalah) | e0965d4 | 2016-06-19 07:58:51 -0700 | [diff] [blame] | 82 | lv.memory = "#{vmram}" |
| 83 | lv.cpus = "#{vmcpu}" |
Jeff Shaw | ecec279 | 2016-04-05 10:23:17 -0700 | [diff] [blame] | 84 | end |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 85 | config.vm.provider "vmware_workstation" do |vws,override| |
Keith Burns (alagalah) | e0965d4 | 2016-06-19 07:58:51 -0700 | [diff] [blame] | 86 | vws.vmx["memsize"] = "#{vmram}" |
| 87 | vws.vmx["numvcpus"] = "#{vmcpu}" |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 88 | end |
| 89 | end |