Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: client/virt/tests/multicast.py

Issue 6883246: Merge autotest upstream from @5318 ~ @5336 (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/virt/tests/mac_change.py ('k') | client/virt/tests/netperf.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import logging, os, re 1 import logging, os, re
2 from autotest_lib.client.common_lib import error 2 from autotest_lib.client.common_lib import error
3 from autotest_lib.client.bin import utils 3 from autotest_lib.client.bin import utils
4 import kvm_test_utils, kvm_subprocess 4 from autotest_lib.client.virt import virt_test_utils, aexpect
5 5
6 6
7 def run_multicast(test, params, env): 7 def run_multicast(test, params, env):
8 """ 8 """
9 Test multicast function of nic (rtl8139/e1000/virtio) 9 Test multicast function of nic (rtl8139/e1000/virtio)
10 10
11 1) Create a VM. 11 1) Create a VM.
12 2) Join guest into multicast groups. 12 2) Join guest into multicast groups.
13 3) Ping multicast addresses on host. 13 3) Ping multicast addresses on host.
14 4) Flood ping test with different size of packets. 14 4) Flood ping test with different size of packets.
15 5) Final ping test and check if lose packet. 15 5) Final ping test and check if lose packet.
16 16
17 @param test: KVM test object. 17 @param test: KVM test object.
18 @param params: Dictionary with the test parameters. 18 @param params: Dictionary with the test parameters.
19 @param env: Dictionary with test environment. 19 @param env: Dictionary with test environment.
20 """ 20 """
21 vm = env.get_vm(params["main_vm"]) 21 vm = env.get_vm(params["main_vm"])
22 vm.verify_alive() 22 vm.verify_alive()
23 session = vm.wait_for_login(timeout=int(params.get("login_timeout", 360))) 23 session = vm.wait_for_login(timeout=int(params.get("login_timeout", 360)))
24 24
25 def run_guest(cmd): 25 def run_guest(cmd):
26 try: 26 try:
27 session.cmd(cmd) 27 session.cmd(cmd)
28 except kvm_subprocess.ShellError, e: 28 except aexpect.ShellError, e:
29 logging.warn(e) 29 logging.warn(e)
30 30
31 def run_host_guest(cmd): 31 def run_host_guest(cmd):
32 run_guest(cmd) 32 run_guest(cmd)
33 utils.system(cmd, ignore_status=True) 33 utils.system(cmd, ignore_status=True)
34 34
35 # flush the firewall rules 35 # flush the firewall rules
36 cmd_flush = "iptables -F" 36 cmd_flush = "iptables -F"
37 cmd_selinux = ("if [ -e /selinux/enforce ]; then setenforce 0; " 37 cmd_selinux = ("if [ -e /selinux/enforce ]; then setenforce 0; "
38 "else echo 'no /selinux/enforce file present'; fi") 38 "else echo 'no /selinux/enforce file present'; fi")
(...skipping 24 matching lines...) Expand all
63 pid = re.findall("join_mcast_pid:(\d+)", output)[0] 63 pid = re.findall("join_mcast_pid:(\d+)", output)[0]
64 except IndexError: 64 except IndexError:
65 raise error.TestFail("Can't join multicast groups,output:%s" % output) 65 raise error.TestFail("Can't join multicast groups,output:%s" % output)
66 66
67 try: 67 try:
68 for i in range(mgroup_count): 68 for i in range(mgroup_count):
69 new_suffix = suffix + i 69 new_suffix = suffix + i
70 mcast = "%s.%d" % (prefix, new_suffix) 70 mcast = "%s.%d" % (prefix, new_suffix)
71 71
72 logging.info("Initial ping test, mcast: %s", mcast) 72 logging.info("Initial ping test, mcast: %s", mcast)
73 s, o = kvm_test_utils.ping(mcast, 10, interface=ifname, timeout=20) 73 s, o = virt_test_utils.ping(mcast, 10, interface=ifname, timeout=20)
74 if s != 0: 74 if s != 0:
75 raise error.TestFail(" Ping return non-zero value %s" % o) 75 raise error.TestFail(" Ping return non-zero value %s" % o)
76 76
77 logging.info("Flood ping test, mcast: %s", mcast) 77 logging.info("Flood ping test, mcast: %s", mcast)
78 kvm_test_utils.ping(mcast, None, interface=ifname, flood=True, 78 virt_test_utils.ping(mcast, None, interface=ifname, flood=True,
79 output_func=None, timeout=flood_minutes*60) 79 output_func=None, timeout=flood_minutes*60)
80 80
81 logging.info("Final ping test, mcast: %s", mcast) 81 logging.info("Final ping test, mcast: %s", mcast)
82 s, o = kvm_test_utils.ping(mcast, 10, interface=ifname, timeout=20) 82 s, o = virt_test_utils.ping(mcast, 10, interface=ifname, timeout=20)
83 if s != 0: 83 if s != 0:
84 raise error.TestFail("Ping failed, status: %s, output: %s" % 84 raise error.TestFail("Ping failed, status: %s, output: %s" %
85 (s, o)) 85 (s, o))
86 86
87 finally: 87 finally:
88 logging.debug(session.cmd_output("ipmaddr show")) 88 logging.debug(session.cmd_output("ipmaddr show"))
89 session.cmd_output("kill -s SIGCONT %s" % pid) 89 session.cmd_output("kill -s SIGCONT %s" % pid)
90 session.close() 90 session.close()
OLDNEW
« no previous file with comments | « client/virt/tests/mac_change.py ('k') | client/virt/tests/netperf.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698