1# 2# Copyright 2021 - The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16from acts_contrib.test_utils.wifi import wifi_test_utils as wutils 17from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest 18from WifiEnterpriseRoamingTest import WifiEnterpriseRoamingTest 19 20WifiEnums = wutils.WifiEnums 21# EAP Macros 22EAP = WifiEnums.Eap 23EapPhase2 = WifiEnums.EapPhase2 24Ent = WifiEnums.Enterprise 25 26 27class WifiEnterpriseRoaming11axTest(WifiEnterpriseRoamingTest): 28 """Tests for WPA2 Enterprise 11ax. 29 30 Test Bed Requirement: 31 One Android device, 2 Asus AXE11000 Access Point and Radius server 32 """ 33 34 def __init__(self, configs): 35 super().__init__(configs) 36 self.tests = ( 37 "test_roaming_with_config_tls", 38 "test_roaming_with_config_ttls_none", 39 "test_roaming_with_config_ttls_pap", 40 "test_roaming_with_config_ttls_mschap", 41 "test_roaming_with_config_ttls_mschapv2", 42 "test_roaming_with_config_ttls_gtc", 43 "test_roaming_with_config_peap_mschapv2", 44 "test_roaming_with_config_peap_gtc", 45 ) 46 47 def setup_class(self): 48 WifiBaseTest.setup_class(self) 49 50 self.dut = self.android_devices[0] 51 req_params = [ 52 "attn_vals", "roam_interval", "ca_cert", "client_cert", "client_key", 53 "eap_identity", "eap_password", "device_password", "wifi6_models", 54 "bssid_map", "radius_conf_2g", "radius_conf_5g", "roaming_attn" 55 ] 56 self.unpack_userparams(req_params) 57 self.ap1 = self.access_points[0] 58 self.ap2 = self.access_points[1] 59 self.ent_roaming_ssid = "test_ent_roaming" 60 self.ap1.configure_ap({ 61 "2g": { 62 "security": "wpa2", 63 "radius_server_ip": self.radius_conf_2g["radius_server_ip"], 64 "radius_server_port": self.radius_conf_2g["radius_server_port"], 65 "radius_server_secret": self.radius_conf_2g["radius_server_secret"], 66 "ssid": self.ent_roaming_ssid, 67 } 68 }) 69 self.ap2.configure_ap({ 70 "2g": { 71 "security": "wpa2", 72 "radius_server_ip": self.radius_conf_2g["radius_server_ip"], 73 "radius_server_port": self.radius_conf_2g["radius_server_port"], 74 "radius_server_secret": self.radius_conf_2g["radius_server_secret"], 75 "ssid": self.ent_roaming_ssid, 76 } 77 }) 78 self.bssid_a = self.bssid_map[0]["2g"] 79 self.bssid_b = self.bssid_map[1]["2g"] 80 self.config_peap = { 81 Ent.EAP: int(EAP.PEAP), 82 Ent.CA_CERT: self.ca_cert, 83 Ent.IDENTITY: self.eap_identity, 84 Ent.PASSWORD: self.eap_password, 85 Ent.PHASE2: int(EapPhase2.MSCHAPV2), 86 WifiEnums.SSID_KEY: self.ent_roaming_ssid 87 } 88 self.config_tls = { 89 Ent.EAP: int(EAP.TLS), 90 Ent.CA_CERT: self.ca_cert, 91 WifiEnums.SSID_KEY: self.ent_roaming_ssid, 92 Ent.CLIENT_CERT: self.client_cert, 93 Ent.PRIVATE_KEY_ID: self.client_key, 94 Ent.IDENTITY: self.eap_identity, 95 } 96 self.config_ttls = { 97 Ent.EAP: int(EAP.TTLS), 98 Ent.CA_CERT: self.ca_cert, 99 Ent.IDENTITY: self.eap_identity, 100 Ent.PASSWORD: self.eap_password, 101 Ent.PHASE2: int(EapPhase2.MSCHAPV2), 102 WifiEnums.SSID_KEY: self.ent_roaming_ssid 103 } 104 self.attn_a = self.attenuators[0] 105 self.attn_b = self.attenuators[2] 106 107 # Set screen lock password so ConfigStore is unlocked. 108 self.dut.droid.setDevicePassword(self.device_password) 109