Merge tag 'android-security-10.0.0_r53' into int/10/fp2
Android security 10.0.0 release 53
* tag 'android-security-10.0.0_r53':
Change-Id: I55f308c8bfd6f25e2297c05d22c90961933a1492
diff --git a/acts/framework/acts/controllers/packet_capture.py b/acts/framework/acts/controllers/packet_capture.py
index 828c2fe..d10ffad 100755
--- a/acts/framework/acts/controllers/packet_capture.py
+++ b/acts/framework/acts/controllers/packet_capture.py
@@ -106,7 +106,12 @@
self._create_interface(MON_2G, 'monitor')
self._create_interface(MON_5G, 'monitor')
- self._create_interface(SCAN_IFACE, 'managed')
+ self.managed_mode = True
+ result = self.ssh.run('ifconfig -a', ignore_status=True)
+ if result.stderr or SCAN_IFACE not in result.stdout:
+ self.managed_mode = False
+ if self.managed_mode:
+ self._create_interface(SCAN_IFACE, 'managed')
self.pcap_properties = dict()
self._pcap_stop_lock = threading.Lock()
@@ -116,6 +121,8 @@
Create mon0/mon1 for 2G/5G monitor mode and wlan2 for managed mode.
"""
+ if mode == 'monitor':
+ self.ssh.run('ifconfig wlan%s down' % iface[-1], ignore_status=True)
self.ssh.run('iw dev %s del' % iface, ignore_status=True)
self.ssh.run('iw phy%s interface add %s type %s'
% (iface[-1], iface, mode), ignore_status=True)
@@ -171,6 +178,8 @@
Returns:
List of dictionaries each representing a found network.
"""
+ if not self.managed_mode:
+ raise PacketCaptureError('Managed mode not setup')
result = self.ssh.run('iw dev %s scan' % SCAN_IFACE)
if result.stderr:
raise PacketCaptureError('Failed to get scan dump')
diff --git a/acts/framework/acts/libs/uicd/uicd_cli.py b/acts/framework/acts/libs/uicd/uicd_cli.py
index b542cf0..8388551 100644
--- a/acts/framework/acts/libs/uicd/uicd_cli.py
+++ b/acts/framework/acts/libs/uicd/uicd_cli.py
@@ -45,7 +45,7 @@
containing them.
log_path: Directory for storing logs generated by Uicd.
"""
- self._uicd_zip = uicd_zip
+ self._uicd_zip = uicd_zip[0] if isinstance(uicd_zip, list) else uicd_zip
self._uicd_path = tempfile.mkdtemp(prefix='uicd')
self._log_path = log_path
if self._log_path:
diff --git a/acts/framework/acts/test_utils/net/connectivity_const.py b/acts/framework/acts/test_utils/net/connectivity_const.py
index f4865ab..946d2c6 100644
--- a/acts/framework/acts/test_utils/net/connectivity_const.py
+++ b/acts/framework/acts/test_utils/net/connectivity_const.py
@@ -64,6 +64,12 @@
MULTIPATH_PREFERENCE_RELIABILITY = 1 << 1
MULTIPATH_PREFERENCE_PERFORMANCE = 1 << 2
+# Private DNS constants
+DNS_GOOGLE = "dns.google"
+PRIVATE_DNS_MODE_OFF = "off"
+PRIVATE_DNS_MODE_OPPORTUNISTIC = "opportunistic"
+PRIVATE_DNS_MODE_STRICT = "hostname"
+
# IpSec constants
SOCK_STREAM = 1
SOCK_DGRAM = 2
diff --git a/acts/framework/acts/test_utils/net/connectivity_test_utils.py b/acts/framework/acts/test_utils/net/connectivity_test_utils.py
index 02167c9..4b7668c 100644
--- a/acts/framework/acts/test_utils/net/connectivity_test_utils.py
+++ b/acts/framework/acts/test_utils/net/connectivity_test_utils.py
@@ -14,6 +14,7 @@
# limitations under the License.
from acts import asserts
+from acts.test_utils.net import connectivity_const as cconst
def start_natt_keepalive(ad, src_ip, src_port, dst_ip, interval = 10):
""" Start NAT-T keep alive on dut """
@@ -61,3 +62,17 @@
ad.droid.connectivityRemovePacketKeepaliveReceiverKey(key)
return status
+
+def set_private_dns(ad, dns_mode, hostname=None):
+ """ Set private DNS mode on dut """
+ if dns_mode == cconst.PRIVATE_DNS_MODE_OFF:
+ ad.droid.setPrivateDnsMode(False)
+ else:
+ ad.droid.setPrivateDnsMode(True, hostname)
+
+ mode = ad.droid.getPrivateDnsMode()
+ host = ad.droid.getPrivateDnsSpecifier()
+ ad.log.info("DNS mode is %s and DNS server is %s" % (mode, host))
+ asserts.assert_true(dns_mode == mode and host == hostname,
+ "Failed to set DNS mode to %s and DNS to %s" % \
+ (dns_mode, hostname))
diff --git a/acts/framework/acts/test_utils/wifi/wifi_test_utils.py b/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
index b2ae9a4..6e29e61 100755
--- a/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
+++ b/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
@@ -44,7 +44,6 @@
SHORT_TIMEOUT = 30
ROAMING_TIMEOUT = 30
WIFI_CONNECTION_TIMEOUT_DEFAULT = 30
-WIFI_ABNORMAL_CONNECTION_TIME = 10
# Speed of light in m/s.
SPEED_OF_LIGHT = 299792458
@@ -1166,9 +1165,7 @@
if id is None and ssid is None:
for i in range(tries):
try:
- start = time.time()
conn_result = ad.ed.pop_event(wifi_constants.WIFI_CONNECTED, 30)
- _assert_connection_time(start)
break
except Empty:
pass
@@ -1176,25 +1173,16 @@
# If ssid or network id is specified, wait for specific connect event.
for i in range(tries):
try:
- start = time.time()
conn_result = ad.ed.pop_event(wifi_constants.WIFI_CONNECTED, 30)
if id and conn_result['data'][WifiEnums.NETID_KEY] == id:
- _assert_connection_time(start)
break
elif ssid and conn_result['data'][WifiEnums.SSID_KEY] == ssid:
- _assert_connection_time(start)
break
except Empty:
pass
return conn_result
-def _assert_connection_time(start):
- duration = time.time() - start
- asserts.assert_true(
- duration < WIFI_ABNORMAL_CONNECTION_TIME,
- "Took " + str(duration) + "s to connect to network, " +
- " expected " + str(WIFI_ABNORMAL_CONNECTION_TIME))
def wait_for_disconnect(ad, timeout=10):
"""Wait for a disconnect event within the specified timeout.
@@ -1430,6 +1418,7 @@
finally:
ad.droid.wifiStopTrackingStateChange()
+
def wifi_connect_using_network_request(ad, network, network_specifier,
num_of_tries=3, assert_on_fail=True):
"""Connect an Android device to a wifi network using network request.
diff --git a/acts/tests/google/net/CaptivePortalTest.py b/acts/tests/google/net/CaptivePortalTest.py
new file mode 100644
index 0000000..10240e4
--- /dev/null
+++ b/acts/tests/google/net/CaptivePortalTest.py
@@ -0,0 +1,209 @@
+#
+# Copyright 2019 - The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import time
+
+from acts import asserts
+from acts import base_test
+from acts import signals
+from acts.libs.uicd.uicd_cli import UicdCli
+from acts.test_decorators import test_tracker_info
+from acts.test_utils.net import connectivity_const as cconst
+from acts.test_utils.net import connectivity_test_utils as cutils
+from acts.test_utils.wifi import wifi_test_utils as wutils
+
+WifiEnums = wutils.WifiEnums
+IFACE = "InterfaceName"
+TIME_OUT = 20
+WLAN = "wlan0"
+
+
+class CaptivePortalTest(base_test.BaseTestClass):
+ """ Tests for Captive portal """
+
+ def setup_class(self):
+ """Setup devices for tests and unpack params
+
+ Required params:
+ 1. rk_captive_portal: SSID of ruckus captive portal network in dict
+ 2. gg_captive_portal: SSID of guestgate network in dict
+ 3. uicd_workflows: uicd workflow that specify click actions to accept
+ a captive portal connection. Ex: Click on SignIn, Accept & Continue
+ //wireless/android/platform/testing/wifi/configs/uicd/
+ 4. uic_zip: Zip file location of UICD application
+ """
+ self.dut = self.android_devices[0]
+ wutils.wifi_test_device_init(self.dut)
+ wutils.wifi_toggle_state(self.dut, True)
+ req_params = ["rk_captive_portal",
+ "gg_captive_portal",
+ "uicd_workflows",
+ "uicd_zip"]
+ self.unpack_userparams(req_param_names=req_params,)
+ self.ui = UicdCli(self.uicd_zip, self.uicd_workflows)
+ self.rk_workflow_config = "rk_captive_portal_%s" % self.dut.model
+ self.gg_workflow_config = "gg_captive_portal_%s" % self.dut.model
+
+ def teardown_class(self):
+ """ Reset devices """
+ cutils.set_private_dns(self.dut, cconst.PRIVATE_DNS_MODE_OPPORTUNISTIC)
+
+ def setup_test(self):
+ """ Setup device """
+ self.dut.unlock_screen()
+
+ def teardown_test(self):
+ """ Reset to default state after each test """
+ wutils.reset_wifi(self.dut)
+
+ def on_fail(self, test_name, begin_time):
+ self.dut.take_bug_report(test_name, begin_time)
+
+ ### Helper methods ###
+
+ def _verify_captive_portal(self, network, uicd_workflow):
+ """Connect to captive portal network using uicd workflow
+
+ Steps:
+ 1. Connect to captive portal network
+ 2. Run uicd workflow to accept connection
+ 3. Verify internet connectivity
+
+ Args:
+ 1. network: captive portal network to connect to
+ 2. uicd_workflow: ui workflow to accept captive portal conn
+ """
+ # connect to captive portal wifi network
+ wutils.start_wifi_connection_scan_and_ensure_network_found(
+ self.dut, network[WifiEnums.SSID_KEY])
+ wutils.wifi_connect(self.dut, network, check_connectivity=False)
+
+ # run uicd
+ self.ui.run(self.dut.serial, uicd_workflow)
+
+ # wait for sometime for captive portal connection to go through
+ curr_time = time.time()
+ while time.time() < curr_time + TIME_OUT:
+ link_prop = self.dut.droid.connectivityGetActiveLinkProperties()
+ self.log.debug("Link properties %s" % link_prop)
+ if link_prop and link_prop[IFACE] == WLAN:
+ break
+ time.sleep(2)
+
+ # verify connectivity
+ internet = wutils.validate_connection(self.dut,
+ wutils.DEFAULT_PING_ADDR)
+ if not internet:
+ raise signals.TestFailure("Failed to connect to internet on %s" %
+ network[WifiEnums.SSID_KEY])
+
+ ### Test Cases ###
+
+ @test_tracker_info(uuid="b035b4f9-40f7-42f6-9941-ec27afe15040")
+ def test_ruckus_captive_portal_default(self):
+ """Verify captive portal network
+
+ Steps:
+ 1. Set default private dns mode
+ 2. Connect to ruckus captive portal network
+ 3. Verify connectivity
+ """
+ # set private dns to opportunistic
+ cutils.set_private_dns(self.dut, cconst.PRIVATE_DNS_MODE_OPPORTUNISTIC)
+
+ # verify connection to captive portal network
+ self._verify_captive_portal(self.rk_captive_portal,
+ self.rk_workflow_config)
+
+ @test_tracker_info(uuid="8ea18d80-0170-41b1-8945-fe14bcd4feab")
+ def test_ruckus_captive_portal_private_dns_off(self):
+ """Verify captive portal network
+
+ Steps:
+ 1. Turn off private dns mode
+ 2. Connect to ruckus captive portal network
+ 3. Verify connectivity
+ """
+ # turn off private dns
+ cutils.set_private_dns(self.dut, cconst.PRIVATE_DNS_MODE_OFF)
+
+ # verify connection to captive portal network
+ self._verify_captive_portal(self.rk_captive_portal,
+ self.rk_workflow_config)
+
+ @test_tracker_info(uuid="e8e05907-55f7-40e5-850c-b3111ceb31a4")
+ def test_ruckus_captive_portal_private_dns_strict(self):
+ """Verify captive portal network
+
+ Steps:
+ 1. Set strict private dns mode
+ 2. Connect to ruckus captive portal network
+ 3. Verify connectivity
+ """
+ # set private dns to strict mode
+ cutils.set_private_dns(self.dut,
+ cconst.PRIVATE_DNS_MODE_STRICT,
+ cconst.DNS_GOOGLE)
+
+ # verify connection to captive portal network
+ self._verify_captive_portal(self.rk_captive_portal,
+ self.rk_workflow_config)
+
+ @test_tracker_info(uuid="76e49800-f141-4fd2-9969-562585eb1e7a")
+ def test_guestgate_captive_portal_default(self):
+ """Verify captive portal network
+
+ Steps:
+ 1. Set default private dns mode
+ 2. Connect to guestgate captive portal network
+ 3. Verify connectivity
+ """
+ # set private dns to opportunistic
+ cutils.set_private_dns(self.dut, cconst.PRIVATE_DNS_MODE_OPPORTUNISTIC)
+
+ # verify connection to captive portal network
+ self._verify_captive_portal(self.gg_captive_portal, "gg_captive_portal")
+
+ @test_tracker_info(uuid="0aea0cac-0f42-406b-84ba-62c1ef74adfc")
+ def test_guestgate_captive_portal_private_dns_off(self):
+ """Verify captive portal network
+
+ Steps:
+ 1. Turn off private dns mode
+ 2. Connect to guestgate captive portal network
+ 3. Verify connectivity
+ """
+ # turn off private dns
+ cutils.set_private_dns(self.dut, cconst.PRIVATE_DNS_MODE_OFF)
+
+ # verify connection to captive portal network
+ self._verify_captive_portal(self.gg_captive_portal, "gg_captive_portal")
+
+ @test_tracker_info(uuid="39124dcc-2fd3-4d33-b129-a1c8150b7f2a")
+ def test_guestgate_captive_portal_private_dns_strict(self):
+ """Verify captive portal network
+
+ Steps:
+ 1. Set strict private dns mode
+ 2. Connect to guestgate captive portal network
+ 3. Verify connectivity
+ """
+ # set private dns to strict mode
+ cutils.set_private_dns(self.dut,
+ cconst.PRIVATE_DNS_MODE_STRICT,
+ cconst.DNS_GOOGLE)
+
+ # verify connection to captive portal network
+ self._verify_captive_portal(self.gg_captive_portal, "gg_captive_portal")
diff --git a/acts/tests/google/wifi/WifiAutoUpdateTest.py b/acts/tests/google/wifi/WifiAutoUpdateTest.py
index 04fb850..bbbb9e1 100755
--- a/acts/tests/google/wifi/WifiAutoUpdateTest.py
+++ b/acts/tests/google/wifi/WifiAutoUpdateTest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.4
+# !/usr/bin/env python3.4
#
# Copyright 2017 - The Android Open Source Project
#
@@ -14,22 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import itertools
-import pprint
-import queue
-import time
-
-import acts.base_test
-import acts.signals as signals
-import acts.test_utils.wifi.wifi_test_utils as wutils
-import acts.utils
-
+import re
from acts import asserts
+from acts.controllers.android_device import SL4A_APK_NAME
from acts.libs.ota import ota_updater
+import acts.signals as signals
from acts.test_decorators import test_tracker_info
+from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G
+import acts.test_utils.wifi.wifi_test_utils as wutils
from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
+import acts.utils as utils
WifiEnums = wutils.WifiEnums
+SSID = WifiEnums.SSID_KEY
+PWD = WifiEnums.PWD_KEY
+NETID = WifiEnums.NETID_KEY
# Default timeout used for reboot, toggle WiFi and Airplane mode,
# for the system to settle down after the operation.
DEFAULT_TIMEOUT = 10
@@ -51,50 +50,52 @@
self.tests = (
"test_check_wifi_state_after_au",
"test_verify_networks_after_au",
+ "test_configstore_after_au",
+ "test_mac_randomization_after_au",
+ "test_wifi_hotspot_5g_psk_after_au",
"test_all_networks_connectable_after_au",
- "test_connection_to_new_networks",
+ "test_connect_to_network_suggestion_after_au",
"test_check_wifi_toggling_after_au",
+ "test_connection_to_new_networks",
"test_reset_wifi_after_au")
def setup_class(self):
super(WifiAutoUpdateTest, self).setup_class()
ota_updater.initialize(self.user_params, self.android_devices)
self.dut = self.android_devices[0]
+ self.dut_client = self.android_devices[1]
wutils.wifi_test_device_init(self.dut)
- req_params = []
- opt_param = [
- "open_network", "reference_networks", "iperf_server_address"
- ]
- self.unpack_userparams(
- req_param_names=req_params, opt_param_names=opt_param)
-
- if "AccessPoint" in self.user_params:
- self.legacy_configure_ap_and_start()
-
- asserts.assert_true(
- len(self.reference_networks) > 0,
- "Need at least two reference network with psk.")
- asserts.assert_true(
- len(self.open_network) > 0,
- "Need at least two open network with psk.")
wutils.wifi_toggle_state(self.dut, True)
+ # configure APs
+ self.legacy_configure_ap_and_start(wpa_network=True)
+ self.wpapsk_2g = self.reference_networks[0]["2g"]
+ self.wpapsk_5g = self.reference_networks[0]["5g"]
+ self.open_2g = self.open_network[0]["2g"]
+ self.open_5g = self.open_network[0]["5g"]
+
+ # saved & connected networks, network suggestions
+ # and new networks
+ self.saved_networks = [self.open_2g]
+ self.network_suggestions = [self.wpapsk_5g]
+ self.connected_networks = [self.wpapsk_2g, self.open_5g]
+ self.new_networks = [self.reference_networks[1]["2g"],
+ self.open_network[1]["5g"]]
+
+ # add pre ota upgrade configuration
self.wifi_config_list = []
-
- # Disabling WiFi setup before OTA for debugging.
- # Setup WiFi and add few open and wpa networks before OTA.
- # self.add_network_and_enable(self.open_network[0]['2g'])
- # self.add_network_and_enable(self.reference_networks[0]['5g'])
-
- # Add few dummy networks to the list.
- # self.add_and_enable_dummy_networks()
+ self.pre_default_mac = {}
+ self.pre_random_mac = {}
+ self.pst_default_mac = {}
+ self.pst_random_mac = {}
+ self.add_pre_update_configuration()
# Run OTA below, if ota fails then abort all tests.
try:
ota_updater.update(self.dut)
- except Exception as err:
- raise signals.TestSkipClass(
- "Failed up apply OTA update. Aborting tests")
+ except Exception as e:
+ raise signals.TestAbortClass(
+ "Failed up apply OTA update. Aborting tests: %s" % e)
def setup_test(self):
self.dut.droid.wakeLockAcquireBright()
@@ -113,45 +114,115 @@
del self.user_params["reference_networks"]
del self.user_params["open_network"]
- """Helper Functions"""
+ ### Helper Methods
+
+ def add_pre_update_configuration(self):
+ self.add_network_suggestions(self.network_suggestions)
+ self.add_network_and_enable(self.saved_networks[0])
+ self.add_wifi_hotspot()
+ self.connect_to_multiple_networks(self.connected_networks)
+
+ def add_wifi_hotspot(self):
+ self.wifi_hotspot = {"SSID": "hotspot_%s" % utils.rand_ascii_str(6),
+ "password": "pass_%s" % utils.rand_ascii_str(6)}
+ wutils.save_wifi_soft_ap_config(self.dut,
+ self.wifi_hotspot,
+ WIFI_CONFIG_APBAND_5G)
+
+ def verify_wifi_hotspot(self):
+ """Verify wifi tethering."""
+ wutils.start_wifi_tethering_saved_config(self.dut)
+ wutils.connect_to_wifi_network(self.dut_client,
+ self.wifi_hotspot,
+ check_connectivity=False)
+ wutils.stop_wifi_tethering(self.dut)
+
+ def connect_to_multiple_networks(self, networks):
+ """Connect to a list of wifi networks.
+
+ Args:
+ networks : list of wifi networks.
+ """
+ self.log.info("Connect to multiple wifi networks")
+ for network in networks:
+ ssid = network[SSID]
+ wutils.start_wifi_connection_scan_and_ensure_network_found(
+ self.dut, ssid)
+ wutils.wifi_connect(self.dut, network, num_of_tries=6)
+ self.wifi_config_list.append(network)
+ self.pre_default_mac[network[SSID]] = self.get_sta_mac_address()
+ self.pre_random_mac[network[SSID]] = \
+ self.dut.droid.wifigetRandomizedMacAddress(network)
+
+ def get_sta_mac_address(self):
+ """Gets the current MAC address being used for client mode."""
+ out = self.dut.adb.shell("ifconfig wlan0")
+ res = re.match(".* HWaddr (\S+).*", out, re.S)
+ return res.group(1)
+
+ def add_network_suggestions(self, network_suggestions):
+ """Add wifi network suggestions to DUT.
+
+ Args:
+ network_suggestions : suggestions to add.
+ """
+ self.dut.log.info("Adding network suggestions")
+ asserts.assert_true(
+ self.dut.droid.wifiAddNetworkSuggestions(network_suggestions),
+ "Failed to add suggestions")
+
+ # Enable suggestions by the app.
+ self.dut.log.debug("Enabling suggestions from test")
+ self.dut.adb.shell(
+ "cmd wifi network-suggestions-set-user-approved %s yes" % \
+ SL4A_APK_NAME)
+
+ def remove_suggestions_and_ensure_no_connection(self,
+ network_suggestions,
+ expected_ssid):
+ """Remove network suggestions.
+
+ Args:
+ network_suggestions : suggestions to remove.
+ expected_ssid : SSID to verify that DUT is not connected.
+ """
+ self.dut.log.info("Removing network suggestions")
+ asserts.assert_true(
+ self.dut.droid.wifiRemoveNetworkSuggestions(network_suggestions),
+ "Failed to remove suggestions")
+
+ # Ensure we did not disconnect
+ wutils.ensure_no_disconnect(self.dut)
+
+ # Trigger a disconnect and wait for the disconnect.
+ self.dut.droid.wifiDisconnect()
+ wutils.wait_for_disconnect(self.dut)
+ self.dut.ed.clear_all_events()
+
+ # Now ensure that we didn't connect back.
+ asserts.assert_false(
+ wutils.wait_for_connect(self.dut,
+ expected_ssid,
+ assert_on_fail=False),
+ "Device should not connect back")
def add_network_and_enable(self, network):
"""Add a network and enable it.
Args:
network : Network details for the network to be added.
-
"""
+ self.log.info("Add a wifi network and enable it")
ret = self.dut.droid.wifiAddNetwork(network)
asserts.assert_true(ret != -1, "Add network %r failed" % network)
- self.wifi_config_list.append({
- WifiEnums.SSID_KEY: network[WifiEnums.SSID_KEY],
- WifiEnums.NETID_KEY: ret})
+ self.wifi_config_list.append({SSID: network[SSID], NETID: ret})
self.dut.droid.wifiEnableNetwork(ret, 0)
- def add_and_enable_dummy_networks(self, num_networks=5):
- """Add some dummy networks to the device and enable them.
-
- Args:
- num_networks: Number of networks to add.
- """
- ssid_name_base = "dummy_network_"
- for i in range(0, num_networks):
- network = {}
- network[WifiEnums.SSID_KEY] = ssid_name_base + str(i)
- network[WifiEnums.PWD_KEY] = "dummynet_password"
- self.add_network_and_enable(network)
-
def check_networks_after_autoupdate(self, networks):
- """Verify that all previously configured networks are presistent after
- reboot.
+ """Verify that all previously configured networks are persistent.
Args:
networks: List of network dicts.
-
- Return:
- None. Raises TestFailure.
-
"""
network_info = self.dut.droid.wifiGetConfiguredNetworks()
if len(network_info) != len(networks):
@@ -160,21 +231,35 @@
"don't match. \nBefore reboot = %s \n After reboot = %s" %
(networks, network_info))
raise signals.TestFailure(msg)
- current_count = 0
+
# For each network, check if it exists in configured list after Auto-
# update.
for network in networks:
- exists = wutils.match_networks({
- WifiEnums.SSID_KEY: network[WifiEnums.SSID_KEY]
- }, network_info)
- if not len(exists):
+ exists = wutils.match_networks({SSID: network[SSID]}, network_info)
+ if not exists:
raise signals.TestFailure("%s network is not present in the"
" configured list after Auto-update" %
- network[WifiEnums.SSID_KEY])
+ network[SSID])
# Get the new network id for each network after reboot.
- network[WifiEnums.NETID_KEY] = exists[0]['networkId']
+ network[NETID] = exists[0]["networkId"]
- """Tests"""
+ def get_enabled_network(self, network1, network2):
+ """Check network status and return currently unconnected network.
+
+ Args:
+ network1: dict representing a network.
+ network2: dict representing a network.
+
+ Returns:
+ Network dict of the unconnected network.
+ """
+ wifi_info = self.dut.droid.wifiGetConnectionInfo()
+ enabled = network1
+ if wifi_info[SSID] == network1[SSID]:
+ enabled = network2
+ return enabled
+
+ ### Tests
@test_tracker_info(uuid="9ff1f01e-e5ff-408b-9a95-29e87a2df2d8")
def test_check_wifi_state_after_au(self):
@@ -192,6 +277,78 @@
"""
self.check_networks_after_autoupdate(self.wifi_config_list)
+ @test_tracker_info(uuid="799e83c2-305d-4510-921e-dac3c0dbb6c5")
+ def test_configstore_after_au(self):
+ """Verify DUT automatically connects to wifi networks after ota.
+
+ Steps:
+ 1. Connect to two wifi networks pre ota.
+ 2. Verify DUT automatically connects to 1 after ota.
+ 3. Re-connect to the other wifi network.
+ """
+ wifi_info = self.dut.droid.wifiGetConnectionInfo()
+ self.pst_default_mac[wifi_info[SSID]] = self.get_sta_mac_address()
+ self.pst_random_mac[wifi_info[SSID]] = \
+ self.dut.droid.wifigetRandomizedMacAddress(wifi_info)
+ reconnect_to = self.get_enabled_network(self.wifi_config_list[1],
+ self.wifi_config_list[2])
+ wutils.start_wifi_connection_scan_and_ensure_network_found(
+ self.dut, reconnect_to[SSID])
+ wutils.wifi_connect_by_id(self.dut, reconnect_to[NETID])
+ connect_data = self.dut.droid.wifiGetConnectionInfo()
+ connect_ssid = connect_data[SSID]
+ self.log.info("Expected SSID = %s" % reconnect_to[SSID])
+ self.log.info("Connected SSID = %s" % connect_ssid)
+ if connect_ssid != reconnect_to[SSID]:
+ raise signals.TestFailure(
+ "Device failed to reconnect to the correct"
+ " network after reboot.")
+ self.pst_default_mac[wifi_info[SSID]] = self.get_sta_mac_address()
+ self.pst_random_mac[wifi_info[SSID]] = \
+ self.dut.droid.wifigetRandomizedMacAddress(wifi_info)
+
+ for network in self.connected_networks:
+ wutils.wifi_forget_network(self.dut, network[SSID])
+
+ @test_tracker_info(uuid="e26d0ed9-9457-4a95-a962-4d43b0032bac")
+ def test_mac_randomization_after_au(self):
+ """Verify randomized MAC addrs are persistent after ota.
+
+ Steps:
+ 1. Reconnect to the wifi networks configured pre ota.
+ 2. Get the randomized MAC addrs.
+ """
+ for ssid, mac in self.pst_random_mac.items():
+ asserts.assert_true(
+ self.pre_random_mac[ssid] == mac,
+ "MAC addr of %s is %s after ota. Expected %s" %
+ (ssid, mac, self.pre_random_mac[ssid]))
+
+ @test_tracker_info(uuid="f68a65e6-97b7-4746-bad8-4c206551d87e")
+ def test_wifi_hotspot_5g_psk_after_au(self):
+ """Verify hotspot after ota upgrade.
+
+ Steps:
+ 1. Start wifi hotspot on the saved config.
+ 2. Verify DUT client connects to it.
+ """
+ self.verify_wifi_hotspot()
+
+ @test_tracker_info(uuid="21f91372-88a6-44b9-a4e8-d4664823dffb")
+ def test_connect_to_network_suggestion_after_au(self):
+ """Verify connection to network suggestion after ota.
+
+ Steps:
+ 1. DUT has network suggestion added before OTA.
+ 2. Wait for the device to connect to it.
+ 3. Remove the suggestions and ensure the device does not
+ connect back.
+ """
+ wutils.start_wifi_connection_scan_and_return_status(self.dut)
+ wutils.wait_for_connect(self.dut, self.network_suggestions[0][SSID])
+ self.remove_suggestions_and_ensure_no_connection(
+ self.network_suggestions, self.network_suggestions[0][SSID])
+
@test_tracker_info(uuid="b8e47a4f-62fe-4a0e-b999-27ae1ebf4d19")
def test_connection_to_new_networks(self):
"""Check if we can connect to new networks after Auto-update.
@@ -201,14 +358,11 @@
2. Connect to an open network.
3. Forget ntworks added in 1 & 2.
TODO: (@bmahadev) Add WEP network once it's ready.
-
"""
- wutils.connect_to_wifi_network(self.dut, self.open_network[0]['5g'])
- wutils.connect_to_wifi_network(self.dut, self.reference_networks[0]['2g'])
- wutils.wifi_forget_network(self.dut,
- self.reference_networks[0]['2g'][WifiEnums.SSID_KEY])
- wutils.wifi_forget_network(self.dut,
- self.open_network[0]['5g'][WifiEnums.SSID_KEY])
+ for network in self.new_networks:
+ wutils.connect_to_wifi_network(self.dut, network)
+ for network in self.new_networks:
+ wutils.wifi_forget_network(self.dut, network[SSID])
@test_tracker_info(uuid="1d8309e4-d5a2-4f48-ba3b-895a58c9bf3a")
def test_all_networks_connectable_after_au(self):
@@ -218,15 +372,14 @@
1. Connect to previously added PSK network using network id.
2. Connect to previously added open network using network id.
TODO: (@bmahadev) Add WEP network once it's ready.
-
"""
- for network in self.wifi_config_list:
- if 'dummy' not in network[WifiEnums.SSID_KEY]:
- if not wutils.connect_to_wifi_network_with_id(self.dut,
- network[WifiEnums.NETID_KEY],
- network[WifiEnums.SSID_KEY]):
- raise signals.TestFailure("Failed to connect to %s after \
- Auto-update" % network[WifiEnums.SSID_KEY])
+ network = self.wifi_config_list[0]
+ if not wutils.connect_to_wifi_network_with_id(self.dut,
+ network[NETID],
+ network[SSID]):
+ raise signals.TestFailure("Failed to connect to %s after OTA" %
+ network[SSID])
+ wutils.wifi_forget_network(self.dut, network[SSID])
@test_tracker_info(uuid="05671859-38b1-4dbf-930c-18048971d075")
def test_check_wifi_toggling_after_au(self):
diff --git a/acts/tests/google/wifi/WifiChaosTest.py b/acts/tests/google/wifi/WifiChaosTest.py
index aa36588..0fa77b3 100755
--- a/acts/tests/google/wifi/WifiChaosTest.py
+++ b/acts/tests/google/wifi/WifiChaosTest.py
@@ -213,15 +213,13 @@
Steps:
1. Send a few link probes.
- 2. Verify that at least one link probe succeeded.
- 3. Ensure that the device and AP did not crash (by checking that the
+ 2. Ensure that the device and AP did not crash (by checking that the
device remains connected to the expected network).
"""
results = wutils.send_link_probes(
self.dut, NUM_LINK_PROBES, PROBE_DELAY_SEC)
- asserts.assert_true(any(result.is_success for result in results),
- "Expect at least 1 probe success: " + str(results))
+ self.log.info("Link Probe results: %s" % (results,))
wifi_info = self.dut.droid.wifiGetConnectionInfo()
expected = network[WifiEnums.SSID_KEY]
@@ -269,12 +267,13 @@
self.log.info("Connecting to %s" % ssid)
self.scan_and_connect_by_id(network, net_id)
self.run_ping(10)
- self.send_link_probes(network)
+ # TODO(b/133369482): uncomment once bug is resolved
+ # self.send_link_probes(network)
wutils.wifi_forget_network(self.dut, ssid)
time.sleep(WAIT_BEFORE_CONNECTION)
- except:
+ except Exception as e:
self.log.error("Connection to %s network failed on the %d "
- "attempt." % (ssid, attempt))
+ "attempt with exception %s." % (ssid, attempt, e))
# TODO:(bmahadev) Uncomment after scan issue is fixed.
# self.dut.take_bug_report(ssid, begin_time)
# self.dut.cat_adb_log(ssid, begin_time)
diff --git a/acts/tests/google/wifi/WifiMacRandomizationTest.py b/acts/tests/google/wifi/WifiMacRandomizationTest.py
index 09630d7..fa01d45 100755
--- a/acts/tests/google/wifi/WifiMacRandomizationTest.py
+++ b/acts/tests/google/wifi/WifiMacRandomizationTest.py
@@ -272,14 +272,15 @@
@test_tracker_info(uuid="2dd0a05e-a318-45a6-81cd-962e098fa242")
def test_set_mac_randomization_to_none(self):
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
network = self.wpapsk_2g
# Set macRandomizationSetting to RANDOMIZATION_NONE.
network["macRand"] = RANDOMIZATION_NONE
self.connect_to_network_and_verify_mac_randomization(network,
status=RANDOMIZATION_NONE)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_2G][1],
+ hostapd_constants.BAND_2G.upper())
time.sleep(SHORT_TIMEOUT)
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
packets = rdpcap(pcap_fname)
@@ -461,14 +462,15 @@
if not result:
raise ValueError("Failed to configure channel for 2G band")
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
# re-connect to the softAp network after sniffer is started
wutils.connect_to_wifi_network(self.dut_client, self.wpapsk_2g)
wutils.connect_to_wifi_network(self.dut_client, softap)
time.sleep(SHORT_TIMEOUT)
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_2G][1],
+ hostapd_constants.BAND_2G.upper())
packets = rdpcap(pcap_fname)
self.verify_mac_not_found_in_pcap(self.soft_ap_factory_mac, packets)
self.verify_mac_not_found_in_pcap(self.sta_factory_mac, packets)
@@ -520,13 +522,14 @@
"""
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
time.sleep(SHORT_TIMEOUT)
network = self.wpapsk_5g
rand_mac = self.connect_to_network_and_verify_mac_randomization(network)
wutils.send_link_probes(self.dut, 3, 3)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_5G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_5G][1],
+ hostapd_constants.BAND_5G.upper())
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
time.sleep(SHORT_TIMEOUT)
packets = rdpcap(pcap_fname)
@@ -546,11 +549,12 @@
"""
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.log_path, self.test_name)
+ self.packet_capture, 'dual', self.test_name)
wutils.start_wifi_connection_scan(self.dut)
time.sleep(SHORT_TIMEOUT)
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % \
+ (self.pcap_procs[hostapd_constants.BAND_2G][1],
+ hostapd_constants.BAND_2G.upper())
packets = rdpcap(pcap_fname)
self.verify_mac_not_found_in_pcap(self.sta_factory_mac, packets)
diff --git a/acts/tests/google/wifi/WifiNetworkSuggestionTest.py b/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
index 5cb2776..275dee5 100755
--- a/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
+++ b/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
@@ -31,11 +31,17 @@
from acts.test_utils.wifi import wifi_constants
WifiEnums = wutils.WifiEnums
+# EAP Macros
+EAP = WifiEnums.Eap
+EapPhase2 = WifiEnums.EapPhase2
+# Enterprise Config Macros
+Ent = WifiEnums.Enterprise
# Default timeout used for reboot, toggle WiFi and Airplane mode,
# for the system to settle down after the operation.
DEFAULT_TIMEOUT = 10
+
class WifiNetworkSuggestionTest(WifiBaseTest):
"""Tests for WifiNetworkSuggestion API surface.
@@ -53,22 +59,44 @@
wutils.wifi_test_device_init(self.dut)
req_params = []
opt_param = [
- "open_network", "reference_networks"
+ "open_network", "reference_networks", "radius_conf_2g", "radius_conf_5g", "ca_cert",
+ "eap_identity", "eap_password", "hidden_networks"
]
self.unpack_userparams(
req_param_names=req_params, opt_param_names=opt_param)
if "AccessPoint" in self.user_params:
- self.legacy_configure_ap_and_start(wpa_network=True,
- wep_network=True)
+ self.legacy_configure_ap_and_start(
+ wpa_network=True, ent_network=True,
+ radius_conf_2g=self.radius_conf_2g,
+ radius_conf_5g=self.radius_conf_5g,)
asserts.assert_true(
len(self.reference_networks) > 0,
"Need at least one reference network with psk.")
- self.wpa_psk_2g = self.reference_networks[0]["2g"]
- self.wpa_psk_5g = self.reference_networks[0]["5g"]
- self.open_2g = self.open_network[0]["2g"]
- self.open_5g = self.open_network[0]["5g"]
+ if hasattr(self, "reference_networks"):
+ self.wpa_psk_2g = self.reference_networks[0]["2g"]
+ self.wpa_psk_5g = self.reference_networks[0]["5g"]
+ if hasattr(self, "open_network"):
+ self.open_2g = self.open_network[0]["2g"]
+ self.open_5g = self.open_network[0]["5g"]
+ if hasattr(self, "ent_networks"):
+ self.ent_network_2g = self.ent_networks[0]["2g"]
+ self.ent_network_5g = self.ent_networks[0]["5g"]
+ self.config_aka = {
+ Ent.EAP: int(EAP.AKA),
+ WifiEnums.SSID_KEY: self.ent_network_2g[WifiEnums.SSID_KEY],
+ }
+ self.config_ttls = {
+ Ent.EAP: int(EAP.TTLS),
+ Ent.CA_CERT: self.ca_cert,
+ Ent.IDENTITY: self.eap_identity,
+ Ent.PASSWORD: self.eap_password,
+ Ent.PHASE2: int(EapPhase2.MSCHAPV2),
+ WifiEnums.SSID_KEY: self.ent_network_2g[WifiEnums.SSID_KEY],
+ }
+ if hasattr(self, "hidden_networks"):
+ self.hidden_network = self.hidden_networks[0]
self.dut.droid.wifiRemoveNetworkSuggestions([])
def setup_test(self):
@@ -84,6 +112,7 @@
self.dut.droid.wifiRemoveNetworkSuggestions([])
self.dut.droid.wifiDisconnect()
wutils.reset_wifi(self.dut)
+ wutils.wifi_toggle_state(self.dut, False)
self.dut.ed.clear_all_events()
def on_fail(self, test_name, begin_time):
@@ -149,6 +178,47 @@
self.dut.droid.wifiStopTrackingNetworkSuggestionStateChange()
self.dut.ed.clear_all_events()
+ def remove_suggestions_disconnect_and_ensure_no_connection_back(self,
+ network_suggestions,
+ expected_ssid):
+ self.dut.log.info("Removing network suggestions")
+ asserts.assert_true(
+ self.dut.droid.wifiRemoveNetworkSuggestions(network_suggestions),
+ "Failed to remove suggestions")
+ # Ensure we did not disconnect
+ wutils.ensure_no_disconnect(self.dut)
+
+ # Trigger a disconnect and wait for the disconnect.
+ self.dut.droid.wifiDisconnect()
+ wutils.wait_for_disconnect(self.dut)
+ self.dut.ed.clear_all_events()
+
+ # Now ensure that we didn't connect back.
+ asserts.assert_false(
+ wutils.wait_for_connect(self.dut, expected_ssid, assert_on_fail=False),
+ "Device should not connect back")
+
+ def _test_connect_to_wifi_network_reboot_config_store(self,
+ network_suggestions,
+ wifi_network):
+ """ Test network suggestion with reboot config store
+
+ Args:
+ 1. network_suggestions: network suggestions in list to add to the device.
+ 2. wifi_network: expected wifi network to connect to
+ """
+
+ self.add_suggestions_and_ensure_connection(
+ network_suggestions, wifi_network[WifiEnums.SSID_KEY], None)
+
+ # Reboot and wait for connection back to the same suggestion.
+ self.dut.reboot()
+ time.sleep(DEFAULT_TIMEOUT)
+
+ wutils.wait_for_connect(self.dut, wifi_network[WifiEnums.SSID_KEY])
+
+ self.remove_suggestions_disconnect_and_ensure_no_connection_back(
+ network_suggestions, wifi_network[WifiEnums.SSID_KEY])
@test_tracker_info(uuid="bda8ed20-4382-4380-831a-64cf77eca108")
def test_connect_to_wpa_psk_2g(self):
@@ -164,25 +234,9 @@
self.add_suggestions_and_ensure_connection(
[self.wpa_psk_2g], self.wpa_psk_2g[WifiEnums.SSID_KEY],
False)
- self.dut.log.info("Removing network suggestions");
- asserts.assert_true(
- self.dut.droid.wifiRemoveNetworkSuggestions([self.wpa_psk_2g]),
- "Failed to remove suggestions")
- # Ensure we did not disconnect
- wutils.ensure_no_disconnect(self.dut)
- # Trigger a disconnect and wait for the disconnect.
- self.dut.droid.wifiDisconnect()
- wutils.wait_for_disconnect(self.dut)
- self.dut.ed.clear_all_events()
-
- # Now ensure that we didn't connect back.
- asserts.assert_false(
- wutils.wait_for_connect(self.dut,
- self.wpa_psk_2g[WifiEnums.SSID_KEY],
- assert_on_fail=False),
- "Device should not connect back")
-
+ self.remove_suggestions_disconnect_and_ensure_no_connection_back(
+ [self.wpa_psk_2g], self.wpa_psk_2g[WifiEnums.SSID_KEY])
@test_tracker_info(uuid="f54bc250-d9e9-4f00-8b5b-b866e8550b43")
def test_connect_to_highest_priority(self):
@@ -209,15 +263,8 @@
self.wpa_psk_2g[WifiEnums.SSID_KEY],
None)
- # Remove all suggestions
- self.dut.log.info("Removing network suggestions");
- asserts.assert_true(
- self.dut.droid.wifiRemoveNetworkSuggestions([]),
- "Failed to remove suggestions")
- # Trigger a disconnect and wait for the disconnect.
- self.dut.droid.wifiDisconnect()
- wutils.wait_for_disconnect(self.dut)
- self.dut.ed.clear_all_events()
+ self.remove_suggestions_disconnect_and_ensure_no_connection_back(
+ [], self.wpa_psk_2g[WifiEnums.SSID_KEY])
# Reverse the priority.
# Add suggestions & wait for the connection event.
@@ -228,7 +275,6 @@
self.wpa_psk_5g[WifiEnums.SSID_KEY],
None)
-
@test_tracker_info(uuid="b1d27eea-23c8-4c4f-b944-ef118e4cc35f")
def test_connect_to_wpa_psk_2g_with_post_connection_broadcast(self):
""" Adds a network suggestion and ensure that the device connected.
@@ -246,25 +292,8 @@
self.add_suggestions_and_ensure_connection(
[network_suggestion], self.wpa_psk_2g[WifiEnums.SSID_KEY],
True)
- self.dut.log.info("Removing network suggestions");
- asserts.assert_true(
- self.dut.droid.wifiRemoveNetworkSuggestions([network_suggestion]),
- "Failed to remove suggestions")
- # Ensure we did not disconnect
- wutils.ensure_no_disconnect(self.dut)
-
- # Trigger a disconnect and wait for the disconnect.
- self.dut.droid.wifiDisconnect()
- wutils.wait_for_disconnect(self.dut)
- self.dut.ed.clear_all_events()
-
- # Now ensure that we didn't connect back.
- asserts.assert_false(
- wutils.wait_for_connect(self.dut,
- self.wpa_psk_2g[WifiEnums.SSID_KEY],
- assert_on_fail=False),
- "Device should not connect back")
-
+ self.remove_suggestions_disconnect_and_ensure_no_connection_back(
+ [self.wpa_psk_2g], self.wpa_psk_2g[WifiEnums.SSID_KEY])
@test_tracker_info(uuid="a036a24d-29c0-456d-ae6a-afdde34da710")
def test_connect_to_wpa_psk_5g_reboot_config_store(self):
@@ -281,35 +310,45 @@
5. Wait for the device to connect to back to it.
6. Remove the suggestions and ensure the device does not connect back.
"""
- self.add_suggestions_and_ensure_connection(
- [self.wpa_psk_5g], self.wpa_psk_5g[WifiEnums.SSID_KEY],
- None)
+ self._test_connect_to_wifi_network_reboot_config_store(
+ [self.wpa_psk_5g], self.wpa_psk_5g)
- # Reboot and wait for connection back to the same suggestion.
- self.dut.reboot()
- time.sleep(DEFAULT_TIMEOUT)
+ @test_tracker_info(uuid="61649a2b-0f00-4272-9b9b-40ad5944da31")
+ def test_connect_to_wpa_ent_config_aka_reboot_config_store(self):
+ """
+ Adds a network suggestion and ensure that the device connects to it
+ after reboot.
- wutils.wait_for_connect(self.dut, self.wpa_psk_5g[WifiEnums.SSID_KEY])
+ Steps:
+ 1. Send a Enterprise AKA network suggestion to the device.
+ 2. Wait for the device to connect to it.
+ 3. Ensure that we did not receive the post connection broadcast.
+ 4. Reboot the device.
+ 5. Wait for the device to connect to the wifi network.
+ 6. Remove suggestions and ensure device doesn't connect back to it.
+ """
+ self._test_connect_to_wifi_network_reboot_config_store(
+ [self.config_aka], self.ent_network_2g)
- self.dut.log.info("Removing network suggestions");
- asserts.assert_true(
- self.dut.droid.wifiRemoveNetworkSuggestions([self.wpa_psk_5g]),
- "Failed to remove suggestions")
- # Ensure we did not disconnect
- wutils.ensure_no_disconnect(self.dut)
+ @test_tracker_info(uuid="98b2d40a-acb4-4a2f-aba1-b069e2a1d09d")
+ def test_connect_to_wpa_ent_config_ttls_pap_reboot_config_store(self):
+ """
+ Adds a network suggestion and ensure that the device connects to it
+ after reboot.
- # Trigger a disconnect and wait for the disconnect.
- self.dut.droid.wifiDisconnect()
- wutils.wait_for_disconnect(self.dut)
- self.dut.ed.clear_all_events()
+ Steps:
+ 1. Send a Enterprise TTLS PAP network suggestion to the device.
+ 2. Wait for the device to connect to it.
+ 3. Ensure that we did not receive the post connection broadcast.
+ 4. Reboot the device.
+ 5. Wait for the device to connect to the wifi network.
+ 6. Remove suggestions and ensure device doesn't connect back to it.
+ """
+ config = dict(self.config_ttls)
+ config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value
- # Now ensure that we didn't connect back.
- asserts.assert_false(
- wutils.wait_for_connect(self.dut,
- self.wpa_psk_5g[WifiEnums.SSID_KEY],
- assert_on_fail=False),
- "Device should not connect back")
-
+ self._test_connect_to_wifi_network_reboot_config_store(
+ [config], self.ent_network_2g)
@test_tracker_info(uuid="554b5861-22d0-4922-a5f4-712b4cf564eb")
def test_fail_to_connect_to_wpa_psk_5g_when_not_approved(self):
@@ -383,7 +422,7 @@
[network_suggestion], self.wpa_psk_2g[WifiEnums.SSID_KEY],
True)
- # Simulate user forgeting the ephemeral network.
+ # Simulate user forgetting the ephemeral network.
self.dut.droid.wifiDisableEphemeralNetwork(
self.wpa_psk_2g[WifiEnums.SSID_KEY])
wutils.wait_for_disconnect(self.dut)
@@ -397,3 +436,24 @@
self.wpa_psk_2g[WifiEnums.SSID_KEY],
assert_on_fail=False),
"Device should not connect back")
+
+ @test_tracker_info(uuid="93c86b05-fa56-4d79-ad27-009a16f691b1")
+ def test_connect_to_hidden_network(self):
+ """
+ Adds a network suggestion with hidden SSID config, ensure device can scan
+ and connect to this network.
+
+ Steps:
+ 1. Send a hidden network suggestion to the device.
+ 2. Wait for the device to connect to it.
+ 3. Ensure that we did not receive the post connection broadcast
+ (isAppInteractionRequired = False).
+ 4. Remove the suggestions and ensure the device does not connect back.
+ """
+ asserts.skip_if(not hasattr(self, "hidden_networks"), "No hidden networks, skip this test")
+
+ network_suggestion = self.hidden_network
+ self.add_suggestions_and_ensure_connection(
+ [network_suggestion], network_suggestion[WifiEnums.SSID_KEY], False)
+ self.remove_suggestions_disconnect_and_ensure_no_connection_back(
+ [network_suggestion], network_suggestion[WifiEnums.SSID_KEY])
diff --git a/acts/tests/google/wifi/WifiPasspointTest.py b/acts/tests/google/wifi/WifiPasspointTest.py
index 5ca9a49..b867faa 100755
--- a/acts/tests/google/wifi/WifiPasspointTest.py
+++ b/acts/tests/google/wifi/WifiPasspointTest.py
@@ -73,11 +73,13 @@
self.unknown_fqdn = UNKNOWN_FQDN
# Setup Uicd cli object for UI interation.
self.ui = UicdCli(self.uicd_zip[0], self.uicd_workflows)
+ self.passpoint_workflow = "passpoint-login_%s" % self.dut.model
def setup_test(self):
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
+ self.dut.unlock_screen()
def teardown_test(self):
@@ -180,7 +182,7 @@
"Passpoint Provisioning status %s" % dut_event['data'][
'status'])
if int(dut_event['data']['status']) == 7:
- self.ui.run(self.dut.serial, "passpoint-login")
+ self.ui.run(self.dut.serial, self.passpoint_workflow)
# Clear all previous events.
self.dut.ed.clear_all_events()
diff --git a/acts/tests/google/wifi/WifiScannerMultiScanTest.py b/acts/tests/google/wifi/WifiScannerMultiScanTest.py
index 1b33e57..491b07a 100755
--- a/acts/tests/google/wifi/WifiScannerMultiScanTest.py
+++ b/acts/tests/google/wifi/WifiScannerMultiScanTest.py
@@ -231,6 +231,14 @@
def __init__(self, controllers):
WifiBaseTest.__init__(self, controllers)
+ self.tests = (
+ 'test_wifi_two_scans_at_same_interval',
+ 'test_wifi_two_scans_at_different_interval',
+ 'test_wifi_scans_24GHz_and_both',
+ 'test_wifi_scans_5GHz_and_both',
+ 'test_wifi_scans_batch_and_24GHz',
+ 'test_wifi_scans_batch_and_5GHz',
+ 'test_wifi_scans_24GHz_5GHz_full_result',)
def setup_class(self):
# If running in a setup with attenuators, set attenuation on all
diff --git a/acts/tests/google/wifi/WifiScannerScanTest.py b/acts/tests/google/wifi/WifiScannerScanTest.py
index 9b06641..eaef028 100755
--- a/acts/tests/google/wifi/WifiScannerScanTest.py
+++ b/acts/tests/google/wifi/WifiScannerScanTest.py
@@ -61,19 +61,9 @@
"test_wifi_scanner_with_wifi_off",
"test_single_scan_report_each_scan_for_channels_with_enumerated_params",
"test_single_scan_report_each_scan_for_band_with_enumerated_params",
- "test_wifi_scanner_batch_scan_channel_sanity",
- "test_wifi_scanner_batch_scan_period_too_short",
- "test_batch_scan_report_buffer_full_for_channels_with_enumerated_params",
- "test_batch_scan_report_buffer_full_for_band_with_enumerated_params",
- "test_batch_scan_report_each_scan_for_channels_with_enumerated_params",
- "test_batch_scan_report_each_scan_for_band_with_enumerated_params",
"test_single_scan_report_full_scan_for_channels_with_enumerated_params",
"test_single_scan_report_full_scan_for_band_with_enumerated_params",
- "test_batch_scan_report_full_scan_for_channels_with_enumerated_params",
- "test_batch_scan_report_full_scan_for_band_with_enumerated_params",
- "test_wifi_connection_while_single_scan",
"test_single_scan_while_pno",
- "test_wifi_connection_and_pno_while_batch_scan",
"test_wifi_scanner_single_scan_in_isolated",
"test_wifi_scanner_with_invalid_numBssidsPerScan",
"test_wifi_scanner_dual_radio_low_latency",
@@ -776,50 +766,6 @@
len(scan_settings), scan_settings))
self.wifi_scanner_batch_scan_full(scan_settings[0])
- @test_tracker_info(uuid="740e1c18-911a-43d2-9317-3827ecf71d3b")
- def test_wifi_connection_while_single_scan(self):
- """Test configuring a connection parallel to wifi scanner single scan.
-
- 1. Start WifiScanner single scan for both band with default scan settings.
- 2. Configure a connection to reference network.
- 3. Verify that connection to reference network occurred.
- 2. Verify that scanner report single scan results.
- """
- self.attenuators[ATTENUATOR].set_atten(0)
- data = wutils.start_wifi_single_scan(self.dut,
- self.default_scan_setting)
- idx = data["Index"]
- scan_rt = data["ScanElapsedRealtime"]
- self.log.info("Wifi single shot scan started with index: {}".format(
- idx))
- asserts.assert_true(self.connect_to_reference_network(), NETWORK_ERROR)
- time.sleep(10) #wait for connection to be active
- asserts.assert_true(
- wutils.validate_connection(self.dut, self.ping_addr),
- "Error, No internet connection for current network")
- #generating event wait time from scan setting plus leeway
- scan_time, scan_channels = wutils.get_scan_time_and_channels(
- self.wifi_chs, self.default_scan_setting, self.stime_channel)
- wait_time = int(scan_time / 1000) + self.leeway
- validity = False
- try:
- event_name = "{}{}onResults".format(EVENT_TAG, idx)
- self.log.debug("Waiting for event: {} for time {}".format(
- event_name, wait_time))
- event = self.dut.ed.pop_event(event_name, wait_time)
- self.log.debug("Event received: {}".format(event))
- results = event["data"]["Results"]
- bssids, validity = self.proces_and_valid_batch_scan_result(
- results, scan_rt, event["data"][KEY_RET],
- self.default_scan_setting)
- self.log.info("Scan number Buckets: {}\nTotal BSSID: {}".format(
- len(results), bssids))
- asserts.assert_true(
- len(results) == 1 and bssids >= 1, EMPTY_RESULT)
- except queue.Empty as error:
- raise AssertionError(
- "Event did not triggered for single scan {}".format(error))
-
@test_tracker_info(uuid="e9a7cfb5-21c4-4c40-8169-8d88b65a1dee")
def test_single_scan_while_pno(self):
"""Test wifi scanner single scan parallel to PNO connection.
@@ -832,6 +778,13 @@
6. Verify connection occurred through PNO.
"""
self.log.info("Check connection through PNO for reference network")
+ self.attenuators[ATTENUATOR].set_atten(0)
+ asserts.assert_true(self.connect_to_reference_network(), NETWORK_ERROR)
+ time.sleep(10) #wait for connection to be active
+ asserts.assert_true(
+ wutils.validate_connection(self.dut, self.ping_addr),
+ "Error, No internet connection for current network")
+
current_network = self.dut.droid.wifiGetConnectionInfo()
self.log.info("Current network: {}".format(current_network))
asserts.assert_true('network_id' in current_network, NETWORK_ID_ERROR)
diff --git a/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py b/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py
index a359deb..f9d2b23 100644
--- a/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py
+++ b/acts/tests/google/wifi/p2p/functional/WifiP2pSnifferTest.py
@@ -25,7 +25,7 @@
from acts.test_utils.wifi.p2p.WifiP2pBaseTest import WifiP2pBaseTest
from acts.test_utils.wifi.p2p import wifi_p2p_test_utils as wp2putils
from acts.test_utils.wifi.p2p import wifi_p2p_const as p2pconsts
-from acts.controllers.ap_lib import hostapd_constants
+from acts.controllers.ap_lib.hostapd_constants import BAND_2G
from scapy.all import *
WPS_PBC = wp2putils.WifiP2PEnums.WpsInfo.WIFI_WPS_INFO_PBC
@@ -53,7 +53,7 @@
def setup_test(self):
super(WifiP2pSnifferTest, self).setup_test()
self.pcap_procs = wutils.start_pcap(
- self.packet_capture, '2g', self.log_path, self.test_name)
+ self.packet_capture, '2g', self.test_name)
def teardown_test(self):
self.verify_mac_no_leakage()
@@ -62,8 +62,7 @@
def configure_packet_capture(self):
"""Configure packet capture on the social channels."""
self.packet_capture = self.packet_capture[0]
- result = self.packet_capture.configure_monitor_mode(
- hostapd_constants.BAND_2G, 6)
+ result = self.packet_capture.configure_monitor_mode(BAND_2G, 6)
if not result:
raise ValueError("Failed to configure channel for 2G band")
@@ -72,8 +71,8 @@
self.log.info("Stopping packet capture")
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
# Verify factory MAC is not leaked in 2G pcaps
- pcap_fname = os.path.join(self.log_path, self.test_name,
- (self.test_name + '_2G.pcap'))
+ pcap_fname = '%s_%s.pcap' % (self.pcap_procs[BAND_2G][1],
+ BAND_2G.upper())
packets = rdpcap(pcap_fname)
wutils.verify_mac_not_found_in_pcap(self.dut1_mac, packets)
wutils.verify_mac_not_found_in_pcap(self.dut2_mac, packets)
diff --git a/acts/tests/google/wifi/rtt/functional/RangeAwareTest.py b/acts/tests/google/wifi/rtt/functional/RangeAwareTest.py
index 8c60e82..4eff048 100644
--- a/acts/tests/google/wifi/rtt/functional/RangeAwareTest.py
+++ b/acts/tests/google/wifi/rtt/functional/RangeAwareTest.py
@@ -274,22 +274,22 @@
"Missing (timed-out) results",
extras=extras)
asserts.assert_false(
- stats['any_lci_mismatch'], "LCI mismatch", extras=extras)
+ stats_reverse_direction['any_lci_mismatch'], "LCI mismatch", extras=extras)
asserts.assert_false(
- stats['any_lcr_mismatch'], "LCR mismatch", extras=extras)
+ stats_reverse_direction['any_lcr_mismatch'], "LCR mismatch", extras=extras)
asserts.assert_equal(
- stats['num_invalid_rssi'], 0, "Invalid RSSI", extras=extras)
+ stats_reverse_direction['num_invalid_rssi'], 0, "Invalid RSSI", extras=extras)
asserts.assert_true(
stats_reverse_direction['num_failures'] <=
self.rtt_max_failure_rate_two_sided_rtt_percentage *
- stats['num_results'] / 100,
+ stats_reverse_direction['num_results'] / 100,
"Failure rate is too high",
extras=extras)
if accuracy_evaluation:
asserts.assert_true(
stats_reverse_direction['num_range_out_of_margin'] <=
self.rtt_max_margin_exceeded_rate_two_sided_rtt_percentage *
- stats['num_success_results'] / 100,
+ stats_reverse_direction['num_success_results'] / 100,
"Results exceeding error margin rate is too high",
extras=extras)