summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2013-01-15 14:04:53 -0500
committerBill Peck <bpeck@redhat.com>2013-01-15 14:04:53 -0500
commit2db3f22eada4b7f6e32214dbe749a99a6d50b860 (patch)
tree596e625b873c521843943b294cb0ede0130322ef
parentb058ce4d508428b7e69ffc23f0e0fe4f562cf499 (diff)
downloadtests-2db3f22eada4b7f6e32214dbe749a99a6d50b860.tar.gz
tests-2db3f22eada4b7f6e32214dbe749a99a6d50b860.tar.xz
tests-2db3f22eada4b7f6e32214dbe749a99a6d50b860.zip
Simple task to add $SWITCHES to all libvirt guests
-rw-r--r--kernel/networking/openvswitch/libvirt/add_interface/Makefile63
-rw-r--r--kernel/networking/openvswitch/libvirt/add_interface/PURPOSE3
-rwxr-xr-xkernel/networking/openvswitch/libvirt/add_interface/runtest.sh56
3 files changed, 122 insertions, 0 deletions
diff --git a/kernel/networking/openvswitch/libvirt/add_interface/Makefile b/kernel/networking/openvswitch/libvirt/add_interface/Makefile
new file mode 100644
index 0000000..dee5dcc
--- /dev/null
+++ b/kernel/networking/openvswitch/libvirt/add_interface/Makefile
@@ -0,0 +1,63 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Makefile of /kernel/networking/openvswitch/libvirt/add_interface
+# Description: Verifies openvswitch is working properly
+# Author: Bill Peck <bpeck@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing
+# to use, modify, copy, or redistribute it subject to the terms
+# and conditions of the GNU General Public License version 2.
+#
+# This program is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/kernel/networking/openvswitch/libvirt/add_interface
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+ ./runtest.sh
+
+build: $(BUILT_FILES)
+ test -x runtest.sh || chmod a+x runtest.sh
+
+clean:
+ rm -f *~ $(BUILT_FILES)
+
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+ @echo "Owner: Bill Peck <bpeck@redhat.com>" > $(METADATA)
+ @echo "Name: $(TEST)" >> $(METADATA)
+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
+ @echo "Path: $(TEST_DIR)" >> $(METADATA)
+ @echo "Description: Verifies openvswitch is working properly" >> $(METADATA)
+ @echo "Type: Sanity" >> $(METADATA)
+ @echo "TestTime: 10m" >> $(METADATA)
+ @echo "RunFor: openvswitch" >> $(METADATA)
+ @echo "Requires: openvswitch" >> $(METADATA)
+ @echo "Priority: Normal" >> $(METADATA)
+ @echo "License: GPLv2" >> $(METADATA)
+ @echo "Confidential: no" >> $(METADATA)
+ @echo "Destructive: no" >> $(METADATA)
+
+ rhts-lint $(METADATA)
diff --git a/kernel/networking/openvswitch/libvirt/add_interface/PURPOSE b/kernel/networking/openvswitch/libvirt/add_interface/PURPOSE
new file mode 100644
index 0000000..6f48f0d
--- /dev/null
+++ b/kernel/networking/openvswitch/libvirt/add_interface/PURPOSE
@@ -0,0 +1,3 @@
+PURPOSE of /kernel/networking/openvswitch/libvirt/add_interface
+Description: Creates an open vswitch
+Author: Bill Peck <bpeck@redhat.com>
diff --git a/kernel/networking/openvswitch/libvirt/add_interface/runtest.sh b/kernel/networking/openvswitch/libvirt/add_interface/runtest.sh
new file mode 100755
index 0000000..2e88f86
--- /dev/null
+++ b/kernel/networking/openvswitch/libvirt/add_interface/runtest.sh
@@ -0,0 +1,56 @@
+#!/bin/bash -x
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# runtest.sh of /kernel/networking/openvswitch/libvirt/add_interface
+# Description: add $SWITCHES interface to guests
+# Author: Bill Peck <bpeck@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing
+# to use, modify, copy, or redistribute it subject to the terms
+# and conditions of the GNU General Public License version 2.
+#
+# This program is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/bin/rhts-environment.sh || exit 1
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="openvswitch"
+rpm -q $PACKAGE || fail "$PACKAGE not installed"
+
+find_free_slot()
+{
+ # FIXME: We should parse the guest xml and find the next available slot
+ return '0x06'
+}
+
+add_interface()
+{
+ guest=$1
+ switch=$2
+ slot=find_free_slot
+ sed -ie "/<\/interface>/ a \<interface type='bridge'>\n\<source bridge='$switch'\/>\n\<virtualport type='openvswitch'\/>\n\<model type='virtio'\/>\n\<address type='pci' domain='0x0000' bus='0x00' slot='$slot' function='0x0'\/>\n\<\/interface>" $guest
+ virsh define --file $guest
+ return $?
+}
+
+for switch in $SWITCHES; do
+ for guest in $(ls /etc/libvirt/qemu/*.xml); do
+ add_interface $guest $switch && report_result $TEST/$guest/$switch PASS 0
+ done
+done