def run_once(self, pair, udp, bidirectional, time, stream_list): print "running on %s and %s\n" % (pair[0], pair[1]) # Designate a lable for the server side tests. server_label = 'net_server' tagname = "%s_%s" % (pair[0], pair[1]) server = hosts.create_host(pair[0]) client = hosts.create_host(pair[1]) # Ensure the client doesn't have the server label. platform_label = client.get_platform_label() if platform_label == server_label: (server, client) = (client, server) # Disable IPFilters if they are present. for m in [client, server]: status = m.run('iptables -L') if not status.exit_status: m.disable_ipfilters() server_at = autotest_remote.Autotest(server) client_at = autotest_remote.Autotest(client) template = ''.join([ "job.run_test('iperf', server_ip='%s', client_ip=", "'%s', role='%s', udp=%s, bidirectional=%s,", "test_time=%d, stream_list=%s, tag='%s')" ]) server_control_file = template % (server.ip, client.ip, 'server', udp, bidirectional, time, stream_list, tagname) client_control_file = template % (server.ip, client.ip, 'client', udp, bidirectional, time, stream_list, tagname) server_command = subcommand.subcommand( server_at.run, [server_control_file, server.hostname]) client_command = subcommand.subcommand( client_at.run, [client_control_file, client.hostname]) subcommand.parallel([server_command, client_command]) for m in [client, server]: status = m.run('iptables -L') if not status.exit_status: m.enable_ipfilters()
def _install(self): if not self.host: from autotest_lib.server import hosts, autotest_remote self.host = hosts.create_host(self.job.machines[0], auto_monitor=False) try: tmp_dir = self.host.get_tmp_dir(parent="/tmp/sysinfo") self.autotest = autotest_remote.Autotest(self.host) self.autotest.install(autodir=tmp_dir) self.outputdir = self.host.get_tmp_dir() except: # if installation fails roll back the host try: self.host.close() except: logging.exception("Unable to close host %s", self.host.hostname) self.host = None self.autotest = None raise else: host = self.host # if autotest client dir does not exist, reinstall (it may have # been removed by the test code) autodir = host.get_autodir() if not autodir or not host.path_exists(autodir): self.autotest.install(autodir=autodir) # if the output dir does not exist, recreate it if not host.path_exists(self.outputdir): host.run('mkdir -p %s' % self.outputdir) return self.host, self.autotest, self.outputdir
def run_once(self, pair, buffer, upper_bound, variance): print "running on %s and %s\n" % (pair[0], pair[1]) # Designate a platform label for the server side of tests. server_label = 'net_server' server = hosts.create_host(pair[0]) client = hosts.create_host(pair[1]) # If client has the server_label, then swap server and client. platform_label = client.get_platform_label() if platform_label == server_label: (server, client) = (client, server) # Disable IP Filters if they are enabled. for m in [client, server]: status = m.run('iptables -L') if not status.exit_status: m.disable_ipfilters() server_at = autotest_remote.Autotest(server) client_at = autotest_remote.Autotest(client) template = ''.join([ "job.run_test('netpipe', server_ip='%s', ", "client_ip='%s', role='%s', bidirectional=True, ", "buffer_size=%d, upper_bound=%d," "perturbation_size=%d)" ]) server_control_file = template % (server.ip, client.ip, 'server', buffer, upper_bound, variance) client_control_file = template % (server.ip, client.ip, 'client', buffer, upper_bound, variance) server_command = subcommand.subcommand( server_at.run, [server_control_file, server.hostname]) client_command = subcommand.subcommand( client_at.run, [client_control_file, client.hostname]) subcommand.parallel([server_command, client_command]) for m in [client, server]: status = m.run('iptables -L') if not status.exit_status: m.enable_ipfilters()
def run_once(self, pair, test, time, stream_list, cycles): print "running on %s and %s\n" % (pair[0], pair[1]) # Designate a label for the server side tests. server_label = 'net_server' server = hosts.create_host(pair[0]) client = hosts.create_host(pair[1]) # If client has the server_label, then swap server and client. platform_label = client.get_platform_label() if platform_label == server_label: (server, client) = (client, server) # Disable IPFilters if they are enabled. for m in [client, server]: status = m.run('/sbin/iptables -L') if not status.exit_status: m.disable_ipfilters() server_at = autotest_remote.Autotest(server) client_at = autotest_remote.Autotest(client) template = ''.join(["job.run_test('netperf2', server_ip='%s', ", "client_ip='%s', role='%s', test='%s', ", "test_time=%d, stream_list=%s, tag='%s', ", "iterations=%d)"]) server_control_file = template % (server.ip, client.ip, 'server', test, time, stream_list, test, cycles) client_control_file = template % (server.ip, client.ip, 'client', test, time, stream_list, test, cycles) server_command = subcommand.subcommand(server_at.run, [server_control_file, server.hostname]) client_command = subcommand.subcommand(client_at.run, [client_control_file, client.hostname]) subcommand.parallel([server_command, client_command]) for m in [client, server]: status = m.run('/sbin/iptables -L') if not status.exit_status: m.enable_ipfilters()
def _install_clients(self): """ Install autotest_remote on any current job hosts. """ in_use_hosts = set() # find hosts in use but not used by us for host in self.job.hosts: autodir = host.get_autodir() if not (autodir and autodir.startswith(PROFILER_TMPDIR)): in_use_hosts.add(host.hostname) logging.debug('Hosts currently in use: %s', in_use_hosts) # determine what valid host objects we already have installed profiler_hosts = set() for host, at, profiler_dir in self.installed_hosts.values(): if host.path_exists(profiler_dir): profiler_hosts.add(host.hostname) else: # the profiler was wiped out somehow, drop this install logging.warning('The profiler client on %s at %s was deleted', host.hostname, profiler_dir) host.close() del self.installed_hosts[host.hostname] logging.debug('Hosts with profiler clients already installed: %s', profiler_hosts) # install autotest_remote on any new hosts in use for hostname in in_use_hosts - profiler_hosts: host = hosts.create_host(hostname, auto_monitor=False) tmp_dir = host.get_tmp_dir(parent=PROFILER_TMPDIR) at = autotest_remote.Autotest(host) at.install_no_autoserv(autodir=tmp_dir) self.installed_hosts[host.hostname] = (host, at, tmp_dir) # drop any installs from hosts no longer in job.hosts hostnames_to_drop = profiler_hosts - in_use_hosts hosts_to_drop = [ self.installed_hosts[hostname][0] for hostname in hostnames_to_drop ] for host in hosts_to_drop: host.close() del self.installed_hosts[host.hostname]
def __init__(self, k): super(SourceKernel, self).__init__() self.__kernel = k self.__patch_list = [] self.__config_file = None self.__autotest = autotest_remote.Autotest()
def setUp(self): self.autotest = autotest_remote.Autotest()