Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 1 | P4_VM_TYPE = ENV['P4_VM_TYPE'] || "dev" |
Carmelo Cascone | a4dc3c1 | 2019-02-12 17:30:00 -0800 | [diff] [blame] | 2 | P4_VM_UBUNTU_VERSION = ENV['P4_VM_UBUNTU_VERSION'] || "16.04" |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 3 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 4 | Vagrant.configure(2) do |config| |
Carmelo Cascone | ea2c110 | 2018-08-21 18:32:58 -0700 | [diff] [blame] | 5 | if P4_VM_TYPE == "tutorial" |
Carmelo Cascone | a4dc3c1 | 2019-02-12 17:30:00 -0800 | [diff] [blame] | 6 | config.vm.box = "lasp/ubuntu" + P4_VM_UBUNTU_VERSION + "-desktop" |
Carmelo Cascone | ea2c110 | 2018-08-21 18:32:58 -0700 | [diff] [blame] | 7 | else |
Carmelo Cascone | a4dc3c1 | 2019-02-12 17:30:00 -0800 | [diff] [blame] | 8 | config.vm.box = "bento/ubuntu-" + P4_VM_UBUNTU_VERSION |
Carmelo Cascone | ea2c110 | 2018-08-21 18:32:58 -0700 | [diff] [blame] | 9 | end |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 10 | config.vm.provider "virtualbox" do |vb| |
Carmelo Cascone | a4dc3c1 | 2019-02-12 17:30:00 -0800 | [diff] [blame] | 11 | vb.name = "ONOS+P4 " + P4_VM_TYPE + " " + P4_VM_UBUNTU_VERSION + " " + Time.now.strftime("(%Y-%m-%d)") |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 12 | vb.gui = true |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 13 | vb.cpus = P4_VM_TYPE == "tutorial" ? 4 : 2 |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 14 | vb.memory = 4096 |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 15 | if P4_VM_TYPE == "tutorial" |
| 16 | vb.customize ["storageattach", :id, |
| 17 | "--storagectl", "IDE Controller", |
| 18 | "--port", "0", "--device", "1", |
| 19 | "--type", "dvddrive", |
| 20 | "--medium", "emptydrive"] |
| 21 | vb.customize ['modifyvm', :id, '--clipboard', 'bidirectional'] |
| 22 | end |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 23 | end |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 24 | config.vm.hostname = "onos-p4-" + P4_VM_TYPE |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 25 | config.vm.network "private_network", :type => 'dhcp', :adapter => 2 |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 26 | config.vm.provision "shell", path: "root-bootstrap.sh", :args => P4_VM_TYPE |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 27 | end |