SoftApAcsTest: add retry logic when getting frequency after connect
Immediately after connection, RSSI poll may not
have happened yet, so frequency may still be -1.
Add retry logic to mitigate this.
Bug: 159658166
Test: Will be tested in continuous runs
Change-Id: I5a392fbead70db42117d877f5387e158e5e8ef65
diff --git a/acts/tests/google/wifi/WifiSoftApAcsTest.py b/acts/tests/google/wifi/WifiSoftApAcsTest.py
index df08f54..dc99381 100644
--- a/acts/tests/google/wifi/WifiSoftApAcsTest.py
+++ b/acts/tests/google/wifi/WifiSoftApAcsTest.py
@@ -35,6 +35,7 @@
WifiEnums = wutils.WifiEnums
WIFI_CONFIG_APBAND_AUTO = WifiEnums.WIFI_CONFIG_SOFTAP_BAND_2G_5G
+GET_FREQUENCY_NUM_RETRIES = 3
class WifiSoftApAcsTest(WifiBaseTest):
"""Tests for Automatic Channel Selection.
@@ -154,10 +155,15 @@
"""
wutils.connect_to_wifi_network(self.dut_client, softap,
check_connectivity=False)
- softap_info = self.dut_client.droid.wifiGetConnectionInfo()
- self.log.debug("DUT is connected to softAP %s with details: %s" %
- (softap[wutils.WifiEnums.SSID_KEY], softap_info))
- frequency = softap_info['frequency']
+ for _ in range(GET_FREQUENCY_NUM_RETRIES):
+ softap_info = self.dut_client.droid.wifiGetConnectionInfo()
+ self.log.debug("DUT is connected to softAP %s with details: %s" %
+ (softap[wutils.WifiEnums.SSID_KEY], softap_info))
+ frequency = softap_info['frequency']
+ if frequency > 0:
+ break
+ time.sleep(1) # frequency not updated yet, try again after a delay
+
return hostapd_constants.CHANNEL_MAP[frequency]
def configure_ap(self, channel_2g=None, channel_5g=None):