Skip to content

Commit 9076be0

Browse files
Jiří Župkalmr
Jiří Župka
authored andcommitted
virt: Adds OpenVSwitch tests
Test uses virttest for virtual machine management. /tests/openvswitch/ preparing test environment: ./get_started.py tests: 1) Performance test. 2) Vlan tests. 3) Ping test. Signed-off-by: Jiří Župka <[email protected]>
1 parent 30ce0cf commit 9076be0

10 files changed

+729
-0
lines changed

openvswitch/__init__.py

Whitespace-only changes.

openvswitch/cfg/subtests.cfg.sample

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copy this file to subtests.cfg and edit it.
2+
#
3+
# Subtests
4+
5+
variants:
6+
- ovs_basic:
7+
type = ovs_basic
8+
vms = "vm1 vm2 vm3 vm4"
9+
cpumodel= "core2duo"
10+
#vms = ""
11+
nics = "nic1 nic2"
12+
netdst_nic2 = ""
13+
extra_params += " -snapshot"
14+
kill_vm = "yes"
15+
kill_vm_gracefully = "no"
16+
bridge_ip = "192.168.250.1/24"
17+
kill_vm_timeout = 0
18+
kill_vm_timeout_on_error = 0
19+
variants:
20+
-ping:
21+
test_type = ping
22+
ping_count = 10
23+
-vlan_ping:
24+
test_type = vlan_ping
25+
ping_count = 10
26+
-iperf:
27+
test_type = iperf
28+
29+
- load_module:
30+
type = load_module
31+
vms = ""
32+
mod_loaditer = "100"
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copy this file to tests-shared.cfg and edit it.
2+
#
3+
# This file contains the base test set definitions, shared among single host
4+
# and multi host jobs.
5+
6+
# Virtualization type (kvm or libvirt)
7+
vm_type = kvm
8+
# The hypervisor uri (default, qemu://hostname/system, etc.)
9+
# where default or unset means derive from installed system
10+
connect_uri = default
11+
12+
# Include the base config files.
13+
include base.cfg
14+
include subtests.cfg
15+
include guest-os.cfg
16+
include guest-hw.cfg
17+
include cdkeys.cfg
18+
include virtio-win.cfg
19+
20+
# Additional directory for find virt type tests. Relative to client/tests
21+
other_tests_dirs = "virt/openvswitch"
22+
23+
# Modify/comment the following lines if you wish to modify the paths of the
24+
# image files, ISO files or qemu binaries.
25+
#
26+
# As for the defaults:
27+
# * qemu and qemu-img are expected to be found under /usr/bin/qemu-kvm and
28+
# /usr/bin/qemu-img respectively.
29+
# * All image files are expected under /tmp/kvm_autotest_root/images/
30+
# * All install iso files are expected under /tmp/kvm_autotest_root/isos/
31+
# * The parameters cdrom_unattended, floppy, kernel and initrd are generated
32+
# by KVM autotest, so remember to put them under a writable location
33+
# (for example, the cdrom share can be read only)
34+
image_name(_.*)? ?<= /tmp/kvm_autotest_root/images/
35+
cdrom(_.*)? ?<= /tmp/kvm_autotest_root/
36+
floppy(_.*)? ?<= /tmp/kvm_autotest_root/
37+
Linux..unattended_install:
38+
kernel ?<= /tmp/kvm_autotest_root/
39+
initrd ?<= /tmp/kvm_autotest_root/
40+
41+
# You may provide information about the DTM server for WHQL tests here:
42+
#whql:
43+
# server_address = 10.20.30.40
44+
# server_shell_port = 10022
45+
# server_file_transfer_port = 10023
46+
# Note that the DTM server must run rss.exe (available under deps/),
47+
# preferably with administrator privileges.
48+
49+
# Uncomment the following lines to enable abort-on-error mode:
50+
#abort_on_error = yes
51+
#kill_vm.* ?= no
52+
#kill_unresponsive_vms.* ?= no

