blob: 101e525489a91076b24a6e8d65c1b64be09dc5c9 [file] [log] [blame]
Carmelo Casconeada7b5b2019-04-23 13:50:03 -07001USE_STRATUM = ENV['USE_STRATUM'] || "false"
2
3REQUIRED_PLUGINS = %w( vagrant-vbguest vagrant-reload vagrant-disksize )
Carmelo Casconec5569c22018-04-18 10:09:15 +09004
Carmelo Casconed6615072017-12-15 00:53:43 -08005Vagrant.configure(2) do |config|
Carmelo Casconeada7b5b2019-04-23 13:50:03 -07006
7 # Install plugins if missing...
8 _retry = false
9 REQUIRED_PLUGINS.each do |plugin|
10 unless Vagrant.has_plugin? plugin
11 system "vagrant plugin install #{plugin}"
12 _retry = true
Carmelo Casconec5569c22018-04-18 10:09:15 +090013 end
Carmelo Casconed6615072017-12-15 00:53:43 -080014 end
Carmelo Casconeada7b5b2019-04-23 13:50:03 -070015
16 if (_retry)
17 exec "vagrant " + ARGV.join(' ')
18 end
19
20 # Common config.
21 config.vm.box = "ubuntu/bionic64"
22 config.vbguest.auto_update = true
23 config.disksize.size = '50GB'
24 config.vm.synced_folder ".", "/vagrant", disabled: false, type: "virtualbox"
Carmelo Casconed6615072017-12-15 00:53:43 -080025 config.vm.network "private_network", :type => 'dhcp', :adapter => 2
Carmelo Casconeada7b5b2019-04-23 13:50:03 -070026
27 # Dev VM
28 config.vm.define "dev" do |d|
29 d.vm.hostname = "onos-p4-dev"
30 d.vm.provider "virtualbox" do |vb|
31 vb.name = "ONOS+P4 Dev " + Time.now.strftime("(%Y-%m-%d)")
32 vb.gui = false
33 vb.cpus = 2
34 vb.memory = 4096
35 vb.customize ["modifyvm", :id, "--vram", "32"]
36 end
37 d.vm.provision "shell", path: "root-bootstrap.sh", :args => ["dev", USE_STRATUM]
38 d.vm.provision "shell", inline: "su sdn '/vagrant/user-bootstrap.sh' dev %s" % ["dev", USE_STRATUM]
39 end
40
41 # Tutorial VM (with desktop)
42 config.vm.define "tutorial" do |d|
43 d.vm.hostname = "onos-p4-tutorial"
44 d.vm.provider "virtualbox" do |vb|
45 vb.name = "ONOS+P4 Tutorial " + Time.now.strftime("(%Y-%m-%d)")
46 vb.gui = true
47 vb.cpus = 4
48 vb.memory = 4096
49 vb.customize ['modifyvm', :id, '--clipboard', 'bidirectional']
50 vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
51 vb.customize ["modifyvm", :id, "--vram", "128"]
52 end
53 d.vm.provision "shell", path: "root-bootstrap.sh", :args => ["tutorial"]
54 d.vm.provision "shell", path: "tutorial-bootstrap.sh"
55 d.vm.provision "shell", inline: "su sdn '/vagrant/user-bootstrap.sh' %s %s" % ["tutorial", USE_STRATUM]
56 end
57
58 config.vm.provision :reload
59end