Home | History | Annotate | Download | only in network_WiFi_RxFrag
      1 # Copyright (c) 2013 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 from autotest_lib.client.common_lib import error
      6 from autotest_lib.client.common_lib.cros.network import ping_runner
      7 from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
      8 from autotest_lib.server.cros.network import hostap_config
      9 from autotest_lib.server.cros.network import wifi_cell_test_base
     10 
     11 
     12 class network_WiFi_RxFrag(wifi_cell_test_base.WiFiCellTestBase):
     13     """Test that the DUT can reassemble packet fragments."""
     14     version = 1
     15 
     16 
     17     def run_once(self):
     18         """Test body.
     19 
     20         When fragthreshold is set, packets larger than the threshold are
     21         broken up by the AP and sent in fragments. The DUT needs to reassemble
     22         these fragments to reconstruct the original packets before processing
     23         them.
     24 
     25         """
     26 
     27         # Whirlwind routers don't support fragmentation, and older builds
     28         # (up to 7849.0.2016_01_20_2103) don't know that they don't, so check
     29         # here using board name.
     30         if self.context.router.board == "whirlwind":
     31             raise error.TestNAError('Whirlwind AP does not support frag threshold')
     32 
     33         configuration = hostap_config.HostapConfig(
     34                 frequency=2437,
     35                 mode=hostap_config.HostapConfig.MODE_11G,
     36                 frag_threshold=256)
     37         self.context.configure(configuration)
     38         self.context.capture_host.start_capture(configuration.frequency)
     39         assoc_params = xmlrpc_datatypes.AssociationParameters()
     40         assoc_params.ssid = self.context.router.get_ssid()
     41         self.context.assert_connect_wifi(assoc_params)
     42         build_config = lambda size: ping_runner.PingConfig(
     43                 self.context.client.wifi_ip, size=size)
     44         self.context.assert_ping_from_server(ping_config=build_config(256))
     45         self.context.assert_ping_from_server(ping_config=build_config(512))
     46         self.context.assert_ping_from_server(ping_config=build_config(1024))
     47         self.context.assert_ping_from_server(ping_config=build_config(1500))
     48         self.context.client.shill.disconnect(assoc_params.ssid)
     49         self.context.router.deconfig()
     50         self.context.capture_host.stop_capture()
     51