Merge 9b592f2f13ad76bd8e0d2d17f4efaa1d2ed21548 on remote branch
Change-Id: Ia073e0efb4e719b9f080ae3825641c07a52ce3c4
diff --git a/acts/framework/acts/controllers/openwrt_ap.py b/acts/framework/acts/controllers/openwrt_ap.py
index f7154b9..702c4e9 100644
--- a/acts/framework/acts/controllers/openwrt_ap.py
+++ b/acts/framework/acts/controllers/openwrt_ap.py
@@ -1,6 +1,7 @@
"""Controller for Open WRT access point."""
import time
+import yaml
from acts import logger
from acts.controllers.ap_lib import hostapd_constants
@@ -15,7 +16,10 @@
PSK_SECURITY = "psk2"
WEP_SECURITY = "wep"
ENT_SECURITY = "wpa2"
+OWE_SECURITY = "owe"
+SAE_SECURITY = "sae"
ENABLE_RADIO = "0"
+PMF_ENABLED = 2
WIFI_2G = "wifi2g"
WIFI_5G = "wifi5g"
@@ -148,6 +152,58 @@
self.ssh.run("wifi down")
time.sleep(9) # wait for sometime for AP to go down
+ def get_bssids_for_wifi_networks(self):
+ """Get BSSIDs for wifi networks configured.
+
+ Returns:
+ Dictionary of SSID - BSSID map for both bands.
+ """
+ bssid_map = {"2g": {}, "5g": {}}
+ for radio in ["radio0", "radio1"]:
+ ssid_ifname_map = self.get_ifnames_for_ssids(radio)
+ if radio == "radio0":
+ for ssid, ifname in ssid_ifname_map.items():
+ bssid_map["5g"][ssid] = self.get_bssid(ifname)
+ elif radio == "radio1":
+ for ssid, ifname in ssid_ifname_map.items():
+ bssid_map["2g"][ssid] = self.get_bssid(ifname)
+ return bssid_map
+
+ def get_ifnames_for_ssids(self, radio):
+ """Get interfaces for wifi networks.
+
+ Args:
+ radio: 2g or 5g radio get the bssids from.
+
+ Returns:
+ dictionary of ssid - ifname mappings.
+ """
+ ssid_ifname_map = {}
+ str_output = self.ssh.run("wifi status %s" % radio).stdout
+ wifi_status = yaml.load(str_output.replace("\t", "").replace("\n", ""),
+ Loader=yaml.FullLoader)
+ wifi_status = wifi_status[radio]
+ if wifi_status["up"]:
+ interfaces = wifi_status["interfaces"]
+ for config in interfaces:
+ ssid = config["config"]["ssid"]
+ ifname = config["ifname"]
+ ssid_ifname_map[ssid] = ifname
+ return ssid_ifname_map
+
+ def get_bssid(self, ifname):
+ """Get MAC address from an interface.
+
+ Args:
+ ifname: interface name of the corresponding MAC.
+
+ Returns:
+ BSSID of the interface.
+ """
+ ifconfig = self.ssh.run("ifconfig %s" % ifname).stdout
+ mac_addr = ifconfig.split("\n")[0].split()[-1]
+ return mac_addr
+
def generate_wireless_configs(self, wifi_configs):
"""Generate wireless configs to configure.
@@ -190,6 +246,23 @@
config["security"],
hostapd_constants.BAND_2G,
hidden=config["hiddenSSID"]))
+ elif config["security"] == OWE_SECURITY:
+ wireless_configs.append(
+ wireless_config.WirelessConfig("%s%s" % (WIFI_2G, num_2g),
+ config["SSID"],
+ config["security"],
+ hostapd_constants.BAND_2G,
+ hidden=config["hiddenSSID"],
+ ieee80211w=PMF_ENABLED))
+ elif config["security"] == SAE_SECURITY:
+ wireless_configs.append(
+ wireless_config.WirelessConfig("%s%s" % (WIFI_2G, num_2g),
+ config["SSID"],
+ config["security"],
+ hostapd_constants.BAND_2G,
+ password=config["password"],
+ hidden=config["hiddenSSID"],
+ ieee80211w=PMF_ENABLED))
elif config["security"] == ENT_SECURITY:
wireless_configs.append(
wireless_config.WirelessConfig(
@@ -227,6 +300,23 @@
config["security"],
hostapd_constants.BAND_5G,
hidden=config["hiddenSSID"]))
+ elif config["security"] == OWE_SECURITY:
+ wireless_configs.append(
+ wireless_config.WirelessConfig("%s%s" % (WIFI_5G, num_5g),
+ config["SSID"],
+ config["security"],
+ hostapd_constants.BAND_5G,
+ hidden=config["hiddenSSID"],
+ ieee80211w=PMF_ENABLED))
+ elif config["security"] == SAE_SECURITY:
+ wireless_configs.append(
+ wireless_config.WirelessConfig("%s%s" % (WIFI_5G, num_5g),
+ config["SSID"],
+ config["security"],
+ hostapd_constants.BAND_5G,
+ password=config["password"],
+ hidden=config["hiddenSSID"],
+ ieee80211w=PMF_ENABLED))
elif config["security"] == ENT_SECURITY:
wireless_configs.append(
wireless_config.WirelessConfig(
diff --git a/acts/framework/acts/controllers/openwrt_lib/wireless_config.py b/acts/framework/acts/controllers/openwrt_lib/wireless_config.py
index ea89636..7810fa2 100644
--- a/acts/framework/acts/controllers/openwrt_lib/wireless_config.py
+++ b/acts/framework/acts/controllers/openwrt_lib/wireless_config.py
@@ -19,6 +19,7 @@
radius_server_port: Port number of radius server.
radius_server_secret: Secret key of radius server.
hidden: Boolean, if the wifi network is hidden.
+ ieee80211w: PMF bit of the wifi network.
"""
def __init__(
@@ -34,7 +35,8 @@
radius_server_ip=None,
radius_server_port=None,
radius_server_secret=None,
- hidden=False):
+ hidden=False,
+ ieee80211w=None):
self.name = name
self.ssid = ssid
self.security = security
@@ -47,4 +49,5 @@
self.radius_server_port = radius_server_port
self.radius_server_secret = radius_server_secret
self.hidden = hidden
+ self.ieee80211w = ieee80211w
diff --git a/acts/framework/acts/controllers/openwrt_lib/wireless_settings_applier.py b/acts/framework/acts/controllers/openwrt_lib/wireless_settings_applier.py
index 5edec84..3c896aa 100644
--- a/acts/framework/acts/controllers/openwrt_lib/wireless_settings_applier.py
+++ b/acts/framework/acts/controllers/openwrt_lib/wireless_settings_applier.py
@@ -9,6 +9,8 @@
PSK_SECURITY = "psk2"
WEP_SECURITY = "wep"
ENT_SECURITY = "wpa2"
+OWE_SECURITY = "owe"
+SAE_SECURITY = "sae"
ENABLE_RADIO = "0"
DISABLE_RADIO = "1"
ENABLE_HIDDEN = "1"
@@ -96,7 +98,7 @@
(config.name, config.ssid))
self.ssh.run("uci set wireless.%s.encryption='%s'" %
(config.name, config.security))
- if config.security == PSK_SECURITY:
+ if config.security == PSK_SECURITY or config.security == SAE_SECURITY:
self.ssh.run("uci set wireless.%s.key='%s'" %
(config.name, config.password))
elif config.security == WEP_SECURITY:
@@ -111,6 +113,9 @@
(config.name, config.radius_server_ip))
self.ssh.run("uci set wireless.%s.auth_port='%s'" %
(config.name, config.radius_server_port))
+ if config.ieee80211w:
+ self.ssh.run("uci set wireless.%s.ieee80211w='%s'" %
+ (config.name, config.ieee80211w))
if config.hidden:
self.ssh.run("uci set wireless.%s.hidden='%s'" %
(config.name, ENABLE_HIDDEN))
diff --git a/acts/framework/acts/test_utils/net/net_test_utils.py b/acts/framework/acts/test_utils/net/net_test_utils.py
index b21c974..bfdc64d 100644
--- a/acts/framework/acts/test_utils/net/net_test_utils.py
+++ b/acts/framework/acts/test_utils/net/net_test_utils.py
@@ -21,9 +21,6 @@
from acts import signals
from acts import utils
from acts.controllers.adb import AdbError
-from acts.logger import epoch_to_log_line_timestamp
-from acts.utils import get_current_epoch_time
-from acts.logger import normalize_log_line_timestamp
from acts.utils import start_standing_subprocess
from acts.utils import stop_standing_subprocess
from acts.test_utils.net import connectivity_const as cconst
@@ -287,18 +284,9 @@
test_name: tcpdump file name will have this
"""
ad.log.info("Starting tcpdump on all interfaces")
- try:
- ad.adb.shell("killall -9 tcpdump")
- except AdbError:
- ad.log.warn("Killing existing tcpdump processes failed")
- out = ad.adb.shell("ls -l %s" % TCPDUMP_PATH)
- if "No such file" in out or not out:
- ad.adb.shell("mkdir %s" % TCPDUMP_PATH)
- else:
- ad.adb.shell("rm -rf %s/*" % TCPDUMP_PATH, ignore_status=True)
-
- begin_time = epoch_to_log_line_timestamp(get_current_epoch_time())
- begin_time = normalize_log_line_timestamp(begin_time)
+ ad.adb.shell("killall -9 tcpdump", ignore_status=True)
+ ad.adb.shell("mkdir %s" % TCPDUMP_PATH, ignore_status=True)
+ ad.adb.shell("rm -rf %s/*" % TCPDUMP_PATH, ignore_status=True)
file_name = "%s/tcpdump_%s_%s.pcap" % (TCPDUMP_PATH, ad.serial, test_name)
ad.log.info("tcpdump file is %s", file_name)
@@ -314,14 +302,16 @@
def stop_tcpdump(ad,
proc,
test_name,
+ pull_dump=True,
adb_pull_timeout=adb.DEFAULT_ADB_PULL_TIMEOUT):
"""Stops tcpdump on any iface
- Pulls the tcpdump file in the tcpdump dir
+ Pulls the tcpdump file in the tcpdump dir if necessary
Args:
ad: android device object.
proc: need to know which pid to stop
test_name: test name to save the tcpdump file
+ pull_dump: pull tcpdump file or not
adb_pull_timeout: timeout for adb_pull
Returns:
@@ -334,12 +324,15 @@
stop_standing_subprocess(proc)
except Exception as e:
ad.log.warning(e)
- log_path = os.path.join(ad.log_path, test_name)
- os.makedirs(log_path, exist_ok=True)
- ad.adb.pull("%s/. %s" % (TCPDUMP_PATH, log_path), timeout=adb_pull_timeout)
- ad.adb.shell("rm -rf %s/*" % TCPDUMP_PATH, ignore_status=True)
- file_name = "tcpdump_%s_%s.pcap" % (ad.serial, test_name)
- return "%s/%s" % (log_path, file_name)
+ if pull_dump:
+ log_path = os.path.join(ad.device_log_path, "TCPDUMP_%s" % ad.serial)
+ os.makedirs(log_path, exist_ok=True)
+ ad.adb.pull("%s/. %s" % (TCPDUMP_PATH, log_path),
+ timeout=adb_pull_timeout)
+ ad.adb.shell("rm -rf %s/*" % TCPDUMP_PATH, ignore_status=True)
+ file_name = "tcpdump_%s_%s.pcap" % (ad.serial, test_name)
+ return "%s/%s" % (log_path, file_name)
+ return None
def start_tcpdump_gce_server(ad, test_name, dest_port, gce):
""" Start tcpdump on gce server
diff --git a/acts/framework/acts/test_utils/wifi/WifiBaseTest.py b/acts/framework/acts/test_utils/wifi/WifiBaseTest.py
index e79d03e..2fb7d37 100644
--- a/acts/framework/acts/test_utils/wifi/WifiBaseTest.py
+++ b/acts/framework/acts/test_utils/wifi/WifiBaseTest.py
@@ -19,6 +19,7 @@
import copy
import itertools
+import os
import time
import acts.controllers.access_point as ap
@@ -34,6 +35,9 @@
from acts.controllers.ap_lib import hostapd_bss_settings
from acts.controllers.ap_lib import hostapd_constants
from acts.controllers.ap_lib import hostapd_security
+from acts.keys import Config
+from acts.test_utils.net import net_test_utils as nutils
+from acts.test_utils.wifi import wifi_test_utils as wutils
AP_1 = 0
AP_2 = 1
@@ -41,10 +45,78 @@
class WifiBaseTest(BaseTestClass):
+
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = False
+ self.packet_log_2g = hostapd_constants.AP_DEFAULT_CHANNEL_2G
+ self.packet_log_5g = hostapd_constants.AP_DEFAULT_CHANNEL_5G
+
def setup_class(self):
if hasattr(self, 'attenuators') and self.attenuators:
for attenuator in self.attenuators:
attenuator.set_atten(0)
+ opt_param = ["pixel_models", "cnss_diag_file"]
+ self.unpack_userparams(opt_param_names=opt_param)
+ if hasattr(self, "cnss_diag_file"):
+ if isinstance(self.cnss_diag_file, list):
+ self.cnss_diag_file = self.cnss_diag_file[0]
+ if not os.path.isfile(self.cnss_diag_file):
+ self.cnss_diag_file = os.path.join(
+ self.user_params[Config.key_config_path.value],
+ self.cnss_diag_file)
+ if self.enable_packet_log and hasattr(self, "packet_capture"):
+ self.packet_logger = self.packet_capture[0]
+ self.packet_logger.configure_monitor_mode("2G", self.packet_log_2g)
+ self.packet_logger.configure_monitor_mode("5G", self.packet_log_5g)
+
+ def setup_test(self):
+ if (hasattr(self, "android_devices") and
+ hasattr(self, "cnss_diag_file") and
+ hasattr(self, "pixel_models")):
+ wutils.start_cnss_diags(
+ self.android_devices, self.cnss_diag_file, self.pixel_models)
+ self.tcpdump_proc = []
+ if hasattr(self, "android_devices"):
+ for ad in self.android_devices:
+ proc = nutils.start_tcpdump(ad, self.test_name)
+ self.tcpdump_proc.append((ad, proc))
+ if hasattr(self, "packet_logger"):
+ self.packet_log_pid = wutils.start_pcap(
+ self.packet_logger, 'dual', self.test_name)
+
+ def teardown_test(self):
+ if (hasattr(self, "android_devices") and
+ hasattr(self, "cnss_diag_file") and
+ hasattr(self, "pixel_models")):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(
+ proc[0], proc[1], self.test_name, pull_dump=False)
+ self.tcpdump_proc = []
+ if hasattr(self, "packet_logger") and self.packet_log_pid:
+ wutils.stop_pcap(
+ self.packet_logger, self.packet_log_pid, test_status=True)
+ self.packet_log_pid = {}
+
+ def on_fail(self, test_name, begin_time):
+ if hasattr(self, "android_devices"):
+ for ad in self.android_devices:
+ ad.take_bug_report(test_name, begin_time)
+ ad.cat_adb_log(test_name, begin_time)
+ wutils.get_ssrdumps(ad)
+ if (hasattr(self, "cnss_diag_file") and
+ hasattr(self, "pixel_models")):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for ad in self.android_devices:
+ wutils.get_cnss_diag_log(ad)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(proc[0], proc[1], self.test_name)
+ self.tcpdump_proc = []
+ if hasattr(self, "packet_logger") and self.packet_log_pid:
+ wutils.stop_pcap(
+ self.packet_logger, self.packet_log_pid, test_status=False)
+ self.packet_log_pid = {}
def get_psk_network(
self,
@@ -123,7 +195,8 @@
hidden=False,
same_ssid=False,
ssid_length_2g=hostapd_constants.AP_SSID_LENGTH_2G,
- ssid_length_5g=hostapd_constants.AP_SSID_LENGTH_5G):
+ ssid_length_5g=hostapd_constants.AP_SSID_LENGTH_5G,
+ security_mode='none'):
"""Generates SSIDs for a open network using a random generator.
Args:
@@ -134,6 +207,7 @@
SSID.
ssid_length_2g: Int, number of characters to use for 2G SSID.
ssid_length_5g: Int, number of characters to use for 5G SSID.
+ security_mode: 'none' for open and 'OWE' for WPA3 OWE.
Returns: A dict of 2G and 5G network lists for hostapd configuration.
@@ -151,13 +225,13 @@
network_dict_2g = {
"SSID": open_2g_ssid,
- "security": 'none',
+ "security": security_mode,
"hiddenSSID": hidden
}
network_dict_5g = {
"SSID": open_5g_ssid,
- "security": 'none',
+ "security": security_mode,
"hiddenSSID": hidden
}
@@ -311,6 +385,8 @@
wep_network=False,
ent_network=False,
ent_network_pwd=False,
+ owe_network=False,
+ sae_network=False,
radius_conf_2g=None,
radius_conf_5g=None,
radius_conf_pwd=None,
@@ -330,18 +406,26 @@
wep_network: Boolean, to check if wep network should be configured.
ent_network: Boolean, to check if ent network should be configured.
ent_network_pwd: Boolean, to check if ent pwd network should be configured.
+ owe_network: Boolean, to check if owe network should be configured.
+ sae_network: Boolean, to check if sae network should be configured.
radius_conf_2g: dictionary with enterprise radius server details.
radius_conf_5g: dictionary with enterprise radius server details.
radius_conf_pwd: dictionary with enterprise radiuse server details.
ap_count: APs to configure.
"""
+ if mirror_ap and ap_count == 1:
+ raise ValueError("ap_count cannot be 1 if mirror_ap is True.")
+
self.reference_networks = []
self.wpa_networks = []
self.wep_networks = []
self.ent_networks = []
self.ent_networks_pwd = []
self.open_network = []
- for _ in range(ap_count):
+ self.owe_networks = []
+ self.sae_networks = []
+ self.bssid_map = []
+ for i in range(ap_count):
network_list = []
if wpa_network:
wpa_dict = self.get_psk_network(mirror_ap,
@@ -396,10 +480,44 @@
ssid_length_2g,
ssid_length_5g)
network_list.append(open_dict)
- self.access_points[_].configure_ap(network_list,
+ if owe_network:
+ owe_dict = self.get_open_network(mirror_ap,
+ self.owe_networks,
+ hidden,
+ same_ssid,
+ ssid_length_2g,
+ ssid_length_5g,
+ "OWE")
+ owe_dict[hostapd_constants.BAND_2G]["security"] = "owe"
+ owe_dict[hostapd_constants.BAND_5G]["security"] = "owe"
+ network_list.append(owe_dict)
+ if sae_network:
+ sae_dict = self.get_psk_network(mirror_ap,
+ self.sae_networks,
+ hidden,
+ same_ssid,
+ hostapd_constants.WPA3_KEY_MGMT,
+ ssid_length_2g,
+ ssid_length_5g,
+ passphrase_length_2g,
+ passphrase_length_5g)
+ sae_dict[hostapd_constants.BAND_2G]["security"] = "sae"
+ sae_dict[hostapd_constants.BAND_5G]["security"] = "sae"
+ network_list.append(sae_dict)
+ self.access_points[i].configure_ap(network_list,
channel_2g,
channel_5g)
- self.access_points[_].start_ap()
+ self.access_points[i].start_ap()
+ self.bssid_map.append(
+ self.access_points[i].get_bssids_for_wifi_networks())
+ if mirror_ap:
+ self.access_points[i+1].configure_ap(network_list,
+ channel_2g,
+ channel_5g)
+ self.access_points[i+1].start_ap()
+ self.bssid_map.append(
+ self.access_points[i+1].get_bssids_for_wifi_networks())
+ break
def legacy_configure_ap_and_start(
self,
diff --git a/acts/framework/acts/test_utils/wifi/aware/AwareBaseTest.py b/acts/framework/acts/test_utils/wifi/aware/AwareBaseTest.py
index 0bf32ac..42287aa 100644
--- a/acts/framework/acts/test_utils/wifi/aware/AwareBaseTest.py
+++ b/acts/framework/acts/test_utils/wifi/aware/AwareBaseTest.py
@@ -14,9 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+
from acts import asserts
from acts import utils
from acts.base_test import BaseTestClass
+from acts.keys import Config
+from acts.test_utils.net import net_test_utils as nutils
from acts.test_utils.wifi import wifi_test_utils as wutils
from acts.test_utils.wifi.aware import aware_const as aconsts
from acts.test_utils.wifi.aware import aware_test_utils as autils
@@ -31,11 +35,31 @@
# at the same time - which can lead to very long clustering times.
device_startup_offset = 2
+ def setup_class(self):
+ opt_param = ["pixel_models", "cnss_diag_file"]
+ self.unpack_userparams(opt_param_names=opt_param)
+ if hasattr(self, "cnss_diag_file"):
+ if isinstance(self.cnss_diag_file, list):
+ self.cnss_diag_file = self.cnss_diag_file[0]
+ if not os.path.isfile(self.cnss_diag_file):
+ self.cnss_diag_file = os.path.join(
+ self.user_params[Config.key_config_path.value],
+ self.cnss_diag_file)
+
def setup_test(self):
required_params = ("aware_default_power_mode",
"dbs_supported_models",)
self.unpack_userparams(required_params)
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.start_cnss_diags(
+ self.android_devices, self.cnss_diag_file, self.pixel_models)
+ self.tcpdump_proc = []
+ if hasattr(self, "android_devices"):
+ for ad in self.android_devices:
+ proc = nutils.start_tcpdump(ad, self.test_name)
+ self.tcpdump_proc.append((ad, proc))
+
for ad in self.android_devices:
ad.droid.wifiEnableVerboseLogging(1)
asserts.skip_if(
@@ -62,6 +86,12 @@
ad.ed.clear_all_events()
def teardown_test(self):
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(
+ proc[0], proc[1], self.test_name, pull_dump=False)
+ self.tcpdump_proc = []
for ad in self.android_devices:
if not ad.droid.doesDeviceSupportWifiAwareFeature():
return
@@ -113,3 +143,11 @@
for ad in self.android_devices:
ad.take_bug_report(test_name, begin_time)
ad.cat_adb_log(test_name, begin_time)
+ wutils.get_ssrdumps(ad)
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for ad in self.android_devices:
+ wutils.get_cnss_diag_log(ad)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(proc[0], proc[1], self.test_name)
+ self.tcpdump_proc = []
diff --git a/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py b/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py
index 1c5a53f..5c41aae 100644
--- a/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py
+++ b/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py
@@ -15,12 +15,15 @@
# limitations under the License.
import acts.utils
+import os
import re
import time
from acts import asserts
from acts import utils
from acts.base_test import BaseTestClass
+from acts.keys import Config
+from acts.test_utils.net import net_test_utils as nutils
from acts.test_utils.wifi import wifi_test_utils as wutils
from acts.test_utils.wifi.p2p import wifi_p2p_const as p2pconsts
@@ -37,7 +40,8 @@
ad.droid.wakeLockAcquireBright()
ad.droid.wakeUpNow()
required_params = ()
- optional_params = ("skip_read_factory_mac", )
+ optional_params = (
+ "skip_read_factory_mac", "pixel_models", "cnss_diag_file")
self.unpack_userparams(required_params,
optional_params,
skip_read_factory_mac=0)
@@ -84,6 +88,13 @@
"DUT3's p2p should be initialized but it didn't")
self.dut3.name = "Android_" + self.dut3.serial
self.dut3.droid.wifiP2pSetDeviceName(self.dut3.name)
+ if hasattr(self, "cnss_diag_file"):
+ if isinstance(self.cnss_diag_file, list):
+ self.cnss_diag_file = self.cnss_diag_file[0]
+ if not os.path.isfile(self.cnss_diag_file):
+ self.cnss_diag_file = os.path.join(
+ self.user_params[Config.key_config_path.value],
+ self.cnss_diag_file)
def teardown_class(self):
self.dut1.droid.wifiP2pClose()
@@ -99,10 +110,25 @@
ad.droid.goToSleepNow()
def setup_test(self):
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.start_cnss_diags(
+ self.android_devices, self.cnss_diag_file, self.pixel_models)
+ self.tcpdump_proc = []
+ if hasattr(self, "android_devices"):
+ for ad in self.android_devices:
+ proc = nutils.start_tcpdump(ad, self.test_name)
+ self.tcpdump_proc.append((ad, proc))
+
for ad in self.android_devices:
ad.ed.clear_all_events()
def teardown_test(self):
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(
+ proc[0], proc[1], self.test_name, pull_dump=False)
+ self.tcpdump_proc = []
for ad in self.android_devices:
# Clear p2p group info
ad.droid.wifiP2pRequestPersistentGroupInfo()
@@ -117,6 +143,14 @@
for ad in self.android_devices:
ad.take_bug_report(test_name, begin_time)
ad.cat_adb_log(test_name, begin_time)
+ wutils.get_ssrdumps(ad)
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for ad in self.android_devices:
+ wutils.get_cnss_diag_log(ad)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(proc[0], proc[1], self.test_name)
+ self.tcpdump_proc = []
def get_p2p_mac_address(self, dut):
"""Gets the current MAC address being used for Wi-Fi Direct."""
diff --git a/acts/framework/acts/test_utils/wifi/rtt/RttBaseTest.py b/acts/framework/acts/test_utils/wifi/rtt/RttBaseTest.py
index 5a7dcda..90c87bd 100644
--- a/acts/framework/acts/test_utils/wifi/rtt/RttBaseTest.py
+++ b/acts/framework/acts/test_utils/wifi/rtt/RttBaseTest.py
@@ -14,15 +14,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+
from acts import asserts
from acts import utils
from acts.base_test import BaseTestClass
+from acts.keys import Config
+from acts.test_utils.net import net_test_utils as nutils
from acts.test_utils.wifi import wifi_test_utils as wutils
from acts.test_utils.wifi.rtt import rtt_const as rconsts
from acts.test_utils.wifi.rtt import rtt_test_utils as rutils
class RttBaseTest(BaseTestClass):
+
+ def setup_class(self):
+ opt_param = ["pixel_models", "cnss_diag_file"]
+ self.unpack_userparams(opt_param_names=opt_param)
+ if hasattr(self, "cnss_diag_file"):
+ if isinstance(self.cnss_diag_file, list):
+ self.cnss_diag_file = self.cnss_diag_file[0]
+ if not os.path.isfile(self.cnss_diag_file):
+ self.cnss_diag_file = os.path.join(
+ self.user_params[Config.key_config_path.value],
+ self.cnss_diag_file)
+
def setup_test(self):
required_params = ("lci_reference", "lcr_reference",
"rtt_reference_distance_mm",
@@ -38,6 +54,15 @@
self.rtt_max_margin_exceeded_rate_one_sided_rtt_percentage = 50
self.rtt_min_expected_rssi_dbm = -100
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.start_cnss_diags(
+ self.android_devices, self.cnss_diag_file, self.pixel_models)
+ self.tcpdump_proc = []
+ if hasattr(self, "android_devices"):
+ for ad in self.android_devices:
+ proc = nutils.start_tcpdump(ad, self.test_name)
+ self.tcpdump_proc.append((ad, proc))
+
for ad in self.android_devices:
utils.set_location_service(ad, True)
ad.droid.wifiEnableVerboseLogging(1)
@@ -55,6 +80,12 @@
ad.rtt_capabilities = rutils.get_rtt_capabilities(ad)
def teardown_test(self):
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(
+ proc[0], proc[1], self.test_name, pull_dump=False)
+ self.tcpdump_proc = []
for ad in self.android_devices:
if not ad.droid.doesDeviceSupportWifiRttFeature():
return
@@ -66,3 +97,11 @@
for ad in self.android_devices:
ad.take_bug_report(test_name, begin_time)
ad.cat_adb_log(test_name, begin_time)
+ wutils.get_ssrdumps(ad)
+ if hasattr(self, "cnss_diag_file") and hasattr(self, "pixel_models"):
+ wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ for ad in self.android_devices:
+ wutils.get_cnss_diag_log(ad)
+ for proc in self.tcpdump_proc:
+ nutils.stop_tcpdump(proc[0], proc[1], self.test_name)
+ self.tcpdump_proc = []
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 360c301..a55cfce 100755
--- a/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
+++ b/acts/framework/acts/test_utils/wifi/wifi_test_utils.py
@@ -2308,7 +2308,7 @@
-def get_ssrdumps(ad, test_name=""):
+def get_ssrdumps(ad):
"""Pulls dumps in the ssrdump dir
Args:
ad: android device object.
@@ -2317,8 +2317,7 @@
logs = ad.get_file_names("/data/vendor/ssrdump/")
if logs:
ad.log.info("Pulling ssrdumps %s", logs)
- log_path = os.path.join(ad.log_path, test_name,
- "SSRDUMP_%s" % ad.serial)
+ log_path = os.path.join(ad.device_log_path, "SSRDUMPS_%s" % ad.serial)
os.makedirs(log_path, exist_ok=True)
ad.pull_files(logs, log_path)
ad.adb.shell("find /data/vendor/ssrdump/ -type f -delete")
@@ -2446,11 +2445,10 @@
ad.adb.shell("setprop %s false" % prop, ignore_status=True)
-def get_cnss_diag_log(ad, test_name=""):
+def get_cnss_diag_log(ad):
"""Pulls the cnss_diag logs in the wlan_logs dir
Args:
ad: android device object.
- test_name: test case name
"""
logs = ad.get_file_names("/data/vendor/wifi/cnss_diag/wlan_logs/")
if logs:
diff --git a/acts/framework/setup.py b/acts/framework/setup.py
index 6eb41e1..c7ca732 100755
--- a/acts/framework/setup.py
+++ b/acts/framework/setup.py
@@ -48,6 +48,15 @@
'paramiko-ng',
]
+if sys.version_info < (3, 6):
+ replacements = {
+ 'tzlocal': 'tzlocal<=2.1',
+ 'numpy': 'numpy<=1.18.1',
+ }
+ install_requires = [replacements[pkg] if pkg in replacements else pkg for pkg in
+ install_requires]
+ install_requires.append('scipy<=1.4.1')
+
if sys.version_info < (3, ):
install_requires.append('enum34')
install_requires.append('statistics')
diff --git a/acts/tests/google/wifi/WifiAutoUpdateTest.py b/acts/tests/google/wifi/WifiAutoUpdateTest.py
index 4ce81d9..5d2dd6f 100755
--- a/acts/tests/google/wifi/WifiAutoUpdateTest.py
+++ b/acts/tests/google/wifi/WifiAutoUpdateTest.py
@@ -98,17 +98,15 @@
"Failed up apply OTA update. Aborting tests: %s" % e)
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiChannelSwitchStressTest.py b/acts/tests/google/wifi/WifiChannelSwitchStressTest.py
index f76331e..bdba6e1 100644
--- a/acts/tests/google/wifi/WifiChannelSwitchStressTest.py
+++ b/acts/tests/google/wifi/WifiChannelSwitchStressTest.py
@@ -59,6 +59,7 @@
wutils.set_wifi_country_code(ad, WifiEnums.CountryCode.US)
def setup_test(self):
+ super().setup_test()
for ad in self.android_devices:
ad.droid.wakeLockAcquireBright()
ad.droid.wakeUpNow()
@@ -78,6 +79,7 @@
WifiEnums.NONE_DFS_5G_FREQUENCIES)
def teardown_test(self):
+ super().teardown_test()
for ad in self.android_devices:
ad.droid.wakeLockRelease()
ad.droid.goToSleepNow()
@@ -92,9 +94,7 @@
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
except signals.TestFailure:
pass
- for ad in self.android_devices:
- ad.take_bug_report(test_name, begin_time)
- ad.cat_adb_log(test_name, begin_time)
+ super().on_fail(test_name, begin_time)
def check_cell_data_and_enable(self):
"""Make sure that cell data is enabled if there is a sim present.
diff --git a/acts/tests/google/wifi/WifiChaosTest.py b/acts/tests/google/wifi/WifiChaosTest.py
index d0a3722..77a83ec 100755
--- a/acts/tests/google/wifi/WifiChaosTest.py
+++ b/acts/tests/google/wifi/WifiChaosTest.py
@@ -112,6 +112,7 @@
self.randomize_testcases()
def setup_class(self):
+ super().setup_class()
self.dut = self.android_devices[0]
self.admin = 'admin' + str(random.randint(1000001, 12345678))
wutils.wifi_test_device_init(self.dut)
@@ -155,6 +156,7 @@
return True
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
@@ -165,10 +167,10 @@
# Sleep to ensure all failed packets are captured.
time.sleep(5)
wutils.stop_pcap(self.pcap, self.pcap_procs, False)
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
+ super().on_fail(test_name, begin_time)
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
diff --git a/acts/tests/google/wifi/WifiConnectedMacRandomizationTest.py b/acts/tests/google/wifi/WifiConnectedMacRandomizationTest.py
index bd10a8b..14eafab 100644
--- a/acts/tests/google/wifi/WifiConnectedMacRandomizationTest.py
+++ b/acts/tests/google/wifi/WifiConnectedMacRandomizationTest.py
@@ -83,21 +83,19 @@
self.wpapsk_5g = self.reference_networks[0]["5g"]
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
wutils.wifi_toggle_state(self.dut, True)
wutils.wifi_toggle_state(self.dut_softap, False)
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
wutils.reset_wifi(self.dut_softap)
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
wutils.stop_wifi_tethering(self.dut_softap)
self.reset_mac_address_to_factory_mac()
diff --git a/acts/tests/google/wifi/WifiCrashStressTest.py b/acts/tests/google/wifi/WifiCrashStressTest.py
index 837112a..02584ef 100644
--- a/acts/tests/google/wifi/WifiCrashStressTest.py
+++ b/acts/tests/google/wifi/WifiCrashStressTest.py
@@ -33,6 +33,10 @@
* One Wi-Fi network visible to the device.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
+
def setup_class(self):
super().setup_class()
@@ -59,6 +63,7 @@
self.ap_iface = 'wlan1'
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
wutils.wifi_toggle_state(self.dut, True)
@@ -67,6 +72,7 @@
wutils.wifi_toggle_state(self.dut_client, True)
def teardown_test(self):
+ super().teardown_test()
if self.dut.droid.wifiIsApEnabled():
wutils.stop_wifi_tethering(self.dut)
self.dut.droid.wakeLockRelease()
@@ -76,12 +82,6 @@
self.dut_client.droid.goToSleepNow()
wutils.reset_wifi(self.dut_client)
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
- self.dut_client.take_bug_report(test_name, begin_time)
- self.dut_client.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiCrashTest.py b/acts/tests/google/wifi/WifiCrashTest.py
index f76b1ed..7f2ad68 100644
--- a/acts/tests/google/wifi/WifiCrashTest.py
+++ b/acts/tests/google/wifi/WifiCrashTest.py
@@ -42,6 +42,9 @@
* One Android device
* One Wi-Fi network visible to the device.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
@@ -64,19 +67,17 @@
self.network = self.reference_networks[0]["2g"]
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
wutils.wifi_toggle_state(self.dut, True)
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiDiagnosticsTest.py b/acts/tests/google/wifi/WifiDiagnosticsTest.py
index 8ef24bd..9e5a46f 100644
--- a/acts/tests/google/wifi/WifiDiagnosticsTest.py
+++ b/acts/tests/google/wifi/WifiDiagnosticsTest.py
@@ -60,19 +60,16 @@
self.open_network = self.open_network[0]["2g"]
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
-
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["open_network"]
diff --git a/acts/tests/google/wifi/WifiDppTest.py b/acts/tests/google/wifi/WifiDppTest.py
index 36d265e..64f7f25 100644
--- a/acts/tests/google/wifi/WifiDppTest.py
+++ b/acts/tests/google/wifi/WifiDppTest.py
@@ -77,7 +77,7 @@
Returns:
True is successfully configured the requirements for testing.
"""
-
+ super().setup_class()
# Device 0 is under test. Device 1 performs the responder role
self.dut = self.android_devices[0]
self.helper_dev = self.android_devices[1]
@@ -132,10 +132,6 @@
def teardown_class(self):
wutils.reset_wifi(self.dut)
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def create_and_save_wifi_network_config(self, security, random_network=False,
r2_auth_error=False):
""" Create a config with random SSID and password.
diff --git a/acts/tests/google/wifi/WifiEnterpriseRoamingTest.py b/acts/tests/google/wifi/WifiEnterpriseRoamingTest.py
index 0cebd42..05b3549 100644
--- a/acts/tests/google/wifi/WifiEnterpriseRoamingTest.py
+++ b/acts/tests/google/wifi/WifiEnterpriseRoamingTest.py
@@ -34,6 +34,11 @@
class WifiEnterpriseRoamingTest(WifiBaseTest):
+
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
+
def setup_class(self):
super().setup_class()
@@ -59,13 +64,22 @@
ap_count=2,
radius_conf_2g=self.radius_conf_2g,
radius_conf_5g=self.radius_conf_5g,)
+ elif "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(
+ mirror_ap=True,
+ ent_network=True,
+ ap_count=2,
+ radius_conf_2g=self.radius_conf_2g,
+ radius_conf_5g=self.radius_conf_5g,)
self.ent_network_2g_a = self.ent_networks[0]["2g"]
self.ent_network_2g_b = self.ent_networks[1]["2g"]
- self.bssid_2g_a = self.ent_network_2g_a[WifiEnums.BSSID_KEY.lower()]
- self.bssid_2g_b = self.ent_network_2g_b[WifiEnums.BSSID_KEY.lower()]
self.ent_roaming_ssid = self.ent_network_2g_a[WifiEnums.SSID_KEY]
- self.bssid_a = self.bssid_2g_a
- self.bssid_b = self.bssid_2g_b
+ if "AccessPoint" in self.user_params:
+ self.bssid_a = self.ent_network_2g_a[WifiEnums.BSSID_KEY.lower()]
+ self.bssid_b = self.ent_network_2g_b[WifiEnums.BSSID_KEY.lower()]
+ elif "OpenWrtAP" in self.user_params:
+ self.bssid_a = self.bssid_map[0]["2g"][self.ent_roaming_ssid]
+ self.bssid_b = self.bssid_map[1]["2g"][self.ent_roaming_ssid]
self.config_peap = {
Ent.EAP: int(EAP.PEAP),
@@ -97,6 +111,8 @@
}
self.attn_a = self.attenuators[0]
self.attn_b = self.attenuators[2]
+ if "OpenWrtAP" in self.user_params:
+ 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")
@@ -108,6 +124,7 @@
self.set_attns("default")
def setup_test(self):
+ super().setup_test()
self.dut.droid.wifiStartTrackingStateChange()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
@@ -115,15 +132,12 @@
self.dut.ed.clear_all_events()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
self.dut.droid.wifiStopTrackingStateChange()
self.set_attns("default")
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def set_attns(self, attn_val_name):
"""Sets attenuation values on attenuators used in this test.
diff --git a/acts/tests/google/wifi/WifiEnterpriseTest.py b/acts/tests/google/wifi/WifiEnterpriseTest.py
index 20f5e9f..aee773c 100644
--- a/acts/tests/google/wifi/WifiEnterpriseTest.py
+++ b/acts/tests/google/wifi/WifiEnterpriseTest.py
@@ -21,8 +21,6 @@
from acts import asserts
from acts import signals
from acts.test_decorators import test_tracker_info
-from acts.test_utils.net.net_test_utils import start_tcpdump
-from acts.test_utils.net.net_test_utils import stop_tcpdump
from acts.test_utils.wifi import wifi_test_utils as wutils
from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
@@ -36,6 +34,11 @@
class WifiEnterpriseTest(WifiBaseTest):
+
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
+
def setup_class(self):
super().setup_class()
@@ -151,7 +154,6 @@
del self.config_passpoint_ttls[WifiEnums.SSID_KEY]
# Set screen lock password so ConfigStore is unlocked.
self.dut.droid.setDevicePassword(self.device_password)
- self.tcpdump_pid = None
def teardown_class(self):
wutils.reset_wifi(self.dut)
@@ -159,23 +161,19 @@
self.dut.ed.clear_all_events()
def setup_test(self):
+ super().setup_test()
self.dut.droid.wifiStartTrackingStateChange()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
wutils.reset_wifi(self.dut)
self.dut.ed.clear_all_events()
- self.tcpdump_pid = start_tcpdump(self.dut, self.test_name)
def teardown_test(self):
- stop_tcpdump(self.dut, self.tcpdump_pid, self.test_name)
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
self.dut.droid.wifiStopTrackingStateChange()
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
"""Helper Functions"""
def eap_negative_connect_logic(self, config, ad):
diff --git a/acts/tests/google/wifi/WifiHiddenSSIDTest.py b/acts/tests/google/wifi/WifiHiddenSSIDTest.py
index 38f3442..da2c066 100644
--- a/acts/tests/google/wifi/WifiHiddenSSIDTest.py
+++ b/acts/tests/google/wifi/WifiHiddenSSIDTest.py
@@ -14,17 +14,9 @@
# 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
import acts.test_utils.wifi.wifi_test_utils as wutils
-import acts.utils
-from acts import asserts
from acts.test_decorators import test_tracker_info
from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
@@ -37,45 +29,40 @@
* Several Wi-Fi networks visible to the device, including an open Wi-Fi
network.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
self.dut = self.android_devices[0]
wutils.wifi_test_device_init(self.dut)
- req_params = []
- opt_param = [
- "open_network", "reference_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(hidden=True)
elif "OpenWrtAP" in self.user_params:
self.configure_openwrt_ap_and_start(open_network=True,
wpa_network=True,
+ owe_network=True,
+ sae_network=True,
hidden=True)
- asserts.assert_true(
- len(self.reference_networks) > 0,
- "Need at least one reference network with psk.")
self.open_hidden_2g = self.open_network[0]["2g"]
self.open_hidden_5g = self.open_network[0]["5g"]
self.wpa_hidden_2g = self.reference_networks[0]["2g"]
self.wpa_hidden_5g = self.reference_networks[0]["5g"]
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
wutils.reset_wifi(self.dut)
if "AccessPoint" in self.user_params:
@@ -164,3 +151,23 @@
"""
self.add_hiddenSSID_and_connect(self.open_hidden_5g)
+
+ @test_tracker_info(uuid="62b664df-6397-4360-97bf-a8095c23a878")
+ def test_connect_to_wpa3_owe_hidden_2g(self):
+ """Connect to WPA3 OWE 2G hidden wifi network."""
+ self.add_hiddenSSID_and_connect(self.owe_networks[0]["2g"])
+
+ @test_tracker_info(uuid="dd7b029d-c008-4288-a91c-0820b0b3f29d")
+ def test_connect_to_wpa3_owe_hidden_5g(self):
+ """Connect to WPA3 OWE 5G hidden wifi network."""
+ self.add_hiddenSSID_and_connect(self.owe_networks[0]["5g"])
+
+ @test_tracker_info(uuid="1a9f3ee8-3db0-4f07-a604-66c14a897f94")
+ def test_connect_to_wpa3_sae_hidden_2g(self):
+ """Connect to WPA3 SAE 2G hidden wifi network."""
+ self.add_hiddenSSID_and_connect(self.sae_networks[0]["2g"])
+
+ @test_tracker_info(uuid="6c75618b-9c9b-4eb6-a922-ef1719704a9c")
+ def test_connect_to_wpa3_sae_hidden_5g(self):
+ """Connect to WPA3 SAE 5G hidden wifi network."""
+ self.add_hiddenSSID_and_connect(self.sae_networks[0]["5g"])
diff --git a/acts/tests/google/wifi/WifiIFSTwTest.py b/acts/tests/google/wifi/WifiIFSTwTest.py
index 5b1603d..ac2022f 100644
--- a/acts/tests/google/wifi/WifiIFSTwTest.py
+++ b/acts/tests/google/wifi/WifiIFSTwTest.py
@@ -87,6 +87,7 @@
utils.set_location_service(self.dut, True)
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
self.dut.unlock_screen()
@@ -96,6 +97,7 @@
self.dut.ed.clear_all_events()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
diff --git a/acts/tests/google/wifi/WifiIOTTwPkg1Test.py b/acts/tests/google/wifi/WifiIOTTwPkg1Test.py
index c6f8c3d..ed0d8d7 100644
--- a/acts/tests/google/wifi/WifiIOTTwPkg1Test.py
+++ b/acts/tests/google/wifi/WifiIOTTwPkg1Test.py
@@ -88,10 +88,12 @@
self.pdu_func()
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
@@ -100,10 +102,6 @@
if "iperf_server_address" in self.user_params:
self.iperf_server.stop()
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
"""Helper Functions"""
def connect_to_wifi_network(self, network):
diff --git a/acts/tests/google/wifi/WifiIOTtpeTest.py b/acts/tests/google/wifi/WifiIOTtpeTest.py
index fd141ff..3a00d0c 100644
--- a/acts/tests/google/wifi/WifiIOTtpeTest.py
+++ b/acts/tests/google/wifi/WifiIOTtpeTest.py
@@ -67,10 +67,12 @@
self.ssid_map[SSID] = network
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
@@ -79,10 +81,6 @@
if "iperf_server_address" in self.user_params:
self.iperf_server.stop()
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
"""Helper Functions"""
def connect_to_wifi_network(self, network):
diff --git a/acts/tests/google/wifi/WifiLinkProbeTest.py b/acts/tests/google/wifi/WifiLinkProbeTest.py
index d50abde..76af4c0 100644
--- a/acts/tests/google/wifi/WifiLinkProbeTest.py
+++ b/acts/tests/google/wifi/WifiLinkProbeTest.py
@@ -56,6 +56,7 @@
self.attenuators = wutils.group_attenuators(self.attenuators)
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
wutils.wifi_toggle_state(self.dut, True)
@@ -65,6 +66,7 @@
self.packet_capture, 'dual', self.test_name)
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
@@ -74,8 +76,7 @@
def on_fail(self, test_name, begin_time):
wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
+ super().on_fail(test_name, begin_time)
def teardown_class(self):
if "AccessPoint" in self.user_params:
diff --git a/acts/tests/google/wifi/WifiMacRandomizationTest.py b/acts/tests/google/wifi/WifiMacRandomizationTest.py
index aba6035..46fcf42 100644
--- a/acts/tests/google/wifi/WifiMacRandomizationTest.py
+++ b/acts/tests/google/wifi/WifiMacRandomizationTest.py
@@ -107,22 +107,20 @@
self.open_5g = self.open_network[0]["5g"]
def setup_test(self):
+ super().setup_test()
for ad in self.android_devices:
ad.droid.wakeLockAcquireBright()
ad.droid.wakeUpNow()
wutils.wifi_toggle_state(ad, True)
def teardown_test(self):
+ super().teardown_test()
for ad in self.android_devices:
ad.droid.wakeLockRelease()
ad.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
wutils.reset_wifi(self.dut_client)
- def on_fail(self, test_name, begin_time):
- self.dut.cat_adb_log(test_name, begin_time)
- self.dut.take_bug_report(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiManagerTest.py b/acts/tests/google/wifi/WifiManagerTest.py
index 9d7f8a0..8b4c197 100644
--- a/acts/tests/google/wifi/WifiManagerTest.py
+++ b/acts/tests/google/wifi/WifiManagerTest.py
@@ -47,6 +47,10 @@
network.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
+
def setup_class(self):
super().setup_class()
@@ -84,12 +88,14 @@
self.open_network_5g = self.open_network[0]["5g"]
def setup_test(self):
+ super().setup_test()
for ad in self.android_devices:
ad.droid.wakeLockAcquireBright()
ad.droid.wakeUpNow()
wutils.wifi_toggle_state(self.dut, True)
def teardown_test(self):
+ super().teardown_test()
for ad in self.android_devices:
ad.droid.wakeLockRelease()
ad.droid.goToSleepNow()
@@ -100,12 +106,6 @@
if self.dut_client:
wutils.reset_wifi(self.dut_client)
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
- if self.dut_client:
- self.dut_client.take_bug_report(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiNetworkRequestTest.py b/acts/tests/google/wifi/WifiNetworkRequestTest.py
index 7a1d8bc..c2671fd 100644
--- a/acts/tests/google/wifi/WifiNetworkRequestTest.py
+++ b/acts/tests/google/wifi/WifiNetworkRequestTest.py
@@ -45,6 +45,9 @@
* Several Wi-Fi networks visible to the device, including an open Wi-Fi
network.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
@@ -75,6 +78,7 @@
self.open_5g = self.open_network[0]["5g"]
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
self.remove_approvals()
@@ -83,6 +87,7 @@
self.dut.ed.clear_all_events()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
self.dut.droid.wifiReleaseNetworkAll()
@@ -94,10 +99,6 @@
wutils.wifi_toggle_state(self.dut, False)
self.dut.ed.clear_all_events()
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiNetworkSelectorTest.py b/acts/tests/google/wifi/WifiNetworkSelectorTest.py
index 41f723c..349df17 100644
--- a/acts/tests/google/wifi/WifiNetworkSelectorTest.py
+++ b/acts/tests/google/wifi/WifiNetworkSelectorTest.py
@@ -48,6 +48,9 @@
"""These tests verify the behavior of the Android Wi-Fi Network Selector
feature.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
@@ -58,30 +61,22 @@
self.configure_packet_capture()
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
self.dut.ed.clear_all_events()
- self.pcap_procs = wutils.start_pcap(
- self.packet_capture, 'dual', self.test_name)
for a in self.attenuators:
a.set_atten(MAX_ATTN)
time.sleep(ATTN_SLEEP)
def teardown_test(self):
+ super().teardown_test()
for a in self.attenuators:
a.set_atten(MIN_ATTN)
wutils.reset_wifi(self.dut)
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
- def on_pass(self, test_name, begin_time):
- wutils.stop_pcap(self.packet_capture, self.pcap_procs, True)
-
- def on_fail(self, test_name, begin_time):
- wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiNetworkSuggestionTest.py b/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
index b3140c6..d8c97b1 100644
--- a/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
+++ b/acts/tests/google/wifi/WifiNetworkSuggestionTest.py
@@ -59,6 +59,9 @@
* Several Wi-Fi networks visible to the device, including an open Wi-Fi
network.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
@@ -98,6 +101,7 @@
"pm disable com.google.android.apps.carrier.carrierwifi")
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
self.dut.unlock_screen()
@@ -116,6 +120,7 @@
self.ent_network_5g = self.ent_networks[0]["5g"]
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
self.dut.droid.wifiRemoveNetworkSuggestions([])
@@ -125,10 +130,6 @@
self.dut.ed.clear_all_events()
self.clear_carrier_approved(str(self.dut.droid.telephonyGetSimCarrierId()))
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
self.dut.adb.shell(
"pm enable com.google.android.apps.carrier.carrierwifi")
diff --git a/acts/tests/google/wifi/WifiNewSetupAutoJoinTest.py b/acts/tests/google/wifi/WifiNewSetupAutoJoinTest.py
index b5ba899..59d65e7 100644
--- a/acts/tests/google/wifi/WifiNewSetupAutoJoinTest.py
+++ b/acts/tests/google/wifi/WifiNewSetupAutoJoinTest.py
@@ -29,6 +29,11 @@
class WifiNewSetupAutoJoinTest(WifiBaseTest):
+
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
+
def add_network_and_enable(self, network):
"""Add a network and enable it.
@@ -53,7 +58,7 @@
self.dut = self.android_devices[0]
wutils.wifi_test_device_init(self.dut)
- req_params = ("atten_val", "ping_addr", "max_bugreports")
+ req_params = ("atten_val", "ping_addr")
opt_param = ["reference_networks"]
self.unpack_userparams(
req_param_names=req_params, opt_param_names=opt_param)
@@ -140,12 +145,6 @@
self.dut.droid.wifiLockRelease()
self.dut.droid.goToSleepNow()
- def on_fail(self, test_name, begin_time):
- if self.max_bugreports > 0:
- self.dut.take_bug_report(test_name, begin_time)
- self.max_bugreports -= 1
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
for ad in self.android_devices:
wutils.reset_wifi(ad)
diff --git a/acts/tests/google/wifi/WifiPasspointTest.py b/acts/tests/google/wifi/WifiPasspointTest.py
index 006c243..6bb9266 100755
--- a/acts/tests/google/wifi/WifiPasspointTest.py
+++ b/acts/tests/google/wifi/WifiPasspointTest.py
@@ -19,9 +19,9 @@
import queue
import time
-import acts.base_test
from acts.test_utils.net import ui_utils as uutils
import acts.test_utils.wifi.wifi_test_utils as wutils
+from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
from acts import asserts
@@ -54,7 +54,7 @@
PASSPOINT_BUTTON = "Get Passpoint"
BOINGO_UI_TEXT = "Online Sign Up"
-class WifiPasspointTest(acts.base_test.BaseTestClass):
+class WifiPasspointTest(WifiBaseTest):
"""Tests for APIs in Android's WifiManager class.
Test Bed Requirement:
@@ -64,6 +64,7 @@
"""
def setup_class(self):
+ super().setup_class()
self.dut = self.android_devices[0]
wutils.wifi_test_device_init(self.dut)
req_params = ["passpoint_networks",
@@ -78,12 +79,14 @@
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
self.dut.unlock_screen()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
passpoint_configs = self.dut.droid.getPasspointConfigs()
@@ -91,11 +94,6 @@
wutils.delete_passpoint(self.dut, config)
wutils.reset_wifi(self.dut)
-
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
-
-
"""Helper Functions"""
diff --git a/acts/tests/google/wifi/WifiPnoTest.py b/acts/tests/google/wifi/WifiPnoTest.py
index 4bfa1d7..16b131a 100644
--- a/acts/tests/google/wifi/WifiPnoTest.py
+++ b/acts/tests/google/wifi/WifiPnoTest.py
@@ -26,6 +26,10 @@
class WifiPnoTest(WifiBaseTest):
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
+
def setup_class(self):
super().setup_class()
@@ -49,6 +53,7 @@
self.set_attns("default")
def setup_test(self):
+ super().setup_test()
self.dut.droid.wifiStartTrackingStateChange()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
@@ -56,15 +61,12 @@
self.dut.ed.clear_all_events()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wifiStopTrackingStateChange()
wutils.reset_wifi(self.dut)
self.dut.ed.clear_all_events()
self.set_attns("default")
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiRoamingTest.py b/acts/tests/google/wifi/WifiRoamingTest.py
index b0f1a71..3183fa4 100644
--- a/acts/tests/google/wifi/WifiRoamingTest.py
+++ b/acts/tests/google/wifi/WifiRoamingTest.py
@@ -72,21 +72,19 @@
del self.user_params["open_network"]
def setup_test(self):
+ super().setup_test()
self.dut.ed.clear_all_events()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
for a in self.attenuators:
a.set_atten(0)
- def on_fail(self, test_name, begin_time):
- self.dut.cat_adb_log(test_name, begin_time)
- self.dut.take_bug_report(test_name, begin_time)
-
def roaming_from_AP1_and_AP2(self, AP1_network, AP2_network):
"""Test roaming between two APs.
diff --git a/acts/tests/google/wifi/WifiScannerMultiScanTest.py b/acts/tests/google/wifi/WifiScannerMultiScanTest.py
index 0b4d44e..b75cbb2 100755
--- a/acts/tests/google/wifi/WifiScannerMultiScanTest.py
+++ b/acts/tests/google/wifi/WifiScannerMultiScanTest.py
@@ -226,11 +226,11 @@
stime_channels: Dwell time plus 2ms.
dut: Android device(s).
wifi_chs: WiFi channels according to the device model.
- max_bugreports: Max number of bug reports allowed.
"""
- def __init__(self, controllers):
- WifiBaseTest.__init__(self, controllers)
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
self.tests = (
'test_wifi_two_scans_at_same_interval',
'test_wifi_two_scans_at_different_interval',
@@ -241,11 +241,7 @@
'test_wifi_scans_24GHz_5GHz_full_result',)
def setup_class(self):
- # If running in a setup with attenuators, set attenuation on all
- # channels to zero.
- if getattr(self, "attenuators", []):
- for a in self.attenuators:
- a.set_atten(0)
+ super().setup_class()
self.leeway = 5 # seconds, for event wait time computation
self.stime_channel = 47 #dwell time plus 2ms
self.dut = self.android_devices[0]
@@ -256,10 +252,8 @@
""" Setup the required dependencies and fetch the user params from
config file.
"""
- req_params = ["max_bugreports"]
opt_param = ["reference_networks"]
- self.unpack_userparams(
- req_param_names=req_params, opt_param_names=opt_param)
+ self.unpack_userparams(opt_param_names=opt_param)
if "AccessPoint" in self.user_params:
self.legacy_configure_ap_and_start()
@@ -268,12 +262,6 @@
self.wifi_chs = WifiChannelUS(self.dut.model)
- def on_fail(self, test_name, begin_time):
- if self.max_bugreports > 0:
- self.dut.take_bug_report(test_name, begin_time)
- self.max_bugreports -= 1
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiScannerScanTest.py b/acts/tests/google/wifi/WifiScannerScanTest.py
index 89ce0d6..c59190a 100755
--- a/acts/tests/google/wifi/WifiScannerScanTest.py
+++ b/acts/tests/google/wifi/WifiScannerScanTest.py
@@ -20,7 +20,6 @@
import traceback
from acts import asserts
-from acts import base_test
from acts import utils
from acts.test_decorators import test_tracker_info
from acts.test_utils.wifi import wifi_constants
@@ -45,8 +44,9 @@
class WifiScannerScanTest(WifiBaseTest):
- def __init__(self, controllers):
- WifiBaseTest.__init__(self, controllers)
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
# TODO(angli): Remove this list.
# There are order dependencies among these tests so we'll have to leave
# it here for now. :(
@@ -71,9 +71,10 @@
"test_wifi_scanner_dual_radio_high_accuracy")
def setup_class(self):
+ super().setup_class()
self.dut = self.android_devices[0]
wutils.wifi_test_device_init(self.dut)
- req_params = ("run_extended_test", "ping_addr", "max_bugreports", "dbs_supported_models")
+ req_params = ("run_extended_test", "ping_addr", "dbs_supported_models")
opt_param = ["reference_networks"]
self.unpack_userparams(
req_param_names=req_params, opt_param_names=opt_param)
@@ -100,16 +101,10 @@
self.attenuators[1].set_atten(0)
def teardown_test(self):
- base_test.BaseTestClass.teardown_test(self)
+ super().teardown_test()
self.log.debug("Shut down all wifi scanner activities.")
self.dut.droid.wifiScannerShutdown()
- def on_fail(self, test_name, begin_time):
- if self.max_bugreports > 0:
- self.dut.take_bug_report(test_name, begin_time)
- self.max_bugreports -= 1
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
if "AccessPoint" in self.user_params:
del self.user_params["reference_networks"]
diff --git a/acts/tests/google/wifi/WifiServiceApiTest.py b/acts/tests/google/wifi/WifiServiceApiTest.py
index b5eed89..afe2a84 100644
--- a/acts/tests/google/wifi/WifiServiceApiTest.py
+++ b/acts/tests/google/wifi/WifiServiceApiTest.py
@@ -19,15 +19,15 @@
import sys
import time
-from acts import base_test
from acts import signals
from acts import utils
from acts.test_decorators import test_tracker_info
from acts.test_utils.wifi import wifi_constants
from acts.test_utils.wifi import wifi_test_utils as wutils
+from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
-class WifiServiceApiTest(base_test.BaseTestClass):
+class WifiServiceApiTest(WifiBaseTest):
"""This class tests the API surface of WifiManager in different wifi states.
Attributes:
@@ -48,6 +48,7 @@
Returns:
True is successfully configured the requirements for testig.
"""
+ super().setup_class()
self.dut = self.android_devices[0]
# Do a simple version of init - mainly just sync the time and enable
# verbose logging. We would also like to test with phones in less
@@ -65,9 +66,6 @@
def teardown_class(self):
wutils.reset_wifi(self.dut)
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
-
def create_and_save_wifi_network_config(self):
""" Create a config with random SSID and password.
diff --git a/acts/tests/google/wifi/WifiSoftApAcsTest.py b/acts/tests/google/wifi/WifiSoftApAcsTest.py
index 49e6428..a3cbdfe 100644
--- a/acts/tests/google/wifi/WifiSoftApAcsTest.py
+++ b/acts/tests/google/wifi/WifiSoftApAcsTest.py
@@ -15,7 +15,6 @@
# limitations under the License.
import itertools
-import os
import pprint
import queue
import sys
@@ -28,7 +27,6 @@
from acts import asserts
from acts.controllers.ap_lib import hostapd_constants
-from acts.keys import Config
from acts.test_decorators import test_tracker_info
from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_2G
from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G
@@ -74,16 +72,9 @@
req_param_names=req_params, opt_param_names=opt_param)
self.chan_map = {v: k for k, v in hostapd_constants.CHANNEL_MAP.items()}
self.pcap_procs = None
- if "cnss_diag_file" in self.user_params:
- self.cnss_diag_file = self.user_params.get("cnss_diag_file")
- if isinstance(self.cnss_diag_file, list):
- self.cnss_diag_file = self.cnss_diag_file[0]
- if not os.path.isfile(self.cnss_diag_file):
- self.cnss_diag_file = os.path.join(
- self.user_params[Config.key_config_path.value],
- self.cnss_diag_file)
def setup_test(self):
+ super().setup_test()
if hasattr(self, 'packet_capture'):
chan = self.test_name.split('_')[-1]
if chan.isnumeric():
@@ -91,20 +82,16 @@
self.packet_capture[0].configure_monitor_mode(band, int(chan))
self.pcap_procs = wutils.start_pcap(
self.packet_capture[0], band, self.test_name)
- if hasattr(self, "cnss_diag_file"):
- wutils.start_cnss_diags(
- self.android_devices, self.cnss_diag_file, self.pixel_models)
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.stop_wifi_tethering(self.dut)
wutils.reset_wifi(self.dut)
wutils.reset_wifi(self.dut_client)
- if hasattr(self, "cnss_diag_file"):
- wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
if hasattr(self, 'packet_capture') and self.pcap_procs:
wutils.stop_pcap(self.packet_capture[0], self.pcap_procs, False)
self.pcap_procs = None
@@ -116,11 +103,6 @@
pass
self.access_points[0].close()
- def on_fail(self, test_name, begin_time):
- for ad in self.android_devices:
- ad.take_bug_report(test_name, begin_time)
- wutils.get_cnss_diag_log(ad, test_name)
-
"""Helper Functions"""
def run_iperf_client(self, params):
diff --git a/acts/tests/google/wifi/WifiSoftApMultiCountryTest.py b/acts/tests/google/wifi/WifiSoftApMultiCountryTest.py
new file mode 100644
index 0000000..f524884
--- /dev/null
+++ b/acts/tests/google/wifi/WifiSoftApMultiCountryTest.py
@@ -0,0 +1,286 @@
+#!/usr/bin/env python3
+#
+# Copyright 2020 - 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 queue
+import logging
+import random
+import time
+import re
+import acts.controllers.packet_capture as packet_capture
+import acts.signals as signals
+
+from acts import asserts
+from acts import utils
+from acts.test_decorators import test_tracker_info
+from acts.test_utils.net import socket_test_utils as sutils
+from acts.test_utils.tel import tel_defines
+from acts.test_utils.tel import tel_test_utils as tel_utils
+from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_2G
+from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G
+from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_AUTO
+from acts.test_utils.wifi import wifi_constants
+from acts.test_utils.wifi import wifi_test_utils as wutils
+from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
+from acts.controllers.ap_lib.hostapd_constants import CHANNEL_MAP
+
+
+WifiEnums = wutils.WifiEnums
+
+class WifiSoftApMultiCountryTest(WifiBaseTest):
+
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.basetest_name = (
+ "test_full_tether_startup_auto_one_client_ping_softap_multicountry",
+ "test_full_tether_startup_2G_one_client_ping_softap_multicountry",
+ "test_full_tether_startup_5G_one_client_ping_softap_multicountry")
+ self.generate_tests()
+
+ def generate_testcase(self, basetest_name, country):
+ """Generates a single test case from the given data.
+
+ Args:
+ basetest_name: The name of the base test case.
+ country: The information about the country code under test.
+ """
+ base_test = getattr(self, basetest_name)
+ test_tracker_uuid = ""
+
+ testcase_name = 'test_%s_%s' % (basetest_name, country)
+ test_case = test_tracker_info(uuid=test_tracker_uuid)(
+ lambda: base_test(country))
+ setattr(self, testcase_name, test_case)
+ self.tests.append(testcase_name)
+
+ def generate_tests(self):
+ for country in self.user_params['wifi_country_code']:
+ for basetest_name in self.basetest_name:
+ self.generate_testcase(basetest_name, country)
+
+
+ def setup_class(self):
+ """It will setup the required dependencies from config file and configure
+ the devices for softap mode testing.
+
+ Returns:
+ True if successfully configured the requirements for testing.
+ """
+ super().setup_class()
+ self.dut = self.android_devices[0]
+ self.dut_client = self.android_devices[1]
+ if hasattr(self, 'packet_capture'):
+ self.packet_capture = self.packet_capture[0]
+
+ self.channel_list_2g = WifiEnums.ALL_2G_FREQUENCIES
+ self.channel_list_5g = WifiEnums.ALL_5G_FREQUENCIES
+ req_params = ["dbs_supported_models"]
+ opt_param = ["open_network"]
+ 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()
+ elif "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(open_network=True)
+ self.open_network = self.open_network[0]["2g"]
+ # Do a simple version of init - mainly just sync the time and enable
+ # verbose logging. This test will fail if the DUT has a sim and cell
+ # data is disabled. We would also like to test with phones in less
+ # constrained states (or add variations where we specifically
+ # constrain).
+ utils.require_sl4a((self.dut, self.dut_client))
+ utils.sync_device_time(self.dut)
+ utils.sync_device_time(self.dut_client)
+ # Enable verbose logging on the duts
+ self.dut.droid.wifiEnableVerboseLogging(1)
+ asserts.assert_equal(self.dut.droid.wifiGetVerboseLoggingLevel(), 1,
+ "Failed to enable WiFi verbose logging on the softap dut.")
+ self.dut_client.droid.wifiEnableVerboseLogging(1)
+ asserts.assert_equal(self.dut_client.droid.wifiGetVerboseLoggingLevel(), 1,
+ "Failed to enable WiFi verbose logging on the client dut.")
+ wutils.wifi_toggle_state(self.dut, True)
+ wutils.wifi_toggle_state(self.dut_client, True)
+ self.AP_IFACE = 'wlan0'
+ if self.dut.model in self.dbs_supported_models:
+ self.AP_IFACE = 'wlan1'
+
+ def teardown_class(self):
+ if self.dut.droid.wifiIsApEnabled():
+ wutils.stop_wifi_tethering(self.dut)
+ wutils.reset_wifi(self.dut)
+ wutils.reset_wifi(self.dut_client)
+ if "AccessPoint" in self.user_params:
+ del self.user_params["reference_networks"]
+ del self.user_params["open_network"]
+
+ def teardown_test(self):
+ super().teardown_test()
+ if self.dut.droid.wifiIsApEnabled():
+ wutils.stop_wifi_tethering(self.dut)
+
+ """ Snifferconfig Functions """
+ def conf_packet_capture(self, band, channel):
+ """Configure packet capture on necessary channels."""
+ freq_to_chan = wutils.WifiEnums.freq_to_channel[int(channel)]
+ logging.info("Capturing packets from "
+ "frequency:{}, Channel:{}".format(channel, freq_to_chan))
+ result = self.packet_capture.configure_monitor_mode(band, freq_to_chan)
+ if not result:
+ logging.error("Failed to configure channel "
+ "for {} band".format(band))
+ self.pcap_procs = wutils.start_pcap(
+ self.packet_capture, band, self.test_name)
+ time.sleep(5)
+
+ """ Helper Functions """
+ def create_softap_config(self):
+ """Create a softap config with ssid and password."""
+ ap_ssid = "softap_" + utils.rand_ascii_str(8)
+ ap_password = utils.rand_ascii_str(8)
+ self.dut.log.info("softap setup: %s %s", ap_ssid, ap_password)
+ config = {wutils.WifiEnums.SSID_KEY: ap_ssid}
+ config[wutils.WifiEnums.PWD_KEY] = ap_password
+ return config
+
+ def validate_full_tether_startup(self, band=None, test_ping=False):
+ """Test full startup of wifi tethering
+
+ 1. Report current state.
+ 2. Switch to AP mode.
+ 3. verify SoftAP active.
+ 4. Shutdown wifi tethering.
+ 5. verify back to previous mode.
+ """
+ initial_wifi_state = self.dut.droid.wifiCheckState()
+ self.dut.log.info("current state: %s", initial_wifi_state)
+ config = self.create_softap_config()
+ wutils.start_wifi_tethering(
+ self.dut,
+ config[wutils.WifiEnums.SSID_KEY],
+ config[wutils.WifiEnums.PWD_KEY],
+ band=band)
+
+ if test_ping:
+ self.validate_ping_between_softap_and_client(config)
+
+ wutils.stop_wifi_tethering(self.dut)
+ asserts.assert_false(self.dut.droid.wifiIsApEnabled(),
+ "SoftAp is still reported as running")
+ if initial_wifi_state:
+ wutils.wait_for_wifi_state(self.dut, True)
+ elif self.dut.droid.wifiCheckState():
+ asserts.fail(
+ "Wifi was disabled before softap and now it is enabled")
+
+ def validate_ping_between_softap_and_client(self, config):
+ """Test ping between softap and its client.
+
+ Connect one android device to the wifi hotspot.
+ Verify they can ping each other.
+
+ Args:
+ config: wifi network config with SSID, password
+ """
+ wutils.wifi_connect(self.dut_client, config, check_connectivity=False)
+ softap_frequency = int(self.get_wlan1_status(self.dut)['freq'])
+ softap_channel = str(CHANNEL_MAP[softap_frequency])
+ n = int(softap_channel)
+ if n in range(len(self.channel_list_2g)):
+ softap_band = '2g'
+ else:
+ softap_band = '5g'
+ self.dut.log.info('softap frequency : {}'.format(softap_frequency))
+ self.dut.log.info('softap channel : {}'.format(softap_channel))
+ self.dut.log.info('softap band : {}'.format(softap_band))
+ if hasattr(self, 'packet_capture'):
+ self.conf_packet_capture(softap_band, softap_frequency)
+ dut_ip = self.dut.droid.connectivityGetIPv4Addresses(self.AP_IFACE)[0]
+ dut_client_ip = self.dut_client.droid.connectivityGetIPv4Addresses('wlan0')[0]
+
+ self.dut.log.info("Try to ping %s" % dut_client_ip)
+ asserts.assert_true(
+ utils.adb_shell_ping(self.dut, count=10, dest_ip=dut_client_ip, timeout=20),
+ "%s ping %s failed" % (self.dut.serial, dut_client_ip))
+
+ self.dut_client.log.info("Try to ping %s" % dut_ip)
+ asserts.assert_true(
+ utils.adb_shell_ping(self.dut_client, count=10, dest_ip=dut_ip, timeout=20),
+ "%s ping %s failed" % (self.dut_client.serial, dut_ip))
+
+ wutils.stop_wifi_tethering(self.dut)
+
+ def get_wlan1_status(self, dut):
+ """ get wlan1 interface status"""
+ get_wlan1 = 'hostapd_cli status'
+ out_wlan1 = dut.adb.shell(get_wlan1)
+ out_wlan1 = dict(re.findall(r'(\S+)=(".*?"|\S+)', out_wlan1))
+ return out_wlan1
+
+ """ Tests Begin """
+
+ @test_tracker_info(uuid="6ce4fb40-6fa7-452f-ba17-ea3fe47d325d")
+ def test_full_tether_startup_2G_one_client_ping_softap_multicountry(self, country):
+ """(AP) 1 Device can connect to 2G hotspot
+
+ Steps:
+ 1. Setting country code for each device
+ 2. Turn on DUT's 2G softap
+ 3. Client connects to the softap
+ 4. Client and DUT ping each other
+ """
+ wutils.set_wifi_country_code(self.dut, country)
+ wutils.set_wifi_country_code(self.dut_client, country)
+ self.validate_full_tether_startup(WIFI_CONFIG_APBAND_2G, test_ping=True)
+ if hasattr(self, 'packet_capture'):
+ wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
+
+ @test_tracker_info(uuid="ae4629e6-08d5-4b51-ac34-6c2485f54df5")
+ def test_full_tether_startup_5G_one_client_ping_softap_multicountry(self, country):
+ """(AP) 1 Device can connect to 2G hotspot
+
+ Steps:
+ 1. Setting country code for each device
+ 2. Turn on DUT's 5G softap
+ 3. Client connects to the softap
+ 4. Client and DUT ping each other
+ """
+ wutils.set_wifi_country_code(self.dut, country)
+ wutils.set_wifi_country_code(self.dut_client, country)
+ self.validate_full_tether_startup(WIFI_CONFIG_APBAND_5G, test_ping=True)
+ if hasattr(self, 'packet_capture'):
+ wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
+
+ @test_tracker_info(uuid="84a10203-cb02-433c-92a7-e8aa2348cc02")
+ def test_full_tether_startup_auto_one_client_ping_softap_multicountry(self, country):
+ """(AP) 1 Device can connect to hotspot
+
+ Steps:
+ 1.Setting country code for each device
+ 2. Turn on DUT's softap
+ 3. Client connects to the softap
+ 4. Client and DUT ping each other
+ """
+ wutils.set_wifi_country_code(self.dut, country)
+ wutils.set_wifi_country_code(self.dut_client, country)
+ self.validate_full_tether_startup(
+ WIFI_CONFIG_APBAND_AUTO, test_ping=True)
+ if hasattr(self, 'packet_capture'):
+ wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
+
+ """ Tests End """
+
+
+if __name__ == "__main__":
+ pass
diff --git a/acts/tests/google/wifi/WifiSoftApTest.py b/acts/tests/google/wifi/WifiSoftApTest.py
index 78b1306..8d260b1 100644
--- a/acts/tests/google/wifi/WifiSoftApTest.py
+++ b/acts/tests/google/wifi/WifiSoftApTest.py
@@ -15,14 +15,12 @@
# limitations under the License.
import logging
-import os
import queue
import random
import time
from acts import asserts
from acts import utils
-from acts.keys import Config
from acts.test_decorators import test_tracker_info
from acts.test_utils.net import socket_test_utils as sutils
from acts.test_utils.tel import tel_defines
@@ -45,9 +43,10 @@
Returns:
True if successfully configured the requirements for testing.
"""
+ super().setup_class()
self.dut = self.android_devices[0]
self.dut_client = self.android_devices[1]
- req_params = ["dbs_supported_models", "pixel_models"]
+ req_params = ["dbs_supported_models"]
opt_param = ["open_network"]
self.unpack_userparams(
req_param_names=req_params, opt_param_names=opt_param)
@@ -86,14 +85,6 @@
asserts.assert_equal(self.android_devices[2].droid.wifiGetVerboseLoggingLevel(), 1,
"Failed to enable WiFi verbose logging on the client dut.")
self.dut_client_2 = self.android_devices[2]
- if "cnss_diag_file" in self.user_params:
- self.cnss_diag_file = self.user_params.get("cnss_diag_file")
- if isinstance(self.cnss_diag_file, list):
- self.cnss_diag_file = self.cnss_diag_file[0]
- if not os.path.isfile(self.cnss_diag_file):
- self.cnss_diag_file = os.path.join(
- self.user_params[Config.key_config_path.value],
- self.cnss_diag_file)
def teardown_class(self):
if self.dut.droid.wifiIsApEnabled():
@@ -105,26 +96,18 @@
del self.user_params["open_network"]
def setup_test(self):
+ super().setup_test()
for ad in self.android_devices:
wutils.wifi_toggle_state(ad, True)
- if hasattr(self, "cnss_diag_file"):
- wutils.start_cnss_diags(
- self.android_devices, self.cnss_diag_file, self.pixel_models)
def teardown_test(self):
- if hasattr(self, "cnss_diag_file"):
- wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ super().teardown_test()
self.dut.log.debug("Toggling Airplane mode OFF.")
asserts.assert_true(utils.force_airplane_mode(self.dut, False),
"Can not turn off airplane mode: %s" % self.dut.serial)
if self.dut.droid.wifiIsApEnabled():
wutils.stop_wifi_tethering(self.dut)
-
- def on_fail(self, test_name, begin_time):
- for ad in self.android_devices:
- ad.take_bug_report(test_name, begin_time)
- ad.cat_adb_log(test_name, begin_time)
- wutils.get_cnss_diag_log(ad, test_name)
+ wutils.set_wifi_country_code(self.dut, wutils.WifiEnums.CountryCode.US)
""" Helper Functions """
def create_softap_config(self):
@@ -856,6 +839,37 @@
# Unregister callback
self.dut.droid.unregisterSoftApCallback(callbackId)
+
+ @test_tracker_info(uuid="07b4e5b3-48ce-49b9-a83e-3e288bb88e91")
+ def test_softap_5g_preferred_country_code_de(self):
+ """Verify softap works when set to 5G preferred band
+ with country code 'DE'.
+
+ Steps:
+ 1. Set country code to Germany
+ 2. Save a softap configuration set to 5G preferred band.
+ 3. Start softap and verify it works
+ 4. Verify a client device can connect to it.
+ """
+ wutils.set_wifi_country_code(
+ self.dut, wutils.WifiEnums.CountryCode.GERMANY)
+ sap_config = self.create_softap_config()
+ wifi_network = sap_config.copy()
+ sap_config[
+ WifiEnums.AP_BAND_KEY] = WifiEnums.WIFI_CONFIG_SOFTAP_BAND_2G_5G
+ sap_config[WifiEnums.SECURITY] = WifiEnums.SoftApSecurityType.WPA2
+ 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)
+ sap_band = softap_conf[WifiEnums.AP_BAND_KEY]
+ asserts.assert_true(
+ 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)
+
""" Tests End """
diff --git a/acts/tests/google/wifi/WifiStaApConcurrencyTest.py b/acts/tests/google/wifi/WifiStaApConcurrencyTest.py
index bf5b6a3..2a1e67f 100644
--- a/acts/tests/google/wifi/WifiStaApConcurrencyTest.py
+++ b/acts/tests/google/wifi/WifiStaApConcurrencyTest.py
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import os
import pprint
import time
import re
@@ -22,7 +21,6 @@
from acts import asserts
from acts import base_test
from acts.controllers.ap_lib import hostapd_constants
-from acts.keys import Config
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_2G
@@ -71,34 +69,22 @@
ad.droid.wifiEnableVerboseLogging(1)
req_params = ["dbs_supported_models",
- "pixel_models",
"iperf_server_address",
"iperf_server_port"]
self.unpack_userparams(req_param_names=req_params,)
asserts.abort_class_if(
self.dut.model not in self.dbs_supported_models,
"Device %s does not support dual interfaces." % self.dut.model)
- if "cnss_diag_file" in self.user_params:
- self.cnss_diag_file = self.user_params.get("cnss_diag_file")
- if isinstance(self.cnss_diag_file, list):
- self.cnss_diag_file = self.cnss_diag_file[0]
- if not os.path.isfile(self.cnss_diag_file):
- self.cnss_diag_file = os.path.join(
- self.user_params[Config.key_config_path.value],
- self.cnss_diag_file)
def setup_test(self):
+ super().setup_test()
for ad in self.android_devices:
ad.droid.wakeLockAcquireBright()
ad.droid.wakeUpNow()
self.turn_location_off_and_scan_toggle_off()
- if hasattr(self, "cnss_diag_file"):
- wutils.start_cnss_diags(
- self.android_devices, self.cnss_diag_file, self.pixel_models)
def teardown_test(self):
- if hasattr(self, "cnss_diag_file"):
- wutils.stop_cnss_diags(self.android_devices, self.pixel_models)
+ super().teardown_test()
# Prevent the stop wifi tethering failure to block ap close
try:
wutils.stop_wifi_tethering(self.dut)
@@ -119,12 +105,6 @@
self.log.warn("There is no 'reference_network' or "
"'open_network' to delete")
- def on_fail(self, test_name, begin_time):
- for ad in self.android_devices:
- ad.take_bug_report(test_name, begin_time)
- ad.cat_adb_log(test_name, begin_time)
- wutils.get_cnss_diag_log(ad, test_name)
-
### Helper Functions ###
def configure_ap(self, channel_2g=None, channel_5g=None):
diff --git a/acts/tests/google/wifi/WifiStressTest.py b/acts/tests/google/wifi/WifiStressTest.py
index e31adbb..10ba578 100644
--- a/acts/tests/google/wifi/WifiStressTest.py
+++ b/acts/tests/google/wifi/WifiStressTest.py
@@ -46,6 +46,9 @@
* Several Wi-Fi networks visible to the device, including an open Wi-Fi
network.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
@@ -79,20 +82,18 @@
self.networks = [self.wpa_2g, self.wpa_5g, self.open_2g, self.open_5g]
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
def teardown_test(self):
+ super().teardown_test()
if self.dut.droid.wifiIsApEnabled():
wutils.stop_wifi_tethering(self.dut)
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def teardown_class(self):
wutils.reset_wifi(self.dut)
if "AccessPoint" in self.user_params:
diff --git a/acts/tests/google/wifi/WifiTetheringTest.py b/acts/tests/google/wifi/WifiTetheringTest.py
index b1c92cc..56c6427 100644
--- a/acts/tests/google/wifi/WifiTetheringTest.py
+++ b/acts/tests/google/wifi/WifiTetheringTest.py
@@ -19,7 +19,6 @@
import time
from acts import asserts
-from acts import base_test
from acts import test_runner
from acts import utils
from acts.controllers import adb
@@ -34,15 +33,16 @@
from acts.test_utils.net import arduino_test_utils as dutils
from acts.test_utils.net import net_test_utils as nutils
from acts.test_utils.wifi import wifi_test_utils as wutils
+from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
WAIT_TIME = 5
-class WifiTetheringTest(base_test.BaseTestClass):
+class WifiTetheringTest(WifiBaseTest):
""" Tests for Wifi Tethering """
def setup_class(self):
""" Setup devices for tethering and unpack params """
-
+ super().setup_class()
self.hotspot_device = self.android_devices[0]
self.tethered_devices = self.android_devices[1:]
req_params = ("url", "open_network")
@@ -50,36 +50,26 @@
self.network = {"SSID": "hotspot_%s" % utils.rand_ascii_str(6),
"password": "pass_%s" % utils.rand_ascii_str(6)}
self.new_ssid = "hs_%s" % utils.rand_ascii_str(6)
- self.tcpdump_pid=[]
nutils.verify_lte_data_and_tethering_supported(self.hotspot_device)
for ad in self.tethered_devices:
wutils.wifi_test_device_init(ad)
def setup_test(self):
- for ad in self.android_devices:
- self.tcpdump_pid.append(nutils.start_tcpdump(ad, self.test_name))
+ super().setup_test()
self.tethered_devices[0].droid.telephonyToggleDataConnection(False)
def teardown_test(self):
+ super().teardown_test()
if self.hotspot_device.droid.wifiIsApEnabled():
wutils.stop_wifi_tethering(self.hotspot_device)
self.tethered_devices[0].droid.telephonyToggleDataConnection(True)
- for ad, pid in zip(self.android_devices, self.tcpdump_pid):
- nutils.stop_tcpdump(ad, pid, self.test_name)
- self.tcpdump_pid = []
-
def teardown_class(self):
""" Reset devices """
for ad in self.tethered_devices:
wutils.reset_wifi(ad)
- def on_fail(self, test_name, begin_time):
- """ Collect bug report on failure """
- for ad in self.android_devices:
- ad.take_bug_report(test_name, begin_time)
-
""" Helper functions """
def _is_ipaddress_ipv6(self, ip_address):
diff --git a/acts/tests/google/wifi/WifiWakeTest.py b/acts/tests/google/wifi/WifiWakeTest.py
index 5a49b54..52ab2fd 100644
--- a/acts/tests/google/wifi/WifiWakeTest.py
+++ b/acts/tests/google/wifi/WifiWakeTest.py
@@ -43,6 +43,9 @@
* One Android Device
* Two APs that can be turned on and off
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
@@ -114,6 +117,7 @@
self.log.info('Turned AP B on')
def setup_test(self):
+ super().setup_test()
self.dut.droid.wakeLockAcquireBright()
self.dut.droid.wakeUpNow()
self.ap_a_on()
@@ -128,13 +132,10 @@
self.dut.ed.clear_all_events()
def teardown_test(self):
+ super().teardown_test()
self.dut.droid.wakeLockRelease()
self.dut.droid.goToSleepNow()
- def on_fail(self, test_name, begin_time):
- self.dut.take_bug_report(test_name, begin_time)
- self.dut.cat_adb_log(test_name, begin_time)
-
def find_ssid_in_scan_results(self, scan_results_batches, ssid):
scan_results_batch = scan_results_batches[0]
scan_results = scan_results_batch["ScanResults"]
diff --git a/acts/tests/google/wifi/WifiWpa3EnterpriseTest.py b/acts/tests/google/wifi/WifiWpa3EnterpriseTest.py
index 8e1395b..5257766 100644
--- a/acts/tests/google/wifi/WifiWpa3EnterpriseTest.py
+++ b/acts/tests/google/wifi/WifiWpa3EnterpriseTest.py
@@ -42,21 +42,19 @@
self.unpack_userparams(req_param_names=req_params,)
def setup_test(self):
+ super().setup_test()
for ad in self.android_devices:
ad.droid.wakeLockAcquireBright()
ad.droid.wakeUpNow()
wutils.wifi_toggle_state(self.dut, True)
def teardown_test(self):
+ super().teardown_test()
for ad in self.android_devices:
ad.droid.wakeLockRelease()
ad.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
- def on_fail(self, test_name, begin_time):
- self.dut.cat_adb_log(test_name, begin_time)
- self.dut.take_bug_report(test_name, begin_time)
-
### Tests ###
@test_tracker_info(uuid="404c6165-6e23-4ec1-bc2c-9dfdd5c7dc87")
diff --git a/acts/tests/google/wifi/WifiWpa3OweTest.py b/acts/tests/google/wifi/WifiWpa3OweTest.py
index ab0f23d..a3c70f3 100644
--- a/acts/tests/google/wifi/WifiWpa3OweTest.py
+++ b/acts/tests/google/wifi/WifiWpa3OweTest.py
@@ -14,22 +14,11 @@
# 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
-from acts import asserts
-from acts.controllers.ap_lib import hostapd_constants
from acts.test_decorators import test_tracker_info
from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
-WifiEnums = wutils.WifiEnums
class WifiWpa3OweTest(WifiBaseTest):
"""Tests for APIs in Android's WifiManager class.
@@ -38,68 +27,56 @@
* At least one Android device and atleast two Access Points.
* Several Wi-Fi networks visible to the device.
"""
+ def __init__(self, configs):
+ super().__init__(configs)
+ self.enable_packet_log = True
def setup_class(self):
super().setup_class()
self.dut = self.android_devices[0]
- self.dut_client = self.android_devices[1]
wutils.wifi_test_device_init(self.dut)
- wutils.wifi_test_device_init(self.dut_client)
- req_params = ["owe_networks", "wpa3_personal"]
- opt_param = []
- self.unpack_userparams(
- req_param_names=req_params, opt_param_names=opt_param)
+ req_params = ["owe_networks", "sae_networks"]
+ self.unpack_userparams(req_param_names=req_params,)
wutils.wifi_toggle_state(self.dut, True)
- wutils.wifi_toggle_state(self.dut_client, True)
+ if "OpenWrtAP" in self.user_params:
+ self.configure_openwrt_ap_and_start(owe_network=True,
+ sae_network=True)
self.owe_2g = self.owe_networks[0]["2g"]
self.owe_5g = self.owe_networks[0]["5g"]
- self.wpa3_personal_2g = self.wpa3_personal[0]["2g"]
- self.wpa3_personal_5g = self.wpa3_personal[0]["5g"]
+ self.wpa3_personal_2g = self.sae_networks[0]["2g"]
+ self.wpa3_personal_5g = self.sae_networks[0]["5g"]
def setup_test(self):
+ super().setup_test()
for ad in self.android_devices:
ad.droid.wakeLockAcquireBright()
ad.droid.wakeUpNow()
wutils.wifi_toggle_state(ad, True)
def teardown_test(self):
+ super().teardown_test()
for ad in self.android_devices:
ad.droid.wakeLockRelease()
ad.droid.goToSleepNow()
wutils.reset_wifi(self.dut)
- wutils.reset_wifi(self.dut_client)
- def on_fail(self, test_name, begin_time):
- self.dut.cat_adb_log(test_name, begin_time)
- self.dut.take_bug_report(test_name, begin_time)
-
- """Helper Functions"""
-
- """Tests"""
+ ### Test cases ###
@test_tracker_info(uuid="a7755f1f-5740-4d45-8c29-3711172b1bd7")
def test_connect_to_owe_2g(self):
- wutils.start_wifi_connection_scan_and_ensure_network_found(self.dut,
- self.owe_2g[WifiEnums.SSID_KEY])
- wutils.connect_to_wifi_network(self.dut, self.owe_2g )
+ wutils.connect_to_wifi_network(self.dut, self.owe_2g)
@test_tracker_info(uuid="9977765e-03da-4614-ab96-4c1597101118")
def test_connect_to_owe_5g(self):
- wutils.start_wifi_connection_scan_and_ensure_network_found(self.dut,
- self.owe_5g[WifiEnums.SSID_KEY])
wutils.connect_to_wifi_network(self.dut, self.owe_5g)
@test_tracker_info(uuid="3670702a-3d78-4184-b5e1-7fcf5fa48fd8")
def test_connect_to_wpa3_personal_2g(self):
- wutils.start_wifi_connection_scan_and_ensure_network_found(self.dut,
- self.wpa3_personal_2g[WifiEnums.SSID_KEY])
wutils.connect_to_wifi_network(self.dut, self.wpa3_personal_2g)
@test_tracker_info(uuid="c4528eaf-7960-4ecd-8f11-d5439bdf1c58")
def test_connect_to_wpa3_personal_5g(self):
- wutils.start_wifi_connection_scan_and_ensure_network_found(self.dut,
- self.wpa3_personal_5g[WifiEnums.SSID_KEY])
wutils.connect_to_wifi_network(self.dut, self.wpa3_personal_5g)
@test_tracker_info(uuid="a8fb46be-3487-4dc8-a393-5af992b27f45")
@@ -113,10 +90,6 @@
4. Initial connect request fails
Second connect request from framework succeeds.
"""
- wutils.start_wifi_connection_scan_and_ensure_network_found(self.dut,
- self.wpa3_personal_2g[WifiEnums.SSID_KEY])
wutils.connect_to_wifi_network(self.dut, self.wpa3_personal_2g)
wutils.toggle_wifi_off_and_on(self.dut)
- wutils.start_wifi_connection_scan_and_ensure_network_found(self.dut,
- self.wpa3_personal_2g[WifiEnums.SSID_KEY])
wutils.connect_to_wifi_network(self.dut, self.wpa3_personal_2g)
diff --git a/acts/tests/google/wifi/p2p/functional/WifiP2pMultiCoutryTest.py b/acts/tests/google/wifi/p2p/functional/WifiP2pMultiCoutryTest.py
new file mode 100644
index 0000000..da38657
--- /dev/null
+++ b/acts/tests/google/wifi/p2p/functional/WifiP2pMultiCoutryTest.py
@@ -0,0 +1,243 @@
+#!/usr/bin/env python3
+#
+# Copyright 2020 - 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 acts.test_utils.wifi.wifi_test_utils as wutils
+import acts.utils
+import time
+import acts.controllers.packet_capture as packet_capture
+import re
+import logging
+
+from acts import asserts
+from acts import utils
+
+from acts.test_decorators import test_tracker_info
+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.hostapd_constants import CHANNEL_MAP
+
+WPS_PBC = wp2putils.WifiP2PEnums.WpsInfo.WIFI_WPS_INFO_PBC
+WPS_DISPLAY = wp2putils.WifiP2PEnums.WpsInfo.WIFI_WPS_INFO_DISPLAY
+WPS_KEYPAD = wp2putils.WifiP2PEnums.WpsInfo.WIFI_WPS_INFO_KEYPAD
+
+WifiEnums = wutils.WifiEnums
+
+class WifiP2pMultiCoutryTest(WifiP2pBaseTest):
+ """Tests for APIs in Android's WifiP2pManager class.
+
+ Test Bed Requirement:
+ * At least two Android devices
+ * 3 Android devices for WifiP2pMultiPeersTest.py
+ """
+ def __init__(self, controllers):
+ WifiP2pBaseTest.__init__(self, controllers)
+ self.basetest_name = (
+ "test_p2p_connect_via_pbc_and_ping_and_reconnect_multicountry",
+ "test_p2p_connect_via_display_and_ping_and_reconnect_multicountry",
+ )
+
+ self.generate_tests()
+
+ def generate_testcase(self, basetest_name, country):
+ """Generates a single test case from the given data.
+
+ Args:
+ basetest_name: The name of the base test case.
+ country: The information about the country code under test.
+ """
+ base_test = getattr(self, basetest_name)
+ test_tracker_uuid = ""
+
+ testcase_name = 'test_%s_%s' % (basetest_name, country)
+ test_case = test_tracker_info(uuid=test_tracker_uuid)(
+ lambda: base_test(country))
+ setattr(self, testcase_name, test_case)
+ self.tests.append(testcase_name)
+
+ def generate_tests(self):
+ for country in self.user_params['wifi_country_code']:
+ for basetest_name in self.basetest_name:
+ self.generate_testcase(basetest_name, country)
+
+ def setup_class(self):
+ super().setup_class()
+ if hasattr(self, 'packet_capture'):
+ self.packet_capture = self.packet_capture[0]
+ self.channel_list_2g = WifiEnums.ALL_2G_FREQUENCIES
+ self.channel_list_5g = WifiEnums.ALL_5G_FREQUENCIES
+
+ def conf_packet_capture(self, band, channel):
+ """Configure packet capture on necessary channels."""
+ freq_to_chan = wutils.WifiEnums.freq_to_channel[int(channel)]
+ logging.info("Capturing packets from "
+ "frequency:{}, Channel:{}".format(channel, freq_to_chan))
+ result = self.packet_capture.configure_monitor_mode(band, freq_to_chan)
+ if not result:
+ logging.error("Failed to configure channel "
+ "for {} band".format(band))
+ self.pcap_procs = wutils.start_pcap(
+ self.packet_capture, band, self.test_name)
+ time.sleep(5)
+
+ def get_p2p0_freq(self, dut):
+ """ get P2P0 interface status"""
+ get_p2p0 = "timeout 3 logcat |grep P2P-GROUP-STARTED |grep p2p-p2p0-* |grep freq="
+ out_p2p01 = dut.adb.shell(get_p2p0)
+ out_p2p0 = re.findall("freq=(\d+)", out_p2p01)
+ return out_p2p0
+
+
+
+ """Test Cases"""
+
+ @test_tracker_info(uuid="f7d98b9e-494e-4e60-ae29-8418e270d2d8")
+ def test_p2p_connect_via_pbc_and_ping_and_reconnect_multicountry(self, country):
+ """Verify the p2p connect via pbc functionality
+
+ Steps:
+ 1. Setting country code for each device
+ 2. Request the connection which include discover the target device
+ 3. check which dut is GO and which dut is GC
+ 4. connection check via ping from GC to GO
+ 5. disconnect
+ 6. Trigger connect again from GO for reconnect test.
+ 7. GO trigger disconnect
+ 8. Trigger connect again from GC for reconnect test.
+ 9. GC trigger disconnect
+ """
+ # Request the connection
+
+ wutils.set_wifi_country_code(self.dut1, country)
+ wutils.set_wifi_country_code(self.dut2, country)
+ wp2putils.p2p_connect(self.dut1, self.dut2, False, WPS_PBC)
+ p2pfreg = int(self.get_p2p0_freq(self.dut1)[0])
+ p2p_channel = str(CHANNEL_MAP[p2pfreg])
+ n = int(p2p_channel)
+ if n in range(len(self.channel_list_2g)):
+ sp2p_band = '2g'
+ else:
+ sp2p_band = '5g'
+ self.dut1.log.info('p2p frequency : {}'.format(p2pfreg))
+ self.dut1.log.info('p2p channel : {}'.format(p2p_channel))
+ self.dut1.log.info('p2p band : {}'.format(sp2p_band))
+ if hasattr(self, 'packet_capture'):
+ self.conf_packet_capture(sp2p_band, p2pfreg)
+ if wp2putils.is_go(self.dut1):
+ go_dut = self.dut1
+ gc_dut = self.dut2
+ elif wp2putils.is_go(self.dut2):
+ go_dut = self.dut2
+ gc_dut = self.dut1
+
+ go_ip = wp2putils.p2p_go_ip(gc_dut)
+ wp2putils.p2p_connection_ping_test(gc_dut, go_ip)
+
+ # trigger disconnect
+ wp2putils.p2p_disconnect(self.dut1)
+ wp2putils.check_disconnect(self.dut2)
+ time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME)
+
+ self.log.info("Reconnect test, triggered by GO")
+ # trigger reconnect from GO
+ go_dut.ed.clear_all_events()
+ gc_dut.ed.clear_all_events()
+ wp2putils.p2p_connect(go_dut, gc_dut, True, WPS_PBC)
+ wp2putils.p2p_disconnect(go_dut)
+ wp2putils.check_disconnect(gc_dut)
+ time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME)
+
+ # trigger reconnect from GC
+ self.log.info("Reconnect test, triggered by GC")
+ go_dut.ed.clear_all_events()
+ gc_dut.ed.clear_all_events()
+ wp2putils.p2p_connect(gc_dut, go_dut, True, WPS_PBC)
+ wp2putils.p2p_disconnect(gc_dut)
+ wp2putils.check_disconnect(
+ go_dut, timeout=p2pconsts.DEFAULT_GROUP_CLIENT_LOST_TIME)
+ time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME)
+ if hasattr(self, 'packet_capture'):
+ wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
+ time.sleep(10)
+
+ @test_tracker_info(uuid="56b9745a-06ec-49fc-91d5-383f2dac082a")
+ def test_p2p_connect_via_display_and_ping_and_reconnect_multicountry(self, country):
+ """Verify the p2p connect via display functionality
+
+ Steps:
+ 1. Setting country code for each device
+ 2. Request the connection which include discover the target device
+ 3. check which dut is GO and which dut is GC
+ 4. connection check via ping from GC to GO
+ 5. disconnect
+ 6. Trigger connect again from GO for reconnect test.
+ 7. GO trigger disconnect
+ 8. Trigger connect again from GC for reconnect test.
+ 9. GC trigger disconnect
+ """
+ # Request the connection
+ wutils.set_wifi_country_code(self.dut1, country)
+ wutils.set_wifi_country_code(self.dut2, country)
+ wp2putils.p2p_connect(self.dut1, self.dut2, False, WPS_DISPLAY)
+ p2pfreg = int(self.get_p2p0_freq(self.dut1)[0])
+ p2p_channel = str(CHANNEL_MAP[p2pfreg])
+ n = int(p2p_channel)
+ if n in range(len(self.channel_list_2g)):
+ sp2p_band = '2g'
+ else:
+ sp2p_band = '5g'
+ self.dut1.log.info('p2p frequency : {}'.format(p2pfreg))
+ self.dut1.log.info('p2p channel : {}'.format(p2p_channel))
+ self.dut1.log.info('p2p band : {}'.format(sp2p_band))
+ if hasattr(self, 'packet_capture'):
+ self.conf_packet_capture(sp2p_band, p2pfreg)
+ if wp2putils.is_go(self.dut1):
+ go_dut = self.dut1
+ gc_dut = self.dut2
+ elif wp2putils.is_go(self.dut2):
+ go_dut = self.dut2
+ gc_dut = self.dut1
+
+ go_ip = wp2putils.p2p_go_ip(gc_dut)
+ wp2putils.p2p_connection_ping_test(gc_dut, go_ip)
+
+ # trigger disconnect
+ wp2putils.p2p_disconnect(self.dut1)
+ wp2putils.check_disconnect(self.dut2)
+ time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME)
+
+ self.log.info("Reconnect test, triggered by GO")
+ # trigger reconnect from GO
+ go_dut.ed.clear_all_events()
+ gc_dut.ed.clear_all_events()
+ wp2putils.p2p_connect(go_dut, gc_dut, True, WPS_DISPLAY)
+ wp2putils.p2p_disconnect(go_dut)
+ wp2putils.check_disconnect(gc_dut)
+ time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME)
+
+ # trigger reconnect from GC
+ self.log.info("Reconnect test, triggered by GC")
+ go_dut.ed.clear_all_events()
+ gc_dut.ed.clear_all_events()
+ wp2putils.p2p_connect(gc_dut, go_dut, True, WPS_DISPLAY)
+ wp2putils.p2p_disconnect(gc_dut)
+ wp2putils.check_disconnect(
+ go_dut, timeout=p2pconsts.DEFAULT_GROUP_CLIENT_LOST_TIME)
+ time.sleep(p2pconsts.DEFAULT_FUNCTION_SWITCH_TIME)
+ if hasattr(self, 'packet_capture'):
+ wutils.stop_pcap(self.packet_capture, self.pcap_procs, False)
+ time.sleep(10)
+
diff --git a/acts/tests/google/wifi/rtt/functional/RangeApNonSupporting11McTest.py b/acts/tests/google/wifi/rtt/functional/RangeApNonSupporting11McTest.py
index 1ffbb02..a40647b 100644
--- a/acts/tests/google/wifi/rtt/functional/RangeApNonSupporting11McTest.py
+++ b/acts/tests/google/wifi/rtt/functional/RangeApNonSupporting11McTest.py
@@ -22,7 +22,7 @@
from acts.test_utils.wifi.rtt.RttBaseTest import RttBaseTest
-class RangeApNonSupporting11McTest(WifiBaseTest, RttBaseTest):
+class RangeApNonSupporting11McTest(RttBaseTest, WifiBaseTest):
"""Test class for RTT ranging to Access Points which do not support IEEE
802.11mc
"""
diff --git a/acts/tests/google/wifi/rtt/functional/RttDisableTest.py b/acts/tests/google/wifi/rtt/functional/RttDisableTest.py
index e3219d4..703efac 100644
--- a/acts/tests/google/wifi/rtt/functional/RttDisableTest.py
+++ b/acts/tests/google/wifi/rtt/functional/RttDisableTest.py
@@ -30,6 +30,9 @@
MODE_ENABLE_DOZE = 1
MODE_DISABLE_LOCATIONING = 2
+ def setup_test(self):
+ RttBaseTest.setup_test(self)
+
def setup_class(self):
super().setup_class()
if "AccessPoint" in self.user_params: