diff options
-rwxr-xr-x | acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py | 52 | ||||
-rwxr-xr-x | acts/tests/google/wifi/WifiStaApConcurrencyTest.py | 71 |
2 files changed, 66 insertions, 57 deletions
diff --git a/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py b/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py index bd78d2e4a5..080279eb72 100755 --- a/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py +++ b/acts/tests/google/wifi/WifiStaApConcurrencyStressTest.py @@ -110,41 +110,15 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): "Failed to enable WiFi verbose logging on the client dut.") """Helper Functions""" - - def verify_traffic_between_softap_clients(self): - ad1 = self.dut_client - ad2 = self.android_devices[2] - ad1_ip = ad1.droid.connectivityGetIPv4Addresses('wlan0')[0] - ad2_ip = ad2.droid.connectivityGetIPv4Addresses('wlan0')[0] - # Ping each other - asserts.assert_true( - utils.adb_shell_ping(ad1, count=10, dest_ip=ad2_ip, timeout=20), - "%s ping %s failed" % (ad1.serial, ad2_ip)) - asserts.assert_true( - utils.adb_shell_ping(ad2, count=10, dest_ip=ad1_ip, timeout=20), - "%s ping %s failed" % (ad2.serial, ad1_ip)) - - def verify_traffic_between_onhub_clients(self, interface): - ad1 = self.dut - ad2 = self.android_devices[2] - ad1_ip = ad1.droid.connectivityGetIPv4Addresses(interface)[0] - ad2_ip = ad2.droid.connectivityGetIPv4Addresses('wlan0')[0] - # Ping each other - asserts.assert_true( - utils.adb_shell_ping(ad1, count=10, dest_ip=ad2_ip, timeout=20), - "%s ping %s failed" % (ad1.serial, ad2_ip)) - asserts.assert_true( - utils.adb_shell_ping(ad2, count=10, dest_ip=ad1_ip, timeout=20), - "%s ping %s failed" % (ad2.serial, ad1_ip)) - - def verify_wifi_full_on_off(self, network, softap_config, interface): + def verify_wifi_full_on_off(self, network, softap_config): wutils.wifi_toggle_state(self.dut, True) self.connect_to_wifi_network_and_verify((network, self.dut)) self.run_iperf_client((network, self.dut)) self.run_iperf_client((softap_config, self.dut_client)) if len(self.android_devices) > 2: self.log.info("Testbed has extra android devices, do more validation") - self.verify_traffic_between_onhub_clients(interface) + self.verify_traffic_between_ap_clients( + self.dut, self.android_devices[2]) wutils.wifi_toggle_state(self.dut, False) def verify_softap_full_on_off(self, network, softap_band): @@ -153,7 +127,11 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): self.run_iperf_client((softap_config, self.dut_client)) if len(self.android_devices) > 2: self.log.info("Testbed has extra android devices, do more validation") - self.verify_traffic_between_softap_clients() + self.verify_traffic_between_softap_clients( + self.dut_client, self.android_devices[2]) + wutils.reset_wifi(self.dut_client) + if len(self.android_devices) > 2: + wutils.reset_wifi(self.android_devices[2]) wutils.stop_wifi_tethering(self.dut) """Tests""" @@ -258,7 +236,7 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): WIFI_CONFIG_APBAND_2G, check_connectivity=False) for count in range(self.stress_count): self.log.info("Iteration %d", count+1) - self.verify_wifi_full_on_off(self.wpapsk_2g, softap_config, 'wlan1') + self.verify_wifi_full_on_off(self.wpapsk_2g, softap_config) raise signals.TestPass(details="", extras={"Iterations":"%d" % self.stress_count, "Pass":"%d" %(count+1)}) @@ -271,7 +249,7 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): WIFI_CONFIG_APBAND_5G, check_connectivity=False) for count in range(self.stress_count): self.log.info("Iteration %d", count+1) - self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config, 'wlan1') + self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config) raise signals.TestPass(details="", extras={"Iterations":"%d" % self.stress_count, "Pass":"%d" %(count+1)}) @@ -284,7 +262,7 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): WIFI_CONFIG_APBAND_5G, check_connectivity=False) for count in range(self.stress_count): self.log.info("Iteration %d", count+1) - self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config, 'wlan1') + self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config) raise signals.TestPass(details="", extras={"Iterations":"%d" % self.stress_count, "Pass":"%d" %(count+1)}) @@ -297,7 +275,7 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): WIFI_CONFIG_APBAND_5G, check_connectivity=False) for count in range(self.stress_count): self.log.info("Iteration %d", count+1) - self.verify_wifi_full_on_off(self.wpapsk_2g, softap_config, 'wlan1') + self.verify_wifi_full_on_off(self.wpapsk_2g, softap_config) raise signals.TestPass(details="", extras={"Iterations":"%d" % self.stress_count, "Pass":"%d" %(count+1)}) @@ -310,7 +288,7 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): WIFI_CONFIG_APBAND_2G, check_connectivity=False) for count in range(self.stress_count): self.log.info("Iteration %d", count+1) - self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config, 'wlan1') + self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config) raise signals.TestPass(details="", extras={"Iterations":"%d" % self.stress_count, "Pass":"%d" %(count+1)}) @@ -323,7 +301,7 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): WIFI_CONFIG_APBAND_2G, check_connectivity=False) for count in range(self.stress_count): self.log.info("Iteration %d", count+1) - self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config, 'wlan1') + self.verify_wifi_full_on_off(self.wpapsk_5g, softap_config) raise signals.TestPass(details="", extras={"Iterations":"%d" % self.stress_count, "Pass":"%d" %(count+1)}) @@ -338,6 +316,6 @@ class WifiStaApConcurrencyStressTest(WifiStaApConcurrencyTest): WIFI_CONFIG_APBAND_5G, check_connectivity=False) for count in range(self.stress_count): self.log.info("Iteration %d", count+1) - self.verify_wifi_full_on_off(self.wpapsk_2g, softap_config, 'wlan0') + self.verify_wifi_full_on_off(self.wpapsk_2g, softap_config) raise signals.TestPass(details="", extras={"Iterations":"%d" % self.stress_count, "Pass":"%d" %(count+1)}) diff --git a/acts/tests/google/wifi/WifiStaApConcurrencyTest.py b/acts/tests/google/wifi/WifiStaApConcurrencyTest.py index 4615d435fe..b88d5c9fbe 100755 --- a/acts/tests/google/wifi/WifiStaApConcurrencyTest.py +++ b/acts/tests/google/wifi/WifiStaApConcurrencyTest.py @@ -271,14 +271,13 @@ class WifiStaApConcurrencyTest(WifiBaseTest): # Verify that both softap & wifi is enabled concurrently. self.verify_wifi_and_softap_enabled() - def start_softap_and_connect_to_wifi_network(self, nw_params, softap_band, interface): + def start_softap_and_connect_to_wifi_network(self, nw_params, softap_band): """Test concurrent wifi connection and softap. This helper method first starts SoftAp and then makes a wifi connection. Args: nw_params: Params for network STA connection. softap_band: Band for the AP. - interface: the wlan interface of DUT 1. Bring up softap and verify AP can be connected by a client device. 2. Bring up wifi. @@ -292,17 +291,8 @@ class WifiStaApConcurrencyTest(WifiBaseTest): self.run_iperf_client((softap_config, self.dut_client)) if len(self.android_devices) > 2: self.log.info("Testbed has extra android devices, do more validation") - ad1 = self.dut - ad2 = self.android_devices[2] - ad1_ip = ad1.droid.connectivityGetIPv4Addresses(interface)[0] - ad2_ip = ad2.droid.connectivityGetIPv4Addresses('wlan0')[0] - # Ping each other - asserts.assert_true( - utils.adb_shell_ping(ad1, count=10, dest_ip=ad2_ip, timeout=20), - "%s ping %s failed" % (ad1.serial, ad2_ip)) - asserts.assert_true( - utils.adb_shell_ping(ad2, count=10, dest_ip=ad1_ip, timeout=20), - "%s ping %s failed" % (ad2.serial, ad1_ip)) + self.verify_traffic_between_ap_clients( + self.dut, self.android_devices[2]) # Verify that both softap & wifi is enabled concurrently. self.verify_wifi_and_softap_enabled() @@ -314,6 +304,47 @@ class WifiStaApConcurrencyTest(WifiBaseTest): asserts.assert_true(self.dut.droid.wifiIsApEnabled(), "SoftAp is not reported as running") + def verify_traffic_between_softap_clients(self, ad1, ad2, num_of_tries=2): + """Test the clients that connect to DUT's softap can ping each other. + + Args: + num_of_tries: the retry times of ping test. + """ + ad1_ip = ad1.droid.connectivityGetIPv4Addresses('wlan0')[0] + ad2_ip = ad2.droid.connectivityGetIPv4Addresses('wlan0')[0] + # Ping each other + for _ in range(num_of_tries): + if utils.adb_shell_ping(ad1, count=10, dest_ip=ad2_ip, timeout=20): + break + else: + asserts.fail("%s ping %s failed" % (ad1.serial, ad2_ip)) + for _ in range(num_of_tries): + if utils.adb_shell_ping(ad2, count=10, dest_ip=ad1_ip, timeout=20): + break + else: + asserts.fail("%s ping %s failed" % (ad2.serial, ad1_ip)) + + def verify_traffic_between_ap_clients( + self, ad1, ad2, num_of_tries=2): + """Test the clients that connect to access point can ping each other. + + Args: + num_of_tries: the retry times of ping test. + """ + ad1_ip = ad1.droid.connectivityGetIPv4Addresses('wlan0')[0] + ad2_ip = ad2.droid.connectivityGetIPv4Addresses('wlan0')[0] + # Ping each other + for _ in range(num_of_tries): + if utils.adb_shell_ping(ad1, count=10, dest_ip=ad2_ip, timeout=20): + break + else: + asserts.fail("%s ping %s failed" % (ad1.serial, ad2_ip)) + for _ in range(num_of_tries): + if utils.adb_shell_ping(ad2, count=10, dest_ip=ad1_ip, timeout=20): + break + else: + asserts.fail("%s ping %s failed" % (ad2.serial, ad1_ip)) + """Tests""" @test_tracker_info(uuid="c396e7ac-cf22-4736-a623-aa6d3c50193a") def test_wifi_connection_2G_softap_2G(self): @@ -383,7 +414,7 @@ class WifiStaApConcurrencyTest(WifiBaseTest): """ self.configure_ap(channel_2g=WIFI_NETWORK_AP_CHANNEL_2G) self.start_softap_and_connect_to_wifi_network( - self.wpapsk_2g, WIFI_CONFIG_APBAND_2G, 'wlan1') + self.wpapsk_2g, WIFI_CONFIG_APBAND_2G) @test_tracker_info(uuid="5f954957-ad20-4de1-b20c-6c97d0463bdd") def test_softap_5G_wifi_connection_5G(self): @@ -391,7 +422,7 @@ class WifiStaApConcurrencyTest(WifiBaseTest): """ self.configure_ap(channel_5g=WIFI_NETWORK_AP_CHANNEL_5G) self.start_softap_and_connect_to_wifi_network( - self.wpapsk_5g, WIFI_CONFIG_APBAND_5G, 'wlan1') + self.wpapsk_5g, WIFI_CONFIG_APBAND_5G) @test_tracker_info(uuid="1306aafc-a07e-4654-ba78-674f90cf748e") def test_softap_5G_wifi_connection_5G_DFS(self): @@ -399,7 +430,7 @@ class WifiStaApConcurrencyTest(WifiBaseTest): """ self.configure_ap(channel_5g=WIFI_NETWORK_AP_CHANNEL_5G_DFS) self.start_softap_and_connect_to_wifi_network( - self.wpapsk_5g, WIFI_CONFIG_APBAND_5G, 'wlan1') + self.wpapsk_5g, WIFI_CONFIG_APBAND_5G) @test_tracker_info(uuid="5e28e8b5-3faa-4cff-a782-13a796d7f572") def test_softap_5G_wifi_connection_2G(self): @@ -407,7 +438,7 @@ class WifiStaApConcurrencyTest(WifiBaseTest): """ self.configure_ap(channel_2g=WIFI_NETWORK_AP_CHANNEL_2G) self.start_softap_and_connect_to_wifi_network( - self.wpapsk_2g, WIFI_CONFIG_APBAND_5G, 'wlan1') + self.wpapsk_2g, WIFI_CONFIG_APBAND_5G) @test_tracker_info(uuid="a2c62bc6-9ccd-4bc4-8a23-9a1b5d0b4b5c") def test_softap_2G_wifi_connection_5G(self): @@ -415,7 +446,7 @@ class WifiStaApConcurrencyTest(WifiBaseTest): """ self.configure_ap(channel_5g=WIFI_NETWORK_AP_CHANNEL_5G) self.start_softap_and_connect_to_wifi_network( - self.wpapsk_5g, WIFI_CONFIG_APBAND_2G, 'wlan1') + self.wpapsk_5g, WIFI_CONFIG_APBAND_2G) @test_tracker_info(uuid="a2c62bc6-9ccd-4bc4-8a23-9a1b5d0b4b5c") def test_softap_2G_wifi_connection_5G_DFS(self): @@ -423,7 +454,7 @@ class WifiStaApConcurrencyTest(WifiBaseTest): """ self.configure_ap(channel_5g=WIFI_NETWORK_AP_CHANNEL_5G_DFS) self.start_softap_and_connect_to_wifi_network( - self.wpapsk_5g, WIFI_CONFIG_APBAND_2G, 'wlan1') + self.wpapsk_5g, WIFI_CONFIG_APBAND_2G) @test_tracker_info(uuid="aa23a3fc-31a1-4d5c-8cf5-2eb9fdf9e7ce") def test_softap_5G_wifi_connection_2G_with_location_scan_on(self): @@ -433,7 +464,7 @@ class WifiStaApConcurrencyTest(WifiBaseTest): self.configure_ap(channel_2g=WIFI_NETWORK_AP_CHANNEL_2G) self.turn_location_on_and_scan_toggle_on() self.start_softap_and_connect_to_wifi_network( - self.wpapsk_2g, WIFI_CONFIG_APBAND_5G, 'wlan0') + self.wpapsk_2g, WIFI_CONFIG_APBAND_5G) # Now toggle wifi off & ensure we can still scan. wutils.wifi_toggle_state(self.dut, False) wutils.start_wifi_connection_scan_and_ensure_network_found( |