blob: a7bb9bf77bc69322f5d33936a3ea300c7eb26c03 [file] [log] [blame]
Carmelo Casconec5569c22018-04-18 10:09:15 +09001P4_VM_TYPE = ENV['P4_VM_TYPE'] || "dev"
Carmelo Casconea4dc3c12019-02-12 17:30:00 -08002P4_VM_UBUNTU_VERSION = ENV['P4_VM_UBUNTU_VERSION'] || "16.04"
Carmelo Casconec5569c22018-04-18 10:09:15 +09003
Carmelo Casconed6615072017-12-15 00:53:43 -08004Vagrant.configure(2) do |config|
Carmelo Casconeea2c1102018-08-21 18:32:58 -07005 if P4_VM_TYPE == "tutorial"
Carmelo Casconea4dc3c12019-02-12 17:30:00 -08006 config.vm.box = "lasp/ubuntu" + P4_VM_UBUNTU_VERSION + "-desktop"
Carmelo Casconeea2c1102018-08-21 18:32:58 -07007 else
Carmelo Casconea4dc3c12019-02-12 17:30:00 -08008 config.vm.box = "bento/ubuntu-" + P4_VM_UBUNTU_VERSION
Carmelo Casconeea2c1102018-08-21 18:32:58 -07009 end
Carmelo Casconed6615072017-12-15 00:53:43 -080010 config.vm.provider "virtualbox" do |vb|
Carmelo Casconea4dc3c12019-02-12 17:30:00 -080011 vb.name = "ONOS+P4 " + P4_VM_TYPE + " " + P4_VM_UBUNTU_VERSION + " " + Time.now.strftime("(%Y-%m-%d)")
Carmelo Casconed6615072017-12-15 00:53:43 -080012 vb.gui = true
Carmelo Casconec5569c22018-04-18 10:09:15 +090013 vb.cpus = P4_VM_TYPE == "tutorial" ? 4 : 2
Carmelo Casconed6615072017-12-15 00:53:43 -080014 vb.memory = 4096
Carmelo Casconec5569c22018-04-18 10:09:15 +090015 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 Casconed6615072017-12-15 00:53:43 -080023 end
Carmelo Casconec5569c22018-04-18 10:09:15 +090024 config.vm.hostname = "onos-p4-" + P4_VM_TYPE
Carmelo Casconed6615072017-12-15 00:53:43 -080025 config.vm.network "private_network", :type => 'dhcp', :adapter => 2
Carmelo Casconec5569c22018-04-18 10:09:15 +090026 config.vm.provision "shell", path: "root-bootstrap.sh", :args => P4_VM_TYPE
Carmelo Casconed6615072017-12-15 00:53:43 -080027end