Home | History | Annotate | Download | only in network_WiFi_CliqueLongConnect
      1 # Copyright 2015 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 
      6 import logging
      7 
      8 import common
      9 from autotest_lib.client.common_lib import error
     10 from autotest_lib.server import test
     11 from autotest_lib.server.cros.clique_lib import clique_dut_control
     12 
     13 
     14 class network_WiFi_CliqueLongConnect(test.test):
     15     """ Dynamic Clique test to connect and disconnect to an AP. """
     16 
     17     version = 1
     18 
     19 
     20     def run_once(self, capturer, capturer_frequency, capturer_ht_type,
     21                  dut_pool, assoc_params_list, tries, debug_info,
     22                  conn_workers):
     23         """ Main entry function for autotest.
     24 
     25         @param capturer: a packet capture device
     26         @param capturer_frequency: integer channel frequency in MHz.
     27         @param capturer_ht_type: string specifier of channel HT type.
     28         @param dut_pool: the DUT pool to be used for the test. It is a 2D list
     29                          of DUTObjects.
     30         @param assoc_params_list: a list of AssociationParameters objects.
     31         @param tries: an integer, number of connection attempts.
     32         @param debug_info: a string of additional info to display on failure
     33         @param conn_workers: List of ConnectionWorkerAbstract objects, to
     34                              run extra work after successful connection.
     35         """
     36         # We need 2 sets in the pool for this test.
     37         if len(dut_pool) != 2:
     38             raise error.TestFail("Incorrect DUT pool configuration.")
     39         # We need 2 AP's in the pool for this test.
     40         if len(assoc_params_list) != 2:
     41             raise error.TestFail("Incorrect AP pool configuration.")
     42         # We need 2 connection workers in the pool for this test.
     43         if len(conn_workers) != 2:
     44             raise error.TestFail("Incorrect connection worker configuration.")
     45 
     46         # Both DUT sets are performing long connects.
     47         dut_role_classes = [clique_dut_control.DUTRoleConnectDuration,
     48                             clique_dut_control.DUTRoleConnectDuration]
     49 
     50         test_params = { 'capturer': capturer,
     51                         'capturer_frequency': capturer_frequency,
     52                         'capturer_ht_type': capturer_ht_type,
     53                         'debug_info': debug_info }
     54         error_results = clique_dut_control.execute_dut_pool(
     55                 dut_pool, dut_role_classes, assoc_params_list, conn_workers,
     56                 test_params)
     57         if error_results:
     58             logging.debug('Debug info: %s', debug_info)
     59             raise error.TestFail("Failed test. Error Results: %s" %
     60                                  str(error_results))
     61