vagrant: Provide basic Vagrantfile
authorThomas Graf <tgraf@noironetworks.com>
Mon, 5 Jan 2015 15:22:56 +0000 (16:22 +0100)
committerThomas Graf <tgraf@noironetworks.com>
Mon, 5 Jan 2015 16:52:47 +0000 (17:52 +0100)
This is a basic Vagrantfile which compiles and provisions the local OVS
source tree in a Fedora 20 VM. The Vagrantfile.in can be extended to
support additional distributions.

To use this Vagrantfile:
 1. Install Vagrant plus a compatible hypervisor
 2. Run configure to translate Vagrantfile.in to Vagrantfile
 3. Run `vagrant up` to create & provision the VM
 4. Run `vagrant ssh` to log into the VM

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Acked-by: Kyle Mestery <mestery@mestery.com>
.gitignore
INSTALL.md
Makefile.am
Vagrantfile.in [new file with mode: 0644]
configure.ac

index 50ec1d7..a3522d8 100644 (file)
@@ -65,3 +65,5 @@ tags
 _debian
 odp-netlink.h
 OvsDpInterface.h
+Vagrantfile
+/.vagrant/
index 941cf37..122c362 100644 (file)
@@ -562,6 +562,24 @@ test failures that you believe to represent bugs in Open vSwitch.
 Include the precise versions of Open vSwitch and Ryu in your bug
 report, plus any other information needed to reproduce the problem.
 
+Vagrant
+-------
+
+Requires: Vagrant and a compatible hypervisor
+
+A Vagrantfile is provided allowing to compile and provision the source
+tree as found locally in a virtual machine using the following commands:
+
+       vagrant up
+       vagrant ssh
+
+This will bring up w Fedora 20 VM by default, alternatively the
+`Vagrantfile.in` can be modified to use a different distribution box as
+base. Also, the VM can be reprovisioned at any time to recompile and
+reinstall OVS:
+
+       vagrant provision
+
 Continuous Integration with Travis-CI
 -------------------------------------
 
index 46e8610..e209e3c 100644 (file)
@@ -103,7 +103,8 @@ EXTRA_DIST = \
        build-aux/sodepends.pl \
        build-aux/soexpand.pl \
        $(MAN_FRAGMENTS) \
-       $(MAN_ROOTS)
+       $(MAN_ROOTS) \
+       Vagrantfile.in
 bin_PROGRAMS =
 sbin_PROGRAMS =
 bin_SCRIPTS =
diff --git a/Vagrantfile.in b/Vagrantfile.in
new file mode 100644 (file)
index 0000000..ba10ede
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+$bootstrap_fedora = <<SCRIPT
+yum -y update
+yum -y install autoconf automake openssl-devel libtool \
+               python-twisted-core python-zope-interface PyQt4 \
+              desktop-file-utils groff graphviz rpmdevtools
+cd /vagrant
+./boot.sh && ./configure
+make clean && make dist
+rpmdev-setuptree
+cp openvswitch-@PACKAGE_VERSION@.tar.gz $HOME/rpmbuild/SOURCES
+rpmbuild --bb --without check rhel/openvswitch-fedora.spec
+rpm -e openvswitch
+rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-@PACKAGE_VERSION@-1.fc20.x86_64.rpm
+systemctl enable openvswitch
+systemctl start openvswitch
+systemctl status openvswitch
+SCRIPT
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  config.vm.define "fedora-20" do |fedora|
+    fedora.vm.box = "chef/fedora-20"
+    fedora.vm.provision :shell, inline: $bootstrap_fedora
+  end
+end
index ebb8b02..03f9369 100644 (file)
@@ -177,6 +177,7 @@ AC_CONFIG_FILES(lib/libsflow.pc)
 AC_CONFIG_FILES(ofproto/libofproto.pc)
 AC_CONFIG_FILES(ovsdb/libovsdb.pc)
 AC_CONFIG_FILES(include/openvswitch/version.h)
+AC_CONFIG_FILES(Vagrantfile)
 
 dnl This makes sure that include/openflow gets created in the build directory.
 AC_CONFIG_COMMANDS([include/openflow/openflow.h.stamp])