[Multiple Tests] Cherry picked changes from git_master
Following changes are cherry picked from git_master.
- ag/13403527
- ag/13567815
- ag/13717566
- ag/13712306
- ag/13712970
- ag/13778838
Bug: 174705814
Fixes: 174705814
Test: Verified the changes
Merged-In: I4bda6b836eb979a498ee0683bec16e85c31c2ef6
Change-Id: I31692c9817b73c77ab8b261c846fbdd1c1044673
diff --git a/acts_tests/acts_contrib/test_utils/wifi/wifi_test_utils.py b/acts_tests/acts_contrib/test_utils/wifi/wifi_test_utils.py
index 42948c6..f421695 100755
--- a/acts_tests/acts_contrib/test_utils/wifi/wifi_test_utils.py
+++ b/acts_tests/acts_contrib/test_utils/wifi/wifi_test_utils.py
@@ -118,6 +118,7 @@
WPA3_SAE = "WPA3_SAE"
class CountryCode():
+ AUSTRALIA = "AU"
CHINA = "CN"
GERMANY = "DE"
JAPAN = "JP"
diff --git a/acts_tests/tests/google/net/CaptivePortalTest.py b/acts_tests/tests/google/net/CaptivePortalTest.py
index 9895069..eaafa25 100644
--- a/acts_tests/tests/google/net/CaptivePortalTest.py
+++ b/acts_tests/tests/google/net/CaptivePortalTest.py
@@ -82,13 +82,13 @@
"""Verify sign in notification shows for captive portal."""
curr_time = time.time()
while time.time() < curr_time + TIME_OUT:
+ time.sleep(3) # wait for sometime before checking the notification
screen_dump = uutils.get_screen_dump_xml(self.dut)
nodes = screen_dump.getElementsByTagName('node')
for node in nodes:
if SIGN_IN_NOTIFICATION in node.getAttribute(
'text') or CONNECTED in node.getAttribute('text'):
return
- time.sleep(3) # wait for sometime before checking the notification
asserts.fail("Failed to get sign in notification")
def _verify_captive_portal(self, network, click_accept=ACCEPT_CONTINUE):
@@ -116,11 +116,11 @@
# wait for sometime for captive portal connection to go through
curr_time = time.time()
while time.time() < curr_time + TIME_OUT:
+ time.sleep(3) # wait for sometime for AP to send DHCP info
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
asserts.assert_true(
diff --git a/acts_tests/tests/google/wifi/WifiEnterpriseRoamingTest.py b/acts_tests/tests/google/wifi/WifiEnterpriseRoamingTest.py
index b33579c..b6e33bb 100644
--- a/acts_tests/tests/google/wifi/WifiEnterpriseRoamingTest.py
+++ b/acts_tests/tests/google/wifi/WifiEnterpriseRoamingTest.py
@@ -13,12 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import pprint
-import random
import time
-from acts import asserts
-from acts import signals
from acts.test_decorators import test_tracker_info
from acts_contrib.test_utils.wifi import wifi_test_utils as wutils
from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest
@@ -45,7 +41,7 @@
self.dut = self.android_devices[0]
wutils.wifi_test_device_init(self.dut)
req_params = (
- "attn_vals",
+ "roaming_attn",
# Expected time within which roaming should finish, in seconds.
"roam_interval",
"ca_cert",
@@ -115,13 +111,13 @@
self.attn_b = self.attenuators[1]
# Set screen lock password so ConfigStore is unlocked.
self.dut.droid.setDevicePassword(self.device_password)
- self.set_attns("default")
+ wutils.set_attns(self.attenuators, "default")
def teardown_class(self):
wutils.reset_wifi(self.dut)
self.dut.droid.disableDevicePassword(self.device_password)
self.dut.ed.clear_all_events()
- self.set_attns("default")
+ wutils.set_attns(self.attenuators, "default")
def setup_test(self):
super().setup_test()
@@ -136,23 +132,7 @@
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
self.dut.droid.wifiStopTrackingStateChange()
- self.set_attns("default")
-
- def set_attns(self, attn_val_name):
- """Sets attenuation values on attenuators used in this test.
-
- Args:
- attn_val_name: Name of the attenuation value pair to use.
- """
- self.log.info("Set attenuation values to %s",
- self.attn_vals[attn_val_name])
- try:
- self.attn_a.set_atten(self.attn_vals[attn_val_name][0])
- self.attn_b.set_atten(self.attn_vals[attn_val_name][1])
- except:
- self.log.exception("Failed to set attenuation values %s.",
- attn_val_name)
- raise
+ wutils.set_attns(self.attenuators, "default")
def trigger_roaming_and_validate(self, attn_val_name, expected_con):
"""Sets attenuators to trigger roaming and validate the DUT connected
@@ -163,9 +143,9 @@
expected_con: The expected info of the network to we expect the DUT
to roam to.
"""
- self.set_attns(attn_val_name)
+ wutils.set_attns_steps(
+ self.attenuators, attn_val_name, self.roaming_attn)
self.log.info("Wait %ss for roaming to finish.", self.roam_interval)
- time.sleep(self.roam_interval)
try:
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
@@ -195,13 +175,14 @@
WifiEnums.SSID_KEY: self.ent_roaming_ssid,
WifiEnums.BSSID_KEY: self.bssid_b,
}
- self.set_attns("a_on_b_off")
- wutils.wifi_connect(self.dut, config)
+ wutils.set_attns_steps(
+ self.attenuators, "AP1_on_AP2_off", self.roaming_attn)
+ wutils.connect_to_wifi_network(self.dut, config)
wutils.verify_wifi_connection_info(self.dut, expected_con_to_a)
self.log.info("Roaming from %s to %s", self.bssid_a, self.bssid_b)
- self.trigger_roaming_and_validate("b_on_a_off", expected_con_to_b)
+ self.trigger_roaming_and_validate("AP1_off_AP2_on", expected_con_to_b)
self.log.info("Roaming from %s to %s", self.bssid_b, self.bssid_a)
- self.trigger_roaming_and_validate("a_on_b_off", expected_con_to_a)
+ self.trigger_roaming_and_validate("AP1_on_AP2_off", expected_con_to_a)
""" Tests Begin """
diff --git a/acts_tests/tests/google/wifi/WifiNetworkSuggestionTest.py b/acts_tests/tests/google/wifi/WifiNetworkSuggestionTest.py
index c2f4d0d..b196730 100644
--- a/acts_tests/tests/google/wifi/WifiNetworkSuggestionTest.py
+++ b/acts_tests/tests/google/wifi/WifiNetworkSuggestionTest.py
@@ -36,6 +36,7 @@
EapPhase2 = WifiEnums.EapPhase2
# Enterprise Config Macros
Ent = WifiEnums.Enterprise
+BOINGO = 1
ATT = 2
# Suggestion network Macros
Untrusted = "untrusted"
@@ -93,9 +94,9 @@
isinstance(self.hidden_networks, list):
self.hidden_network = self.hidden_networks[0]
if hasattr(self, "passpoint_networks"):
- self.passpoint_network = self.passpoint_networks[ATT]
+ self.passpoint_network = self.passpoint_networks[BOINGO]
self.passpoint_network[WifiEnums.SSID_KEY] = \
- self.passpoint_networks[ATT][WifiEnums.SSID_KEY][0]
+ self.passpoint_networks[BOINGO][WifiEnums.SSID_KEY][0]
self.dut.droid.wifiRemoveNetworkSuggestions([])
self.dut.adb.shell(
"pm disable com.google.android.apps.carrier.carrierwifi", ignore_status=True)
@@ -747,7 +748,9 @@
"""
asserts.skip_if(not hasattr(self, "passpoint_networks"),
"No passpoint networks, skip this test")
- passpoint_config = self.passpoint_network
+ passpoint_config = self.passpoint_networks[ATT]
+ passpoint_config[WifiEnums.SSID_KEY] = self.passpoint_networks[
+ ATT][WifiEnums.SSID_KEY][0]
asserts.skip_if("carrierId" not in passpoint_config,
"Not a SIM based passpoint network, skip this test")
diff --git a/acts_tests/tests/google/wifi/WifiPasspointTest.py b/acts_tests/tests/google/wifi/WifiPasspointTest.py
index a06999d..a7b319e 100755
--- a/acts_tests/tests/google/wifi/WifiPasspointTest.py
+++ b/acts_tests/tests/google/wifi/WifiPasspointTest.py
@@ -156,18 +156,21 @@
for _ in range(3):
self.dut.adb.shell("input swipe 300 900 300 300")
- # Enter username
- uutils.wait_and_input_text(self.dut,
- input_text=self.boingo_username,
- text="",
- class_name=EDIT_TEXT_CLASS_NAME)
- self.dut.adb.shell("input keyevent 111") # collapse keyboard
- self.dut.adb.shell("input swipe 300 900 300 750") # swipe up to show text
-
- # Enter password
- uutils.wait_and_input_text(self.dut,
- input_text=self.boingo_password,
- text=PASSWORD_TEXT)
+ # Enter username & password
+ screen_dump = uutils.get_screen_dump_xml(self.dut)
+ nodes = screen_dump.getElementsByTagName("node")
+ index = 0
+ for node in nodes:
+ if uutils.match_node(node, class_name="android.widget.EditText"):
+ x, y = eval(node.attributes["bounds"].value.split("][")[0][1:])
+ self.dut.adb.shell("input tap %s %s" % (x, y))
+ if index == 0:
+ self.dut.adb.shell("input text %s" % self.boingo_username)
+ index += 1
+ else:
+ self.dut.adb.shell("input text %s" % self.boingo_password)
+ break
+ self.dut.adb.shell("input keyevent 111")
self.dut.adb.shell("input keyevent 111") # collapse keyboard
self.dut.adb.shell("input swipe 300 900 300 750") # swipe up to show text
diff --git a/acts_tests/tests/google/wifi/WifiRoamingTest.py b/acts_tests/tests/google/wifi/WifiRoamingTest.py
index 7f8a2e5..8dd8776 100644
--- a/acts_tests/tests/google/wifi/WifiRoamingTest.py
+++ b/acts_tests/tests/google/wifi/WifiRoamingTest.py
@@ -14,10 +14,13 @@
# limitations under the License.
from acts import asserts
+from acts import utils
from acts.test_decorators import test_tracker_info
from acts_contrib.test_utils.wifi import wifi_test_utils as wutils
from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest
+WifiEnums = wutils.WifiEnums
+
class WifiRoamingTest(WifiBaseTest):
@@ -26,20 +29,13 @@
super().setup_class()
self.dut = self.android_devices[0]
+ self.dut_client = self.android_devices[1]
wutils.wifi_test_device_init(self.dut)
req_params = ["roaming_attn",]
self.unpack_userparams(req_param_names=req_params,)
if "AccessPoint" in self.user_params:
self.legacy_configure_ap_and_start(ap_count=2)
- elif "OpenWrtAP" in self.user_params:
- self.configure_openwrt_ap_and_start(open_network=True,
- wpa_network=True,
- owe_network=True,
- sae_network=True,
- ap_count=2,
- mirror_ap=True)
- self.log.info("BSSID map: %s" % self.bssid_map)
def teardown_class(self):
self.dut.ed.clear_all_events()
@@ -59,6 +55,12 @@
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
wutils.set_attns(self.attenuators, "default")
+ for ad in self.android_devices:
+ wutils.set_wifi_country_code(
+ ad, wutils.WifiEnums.CountryCode.US)
+ if "OpenWrtAP" in self.user_params:
+ for ap in self.access_points:
+ ap.close()
### Helper Methods ###
@@ -89,6 +91,11 @@
@test_tracker_info(uuid="db8a46f9-713f-4b98-8d9f-d36319905b0a")
def test_roaming_between_AP1_to_AP2_open_2g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(open_network=True,
+ ap_count=2,
+ mirror_ap=True)
+ self.log.info("BSSID map: %s" % self.bssid_map)
ap1_network = self.open_network[0]["2g"]
ap2_network = self.open_network[1]["2g"]
if "OpenWrtAP" in self.user_params:
@@ -98,6 +105,10 @@
@test_tracker_info(uuid="0db67d9b-6ea9-4f40-acf2-155c4ecf9dc5")
def test_roaming_between_AP1_to_AP2_open_5g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(open_network=True,
+ ap_count=2,
+ mirror_ap=True)
ap1_network = self.open_network[0]["5g"]
ap2_network = self.open_network[1]["5g"]
if "OpenWrtAP" in self.user_params:
@@ -107,6 +118,10 @@
@test_tracker_info(uuid="eabc7319-d962-4bef-b679-725e9ff00420")
def test_roaming_between_AP1_to_AP2_psk_2g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(wpa_network=True,
+ ap_count=2,
+ mirror_ap=True)
ap1_network = self.reference_networks[0]["2g"]
ap2_network = self.reference_networks[1]["2g"]
if "OpenWrtAP" in self.user_params:
@@ -116,6 +131,10 @@
@test_tracker_info(uuid="1cf9c681-4ff0-45c1-9719-f01629f6a7f7")
def test_roaming_between_AP1_to_AP2_psk_5g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(wpa_network=True,
+ ap_count=2,
+ mirror_ap=True)
ap1_network = self.reference_networks[0]["5g"]
ap2_network = self.reference_networks[1]["5g"]
if "OpenWrtAP" in self.user_params:
@@ -125,6 +144,10 @@
@test_tracker_info(uuid="a28f7d2e-fae4-4e66-b633-7ee59f8b46e0")
def test_roaming_between_AP1_to_AP2_owe_2g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(owe_network=True,
+ ap_count=2,
+ mirror_ap=True)
ap1_network = self.owe_networks[0]["2g"]
ap2_network = self.owe_networks[1]["2g"]
if "OpenWrtAP" in self.user_params:
@@ -134,6 +157,10 @@
@test_tracker_info(uuid="3c39110a-9336-4abd-b885-acbba85dc10d")
def test_roaming_between_AP1_to_AP2_owe_5g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(owe_network=True,
+ ap_count=2,
+ mirror_ap=True)
ap1_network = self.owe_networks[0]["5g"]
ap2_network = self.owe_networks[1]["5g"]
if "OpenWrtAP" in self.user_params:
@@ -143,6 +170,10 @@
@test_tracker_info(uuid="68b2baf6-162a-44f2-a00d-4973e5ac9471")
def test_roaming_between_AP1_to_AP2_sae_2g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(sae_network=True,
+ ap_count=2,
+ mirror_ap=True)
ap1_network = self.sae_networks[0]["2g"]
ap2_network = self.sae_networks[1]["2g"]
if "OpenWrtAP" in self.user_params:
@@ -152,6 +183,10 @@
@test_tracker_info(uuid="20e24ed3-0cd1-46dd-bd26-2183ffb443e6")
def test_roaming_between_AP1_to_AP2_sae_5g(self):
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(sae_network=True,
+ ap_count=2,
+ mirror_ap=True)
ap1_network = self.sae_networks[0]["5g"]
ap2_network = self.sae_networks[1]["5g"]
if "OpenWrtAP" in self.user_params:
@@ -159,6 +194,65 @@
ap2_network["bssid"] = self.bssid_map[1]["5g"][ap2_network["SSID"]]
self.roaming_from_AP1_and_AP2(ap1_network, ap2_network)
+ @test_tracker_info(uuid="")
+ def test_soft_2g_ap_channel_when_roam_to_chan_13(self):
+ """Verify softAp 2G channel when after roaming to network on channel 13.
+
+ Steps:
+ 1. Configure 2 APs - 1 on channel 6, the other on channel 13.
+ 2. Connect DUT to AP on channel 6.
+ 3. Start softAp on DUT on 2G band.
+ 4. Verify softAp is started on channel 6.
+ 5. Roam to AP2 with channel 13.
+ 6. Verify SoftAp on DUT changed to channel 13.
+ """
+ for ad in self.android_devices:
+ wutils.set_wifi_country_code(
+ ad, wutils.WifiEnums.CountryCode.AUSTRALIA)
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(open_network=True,
+ ap_count=2,
+ channel_2g_ap2=13,
+ mirror_ap=True)
+ ap1_network = self.open_network[0]["2g"]
+ ap2_network = self.open_network[1]["2g"]
+ if "OpenWrtAP" in self.user_params:
+ ap1_network["bssid"] = self.bssid_map[0]["2g"][ap1_network["SSID"]]
+ ap2_network["bssid"] = self.bssid_map[1]["2g"][ap2_network["SSID"]]
+ wutils.set_attns(self.attenuators, "AP1_on_AP2_off", self.roaming_attn)
+ wutils.connect_to_wifi_network(self.dut, ap1_network)
+
+ # start softap on 2G and verify the channel is 6.
+ sap_config = {
+ WifiEnums.SSID_KEY: "hotspot_%s" % utils.rand_ascii_str(6),
+ WifiEnums.PWD_KEY: "pass_%s" % utils.rand_ascii_str(6),
+ WifiEnums.AP_BAND_KEY: WifiEnums.WIFI_CONFIG_SOFTAP_BAND_2G}
+ asserts.assert_true(
+ self.dut.droid.wifiSetWifiApConfiguration(sap_config),
+ "Failed to set WifiAp Configuration")
+ wutils.start_wifi_tethering_saved_config(self.dut)
+ softap_conf = self.dut.droid.wifiGetApConfiguration()
+ self.log.info("softap conf: %s" % softap_conf)
+ wutils.connect_to_wifi_network(self.dut_client, sap_config)
+ conn_info = self.dut_client.droid.wifiGetConnectionInfo()
+ self.log.info("Wifi connection info on dut_client: %s" % conn_info)
+ softap_channel = wutils.WifiEnums.freq_to_channel[conn_info["frequency"]]
+ asserts.assert_true(softap_channel == 6,
+ "Dut client did not connect to softAp on channel 6")
+
+ # trigger roaming to AP2 with channel 13
+ self.log.info("Roaming from %s to %s", ap1_network, ap2_network)
+ wutils.trigger_roaming_and_validate(
+ self.dut, self.attenuators, "AP1_off_AP2_on", ap2_network,
+ self.roaming_attn)
+
+ # verify softap is now moved to channel 13
+ conn_info = self.dut_client.droid.wifiGetConnectionInfo()
+ self.log.info("Wifi connection info on dut_client: %s" % conn_info)
+ softap_channel = wutils.WifiEnums.freq_to_channel[conn_info["frequency"]]
+ asserts.assert_true(softap_channel == 13,
+ "Dut client did not connect to softAp on channel 13")
+
@test_tracker_info(uuid="3114d625-5cdd-4205-bb46-5a9d057dc80d")
def test_roaming_fail_psk_2g(self):
network = {'SSID':'test_roaming_fail', 'password':'roam123456@'}
diff --git a/acts_tests/tests/google/wifi/WifiSoftApTest.py b/acts_tests/tests/google/wifi/WifiSoftApTest.py
index 42bede1..8b53d82 100644
--- a/acts_tests/tests/google/wifi/WifiSoftApTest.py
+++ b/acts_tests/tests/google/wifi/WifiSoftApTest.py
@@ -99,6 +99,14 @@
super().setup_test()
for ad in self.android_devices:
wutils.wifi_toggle_state(ad, True)
+ if "chan_13" in self.test_name and "OpenWrtAP" in self.user_params:
+ self.access_points[0].close()
+ self.configure_openwrt_ap_and_start(open_network=True,
+ channel_2g=13)
+ self.open_network = self.open_network[0]["2g"]
+ for ad in self.android_devices:
+ wutils.set_wifi_country_code(
+ ad, wutils.WifiEnums.CountryCode.AUSTRALIA)
def teardown_test(self):
super().teardown_test()
@@ -108,6 +116,13 @@
if self.dut.droid.wifiIsApEnabled():
wutils.stop_wifi_tethering(self.dut)
wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
+ if "chan_13" in self.test_name and "OpenWrtAP" in self.user_params:
+ self.access_points[0].close()
+ self.configure_openwrt_ap_and_start(open_network=True)
+ self.open_network = self.open_network[0]["2g"]
+ for ad in self.android_devices:
+ wutils.set_wifi_country_code(
+ ad, wutils.WifiEnums.CountryCode.US)
""" Helper Functions """
def create_softap_config(self):
@@ -869,6 +884,36 @@
sap_band == WifiEnums.WIFI_CONFIG_SOFTAP_BAND_2G_5G,
"Soft AP didn't start in 5G preferred band")
wutils.connect_to_wifi_network(self.dut_client, wifi_network)
+
+ @test_tracker_info(uuid="")
+ def test_softp_2g_channel_when_connected_to_chan_13(self):
+ """Verify softAp 2G channel when connected to network on channel 13.
+
+ Steps:
+ 1. Configure AP in channel 13 on 2G band and connect DUT to it.
+ 2. Start softAp on DUT on 2G band.
+ 3. Verify softAp is started on channel 13.
+ """
+ asserts.skip_if("OpenWrtAP" not in self.user_params,
+ "Need openwrt AP to configure channel 13.")
+ wutils.connect_to_wifi_network(self.dut, self.open_network)
+ sap_config = self.create_softap_config()
+ sap_config[WifiEnums.AP_BAND_KEY] = WifiEnums.WIFI_CONFIG_SOFTAP_BAND_2G
+ asserts.assert_true(
+ self.dut.droid.wifiSetWifiApConfiguration(sap_config),
+ "Failed to set WifiAp Configuration")
+ wutils.start_wifi_tethering_saved_config(self.dut)
+ softap_conf = self.dut.droid.wifiGetApConfiguration()
+ self.log.info("softap conf: %s" % softap_conf)
+ wutils.connect_to_wifi_network(self.dut_client, sap_config)
+ softap_channel = self.dut_client.droid.wifiGetConnectionInfo(
+ )
+ conn_info = self.dut_client.droid.wifiGetConnectionInfo()
+ self.log.info("Wifi connection info on dut_client: %s" % conn_info)
+ softap_channel = wutils.WifiEnums.freq_to_channel[conn_info["frequency"]]
+ asserts.assert_true(softap_channel == 13,
+ "Dut client did not connect to softAp on channel 13")
+
""" Tests End """
diff --git a/acts_tests/tests/google/wifi/WifiStaConcurrencyNetworkRequestTest.py b/acts_tests/tests/google/wifi/WifiStaConcurrencyNetworkRequestTest.py
index de85650..7b030ee 100755
--- a/acts_tests/tests/google/wifi/WifiStaConcurrencyNetworkRequestTest.py
+++ b/acts_tests/tests/google/wifi/WifiStaConcurrencyNetworkRequestTest.py
@@ -29,8 +29,8 @@
WIFI_NETWORK_AP_CHANNEL_5G_DFS_1 = 132
WIFI_NETWORK_AP_CHANNEL_2G_2 = 2
-WIFI_NETWORK_AP_CHANNEL_5G_2 = 38
-WIFI_NETWORK_AP_CHANNEL_5G_DFS_2 = 134
+WIFI_NETWORK_AP_CHANNEL_5G_2 = 40
+WIFI_NETWORK_AP_CHANNEL_5G_DFS_2 = 136
class WifiStaConcurrencyNetworkRequestTest(WifiBaseTest):
"""STA + STA Tests for concurrency between intenet connectivity &