tturney | 1bdf77d | 2015-12-28 17:46:13 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python3.4 |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 2 | # |
tturney | 1bdf77d | 2015-12-28 17:46:13 -0800 | [diff] [blame] | 3 | # Copyright 2016 - The Android Open Source Project |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | import pprint |
Ang Li | 8e76718 | 2015-12-09 17:29:24 -0800 | [diff] [blame] | 18 | import random |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 19 | import time |
| 20 | |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 21 | from acts import asserts |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 22 | from acts import signals |
Girish Moturu | 03a2e4d | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 23 | from acts.test_decorators import test_tracker_info |
Xianyuan Jia | 63751fb | 2020-11-17 00:07:40 +0000 | [diff] [blame^] | 24 | from acts_contrib.test_utils.wifi import wifi_test_utils as wutils |
| 25 | from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 26 | |
Ang Li | e8ed2b3 | 2015-12-11 12:30:20 -0800 | [diff] [blame] | 27 | WifiEnums = wutils.WifiEnums |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 28 | |
| 29 | # EAP Macros |
| 30 | EAP = WifiEnums.Eap |
| 31 | EapPhase2 = WifiEnums.EapPhase2 |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 32 | # Enterprise Config Macros |
| 33 | Ent = WifiEnums.Enterprise |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 34 | |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 35 | |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 36 | class WifiEnterpriseTest(WifiBaseTest): |
Xianyuan Jia | 97a865e | 2020-11-10 02:09:40 +0000 | [diff] [blame] | 37 | |
| 38 | def __init__(self, configs): |
| 39 | super().__init__(configs) |
| 40 | self.enable_packet_log = True |
| 41 | |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 42 | def setup_class(self): |
Xianyuan Jia | 168103b | 2019-09-06 12:22:52 -0700 | [diff] [blame] | 43 | super().setup_class() |
| 44 | |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 45 | self.dut = self.android_devices[0] |
Ang Li | 8e76718 | 2015-12-09 17:29:24 -0800 | [diff] [blame] | 46 | wutils.wifi_test_device_init(self.dut) |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 47 | # If running in a setup with attenuators, set attenuation on all |
| 48 | # channels to zero. |
| 49 | if getattr(self, "attenuators", []): |
| 50 | for a in self.attenuators: |
| 51 | a.set_atten(0) |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 52 | required_userparam_names = ( |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 53 | "ca_cert", "client_cert", "client_key", "passpoint_ca_cert", |
| 54 | "passpoint_client_cert", "passpoint_client_key", "eap_identity", |
| 55 | "eap_password", "invalid_ca_cert", "invalid_client_cert", |
| 56 | "invalid_client_key", "fqdn", "provider_friendly_name", "realm", |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 57 | "device_password", "ping_addr", "radius_conf_2g", "radius_conf_5g", |
| 58 | "radius_conf_pwd") |
Ang Li | 5cd6d3c | 2016-02-01 11:29:14 -0800 | [diff] [blame] | 59 | self.unpack_userparams(required_userparam_names, |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 60 | roaming_consortium_ids=None, |
Jimmy Chen | 7baec62 | 2020-06-23 19:00:33 +0800 | [diff] [blame] | 61 | plmn=None, |
| 62 | ocsp=0) |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 63 | |
| 64 | if "AccessPoint" in self.user_params: |
| 65 | self.legacy_configure_ap_and_start( |
| 66 | ent_network=True, |
| 67 | radius_conf_2g=self.radius_conf_2g, |
| 68 | radius_conf_5g=self.radius_conf_5g, |
| 69 | ent_network_pwd=True, |
| 70 | radius_conf_pwd=self.radius_conf_pwd,) |
Xianyuan Jia | 97a865e | 2020-11-10 02:09:40 +0000 | [diff] [blame] | 71 | elif "OpenWrtAP" in self.user_params: |
| 72 | self.configure_openwrt_ap_and_start( |
| 73 | ent_network=True, |
| 74 | radius_conf_2g=self.radius_conf_2g, |
| 75 | radius_conf_5g=self.radius_conf_5g, |
| 76 | ent_network_pwd=True, |
| 77 | radius_conf_pwd=self.radius_conf_pwd,) |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 78 | self.ent_network_2g = self.ent_networks[0]["2g"] |
| 79 | self.ent_network_5g = self.ent_networks[0]["5g"] |
| 80 | self.ent_network_pwd = self.ent_networks_pwd[0]["2g"] |
| 81 | |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 82 | # Default configs for EAP networks. |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 83 | self.config_peap0 = { |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 84 | Ent.EAP: int(EAP.PEAP), |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 85 | Ent.CA_CERT: self.ca_cert, |
| 86 | Ent.IDENTITY: self.eap_identity, |
| 87 | Ent.PASSWORD: self.eap_password, |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 88 | Ent.PHASE2: int(EapPhase2.MSCHAPV2), |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 89 | WifiEnums.SSID_KEY: self.ent_network_5g[WifiEnums.SSID_KEY], |
Jimmy Chen | 7baec62 | 2020-06-23 19:00:33 +0800 | [diff] [blame] | 90 | Ent.OCSP: self.ocsp, |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 91 | } |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 92 | self.config_peap1 = dict(self.config_peap0) |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 93 | self.config_peap1[WifiEnums.SSID_KEY] = \ |
| 94 | self.ent_network_2g[WifiEnums.SSID_KEY] |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 95 | self.config_tls = { |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 96 | Ent.EAP: int(EAP.TLS), |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 97 | Ent.CA_CERT: self.ca_cert, |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 98 | WifiEnums.SSID_KEY: self.ent_network_2g[WifiEnums.SSID_KEY], |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 99 | Ent.CLIENT_CERT: self.client_cert, |
| 100 | Ent.PRIVATE_KEY_ID: self.client_key, |
| 101 | Ent.IDENTITY: self.eap_identity, |
Jimmy Chen | 7baec62 | 2020-06-23 19:00:33 +0800 | [diff] [blame] | 102 | Ent.OCSP: self.ocsp, |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 103 | } |
| 104 | self.config_ttls = { |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 105 | Ent.EAP: int(EAP.TTLS), |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 106 | Ent.CA_CERT: self.ca_cert, |
| 107 | Ent.IDENTITY: self.eap_identity, |
| 108 | Ent.PASSWORD: self.eap_password, |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 109 | Ent.PHASE2: int(EapPhase2.MSCHAPV2), |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 110 | WifiEnums.SSID_KEY: self.ent_network_2g[WifiEnums.SSID_KEY], |
Jimmy Chen | 7baec62 | 2020-06-23 19:00:33 +0800 | [diff] [blame] | 111 | Ent.OCSP: self.ocsp, |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 112 | } |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 113 | self.config_pwd = { |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 114 | Ent.EAP: int(EAP.PWD), |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 115 | Ent.IDENTITY: self.eap_identity, |
| 116 | Ent.PASSWORD: self.eap_password, |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 117 | WifiEnums.SSID_KEY: self.ent_network_pwd[WifiEnums.SSID_KEY], |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 118 | } |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 119 | self.config_sim = { |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 120 | Ent.EAP: int(EAP.SIM), |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 121 | WifiEnums.SSID_KEY: self.ent_network_2g[WifiEnums.SSID_KEY], |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 122 | } |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 123 | self.config_aka = { |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 124 | Ent.EAP: int(EAP.AKA), |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 125 | WifiEnums.SSID_KEY: self.ent_network_2g[WifiEnums.SSID_KEY], |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 126 | } |
| 127 | self.config_aka_prime = { |
Girish Moturu | 150d32f | 2017-02-14 12:27:07 -0800 | [diff] [blame] | 128 | Ent.EAP: int(EAP.AKA_PRIME), |
Girish Moturu | f1ce420 | 2018-10-20 21:33:00 -0700 | [diff] [blame] | 129 | WifiEnums.SSID_KEY: self.ent_network_2g[WifiEnums.SSID_KEY], |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 130 | } |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 131 | |
| 132 | # Base config for passpoint networks. |
| 133 | self.config_passpoint = { |
| 134 | Ent.FQDN: self.fqdn, |
| 135 | Ent.FRIENDLY_NAME: self.provider_friendly_name, |
| 136 | Ent.REALM: self.realm, |
| 137 | Ent.CA_CERT: self.passpoint_ca_cert |
| 138 | } |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 139 | if self.plmn: |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 140 | self.config_passpoint[Ent.PLMN] = self.plmn |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 141 | if self.roaming_consortium_ids: |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 142 | self.config_passpoint[ |
| 143 | Ent.ROAMING_IDS] = self.roaming_consortium_ids |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 144 | |
| 145 | # Default configs for passpoint networks. |
| 146 | self.config_passpoint_tls = dict(self.config_tls) |
| 147 | self.config_passpoint_tls.update(self.config_passpoint) |
| 148 | self.config_passpoint_tls[Ent.CLIENT_CERT] = self.passpoint_client_cert |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 149 | self.config_passpoint_tls[ |
| 150 | Ent.PRIVATE_KEY_ID] = self.passpoint_client_key |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 151 | del self.config_passpoint_tls[WifiEnums.SSID_KEY] |
| 152 | self.config_passpoint_ttls = dict(self.config_ttls) |
| 153 | self.config_passpoint_ttls.update(self.config_passpoint) |
| 154 | del self.config_passpoint_ttls[WifiEnums.SSID_KEY] |
| 155 | # Set screen lock password so ConfigStore is unlocked. |
Ang Li | a9d188f | 2016-02-17 18:03:01 -0800 | [diff] [blame] | 156 | self.dut.droid.setDevicePassword(self.device_password) |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 157 | |
| 158 | def teardown_class(self): |
Ang Li | 8e76718 | 2015-12-09 17:29:24 -0800 | [diff] [blame] | 159 | wutils.reset_wifi(self.dut) |
Hsiu-Chang Chen | 3492edd | 2019-03-27 10:28:58 +0800 | [diff] [blame] | 160 | self.dut.droid.disableDevicePassword(self.device_password) |
Ang Li | a9d188f | 2016-02-17 18:03:01 -0800 | [diff] [blame] | 161 | self.dut.ed.clear_all_events() |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 162 | |
| 163 | def setup_test(self): |
Xianyuan Jia | 97a865e | 2020-11-10 02:09:40 +0000 | [diff] [blame] | 164 | super().setup_test() |
Ang Li | a9d188f | 2016-02-17 18:03:01 -0800 | [diff] [blame] | 165 | self.dut.droid.wifiStartTrackingStateChange() |
| 166 | self.dut.droid.wakeLockAcquireBright() |
| 167 | self.dut.droid.wakeUpNow() |
Ang Li | 8e76718 | 2015-12-09 17:29:24 -0800 | [diff] [blame] | 168 | wutils.reset_wifi(self.dut) |
Ang Li | a9d188f | 2016-02-17 18:03:01 -0800 | [diff] [blame] | 169 | self.dut.ed.clear_all_events() |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 170 | |
| 171 | def teardown_test(self): |
Xianyuan Jia | 97a865e | 2020-11-10 02:09:40 +0000 | [diff] [blame] | 172 | super().teardown_test() |
Ang Li | a9d188f | 2016-02-17 18:03:01 -0800 | [diff] [blame] | 173 | self.dut.droid.wakeLockRelease() |
| 174 | self.dut.droid.goToSleepNow() |
| 175 | self.dut.droid.wifiStopTrackingStateChange() |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 176 | |
| 177 | """Helper Functions""" |
| 178 | |
| 179 | def eap_negative_connect_logic(self, config, ad): |
| 180 | """Tries to connect to an enterprise network with invalid credentials |
| 181 | and expect a failure. |
| 182 | |
| 183 | Args: |
| 184 | config: A dict representing an invalid EAP credential. |
| 185 | |
| 186 | Returns: |
| 187 | True if connection failed as expected, False otherwise. |
| 188 | """ |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 189 | with asserts.assert_raises(signals.TestFailure, extras=config): |
Bindu Mahadev | 50374df | 2017-01-04 11:03:32 -0800 | [diff] [blame] | 190 | verdict = wutils.wifi_connect(ad, config) |
Ang Li | 8252281 | 2016-06-02 13:57:21 -0700 | [diff] [blame] | 191 | asserts.explicit_pass("Connection failed as expected.") |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 192 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 193 | def gen_negative_configs(self, config, neg_params): |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 194 | """Generic function used to generate negative configs. |
| 195 | |
| 196 | For all the valid configurations, if a param in the neg_params also |
| 197 | exists in a config, a copy of the config is made with an invalid value |
| 198 | of the param. |
| 199 | |
| 200 | Args: |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 201 | config: A valid configuration. |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 202 | neg_params: A dict that has all the invalid values. |
| 203 | |
| 204 | Returns: |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 205 | An invalid configurations generated based on the valid |
| 206 | configuration. Each invalid configuration has a different invalid |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 207 | field. |
| 208 | """ |
Girish Moturu | c4a2984 | 2017-10-24 07:37:26 -0700 | [diff] [blame] | 209 | negative_config = dict(config) |
| 210 | if negative_config in [self.config_sim, self.config_aka, |
| 211 | self.config_aka_prime]: |
| 212 | negative_config[WifiEnums.SSID_KEY] = 'wrong_hostapd_ssid' |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 213 | for k, v in neg_params.items(): |
| 214 | # Skip negative test for TLS's identity field since it's not |
| 215 | # used for auth. |
| 216 | if config[Ent.EAP] == EAP.TLS and k == Ent.IDENTITY: |
| 217 | continue |
| 218 | if k in config: |
Girish Moturu | c4a2984 | 2017-10-24 07:37:26 -0700 | [diff] [blame] | 219 | negative_config[k] = v |
| 220 | negative_config["invalid_field"] = k |
| 221 | return negative_config |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 222 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 223 | def gen_negative_eap_configs(self, config): |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 224 | """Generates invalid configurations for different EAP authentication |
| 225 | types. |
| 226 | |
| 227 | For all the valid EAP configurations, if a param that is part of the |
| 228 | authentication info exists in a config, a copy of the config is made |
| 229 | with an invalid value of the param. |
| 230 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 231 | Args: |
| 232 | A valid network configration |
| 233 | |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 234 | Returns: |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 235 | An invalid EAP configuration. |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 236 | """ |
| 237 | neg_params = { |
| 238 | Ent.CLIENT_CERT: self.invalid_client_cert, |
| 239 | Ent.CA_CERT: self.invalid_ca_cert, |
| 240 | Ent.PRIVATE_KEY_ID: self.invalid_client_key, |
| 241 | Ent.IDENTITY: "fake_identity", |
| 242 | Ent.PASSWORD: "wrong_password" |
| 243 | } |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 244 | return self.gen_negative_configs(config, neg_params) |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 245 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 246 | def gen_negative_passpoint_configs(self, config): |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 247 | """Generates invalid configurations for different EAP authentication |
| 248 | types with passpoint support. |
| 249 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 250 | Args: |
| 251 | A valid network configration |
| 252 | |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 253 | Returns: |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 254 | An invalid EAP configuration with passpoint fields. |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 255 | """ |
| 256 | neg_params = { |
| 257 | Ent.CLIENT_CERT: self.invalid_client_cert, |
| 258 | Ent.CA_CERT: self.invalid_ca_cert, |
| 259 | Ent.PRIVATE_KEY_ID: self.invalid_client_key, |
| 260 | Ent.IDENTITY: "fake_identity", |
| 261 | Ent.PASSWORD: "wrong_password", |
| 262 | Ent.FQDN: "fake_fqdn", |
| 263 | Ent.REALM: "where_no_one_has_gone_before", |
| 264 | Ent.PLMN: "fake_plmn", |
| 265 | Ent.ROAMING_IDS: [1234567890, 9876543210] |
| 266 | } |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 267 | return self.gen_negative_configs(config, neg_params) |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 268 | |
| 269 | def eap_connect_toggle_wifi(self, |
| 270 | config, |
| 271 | *args): |
| 272 | """Connects to an enterprise network, toggles wifi state and ensures |
| 273 | that the device reconnects. |
| 274 | |
| 275 | This logic expect the enterprise network to have Internet access. |
| 276 | |
| 277 | Args: |
| 278 | config: A dict representing a wifi enterprise configuration. |
| 279 | args: args to be passed to |wutils.eap_connect|. |
| 280 | |
| 281 | Returns: |
| 282 | True if the connection is successful and Internet access works. |
| 283 | """ |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 284 | ad = args[0] |
Bindu Mahadev | 50374df | 2017-01-04 11:03:32 -0800 | [diff] [blame] | 285 | wutils.wifi_connect(ad, config) |
| 286 | wutils.toggle_wifi_and_wait_for_reconnection(ad, config, num_of_tries=5) |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 287 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 288 | """ Tests """ |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 289 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 290 | # EAP connect tests |
| 291 | """ Test connecting to enterprise networks of different authentication |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 292 | types. |
| 293 | |
| 294 | The authentication types tested are: |
| 295 | EAP-TLS |
| 296 | EAP-PEAP with different phase2 types. |
| 297 | EAP-TTLS with different phase2 types. |
| 298 | |
| 299 | Procedures: |
| 300 | For each enterprise wifi network |
| 301 | 1. Connect to the network. |
| 302 | 2. Send a GET request to a website and check response. |
| 303 | |
| 304 | Expect: |
| 305 | Successful connection and Internet access through the enterprise |
| 306 | networks. |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 307 | """ |
| 308 | @test_tracker_info(uuid="4e720cac-ea17-4de7-a540-8dc7c49f9713") |
| 309 | def test_eap_connect_with_config_tls(self): |
| 310 | wutils.wifi_connect(self.dut, self.config_tls) |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 311 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 312 | @test_tracker_info(uuid="10e3a5e9-0018-4162-a9fa-b41500f13340") |
| 313 | def test_eap_connect_with_config_pwd(self): |
| 314 | wutils.wifi_connect(self.dut, self.config_pwd) |
| 315 | |
| 316 | @test_tracker_info(uuid="b4513f78-a1c4-427f-bfc7-2a6b3da714b5") |
| 317 | def test_eap_connect_with_config_sim(self): |
| 318 | wutils.wifi_connect(self.dut, self.config_sim) |
| 319 | |
| 320 | @test_tracker_info(uuid="7d390e30-cb67-4b55-bf00-567adad2d9b0") |
| 321 | def test_eap_connect_with_config_aka(self): |
| 322 | wutils.wifi_connect(self.dut, self.config_aka) |
| 323 | |
| 324 | @test_tracker_info(uuid="742f921b-27c3-4b68-a3ca-88e64fe79c1d") |
| 325 | def test_eap_connect_with_config_aka_prime(self): |
| 326 | wutils.wifi_connect(self.dut, self.config_aka_prime) |
| 327 | |
| 328 | @test_tracker_info(uuid="d34e30f3-6ef6-459f-b47a-e78ed90ce4c6") |
| 329 | def test_eap_connect_with_config_ttls_none(self): |
| 330 | config = dict(self.config_ttls) |
| 331 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value |
| 332 | wutils.wifi_connect(self.dut, config) |
| 333 | |
| 334 | @test_tracker_info(uuid="0dca3a15-472e-427c-8e06-4e38088ee973") |
| 335 | def test_eap_connect_with_config_ttls_pap(self): |
| 336 | config = dict(self.config_ttls) |
| 337 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value |
| 338 | wutils.wifi_connect(self.dut, config) |
| 339 | |
| 340 | @test_tracker_info(uuid="47c4b459-2cb1-4fc7-b4e7-82534e8e090e") |
| 341 | def test_eap_connect_with_config_ttls_mschap(self): |
| 342 | config = dict(self.config_ttls) |
| 343 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value |
| 344 | wutils.wifi_connect(self.dut, config) |
| 345 | |
| 346 | @test_tracker_info(uuid="fdb286c7-8069-481d-baf0-c5dd7a31ff03") |
| 347 | def test_eap_connect_with_config_ttls_mschapv2(self): |
| 348 | config = dict(self.config_ttls) |
| 349 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 350 | wutils.wifi_connect(self.dut, config) |
| 351 | |
| 352 | @test_tracker_info(uuid="d9315962-7987-4ee7-905d-6972c78ce8a1") |
| 353 | def test_eap_connect_with_config_ttls_gtc(self): |
| 354 | config = dict(self.config_ttls) |
| 355 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 356 | wutils.wifi_connect(self.dut, config) |
| 357 | |
| 358 | @test_tracker_info(uuid="90a67bd3-30da-4daf-8ab0-d964d7ad19be") |
| 359 | def test_eap_connect_with_config_peap0_mschapv2(self): |
| 360 | config = dict(self.config_peap0) |
| 361 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 362 | wutils.wifi_connect(self.dut, config) |
| 363 | |
| 364 | @test_tracker_info(uuid="3c451ba4-0c83-4eef-bc95-db4c21893008") |
| 365 | def test_eap_connect_with_config_peap0_gtc(self): |
| 366 | config = dict(self.config_peap0) |
| 367 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 368 | wutils.wifi_connect(self.dut, config) |
| 369 | |
| 370 | @test_tracker_info(uuid="6b45157d-0325-417a-af18-11af5d240d79") |
| 371 | def test_eap_connect_with_config_peap1_mschapv2(self): |
| 372 | config = dict(self.config_peap1) |
| 373 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 374 | wutils.wifi_connect(self.dut, config) |
| 375 | |
| 376 | @test_tracker_info(uuid="1663decc-71ae-4f95-a027-8a6dbf9c337f") |
| 377 | def test_eap_connect_with_config_peap1_gtc(self): |
| 378 | config = dict(self.config_peap1) |
| 379 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 380 | wutils.wifi_connect(self.dut, config) |
| 381 | |
| 382 | # EAP connect negative tests |
| 383 | """ Test connecting to enterprise networks. |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 384 | |
| 385 | Procedures: |
| 386 | For each enterprise wifi network |
| 387 | 1. Connect to the network with invalid credentials. |
| 388 | |
| 389 | Expect: |
| 390 | Fail to establish connection. |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 391 | """ |
| 392 | @test_tracker_info(uuid="b2a91f1f-ccd7-4bd1-ab81-19aab3d8ee38") |
| 393 | def test_eap_connect_negative_with_config_tls(self): |
| 394 | config = self.gen_negative_eap_configs(self.config_tls) |
| 395 | self.eap_negative_connect_logic(config, self.dut) |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 396 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 397 | @test_tracker_info(uuid="6466abde-1d16-4168-9dd8-1e7a0a19889b") |
| 398 | def test_eap_connect_negative_with_config_pwd(self): |
| 399 | config = self.gen_negative_eap_configs(self.config_pwd) |
| 400 | self.eap_negative_connect_logic(config, self.dut) |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 401 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 402 | @test_tracker_info(uuid="d7742a2a-85b0-409a-99d8-47711ddc5612") |
| 403 | def test_eap_connect_negative_with_config_sim(self): |
| 404 | config = self.gen_negative_eap_configs(self.config_sim) |
| 405 | self.eap_negative_connect_logic(config, self.dut) |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 406 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 407 | @test_tracker_info(uuid="0ec0de93-cab3-4f41-960b-c0af64ff48c4") |
| 408 | def test_eap_connect_negative_with_config_aka(self): |
| 409 | config = self.gen_negative_eap_configs(self.config_aka) |
| 410 | self.eap_negative_connect_logic(config, self.dut) |
| 411 | |
| 412 | @test_tracker_info(uuid="bb640ea4-32a6-48ea-87c9-f7128fffbbf6") |
| 413 | def test_eap_connect_negative_with_config_aka_prime(self): |
| 414 | config = self.gen_negative_eap_configs(self.config_aka_prime) |
| 415 | self.eap_negative_connect_logic(config, self.dut) |
| 416 | |
| 417 | @test_tracker_info(uuid="86336ada-0ced-45a4-8a22-c4aa23c81111") |
| 418 | def test_eap_connect_negative_with_config_ttls_none(self): |
| 419 | config = dict(self.config_ttls) |
| 420 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value |
| 421 | config = self.gen_negative_eap_configs(config) |
| 422 | self.eap_negative_connect_logic(config, self.dut) |
| 423 | |
| 424 | @test_tracker_info(uuid="71e0498d-9973-4958-94bd-79051c328920") |
| 425 | def test_eap_connect_negative_with_config_ttls_pap(self): |
| 426 | config = dict(self.config_ttls) |
| 427 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value |
| 428 | config = self.gen_negative_eap_configs(config) |
| 429 | self.eap_negative_connect_logic(config, self.dut) |
| 430 | |
| 431 | @test_tracker_info(uuid="c04142a8-b204-4d2d-98dc-150b16c8397e") |
| 432 | def test_eap_connect_negative_with_config_ttls_mschap(self): |
| 433 | config = dict(self.config_ttls) |
| 434 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value |
| 435 | config = self.gen_negative_eap_configs(config) |
| 436 | self.eap_negative_connect_logic(config, self.dut) |
| 437 | |
| 438 | @test_tracker_info(uuid="625e7aa5-e3e6-4bbe-98c0-5aad8ca1555b") |
| 439 | def test_eap_connect_negative_with_config_ttls_mschapv2(self): |
| 440 | config = dict(self.config_ttls) |
| 441 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 442 | config = self.gen_negative_eap_configs(config) |
| 443 | self.eap_negative_connect_logic(config, self.dut) |
| 444 | |
| 445 | @test_tracker_info(uuid="24ea0d80-0a3f-41c2-8e05-d6387e589058") |
| 446 | def test_eap_connect_negative_with_config_ttls_gtc(self): |
| 447 | config = dict(self.config_ttls) |
| 448 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 449 | config = self.gen_negative_eap_configs(config) |
| 450 | self.eap_negative_connect_logic(config, self.dut) |
| 451 | |
| 452 | @test_tracker_info(uuid="b7c1f0f8-6338-4501-8e1d-c9b136aaba88") |
| 453 | def test_eap_connect_negative_with_config_peap0_mschapv2(self): |
| 454 | config = dict(self.config_peap0) |
| 455 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 456 | config = self.gen_negative_eap_configs(config) |
| 457 | self.eap_negative_connect_logic(config, self.dut) |
| 458 | |
| 459 | @test_tracker_info(uuid="9cf83dcb-38ad-4f75-9ea9-98de1cfaf7f3") |
| 460 | def test_eap_connect_negative_with_config_peap0_gtc(self): |
| 461 | config = dict(self.config_peap0) |
| 462 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 463 | config = self.gen_negative_eap_configs(config) |
| 464 | self.eap_negative_connect_logic(config, self.dut) |
| 465 | |
| 466 | @test_tracker_info(uuid="89bb2b6b-d073-402a-bdc1-68ac5f8752a3") |
| 467 | def test_eap_connect_negative_with_config_peap1_mschapv2(self): |
| 468 | config = dict(self.config_peap1) |
| 469 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 470 | config = self.gen_negative_eap_configs(config) |
| 471 | self.eap_negative_connect_logic(config, self.dut) |
| 472 | |
| 473 | @test_tracker_info(uuid="2252a864-9ff7-43b5-82d9-afe57d1f5e5f") |
| 474 | def test_eap_connect_negative_with_config_peap1_gtc(self): |
| 475 | config = dict(self.config_peap1) |
| 476 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 477 | config = self.gen_negative_eap_configs(config) |
| 478 | self.eap_negative_connect_logic(config, self.dut) |
| 479 | |
| 480 | # EAP connect config store tests |
| 481 | """ Test connecting to enterprise networks of different authentication |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 482 | types after wifi toggle. |
| 483 | |
| 484 | The authentication types tested are: |
| 485 | EAP-TLS |
| 486 | EAP-PEAP with different phase2 types. |
| 487 | EAP-TTLS with different phase2 types. |
| 488 | |
| 489 | Procedures: |
| 490 | For each enterprise wifi network |
| 491 | 1. Connect to the network. |
| 492 | 2. Send a GET request to a website and check response. |
| 493 | 3. Toggle wifi. |
| 494 | 4. Ensure that the device reconnects to the same network. |
| 495 | |
| 496 | Expect: |
| 497 | Successful connection and Internet access through the enterprise |
| 498 | networks. |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 499 | """ |
| 500 | @test_tracker_info(uuid="2a933b7f-27d7-4201-a34f-25b9d8072a8c") |
| 501 | def test_eap_connect_config_store_with_config_tls(self): |
| 502 | self.eap_connect_toggle_wifi(self.config_tls, self.dut) |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 503 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 504 | @test_tracker_info(uuid="08dc071b-9fea-408a-a3f6-d3493869f6d4") |
| 505 | def test_eap_connect_config_store_with_config_pwd(self): |
| 506 | self.eap_connect_toggle_wifi(self.config_pwd, self.dut) |
| 507 | |
| 508 | @test_tracker_info(uuid="230cb03e-58bc-41cb-b9b3-7215c2ab2325") |
| 509 | def test_eap_connect_config_store_with_config_sim(self): |
| 510 | self.eap_connect_toggle_wifi(self.config_sim, self.dut) |
| 511 | |
| 512 | @test_tracker_info(uuid="dfc3e59c-2309-4598-8c23-bb3fe95ef89f") |
| 513 | def test_eap_connect_config_store_with_config_aka(self): |
| 514 | self.eap_connect_toggle_wifi(self.config_aka, self.dut) |
| 515 | |
| 516 | @test_tracker_info(uuid="6050a1d1-4f3a-476d-bf93-638abd066790") |
| 517 | def test_eap_connect_config_store_with_config_aka_prime(self): |
| 518 | self.eap_connect_toggle_wifi(self.config_aka_prime, self.dut) |
| 519 | |
| 520 | @test_tracker_info(uuid="03108057-cc44-4a80-8331-77c93694099c") |
| 521 | def test_eap_connect_config_store_with_config_ttls_none(self): |
| 522 | config = dict(self.config_ttls) |
| 523 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value |
| 524 | self.eap_connect_toggle_wifi(config, self.dut) |
| 525 | |
| 526 | @test_tracker_info(uuid="53dd8195-e272-4589-a261-b8fa3607ad8d") |
| 527 | def test_eap_connect_config_store_with_config_ttls_pap(self): |
| 528 | config = dict(self.config_ttls) |
| 529 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value |
| 530 | self.eap_connect_toggle_wifi(config, self.dut) |
| 531 | |
| 532 | @test_tracker_info(uuid="640f697b-9c62-4b19-bd76-53b236a152e0") |
| 533 | def test_eap_connect_config_store_with_config_ttls_mschap(self): |
| 534 | config = dict(self.config_ttls) |
| 535 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value |
| 536 | self.eap_connect_toggle_wifi(config, self.dut) |
| 537 | |
| 538 | @test_tracker_info(uuid="f0243684-fae0-46f3-afbd-bf525fc712e2") |
| 539 | def test_eap_connect_config_store_with_config_ttls_mschapv2(self): |
| 540 | config = dict(self.config_ttls) |
| 541 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 542 | self.eap_connect_toggle_wifi(config, self.dut) |
| 543 | |
| 544 | @test_tracker_info(uuid="49ec7202-3b00-49c3-970a-201360888c74") |
| 545 | def test_eap_connect_config_store_with_config_ttls_gtc(self): |
| 546 | config = dict(self.config_ttls) |
| 547 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 548 | self.eap_connect_toggle_wifi(config, self.dut) |
| 549 | |
| 550 | @test_tracker_info(uuid="1c6abfa3-f344-4e28-b891-5481ab79efcf") |
| 551 | def test_eap_connect_config_store_with_config_peap0_mschapv2(self): |
| 552 | config = dict(self.config_peap0) |
| 553 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 554 | self.eap_connect_toggle_wifi(config, self.dut) |
| 555 | |
| 556 | @test_tracker_info(uuid="2815bc76-49fa-43a5-a4b6-84788f9809d5") |
| 557 | def test_eap_connect_config_store_with_config_peap0_gtc(self): |
| 558 | config = dict(self.config_peap0) |
| 559 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 560 | self.eap_connect_toggle_wifi(config, self.dut) |
| 561 | |
| 562 | @test_tracker_info(uuid="e93f7472-6895-4e36-bff2-9b2dcfd07ad0") |
| 563 | def test_eap_connect_config_store_with_config_peap1_mschapv2(self): |
| 564 | config = dict(self.config_peap1) |
| 565 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 566 | self.eap_connect_toggle_wifi(config, self.dut) |
| 567 | |
| 568 | @test_tracker_info(uuid="6da72fa0-b858-4475-9559-46fe052d0d64") |
| 569 | def test_eap_connect_config_store_with_config_peap1_gtc(self): |
| 570 | config = dict(self.config_peap1) |
| 571 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 572 | self.eap_connect_toggle_wifi(config, self.dut) |
| 573 | |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 574 | # Removing 'test_' for all passpoint based testcases as we want to disable |
| 575 | # them. Adding the valid test cases to self.tests make them run in serial |
| 576 | # (TODO): gmoturu - Update the passpoint tests to test the valid scenario |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 577 | # Passpoint connect tests |
| 578 | """ Test connecting to enterprise networks of different authentication |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 579 | types with passpoint support. |
| 580 | |
| 581 | The authentication types tested are: |
| 582 | EAP-TLS |
| 583 | EAP-TTLS with MSCHAPV2 as phase2. |
| 584 | |
| 585 | Procedures: |
| 586 | For each enterprise wifi network |
| 587 | 1. Connect to the network. |
| 588 | 2. Send a GET request to a website and check response. |
| 589 | |
| 590 | Expect: |
| 591 | Successful connection and Internet access through the enterprise |
| 592 | networks with passpoint support. |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 593 | """ |
| 594 | @test_tracker_info(uuid="0b942524-bde9-4fc6-ac6a-fef1c247cb8e") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 595 | def passpoint_connect_with_config_passpoint_tls(self): |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 596 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 597 | "Passpoint is not supported on %s" % self.dut.model) |
| 598 | wutils.wifi_connect(self.dut, self.config_passpoint_tls) |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 599 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 600 | @test_tracker_info(uuid="33a014aa-99e7-4612-b732-54fabf1bf922") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 601 | def passpoint_connect_with_config_passpoint_ttls_none(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 602 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 603 | "Passpoint is not supported on %s" % self.dut.model) |
| 604 | config = dict(self.config_passpoint_ttls) |
| 605 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value |
| 606 | wutils.wifi_connect(self.dut, config) |
| 607 | |
| 608 | @test_tracker_info(uuid="1aba8bf9-2b09-4956-b418-c3f4dadab330") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 609 | def passpoint_connect_with_config_passpoint_ttls_pap(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 610 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 611 | "Passpoint is not supported on %s" % self.dut.model) |
| 612 | config = dict(self.config_passpoint_ttls) |
| 613 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value |
| 614 | wutils.wifi_connect(self.dut, config) |
| 615 | |
| 616 | @test_tracker_info(uuid="cd978fc9-a393-4b1e-bba3-1efc52224500") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 617 | def passpoint_connect_with_config_passpoint_ttls_mschap(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 618 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 619 | "Passpoint is not supported on %s" % self.dut.model) |
| 620 | config = dict(self.config_passpoint_ttls) |
| 621 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value |
| 622 | wutils.wifi_connect(self.dut, config) |
| 623 | |
| 624 | @test_tracker_info(uuid="bc311ee7-ba64-4c76-a629-b916701bf6a5") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 625 | def passpoint_connect_with_config_passpoint_ttls_mschapv2(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 626 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 627 | "Passpoint is not supported on %s" % self.dut.model) |
| 628 | config = dict(self.config_passpoint_ttls) |
| 629 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 630 | wutils.wifi_connect(self.dut, config) |
| 631 | |
| 632 | @test_tracker_info(uuid="357e5162-5081-4149-bedd-ef2c0f88b97e") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 633 | def passpoint_connect_with_config_passpoint_ttls_gtc(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 634 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 635 | "Passpoint is not supported on %s" % self.dut.model) |
| 636 | config = dict(self.config_passpoint_ttls) |
| 637 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 638 | wutils.wifi_connect(self.dut, config) |
| 639 | |
| 640 | # Passpoint connect negative tests |
| 641 | """ Test connecting to enterprise networks. |
Ang Li | 73697b3 | 2015-12-03 00:41:53 +0000 | [diff] [blame] | 642 | |
| 643 | Procedures: |
| 644 | For each enterprise wifi network |
| 645 | 1. Connect to the network with invalid credentials. |
| 646 | |
| 647 | Expect: |
| 648 | Fail to establish connection. |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 649 | """ |
| 650 | @test_tracker_info(uuid="7b6b44a0-ff70-49b4-94ca-a98bedc18f92") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 651 | def passpoint_connect_negative_with_config_passpoint_tls(self): |
Ang Li | c2d4521 | 2016-03-10 18:38:53 -0800 | [diff] [blame] | 652 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 653 | "Passpoint is not supported on %s" % self.dut.model) |
| 654 | config = self.gen_negative_passpoint_configs(self.config_passpoint_tls) |
| 655 | self.eap_negative_connect_logic(config, self.dut) |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 656 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 657 | @test_tracker_info(uuid="3dbde40a-e88c-4166-b932-163663a10a41") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 658 | def passpoint_connect_negative_with_config_passpoint_ttls_none(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 659 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 660 | "Passpoint is not supported on %s" % self.dut.model) |
| 661 | config = dict(self.config_passpoint_ttls) |
| 662 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value |
| 663 | config = self.gen_negative_passpoint_configs(config) |
| 664 | self.eap_negative_connect_logic(config, self.dut) |
Ang Li | 8154905 | 2016-06-09 18:51:14 -0700 | [diff] [blame] | 665 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 666 | @test_tracker_info(uuid="8ee22ad6-d561-4ca2-a808-9f372fce56b4") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 667 | def passpoint_connect_negative_with_config_passpoint_ttls_pap(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 668 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 669 | "Passpoint is not supported on %s" % self.dut.model) |
| 670 | config = dict(self.config_passpoint_ttls) |
| 671 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value |
| 672 | config = self.gen_negative_passpoint_configs(config) |
| 673 | self.eap_negative_connect_logic(config, self.dut) |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 674 | |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 675 | @test_tracker_info(uuid="db5cefe7-9cb8-47a6-8635-006c80b97012") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 676 | def passpoint_connect_negative_with_config_passpoint_ttls_mschap(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 677 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 678 | "Passpoint is not supported on %s" % self.dut.model) |
| 679 | config = dict(self.config_passpoint_ttls) |
| 680 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value |
| 681 | config = self.gen_negative_passpoint_configs(config) |
| 682 | self.eap_negative_connect_logic(config, self.dut) |
| 683 | |
| 684 | @test_tracker_info(uuid="8f49496e-80df-48ce-9c51-42f0c6b81aff") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 685 | def passpoint_connect_negative_with_config_passpoint_ttls_mschapv2(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 686 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 687 | "Passpoint is not supported on %s" % self.dut.model) |
| 688 | config = dict(self.config_passpoint_ttls) |
| 689 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 690 | config = self.gen_negative_passpoint_configs(config) |
| 691 | self.eap_negative_connect_logic(config, self.dut) |
| 692 | |
| 693 | @test_tracker_info(uuid="6561508f-598e-408d-96b6-15b631664be6") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 694 | def passpoint_connect_negative_with_config_passpoint_ttls_gtc(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 695 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 696 | "Passpoint is not supported on %s" % self.dut.model) |
| 697 | config = dict(self.config_passpoint_ttls) |
| 698 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 699 | config = self.gen_negative_passpoint_configs(config) |
| 700 | self.eap_negative_connect_logic(config, self.dut) |
| 701 | |
| 702 | # Passpoint connect config store tests |
| 703 | """ Test connecting to enterprise networks of different authentication |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 704 | types with passpoint support after wifi toggle. |
| 705 | |
| 706 | The authentication types tested are: |
| 707 | EAP-TLS |
| 708 | EAP-TTLS with MSCHAPV2 as phase2. |
| 709 | |
| 710 | Procedures: |
| 711 | For each enterprise wifi network |
| 712 | 1. Connect to the network. |
| 713 | 2. Send a GET request to a website and check response. |
| 714 | 3. Toggle wifi. |
| 715 | 4. Ensure that the device reconnects to the same network. |
| 716 | |
| 717 | Expect: |
| 718 | Successful connection and Internet access through the enterprise |
| 719 | networks with passpoint support. |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 720 | """ |
| 721 | @test_tracker_info(uuid="5d5e6bb0-faea-4a6e-a6bc-c87de997a4fd") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 722 | def passpoint_connect_config_store_with_config_passpoint_tls(self): |
Roshan Pius | 58916a3 | 2016-06-16 16:26:44 -0700 | [diff] [blame] | 723 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 724 | "Passpoint is not supported on %s" % self.dut.model) |
| 725 | self.eap_connect_toggle_wifi(self.config_passpoint_tls, self.dut) |
| 726 | |
| 727 | @test_tracker_info(uuid="0c80262d-23c1-439f-ad64-7b8ada5d1962") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 728 | def passpoint_connect_config_store_with_config_passpoint_ttls_none(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 729 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 730 | "Passpoint is not supported on %s" % self.dut.model) |
| 731 | config = dict(self.config_passpoint_ttls) |
| 732 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value |
| 733 | self.eap_connect_toggle_wifi(config, self.dut) |
| 734 | |
| 735 | @test_tracker_info(uuid="786e424c-b5a6-4fe9-a951-b3de16ebb6db") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 736 | def passpoint_connect_config_store_with_config_passpoint_ttls_pap(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 737 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 738 | "Passpoint is not supported on %s" % self.dut.model) |
| 739 | config = dict(self.config_passpoint_ttls) |
| 740 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value |
| 741 | self.eap_connect_toggle_wifi(config, self.dut) |
| 742 | |
| 743 | @test_tracker_info(uuid="22fd61bf-722a-4016-a778-fc33e94ed211") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 744 | def passpoint_connect_config_store_with_config_passpoint_ttls_mschap(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 745 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 746 | "Passpoint is not supported on %s" % self.dut.model) |
| 747 | config = dict(self.config_passpoint_ttls) |
| 748 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value |
| 749 | self.eap_connect_toggle_wifi(config, self.dut) |
| 750 | |
| 751 | @test_tracker_info(uuid="2abd348c-9c66-456b-88ad-55f971717620") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 752 | def passpoint_connect_config_store_with_config_passpoint_ttls_mschapv2(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 753 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 754 | "Passpoint is not supported on %s" % self.dut.model) |
| 755 | config = dict(self.config_passpoint_ttls) |
| 756 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value |
| 757 | self.eap_connect_toggle_wifi(config, self.dut) |
| 758 | |
| 759 | @test_tracker_info(uuid="043e8cdd-db95-4f03-b308-3c8cecf874b1") |
Girish Moturu | 89d8c7f | 2017-09-05 11:52:54 -0700 | [diff] [blame] | 760 | def passpoint_connect_config_store_with_config_passpoint_ttls_gtc(self): |
Girish Moturu | 9cc1cd1 | 2017-07-24 13:27:57 +0530 | [diff] [blame] | 761 | asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(), |
| 762 | "Passpoint is not supported on %s" % self.dut.model) |
| 763 | config = dict(self.config_passpoint_ttls) |
| 764 | config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value |
| 765 | self.eap_connect_toggle_wifi(config, self.dut) |