19886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
29886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley# Use of this source code is governed by a BSD-style license that can be
39886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley# found in the LICENSE file.
49886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley
56aafdddb12ec6c324d6c9d4e931058effb083f0cChristopher Wileyfrom autotest_lib.client.common_lib.cros.network import ping_runner
69886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wileyfrom autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
799d42c95fa5c12285fb129b50445a60c9a145dd3Christopher Wileyfrom autotest_lib.server.cros.network import hostap_config
84961e848f54cb64f911c3ce03b3c377d171b35e5Christopher Wileyfrom autotest_lib.server.cros.network import wifi_cell_test_base
99886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley
109886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley
119886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wileyclass network_WiFi_WMM(wifi_cell_test_base.WiFiCellTestBase):
129886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley    """Test that we can handle different QoS levels."""
139886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley    version = 1
149886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley
159886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley
163e016dfc43799d47b6de12b9c4c98ab83b2a64d4Christopher Wiley    def run_once(self):
179886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        """Body of the test."""
189886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        configuration = hostap_config.HostapConfig(
199886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley                frequency=2437,
209886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley                mode=hostap_config.HostapConfig.MODE_11G,
219886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley                force_wmm=True)
229886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        self.context.configure(configuration)
239886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        assoc_params = xmlrpc_datatypes.AssociationParameters()
249886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        assoc_params.ssid = self.context.router.get_ssid()
253e016dfc43799d47b6de12b9c4c98ab83b2a64d4Christopher Wiley        self.context.assert_connect_wifi(assoc_params)
269886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        for qos in ('BE', 'BK', 'VI', 'VO'):
276aafdddb12ec6c324d6c9d4e931058effb083f0cChristopher Wiley            client_ping_config = ping_runner.PingConfig(
286aafdddb12ec6c324d6c9d4e931058effb083f0cChristopher Wiley                    self.context.get_wifi_addr(), qos=qos)
296aafdddb12ec6c324d6c9d4e931058effb083f0cChristopher Wiley            server_ping_config = ping_runner.PingConfig(
306aafdddb12ec6c324d6c9d4e931058effb083f0cChristopher Wiley                    self.context.client.wifi_ip, qos=qos)
316aafdddb12ec6c324d6c9d4e931058effb083f0cChristopher Wiley            self.context.assert_ping_from_dut(ping_config=client_ping_config)
326aafdddb12ec6c324d6c9d4e931058effb083f0cChristopher Wiley            self.context.assert_ping_from_server(ping_config=server_ping_config)
339886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        self.context.client.shill.disconnect(assoc_params.ssid)
349886982617cbeaebf61a23bd5a10fdf46707f111Christopher Wiley        self.context.router.deconfig()
35