summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2013-01-08 17:04:36 -0500
committerBill Peck <bpeck@redhat.com>2013-01-08 17:04:36 -0500
commite5f69fa59c39f47870e8c2592468a0445df649ad (patch)
treedb9ecb9f426a9bf760fbcd594cc09348aacb9515 /kernel
parent167241313c220a1fe701c5094d0b967be4acb624 (diff)
downloadtests-e5f69fa59c39f47870e8c2592468a0445df649ad.tar.gz
tests-e5f69fa59c39f47870e8c2592468a0445df649ad.tar.xz
tests-e5f69fa59c39f47870e8c2592468a0445df649ad.zip
Update create_bridge to be persistent
Diffstat (limited to 'kernel')
-rw-r--r--kernel/networking/openvswitch/br_to_vswitch/Makefile63
-rw-r--r--kernel/networking/openvswitch/br_to_vswitch/PURPOSE3
-rwxr-xr-xkernel/networking/openvswitch/br_to_vswitch/runtest.sh61
-rwxr-xr-xkernel/networking/openvswitch/create_bridge/runtest.sh7
4 files changed, 134 insertions, 0 deletions
diff --git a/kernel/networking/openvswitch/br_to_vswitch/Makefile b/kernel/networking/openvswitch/br_to_vswitch/Makefile
new file mode 100644
index 0000000..7d97d19
--- /dev/null
+++ b/kernel/networking/openvswitch/br_to_vswitch/Makefile
@@ -0,0 +1,63 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Makefile of /kernel/networking/openvswitch/br_to_vswitch
+# 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/br_to_vswitch
+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/br_to_vswitch/PURPOSE b/kernel/networking/openvswitch/br_to_vswitch/PURPOSE
new file mode 100644
index 0000000..cfd36fd
--- /dev/null
+++ b/kernel/networking/openvswitch/br_to_vswitch/PURPOSE
@@ -0,0 +1,3 @@
+PURPOSE of /kernel/networking/openvswitch/br_to_vswitch
+Description: switches all interfaces under bridge control to openvswitch control.
+Author: Bill Peck <bpeck@redhat.com>
diff --git a/kernel/networking/openvswitch/br_to_vswitch/runtest.sh b/kernel/networking/openvswitch/br_to_vswitch/runtest.sh
new file mode 100755
index 0000000..f579431
--- /dev/null
+++ b/kernel/networking/openvswitch/br_to_vswitch/runtest.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# runtest.sh of /kernel/networking/openvswitch/br_to_vswitch
+# Description: switch all bridge interfaces over to openvswitch
+# 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"
+BRIDGES=${BRIDGES:="$(brctl show | awk 'NR>1 && /^[^\t]/ {printf $1" "}')"}
+count=0
+
+rpm -q $PACKAGE || fail "$PACKAGE not installed"
+service $PACKAGE start
+
+for bridge in $BRIDGES; do
+ vswitch="vswitch-br$count"
+ count=$(($count + 1))
+ ovs-vsctl del-br $vswitch
+ ovs-vsctl add-br $vswitch
+ addr=$(ip addr show dev $bridge| grep -w inet | awk '{print $2}')
+ if [ -n "$addr" ]; then
+ # Is there a default route we need to move?
+ gateway=$(route -n | awk -v b=$bridge '$1 == "0.0.0.0" && $8 == b && $2 != "0.0.0.0" { print $2 }')
+ ip addr del $addr dev $bridge
+ ip addr add $addr dev $vswitch
+ ifconfig $vswitch up
+ [ -n "$gateway" ] && route add default gateway $gateway $vswitch
+ fi
+ # Remove interfaces from br0 and add them to vlan-br
+ while [ "$(brctl show $bridge | awk "/$bridge/ {print \$4}")" != "" ]; do
+ intf=$(brctl show $bridge | awk "/$bridge/ {print \$4}")
+ brctl delif $bridge $intf
+ ovs-vsctl add-port $vswitch $intf && report_result $TEST/$intf PASS 0 || report_result $TEST/$intf FAIL $?
+ done
+done
+ovs-vsctl show
diff --git a/kernel/networking/openvswitch/create_bridge/runtest.sh b/kernel/networking/openvswitch/create_bridge/runtest.sh
index 4a3b4d5..d0907c8 100755
--- a/kernel/networking/openvswitch/create_bridge/runtest.sh
+++ b/kernel/networking/openvswitch/create_bridge/runtest.sh
@@ -32,6 +32,13 @@
for bridge in $BRIDGES; do
brctl addbr $bridge && report_result $TEST/$bridge PASS 0 || report_result $TEST/$bridge FAIL $?
+ cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$bridge
+DEVICE=$bridge
+BOOTPROTO=none
+ONBOOT=yes
+TYPE=Bridge
+DELAY=0
+EOF
done
brctl show