blob: 108dab8b1bcd36fc5af3a0706be644e6492a5999 [file] [log] [blame]
mbligh97590302010-03-11 17:42:46 +00001from autotest_lib.server import autotest, hosts, subcommand, test
2from autotest_lib.server import utils
3
4class netperf2(test.test):
5 version = 2
6
7 def run_once(self, pair, test, time, stream_list, cycles):
8 print "running on %s and %s\n" % (pair[0], pair[1])
9
10 # Designate a label for the server side tests.
11 server_label = 'net_server'
12
13 server = hosts.create_host(pair[0])
14 client = hosts.create_host(pair[1])
15
16 # If client has the server_label, then swap server and client.
17 platform_label = client.get_platform_label()
18 if platform_label == server_label:
19 (server, client) = (client, server)
20
21
22 # Disable IPFilters if they are enabled.
23 for m in [client, server]:
24 status = m.run('/sbin/iptables -L')
25 if not status.exit_status:
26 m.disable_ipfilters()
27
28 server_at = autotest.Autotest(server)
29 client_at = autotest.Autotest(client)
30
31 template = ''.join(["job.run_test('netperf2', server_ip='%s', ",
32 "client_ip='%s', role='%s', test='%s', ",
33 "test_time=%d, stream_list=%s, tag='%s', ",
34 "iterations=%d)"])
35
Eric Li7edb3042011-01-06 17:57:17 -080036 server_control_file = template % (server.ip, client.ip, 'server', test,
mbligh97590302010-03-11 17:42:46 +000037 time, stream_list, test, cycles)
38 client_control_file = template % (server.ip, client.ip, 'client', test,
39 time, stream_list, test, cycles)
40
41 server_command = subcommand.subcommand(server_at.run,
42 [server_control_file, server.hostname])
43 client_command = subcommand.subcommand(client_at.run,
44 [client_control_file, client.hostname])
45
46 subcommand.parallel([server_command, client_command])
47
48 for m in [client, server]:
49 status = m.run('/sbin/iptables -L')
50 if not status.exit_status:
51 m.enable_ipfilters()