• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The Chromium 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
5import logging
6
7from autotest_lib.client.bin import test
8from autotest_lib.client.common_lib import error
9from autotest_lib.client.common_lib.cros.network import interface
10from autotest_lib.client.cros.networking import shill_proxy
11
12
13class network_WlanPresent(test.test):
14    """
15    Fail unless at least WiFi device is present or shill is uninitialized.
16
17    """
18    version = 1
19
20    def run_once(self):
21        """Test main loop."""
22        proxy = shill_proxy.ShillProxy()
23        uninit = proxy.get_proxy().get_dbus_property(
24                proxy.manager,
25                proxy.MANAGER_PROPERTY_UNINITIALIZED_TECHNOLOGIES)
26        if "wifi" in uninit:
27            raise error.TestNAError('shill disables wireless support')
28
29        wlan_ifs = [nic for nic in interface.get_interfaces()
30                        if nic.is_wifi_device()]
31        if not wlan_ifs:
32            raise error.TestFail('Found no recognized wireless device')
33        wlan_names = [w.name for w in wlan_ifs]
34        logging.info('WiFi device found: %s', ', '.join(wlan_names))
35