Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -xe |
| 4 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 5 | VM_TYPE=${P4_VM_TYPE:-dev} |
| 6 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 7 | # Remove references to the existing vagrant-built VM (if any). |
| 8 | # We want to build a new one from scratch, not start an existing one. |
| 9 | rm -rf .vagrant/ |
| 10 | |
| 11 | vagrant up |
| 12 | |
| 13 | SSH_PORT=`vagrant port --guest 22` |
| 14 | VB_UUID=`cat .vagrant/machines/default/virtualbox/id` |
| 15 | |
| 16 | sshpass -p 'rocks' \ |
| 17 | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \ |
| 18 | -p ${SSH_PORT} sdn@127.0.0.1 "bash /vagrant/pre-ova-cleanup.sh" |
| 19 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 20 | sleep 5 |
Carmelo Cascone | 4f985cd | 2018-02-11 17:36:42 -0800 | [diff] [blame] | 21 | vboxmanage controlvm ${VB_UUID} acpipowerbutton |
| 22 | |
| 23 | # Wait for VM to power off |
| 24 | sleep 30 |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 25 | |
| 26 | # Remove vagrant shared folder |
| 27 | vboxmanage sharedfolder remove ${VB_UUID} -name "vagrant" |
| 28 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 29 | rm -rf onos-p4-${VM_TYPE}.ova |
| 30 | vboxmanage export ${VB_UUID} -o onos-p4-${VM_TYPE}.ova |