blob: 3b3bdc7c4b9b26f779b319f8bbdb15348390d91b [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,
41 [server_control_file, server.hostname])
42 client_command = subcommand.subcommand(client_at.run,
43 [client_control_file, client.hostname])
44
45 subcommand.parallel([server_command, client_command])
46
47 for m in [client, server]:
48 status = m.run('iptables -L')
49 if not status.exit_status:
50 m.enable_ipfilters()