diff options
author | Girish Moturu <gmoturu@google.com> | 2020-10-02 21:08:31 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-10-02 21:08:31 +0000 |
commit | 4469995f6706508d395af896682b34e2fef23041 (patch) | |
tree | 7f009a2f303bf5e2ade0bfaf21a0792bb2032d65 | |
parent | 2ba01e4db64ccbe0b85a5ffc40c0f9d81bfd767f (diff) | |
parent | 4bf0b932b6271155f4c212e685261a14e1c55e50 (diff) | |
download | platform_tools_test_connectivity-master.tar.gz platform_tools_test_connectivity-master.tar.bz2 platform_tools_test_connectivity-master.zip |
4 files changed, 82 insertions, 5 deletions
diff --git a/acts/framework/acts/controllers/openwrt_ap.py b/acts/framework/acts/controllers/openwrt_ap.py index 05bd38c271..f377703335 100644 --- a/acts/framework/acts/controllers/openwrt_ap.py +++ b/acts/framework/acts/controllers/openwrt_ap.py @@ -15,7 +15,10 @@ OPEN_SECURITY = "none" 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" @@ -190,6 +193,23 @@ class OpenWrtAP(object): 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 +247,23 @@ class OpenWrtAP(object): 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 ea89636e2d..7810fa22df 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 @@ class WirelessConfig(object): 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 @@ class WirelessConfig(object): 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 @@ class WirelessConfig(object): 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 cfb94d1503..1bbbf9a157 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 @@ OPEN_SECURITY = "none" PSK_SECURITY = "psk2" WEP_SECURITY = "wep" ENT_SECURITY = "wpa2" +OWE_SECURITY = "owe" +SAE_SECURITY = "sae" ENABLE_RADIO = "0" DISABLE_RADIO = "1" ENABLE_HIDDEN = "1" @@ -91,7 +93,7 @@ class WirelessSettingsApplier(object): (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: @@ -106,6 +108,9 @@ class WirelessSettingsApplier(object): (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/wifi/WifiBaseTest.py b/acts/framework/acts/test_utils/wifi/WifiBaseTest.py index e79d03eda5..3a40de0fd8 100644 --- a/acts/framework/acts/test_utils/wifi/WifiBaseTest.py +++ b/acts/framework/acts/test_utils/wifi/WifiBaseTest.py @@ -123,7 +123,8 @@ class WifiBaseTest(BaseTestClass): 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 +135,7 @@ class WifiBaseTest(BaseTestClass): 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 +153,13 @@ class WifiBaseTest(BaseTestClass): 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 +313,8 @@ class WifiBaseTest(BaseTestClass): 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,6 +334,8 @@ class WifiBaseTest(BaseTestClass): 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. @@ -341,6 +347,8 @@ class WifiBaseTest(BaseTestClass): self.ent_networks = [] self.ent_networks_pwd = [] self.open_network = [] + self.owe_networks = [] + self.sae_networks = [] for _ in range(ap_count): network_list = [] if wpa_network: @@ -396,6 +404,30 @@ class WifiBaseTest(BaseTestClass): ssid_length_2g, ssid_length_5g) network_list.append(open_dict) + 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[_].configure_ap(network_list, channel_2g, channel_5g) |