openvswitch/cfg/tests.cfg.sample

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copy this file to tests.cfg and edit it.
2+
#
3+
# This file contains the test set definitions. Define your test sets here.
4+
5+
# Include the base config files.
6+
include tests-shared.cfg
7+
8+
kill_vm_only_when_paused = no
9+
10+
qemu_binary = /usr/bin/qemu-kvm
11+
qemu_img_binary = /usr/bin/qemu-img
12+
qemu_io_binary = /usr/bin/qemu-io
13+
only qcow2
14+
only virtio_net
15+
only virtio_blk
16+
only smp2
17+
only no_9p_export
18+
only no_pci_assignable
19+
only smallpages
20+
only Fedora.17.64
21+
22+
#only ovs_basic.vlan_ping

openvswitch/common.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import os, sys
2+
3+
def load_setup_modules(client_dir):
4+
try:
5+
sys.path.insert(0, client_dir)
6+
import setup_modules
7+
finally:
8+
sys.path.pop(0)
9+
return setup_modules
10+
11+
try:
12+
import autotest.client.setup_modules as setup_modules
13+
client_dir = os.path.dirname(setup_modules.__file__)
14+
sm = setup_modules
15+
except ImportError:
16+
dirname = os.path.dirname(sys.modules[__name__].__file__)
17+
try:
18+
client_dir = os.path.abspath(os.path.join(dirname, "..", "..", ".."))
19+
sm = load_setup_modules(client_dir)
20+
except:
21+
try:
22+
client_dir = os.path.join(os.environ['AUTOTEST_PATH'], 'client')
23+
except KeyError:
24+
print("Environment variable $AUTOTEST_PATH not set. "
25+
"please set it to a path containing an autotest checkout")
26+
sys.exit(1)
27+
sm = load_setup_modules(client_dir)
28+
virt_test_dir = os.path.abspath(os.path.join(dirname, ".."))
29+
sys.path.insert(0, virt_test_dir)
30+
31+
sm.setup(base_path=client_dir, root_module_name="autotest.client")

openvswitch/control

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
AUTHOR = """
2+
<[email protected]> Jiri Zupka
3+
"""
4+
TIME = 'MEDIUM'
5+
NAME = 'openvswitch test'
6+
TEST_TYPE = 'client'
7+
TEST_CLASS = 'Networking'
8+
TEST_CATEGORY = 'Functional'
9+
10+
DOC = """
11+
Executes the openvswitch test on a given host. This module is separated in
12+
minor functions, that execute different tests for doing Quality Assurance
13+
on openvswitch code.
14+
"""
15+
16+
import sys, os, logging
17+
18+
# set English environment (command output might be localized, need to be safe)
19+
os.environ['LANG'] = 'en_US.UTF-8'
20+
21+
virt_test_dir = os.path.join(os.environ['AUTODIR'],'tests/virt')
22+
sys.path.insert(0, virt_test_dir)
23+
24+
from virttest import utils_misc, cartesian_config
25+
26+
parser = cartesian_config.Parser()
27+
parser.parse_file(os.path.join(virt_test_dir, "openvswitch", "cfg", "tests.cfg"))
28+
29+
utils_misc.run_tests(parser, job)

openvswitch/get_started.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
"""
3+
Program to help setup kvm test environment
4+
5+
@copyright: Red Hat 2010
6+
"""
7+
import os, sys
8+
try:
9+
import autotest.common as common
10+
except ImportError:
11+
import common
12+
from virttest import utils_misc
13+
14+
test_name = "openvswitch"
15+
test_dir = os.path.dirname(sys.modules[__name__].__file__)
16+
test_dir = os.path.abspath(test_dir)
17+
base_dir = "/tmp/kvm_autotest_root"
18+
default_userspace_paths = ["/usr/bin/qemu-kvm", "/usr/bin/qemu-img"]
19+
check_modules = ["openvswitch"]
20+
online_docs_url = "https://github.com/autotest/autotest/wiki/OpenVSwitch"
21+
22+
if __name__ == "__main__":
23+
utils_misc.virt_test_assistant(test_name, test_dir, base_dir,
24+
default_userspace_paths, check_modules,
25+
online_docs_url)

0 commit comments

Comments
 (0)