blob: 32e169456ee2198a6155bbb41288e5d418c2279b [file] [log] [blame]
Carmelo Casconed6615072017-12-15 00:53:43 -08001#!/usr/bin/env bash
2
3set -xe
4
Carmelo Casconec5569c22018-04-18 10:09:15 +09005VM_TYPE=${P4_VM_TYPE:-dev}
6
Carmelo Casconed6615072017-12-15 00:53:43 -08007# 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.
9rm -rf .vagrant/
10
11vagrant up
12
13SSH_PORT=`vagrant port --guest 22`
14VB_UUID=`cat .vagrant/machines/default/virtualbox/id`
15
16sshpass -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 Casconed6615072017-12-15 00:53:43 -080020sleep 5
Carmelo Cascone4f985cd2018-02-11 17:36:42 -080021vboxmanage controlvm ${VB_UUID} acpipowerbutton
22
23# Wait for VM to power off
24sleep 30
Carmelo Casconed6615072017-12-15 00:53:43 -080025
26# Remove vagrant shared folder
27vboxmanage sharedfolder remove ${VB_UUID} -name "vagrant"
28
Carmelo Casconec5569c22018-04-18 10:09:15 +090029rm -rf onos-p4-${VM_TYPE}.ova
30vboxmanage export ${VB_UUID} -o onos-p4-${VM_TYPE}.ova