ONOS-7330 Added ONOS-P4 VM build script

Builds and OVA from scratch with the most updated tools in one command.
The build process is based on Vagrant.

Change-Id: I633d99092946f99e877f0c97631a4f99c5b1f37e
diff --git a/tools/dev/p4vm/export-ova.sh b/tools/dev/p4vm/export-ova.sh
new file mode 100755
index 0000000..73d6ef5
--- /dev/null
+++ b/tools/dev/p4vm/export-ova.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -xe
+
+# Remove references to the existing vagrant-built VM (if any).
+# We want to build a new one from scratch, not start an existing one.
+rm -rf .vagrant/
+
+vagrant up
+
+SSH_PORT=`vagrant port --guest 22`
+VB_UUID=`cat .vagrant/machines/default/virtualbox/id`
+
+sshpass -p 'rocks' \
+    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
+    -p ${SSH_PORT} sdn@127.0.0.1 "bash /vagrant/pre-ova-cleanup.sh"
+
+vagrant halt
+
+sleep 5
+
+# Remove vagrant shared folder
+vboxmanage sharedfolder remove ${VB_UUID} -name "vagrant"
+
+rm -rf onos-p4-dev.ova
+vboxmanage export ${VB_UUID} -o onos-p4-dev.ova