blob: 33d075f2f419c4243a4fe59952f3d5604e8489b1 [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 netpipe(test.test):
5 version = 2
6
7 def run_once(self, pair, buffer, upper_bound, variance):
8 print "running on %s and %s\n" % (pair[0], pair[1])
9
10 # Designate a platform label for the server side of 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 # Disable IP Filters if they are enabled.
22 for m in [client, server]:
23 status = m.run('iptables -L')
24 if not status.exit_status:
25 m.disable_ipfilters()
26
27 server_at = autotest.Autotest(server)
28 client_at = autotest.Autotest(client)
29
30 template = ''.join(["job.run_test('netpipe', server_ip='%s', ",
31 "client_ip='%s', role='%s', bidirectional=True, ",
32 "buffer_size=%d, upper_bound=%d,"
33 "perturbation_size=%d)"])
34
35 server_control_file = template % (server.ip, client.ip, 'server',
36 buffer, upper_bound, variance)
37 client_control_file = template % (server.ip, client.ip, 'client',
38 buffer, upper_bound, variance)
39
40 server_command = subcommand.subcommand(server_at.run,
Eric Li726afe82011-04-29 10:16:55 -070041 [server_control_file, server.hostname],
42 subdir='server')
mbligh97590302010-03-11 17:42:46 +000043 client_command = subcommand.subcommand(client_at.run,
Eric Li726afe82011-04-29 10:16:55 -070044 [client_control_file, client.hostname],
45 subdir='client')
mbligh97590302010-03-11 17:42:46 +000046
47 subcommand.parallel([server_command, client_command])
48
49 for m in [client, server]:
50 status = m.run('iptables -L')
51 if not status.exit_status:
52 m.enable_ipfilters()