Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame^] | 1 | P4_VM_TYPE = ENV['P4_VM_TYPE'] || "dev" |
| 2 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 3 | Vagrant.configure(2) do |config| |
| 4 | config.vm.box = "bento/ubuntu-16.04" |
| 5 | config.vm.provider "virtualbox" do |vb| |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame^] | 6 | vb.name = "ONOS+P4 " + P4_VM_TYPE + " " + Time.now.strftime("(%Y-%m-%d)") |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 7 | vb.gui = true |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame^] | 8 | vb.cpus = P4_VM_TYPE == "tutorial" ? 4 : 2 |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 9 | vb.memory = 4096 |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame^] | 10 | if P4_VM_TYPE == "tutorial" |
| 11 | vb.customize ["storageattach", :id, |
| 12 | "--storagectl", "IDE Controller", |
| 13 | "--port", "0", "--device", "1", |
| 14 | "--type", "dvddrive", |
| 15 | "--medium", "emptydrive"] |
| 16 | vb.customize ['modifyvm', :id, '--clipboard', 'bidirectional'] |
| 17 | end |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 18 | end |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame^] | 19 | config.vm.hostname = "onos-p4-" + P4_VM_TYPE |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 20 | # By default vagrant creates a NAT interface. |
| 21 | # Create a second one host-only. |
| 22 | config.vm.network "private_network", :type => 'dhcp', :adapter => 2 |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame^] | 23 | config.vm.provision "shell", path: "root-bootstrap.sh", :args => P4_VM_TYPE |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 24 | end |