[Utils]Re-factor wifi_connect util
The wifi_connect() and eap_connect() seem to do the same thing
differently. This CL refactors wifi_connect() to handle both
eap and non-eap configs. The eap_connect() has been deprecated.
Relevant changes to the facade are in a differnt CL.
Every connection now waits on the WIFI_CONNECT_BY_CONFIG_CALLBACK.
The WIFI_ENTERPRISE_CONNECT_CALLBACK is removed.
While here, also made changes to the run_generated_testcases()
logic to work for methods that have a different argument list.
Bug: 33416299, 34079082
TEST: Ran enterprise and WifiManager tests.
Change-Id: I5e20404f3484a07488ebdffa1447b02fc49d315c
diff --git a/acts/tests/google/wifi/WifiEnterpriseTest.py b/acts/tests/google/wifi/WifiEnterpriseTest.py
index a73232b..257c7a0 100755
--- a/acts/tests/google/wifi/WifiEnterpriseTest.py
+++ b/acts/tests/google/wifi/WifiEnterpriseTest.py
@@ -162,7 +162,7 @@
True if connection failed as expected, False otherwise.
"""
with asserts.assert_raises(signals.TestFailure, extras=config):
- verdict = wutils.eap_connect(config, ad)
+ verdict = wutils.wifi_connect(ad, config)
asserts.explicit_pass("Connection failed as expected.")
def expand_config_by_phase2(self, config):
@@ -369,10 +369,9 @@
Returns:
True if the connection is successful and Internet access works.
"""
- wutils.eap_connect(config, *args)
ad = args[0]
- wutils.toggle_wifi_and_wait_for_reconnection(ad, config,
- num_of_tries=5)
+ wutils.wifi_connect(ad, config)
+ wutils.toggle_wifi_and_wait_for_reconnection(ad, config, num_of_tries=5)
"""Tests"""
@@ -398,10 +397,11 @@
eap_configs = self.gen_eap_configs()
self.log.info("Testing %d different configs.", len(eap_configs))
random.shuffle(eap_configs)
- failed = self.run_generated_testcases(wutils.eap_connect,
+ failed = self.run_generated_testcases(wutils.wifi_connect,
eap_configs,
args=(self.dut, ),
- name_func=self.gen_eap_test_name)
+ name_func=self.gen_eap_test_name,
+ format_args=True)
asserts.assert_equal(
len(failed), 0, "The following configs failed EAP connect test: %s"
% pprint.pformat(failed))
@@ -492,10 +492,11 @@
self.log.info("Testing %d different configs.", len(passpoint_configs))
random.shuffle(passpoint_configs)
failed = self.run_generated_testcases(
- wutils.eap_connect,
- passpoint_configs,
- args=(self.dut, ),
- name_func=self.gen_passpoint_test_name)
+ wutils.wifi_connect,
+ passpoint_configs,
+ args=(self.dut, ),
+ name_func=self.gen_passpoint_test_name,
+ format_args=True)
asserts.assert_equal(
len(failed), 0,
"The following configs failed passpoint connect test: %s" %