blob: b1a5391ab92998bcf485a7f7e7136a2118a2dde5 [file] [log] [blame]
tturney1bdf77d2015-12-28 17:46:13 -08001#!/usr/bin/env python3.4
Ang Li73697b32015-12-03 00:41:53 +00002#
tturney1bdf77d2015-12-28 17:46:13 -08003# Copyright 2016 - The Android Open Source Project
Ang Li73697b32015-12-03 00:41:53 +00004#
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
17import pprint
Ang Li8e767182015-12-09 17:29:24 -080018import random
Ang Li73697b32015-12-03 00:41:53 +000019import time
20
Ang Lic2d45212016-03-10 18:38:53 -080021from acts import asserts
Ang Li82522812016-06-02 13:57:21 -070022from acts import base_test
23from acts import signals
Girish Moturu03a2e4d2017-06-12 10:46:51 +053024from acts.test_decorators import test_tracker_info
Ang Li82522812016-06-02 13:57:21 -070025from acts.test_utils.wifi import wifi_test_utils as wutils
Ang Lic2d45212016-03-10 18:38:53 -080026
Ang Lie8ed2b32015-12-11 12:30:20 -080027WifiEnums = wutils.WifiEnums
Ang Li73697b32015-12-03 00:41:53 +000028
29# EAP Macros
30EAP = WifiEnums.Eap
31EapPhase2 = WifiEnums.EapPhase2
Ang Li73697b32015-12-03 00:41:53 +000032# Enterprise Config Macros
33Ent = WifiEnums.Enterprise
Ang Li73697b32015-12-03 00:41:53 +000034
Ang Li73697b32015-12-03 00:41:53 +000035
Ang Li81549052016-06-09 18:51:14 -070036class WifiEnterpriseTest(base_test.BaseTestClass):
Ang Li73697b32015-12-03 00:41:53 +000037 def __init__(self, controllers):
Ang Li82522812016-06-02 13:57:21 -070038 base_test.BaseTestClass.__init__(self, controllers)
Ang Li73697b32015-12-03 00:41:53 +000039
40 def setup_class(self):
41 self.dut = self.android_devices[0]
Ang Li8e767182015-12-09 17:29:24 -080042 wutils.wifi_test_device_init(self.dut)
Ang Li81549052016-06-09 18:51:14 -070043 # If running in a setup with attenuators, set attenuation on all
44 # channels to zero.
45 if getattr(self, "attenuators", []):
46 for a in self.attenuators:
47 a.set_atten(0)
Ang Li73697b32015-12-03 00:41:53 +000048 required_userparam_names = (
Ang Li81549052016-06-09 18:51:14 -070049 "ca_cert", "client_cert", "client_key", "passpoint_ca_cert",
50 "passpoint_client_cert", "passpoint_client_key", "eap_identity",
51 "eap_password", "invalid_ca_cert", "invalid_client_cert",
52 "invalid_client_key", "fqdn", "provider_friendly_name", "realm",
53 "ssid_peap0", "ssid_peap1", "ssid_tls", "ssid_ttls", "ssid_pwd",
54 "ssid_sim", "ssid_aka", "ssid_aka_prime", "ssid_passpoint",
55 "device_password", "ping_addr")
Ang Li5cd6d3c2016-02-01 11:29:14 -080056 self.unpack_userparams(required_userparam_names,
Ang Li82522812016-06-02 13:57:21 -070057 roaming_consortium_ids=None,
58 plmn=None)
Ang Li73697b32015-12-03 00:41:53 +000059 # Default configs for EAP networks.
Ang Li82522812016-06-02 13:57:21 -070060 self.config_peap0 = {
Girish Moturu150d32f2017-02-14 12:27:07 -080061 Ent.EAP: int(EAP.PEAP),
Ang Li73697b32015-12-03 00:41:53 +000062 Ent.CA_CERT: self.ca_cert,
63 Ent.IDENTITY: self.eap_identity,
64 Ent.PASSWORD: self.eap_password,
Girish Moturu150d32f2017-02-14 12:27:07 -080065 Ent.PHASE2: int(EapPhase2.MSCHAPV2),
Ang Li82522812016-06-02 13:57:21 -070066 WifiEnums.SSID_KEY: self.ssid_peap0
Ang Li73697b32015-12-03 00:41:53 +000067 }
Ang Li82522812016-06-02 13:57:21 -070068 self.config_peap1 = dict(self.config_peap0)
69 self.config_peap1[WifiEnums.SSID_KEY] = self.ssid_peap1
Ang Li73697b32015-12-03 00:41:53 +000070 self.config_tls = {
Girish Moturu150d32f2017-02-14 12:27:07 -080071 Ent.EAP: int(EAP.TLS),
Ang Li73697b32015-12-03 00:41:53 +000072 Ent.CA_CERT: self.ca_cert,
73 WifiEnums.SSID_KEY: self.ssid_tls,
74 Ent.CLIENT_CERT: self.client_cert,
75 Ent.PRIVATE_KEY_ID: self.client_key,
76 Ent.IDENTITY: self.eap_identity,
77 }
78 self.config_ttls = {
Girish Moturu150d32f2017-02-14 12:27:07 -080079 Ent.EAP: int(EAP.TTLS),
Ang Li73697b32015-12-03 00:41:53 +000080 Ent.CA_CERT: self.ca_cert,
81 Ent.IDENTITY: self.eap_identity,
82 Ent.PASSWORD: self.eap_password,
Girish Moturu150d32f2017-02-14 12:27:07 -080083 Ent.PHASE2: int(EapPhase2.MSCHAPV2),
Ang Li73697b32015-12-03 00:41:53 +000084 WifiEnums.SSID_KEY: self.ssid_ttls
85 }
Ang Li82522812016-06-02 13:57:21 -070086 self.config_pwd = {
Girish Moturu150d32f2017-02-14 12:27:07 -080087 Ent.EAP: int(EAP.PWD),
Ang Li82522812016-06-02 13:57:21 -070088 Ent.IDENTITY: self.eap_identity,
89 Ent.PASSWORD: self.eap_password,
90 WifiEnums.SSID_KEY: self.ssid_pwd
91 }
Ang Li73697b32015-12-03 00:41:53 +000092 self.config_sim = {
Girish Moturu150d32f2017-02-14 12:27:07 -080093 Ent.EAP: int(EAP.SIM),
Ang Li73697b32015-12-03 00:41:53 +000094 WifiEnums.SSID_KEY: self.ssid_sim,
95 }
Ang Li82522812016-06-02 13:57:21 -070096 self.config_aka = {
Girish Moturu150d32f2017-02-14 12:27:07 -080097 Ent.EAP: int(EAP.AKA),
Ang Li82522812016-06-02 13:57:21 -070098 WifiEnums.SSID_KEY: self.ssid_aka,
99 }
100 self.config_aka_prime = {
Girish Moturu150d32f2017-02-14 12:27:07 -0800101 Ent.EAP: int(EAP.AKA_PRIME),
Ang Li82522812016-06-02 13:57:21 -0700102 WifiEnums.SSID_KEY: self.ssid_aka_prime,
103 }
Ang Li73697b32015-12-03 00:41:53 +0000104
105 # Base config for passpoint networks.
106 self.config_passpoint = {
107 Ent.FQDN: self.fqdn,
108 Ent.FRIENDLY_NAME: self.provider_friendly_name,
109 Ent.REALM: self.realm,
110 Ent.CA_CERT: self.passpoint_ca_cert
111 }
Ang Li82522812016-06-02 13:57:21 -0700112 if self.plmn:
Ang Li73697b32015-12-03 00:41:53 +0000113 self.config_passpoint[Ent.PLMN] = self.plmn
Ang Li82522812016-06-02 13:57:21 -0700114 if self.roaming_consortium_ids:
Ang Li81549052016-06-09 18:51:14 -0700115 self.config_passpoint[
116 Ent.ROAMING_IDS] = self.roaming_consortium_ids
Ang Li73697b32015-12-03 00:41:53 +0000117
118 # Default configs for passpoint networks.
119 self.config_passpoint_tls = dict(self.config_tls)
120 self.config_passpoint_tls.update(self.config_passpoint)
121 self.config_passpoint_tls[Ent.CLIENT_CERT] = self.passpoint_client_cert
Ang Li81549052016-06-09 18:51:14 -0700122 self.config_passpoint_tls[
123 Ent.PRIVATE_KEY_ID] = self.passpoint_client_key
Ang Li73697b32015-12-03 00:41:53 +0000124 del self.config_passpoint_tls[WifiEnums.SSID_KEY]
125 self.config_passpoint_ttls = dict(self.config_ttls)
126 self.config_passpoint_ttls.update(self.config_passpoint)
127 del self.config_passpoint_ttls[WifiEnums.SSID_KEY]
128 # Set screen lock password so ConfigStore is unlocked.
Ang Lia9d188f2016-02-17 18:03:01 -0800129 self.dut.droid.setDevicePassword(self.device_password)
Ang Li73697b32015-12-03 00:41:53 +0000130
131 def teardown_class(self):
Ang Li8e767182015-12-09 17:29:24 -0800132 wutils.reset_wifi(self.dut)
Ang Lia9d188f2016-02-17 18:03:01 -0800133 self.dut.droid.disableDevicePassword()
134 self.dut.ed.clear_all_events()
Ang Li73697b32015-12-03 00:41:53 +0000135
136 def setup_test(self):
Ang Lia9d188f2016-02-17 18:03:01 -0800137 self.dut.droid.wifiStartTrackingStateChange()
138 self.dut.droid.wakeLockAcquireBright()
139 self.dut.droid.wakeUpNow()
Ang Li8e767182015-12-09 17:29:24 -0800140 wutils.reset_wifi(self.dut)
Ang Lia9d188f2016-02-17 18:03:01 -0800141 self.dut.ed.clear_all_events()
Ang Li73697b32015-12-03 00:41:53 +0000142
143 def teardown_test(self):
Ang Lia9d188f2016-02-17 18:03:01 -0800144 self.dut.droid.wakeLockRelease()
145 self.dut.droid.goToSleepNow()
146 self.dut.droid.wifiStopTrackingStateChange()
Ang Li73697b32015-12-03 00:41:53 +0000147
Ang Li20377aa2016-02-26 13:19:51 -0800148 def on_fail(self, test_name, begin_time):
149 self.dut.cat_adb_log(test_name, begin_time)
150
Ang Li73697b32015-12-03 00:41:53 +0000151 """Helper Functions"""
152
153 def eap_negative_connect_logic(self, config, ad):
154 """Tries to connect to an enterprise network with invalid credentials
155 and expect a failure.
156
157 Args:
158 config: A dict representing an invalid EAP credential.
159
160 Returns:
161 True if connection failed as expected, False otherwise.
162 """
Ang Li82522812016-06-02 13:57:21 -0700163 with asserts.assert_raises(signals.TestFailure, extras=config):
Bindu Mahadev50374df2017-01-04 11:03:32 -0800164 verdict = wutils.wifi_connect(ad, config)
Ang Li82522812016-06-02 13:57:21 -0700165 asserts.explicit_pass("Connection failed as expected.")
Ang Li73697b32015-12-03 00:41:53 +0000166
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530167 def gen_negative_configs(self, config, neg_params):
Ang Li73697b32015-12-03 00:41:53 +0000168 """Generic function used to generate negative configs.
169
170 For all the valid configurations, if a param in the neg_params also
171 exists in a config, a copy of the config is made with an invalid value
172 of the param.
173
174 Args:
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530175 config: A valid configuration.
Ang Li73697b32015-12-03 00:41:53 +0000176 neg_params: A dict that has all the invalid values.
177
178 Returns:
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530179 An invalid configurations generated based on the valid
180 configuration. Each invalid configuration has a different invalid
Ang Li73697b32015-12-03 00:41:53 +0000181 field.
182 """
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530183 nc = dict(config)
184 for k, v in neg_params.items():
185 # Skip negative test for TLS's identity field since it's not
186 # used for auth.
187 if config[Ent.EAP] == EAP.TLS and k == Ent.IDENTITY:
188 continue
189 if k in config:
190 nc[k] = v
191 nc["invalid_field"] = k
192 return nc
Ang Li73697b32015-12-03 00:41:53 +0000193
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530194 def gen_negative_eap_configs(self, config):
Ang Li73697b32015-12-03 00:41:53 +0000195 """Generates invalid configurations for different EAP authentication
196 types.
197
198 For all the valid EAP configurations, if a param that is part of the
199 authentication info exists in a config, a copy of the config is made
200 with an invalid value of the param.
201
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530202 Args:
203 A valid network configration
204
Ang Li73697b32015-12-03 00:41:53 +0000205 Returns:
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530206 An invalid EAP configuration.
Ang Li73697b32015-12-03 00:41:53 +0000207 """
208 neg_params = {
209 Ent.CLIENT_CERT: self.invalid_client_cert,
210 Ent.CA_CERT: self.invalid_ca_cert,
211 Ent.PRIVATE_KEY_ID: self.invalid_client_key,
212 Ent.IDENTITY: "fake_identity",
213 Ent.PASSWORD: "wrong_password"
214 }
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530215 return self.gen_negative_configs(config, neg_params)
Ang Li73697b32015-12-03 00:41:53 +0000216
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530217 def gen_negative_passpoint_configs(self, config):
Ang Li73697b32015-12-03 00:41:53 +0000218 """Generates invalid configurations for different EAP authentication
219 types with passpoint support.
220
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530221 Args:
222 A valid network configration
223
Ang Li73697b32015-12-03 00:41:53 +0000224 Returns:
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530225 An invalid EAP configuration with passpoint fields.
Ang Li73697b32015-12-03 00:41:53 +0000226 """
227 neg_params = {
228 Ent.CLIENT_CERT: self.invalid_client_cert,
229 Ent.CA_CERT: self.invalid_ca_cert,
230 Ent.PRIVATE_KEY_ID: self.invalid_client_key,
231 Ent.IDENTITY: "fake_identity",
232 Ent.PASSWORD: "wrong_password",
233 Ent.FQDN: "fake_fqdn",
234 Ent.REALM: "where_no_one_has_gone_before",
235 Ent.PLMN: "fake_plmn",
236 Ent.ROAMING_IDS: [1234567890, 9876543210]
237 }
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530238 return self.gen_negative_configs(config, neg_params)
Roshan Pius58916a32016-06-16 16:26:44 -0700239
240 def eap_connect_toggle_wifi(self,
241 config,
242 *args):
243 """Connects to an enterprise network, toggles wifi state and ensures
244 that the device reconnects.
245
246 This logic expect the enterprise network to have Internet access.
247
248 Args:
249 config: A dict representing a wifi enterprise configuration.
250 args: args to be passed to |wutils.eap_connect|.
251
252 Returns:
253 True if the connection is successful and Internet access works.
254 """
Roshan Pius58916a32016-06-16 16:26:44 -0700255 ad = args[0]
Bindu Mahadev50374df2017-01-04 11:03:32 -0800256 wutils.wifi_connect(ad, config)
257 wutils.toggle_wifi_and_wait_for_reconnection(ad, config, num_of_tries=5)
Roshan Pius58916a32016-06-16 16:26:44 -0700258
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530259 """ Tests """
Ang Li81549052016-06-09 18:51:14 -0700260
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530261 # EAP connect tests
262 """ Test connecting to enterprise networks of different authentication
Ang Li73697b32015-12-03 00:41:53 +0000263 types.
264
265 The authentication types tested are:
266 EAP-TLS
267 EAP-PEAP with different phase2 types.
268 EAP-TTLS with different phase2 types.
269
270 Procedures:
271 For each enterprise wifi network
272 1. Connect to the network.
273 2. Send a GET request to a website and check response.
274
275 Expect:
276 Successful connection and Internet access through the enterprise
277 networks.
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530278 """
279 @test_tracker_info(uuid="4e720cac-ea17-4de7-a540-8dc7c49f9713")
280 def test_eap_connect_with_config_tls(self):
281 wutils.wifi_connect(self.dut, self.config_tls)
Ang Li73697b32015-12-03 00:41:53 +0000282
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530283 @test_tracker_info(uuid="10e3a5e9-0018-4162-a9fa-b41500f13340")
284 def test_eap_connect_with_config_pwd(self):
285 wutils.wifi_connect(self.dut, self.config_pwd)
286
287 @test_tracker_info(uuid="b4513f78-a1c4-427f-bfc7-2a6b3da714b5")
288 def test_eap_connect_with_config_sim(self):
289 wutils.wifi_connect(self.dut, self.config_sim)
290
291 @test_tracker_info(uuid="7d390e30-cb67-4b55-bf00-567adad2d9b0")
292 def test_eap_connect_with_config_aka(self):
293 wutils.wifi_connect(self.dut, self.config_aka)
294
295 @test_tracker_info(uuid="742f921b-27c3-4b68-a3ca-88e64fe79c1d")
296 def test_eap_connect_with_config_aka_prime(self):
297 wutils.wifi_connect(self.dut, self.config_aka_prime)
298
299 @test_tracker_info(uuid="d34e30f3-6ef6-459f-b47a-e78ed90ce4c6")
300 def test_eap_connect_with_config_ttls_none(self):
301 config = dict(self.config_ttls)
302 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value
303 wutils.wifi_connect(self.dut, config)
304
305 @test_tracker_info(uuid="0dca3a15-472e-427c-8e06-4e38088ee973")
306 def test_eap_connect_with_config_ttls_pap(self):
307 config = dict(self.config_ttls)
308 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value
309 wutils.wifi_connect(self.dut, config)
310
311 @test_tracker_info(uuid="47c4b459-2cb1-4fc7-b4e7-82534e8e090e")
312 def test_eap_connect_with_config_ttls_mschap(self):
313 config = dict(self.config_ttls)
314 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value
315 wutils.wifi_connect(self.dut, config)
316
317 @test_tracker_info(uuid="fdb286c7-8069-481d-baf0-c5dd7a31ff03")
318 def test_eap_connect_with_config_ttls_mschapv2(self):
319 config = dict(self.config_ttls)
320 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
321 wutils.wifi_connect(self.dut, config)
322
323 @test_tracker_info(uuid="d9315962-7987-4ee7-905d-6972c78ce8a1")
324 def test_eap_connect_with_config_ttls_gtc(self):
325 config = dict(self.config_ttls)
326 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
327 wutils.wifi_connect(self.dut, config)
328
329 @test_tracker_info(uuid="90a67bd3-30da-4daf-8ab0-d964d7ad19be")
330 def test_eap_connect_with_config_peap0_mschapv2(self):
331 config = dict(self.config_peap0)
332 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
333 wutils.wifi_connect(self.dut, config)
334
335 @test_tracker_info(uuid="3c451ba4-0c83-4eef-bc95-db4c21893008")
336 def test_eap_connect_with_config_peap0_gtc(self):
337 config = dict(self.config_peap0)
338 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
339 wutils.wifi_connect(self.dut, config)
340
341 @test_tracker_info(uuid="6b45157d-0325-417a-af18-11af5d240d79")
342 def test_eap_connect_with_config_peap1_mschapv2(self):
343 config = dict(self.config_peap1)
344 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
345 wutils.wifi_connect(self.dut, config)
346
347 @test_tracker_info(uuid="1663decc-71ae-4f95-a027-8a6dbf9c337f")
348 def test_eap_connect_with_config_peap1_gtc(self):
349 config = dict(self.config_peap1)
350 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
351 wutils.wifi_connect(self.dut, config)
352
353 # EAP connect negative tests
354 """ Test connecting to enterprise networks.
Ang Li73697b32015-12-03 00:41:53 +0000355
356 Procedures:
357 For each enterprise wifi network
358 1. Connect to the network with invalid credentials.
359
360 Expect:
361 Fail to establish connection.
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530362 """
363 @test_tracker_info(uuid="b2a91f1f-ccd7-4bd1-ab81-19aab3d8ee38")
364 def test_eap_connect_negative_with_config_tls(self):
365 config = self.gen_negative_eap_configs(self.config_tls)
366 self.eap_negative_connect_logic(config, self.dut)
Ang Li81549052016-06-09 18:51:14 -0700367
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530368 @test_tracker_info(uuid="6466abde-1d16-4168-9dd8-1e7a0a19889b")
369 def test_eap_connect_negative_with_config_pwd(self):
370 config = self.gen_negative_eap_configs(self.config_pwd)
371 self.eap_negative_connect_logic(config, self.dut)
Ang Li81549052016-06-09 18:51:14 -0700372
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530373 @test_tracker_info(uuid="d7742a2a-85b0-409a-99d8-47711ddc5612")
374 def test_eap_connect_negative_with_config_sim(self):
375 config = self.gen_negative_eap_configs(self.config_sim)
376 self.eap_negative_connect_logic(config, self.dut)
Ang Li73697b32015-12-03 00:41:53 +0000377
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530378 @test_tracker_info(uuid="0ec0de93-cab3-4f41-960b-c0af64ff48c4")
379 def test_eap_connect_negative_with_config_aka(self):
380 config = self.gen_negative_eap_configs(self.config_aka)
381 self.eap_negative_connect_logic(config, self.dut)
382
383 @test_tracker_info(uuid="bb640ea4-32a6-48ea-87c9-f7128fffbbf6")
384 def test_eap_connect_negative_with_config_aka_prime(self):
385 config = self.gen_negative_eap_configs(self.config_aka_prime)
386 self.eap_negative_connect_logic(config, self.dut)
387
388 @test_tracker_info(uuid="86336ada-0ced-45a4-8a22-c4aa23c81111")
389 def test_eap_connect_negative_with_config_ttls_none(self):
390 config = dict(self.config_ttls)
391 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value
392 config = self.gen_negative_eap_configs(config)
393 self.eap_negative_connect_logic(config, self.dut)
394
395 @test_tracker_info(uuid="71e0498d-9973-4958-94bd-79051c328920")
396 def test_eap_connect_negative_with_config_ttls_pap(self):
397 config = dict(self.config_ttls)
398 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value
399 config = self.gen_negative_eap_configs(config)
400 self.eap_negative_connect_logic(config, self.dut)
401
402 @test_tracker_info(uuid="c04142a8-b204-4d2d-98dc-150b16c8397e")
403 def test_eap_connect_negative_with_config_ttls_mschap(self):
404 config = dict(self.config_ttls)
405 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value
406 config = self.gen_negative_eap_configs(config)
407 self.eap_negative_connect_logic(config, self.dut)
408
409 @test_tracker_info(uuid="625e7aa5-e3e6-4bbe-98c0-5aad8ca1555b")
410 def test_eap_connect_negative_with_config_ttls_mschapv2(self):
411 config = dict(self.config_ttls)
412 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
413 config = self.gen_negative_eap_configs(config)
414 self.eap_negative_connect_logic(config, self.dut)
415
416 @test_tracker_info(uuid="24ea0d80-0a3f-41c2-8e05-d6387e589058")
417 def test_eap_connect_negative_with_config_ttls_gtc(self):
418 config = dict(self.config_ttls)
419 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
420 config = self.gen_negative_eap_configs(config)
421 self.eap_negative_connect_logic(config, self.dut)
422
423 @test_tracker_info(uuid="b7c1f0f8-6338-4501-8e1d-c9b136aaba88")
424 def test_eap_connect_negative_with_config_peap0_mschapv2(self):
425 config = dict(self.config_peap0)
426 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
427 config = self.gen_negative_eap_configs(config)
428 self.eap_negative_connect_logic(config, self.dut)
429
430 @test_tracker_info(uuid="9cf83dcb-38ad-4f75-9ea9-98de1cfaf7f3")
431 def test_eap_connect_negative_with_config_peap0_gtc(self):
432 config = dict(self.config_peap0)
433 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
434 config = self.gen_negative_eap_configs(config)
435 self.eap_negative_connect_logic(config, self.dut)
436
437 @test_tracker_info(uuid="89bb2b6b-d073-402a-bdc1-68ac5f8752a3")
438 def test_eap_connect_negative_with_config_peap1_mschapv2(self):
439 config = dict(self.config_peap1)
440 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
441 config = self.gen_negative_eap_configs(config)
442 self.eap_negative_connect_logic(config, self.dut)
443
444 @test_tracker_info(uuid="2252a864-9ff7-43b5-82d9-afe57d1f5e5f")
445 def test_eap_connect_negative_with_config_peap1_gtc(self):
446 config = dict(self.config_peap1)
447 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
448 config = self.gen_negative_eap_configs(config)
449 self.eap_negative_connect_logic(config, self.dut)
450
451 # EAP connect config store tests
452 """ Test connecting to enterprise networks of different authentication
Roshan Pius58916a32016-06-16 16:26:44 -0700453 types after wifi toggle.
454
455 The authentication types tested are:
456 EAP-TLS
457 EAP-PEAP with different phase2 types.
458 EAP-TTLS with different phase2 types.
459
460 Procedures:
461 For each enterprise wifi network
462 1. Connect to the network.
463 2. Send a GET request to a website and check response.
464 3. Toggle wifi.
465 4. Ensure that the device reconnects to the same network.
466
467 Expect:
468 Successful connection and Internet access through the enterprise
469 networks.
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530470 """
471 @test_tracker_info(uuid="2a933b7f-27d7-4201-a34f-25b9d8072a8c")
472 def test_eap_connect_config_store_with_config_tls(self):
473 self.eap_connect_toggle_wifi(self.config_tls, self.dut)
Roshan Pius58916a32016-06-16 16:26:44 -0700474
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530475 @test_tracker_info(uuid="08dc071b-9fea-408a-a3f6-d3493869f6d4")
476 def test_eap_connect_config_store_with_config_pwd(self):
477 self.eap_connect_toggle_wifi(self.config_pwd, self.dut)
478
479 @test_tracker_info(uuid="230cb03e-58bc-41cb-b9b3-7215c2ab2325")
480 def test_eap_connect_config_store_with_config_sim(self):
481 self.eap_connect_toggle_wifi(self.config_sim, self.dut)
482
483 @test_tracker_info(uuid="dfc3e59c-2309-4598-8c23-bb3fe95ef89f")
484 def test_eap_connect_config_store_with_config_aka(self):
485 self.eap_connect_toggle_wifi(self.config_aka, self.dut)
486
487 @test_tracker_info(uuid="6050a1d1-4f3a-476d-bf93-638abd066790")
488 def test_eap_connect_config_store_with_config_aka_prime(self):
489 self.eap_connect_toggle_wifi(self.config_aka_prime, self.dut)
490
491 @test_tracker_info(uuid="03108057-cc44-4a80-8331-77c93694099c")
492 def test_eap_connect_config_store_with_config_ttls_none(self):
493 config = dict(self.config_ttls)
494 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value
495 self.eap_connect_toggle_wifi(config, self.dut)
496
497 @test_tracker_info(uuid="53dd8195-e272-4589-a261-b8fa3607ad8d")
498 def test_eap_connect_config_store_with_config_ttls_pap(self):
499 config = dict(self.config_ttls)
500 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value
501 self.eap_connect_toggle_wifi(config, self.dut)
502
503 @test_tracker_info(uuid="640f697b-9c62-4b19-bd76-53b236a152e0")
504 def test_eap_connect_config_store_with_config_ttls_mschap(self):
505 config = dict(self.config_ttls)
506 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value
507 self.eap_connect_toggle_wifi(config, self.dut)
508
509 @test_tracker_info(uuid="f0243684-fae0-46f3-afbd-bf525fc712e2")
510 def test_eap_connect_config_store_with_config_ttls_mschapv2(self):
511 config = dict(self.config_ttls)
512 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
513 self.eap_connect_toggle_wifi(config, self.dut)
514
515 @test_tracker_info(uuid="49ec7202-3b00-49c3-970a-201360888c74")
516 def test_eap_connect_config_store_with_config_ttls_gtc(self):
517 config = dict(self.config_ttls)
518 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
519 self.eap_connect_toggle_wifi(config, self.dut)
520
521 @test_tracker_info(uuid="1c6abfa3-f344-4e28-b891-5481ab79efcf")
522 def test_eap_connect_config_store_with_config_peap0_mschapv2(self):
523 config = dict(self.config_peap0)
524 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
525 self.eap_connect_toggle_wifi(config, self.dut)
526
527 @test_tracker_info(uuid="2815bc76-49fa-43a5-a4b6-84788f9809d5")
528 def test_eap_connect_config_store_with_config_peap0_gtc(self):
529 config = dict(self.config_peap0)
530 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
531 self.eap_connect_toggle_wifi(config, self.dut)
532
533 @test_tracker_info(uuid="e93f7472-6895-4e36-bff2-9b2dcfd07ad0")
534 def test_eap_connect_config_store_with_config_peap1_mschapv2(self):
535 config = dict(self.config_peap1)
536 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
537 self.eap_connect_toggle_wifi(config, self.dut)
538
539 @test_tracker_info(uuid="6da72fa0-b858-4475-9559-46fe052d0d64")
540 def test_eap_connect_config_store_with_config_peap1_gtc(self):
541 config = dict(self.config_peap1)
542 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
543 self.eap_connect_toggle_wifi(config, self.dut)
544
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700545 # Removing 'test_' for all passpoint based testcases as we want to disable
546 # them. Adding the valid test cases to self.tests make them run in serial
547 # (TODO): gmoturu - Update the passpoint tests to test the valid scenario
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530548 # Passpoint connect tests
549 """ Test connecting to enterprise networks of different authentication
Ang Li73697b32015-12-03 00:41:53 +0000550 types with passpoint support.
551
552 The authentication types tested are:
553 EAP-TLS
554 EAP-TTLS with MSCHAPV2 as phase2.
555
556 Procedures:
557 For each enterprise wifi network
558 1. Connect to the network.
559 2. Send a GET request to a website and check response.
560
561 Expect:
562 Successful connection and Internet access through the enterprise
563 networks with passpoint support.
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530564 """
565 @test_tracker_info(uuid="0b942524-bde9-4fc6-ac6a-fef1c247cb8e")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700566 def passpoint_connect_with_config_passpoint_tls(self):
Ang Lic2d45212016-03-10 18:38:53 -0800567 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530568 "Passpoint is not supported on %s" % self.dut.model)
569 wutils.wifi_connect(self.dut, self.config_passpoint_tls)
Ang Li73697b32015-12-03 00:41:53 +0000570
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530571 @test_tracker_info(uuid="33a014aa-99e7-4612-b732-54fabf1bf922")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700572 def passpoint_connect_with_config_passpoint_ttls_none(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530573 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
574 "Passpoint is not supported on %s" % self.dut.model)
575 config = dict(self.config_passpoint_ttls)
576 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value
577 wutils.wifi_connect(self.dut, config)
578
579 @test_tracker_info(uuid="1aba8bf9-2b09-4956-b418-c3f4dadab330")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700580 def passpoint_connect_with_config_passpoint_ttls_pap(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530581 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
582 "Passpoint is not supported on %s" % self.dut.model)
583 config = dict(self.config_passpoint_ttls)
584 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value
585 wutils.wifi_connect(self.dut, config)
586
587 @test_tracker_info(uuid="cd978fc9-a393-4b1e-bba3-1efc52224500")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700588 def passpoint_connect_with_config_passpoint_ttls_mschap(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530589 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
590 "Passpoint is not supported on %s" % self.dut.model)
591 config = dict(self.config_passpoint_ttls)
592 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value
593 wutils.wifi_connect(self.dut, config)
594
595 @test_tracker_info(uuid="bc311ee7-ba64-4c76-a629-b916701bf6a5")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700596 def passpoint_connect_with_config_passpoint_ttls_mschapv2(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530597 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
598 "Passpoint is not supported on %s" % self.dut.model)
599 config = dict(self.config_passpoint_ttls)
600 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
601 wutils.wifi_connect(self.dut, config)
602
603 @test_tracker_info(uuid="357e5162-5081-4149-bedd-ef2c0f88b97e")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700604 def passpoint_connect_with_config_passpoint_ttls_gtc(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530605 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
606 "Passpoint is not supported on %s" % self.dut.model)
607 config = dict(self.config_passpoint_ttls)
608 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
609 wutils.wifi_connect(self.dut, config)
610
611 # Passpoint connect negative tests
612 """ Test connecting to enterprise networks.
Ang Li73697b32015-12-03 00:41:53 +0000613
614 Procedures:
615 For each enterprise wifi network
616 1. Connect to the network with invalid credentials.
617
618 Expect:
619 Fail to establish connection.
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530620 """
621 @test_tracker_info(uuid="7b6b44a0-ff70-49b4-94ca-a98bedc18f92")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700622 def passpoint_connect_negative_with_config_passpoint_tls(self):
Ang Lic2d45212016-03-10 18:38:53 -0800623 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530624 "Passpoint is not supported on %s" % self.dut.model)
625 config = self.gen_negative_passpoint_configs(self.config_passpoint_tls)
626 self.eap_negative_connect_logic(config, self.dut)
Ang Li81549052016-06-09 18:51:14 -0700627
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530628 @test_tracker_info(uuid="3dbde40a-e88c-4166-b932-163663a10a41")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700629 def passpoint_connect_negative_with_config_passpoint_ttls_none(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530630 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
631 "Passpoint is not supported on %s" % self.dut.model)
632 config = dict(self.config_passpoint_ttls)
633 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value
634 config = self.gen_negative_passpoint_configs(config)
635 self.eap_negative_connect_logic(config, self.dut)
Ang Li81549052016-06-09 18:51:14 -0700636
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530637 @test_tracker_info(uuid="8ee22ad6-d561-4ca2-a808-9f372fce56b4")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700638 def passpoint_connect_negative_with_config_passpoint_ttls_pap(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530639 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
640 "Passpoint is not supported on %s" % self.dut.model)
641 config = dict(self.config_passpoint_ttls)
642 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value
643 config = self.gen_negative_passpoint_configs(config)
644 self.eap_negative_connect_logic(config, self.dut)
Roshan Pius58916a32016-06-16 16:26:44 -0700645
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530646 @test_tracker_info(uuid="db5cefe7-9cb8-47a6-8635-006c80b97012")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700647 def passpoint_connect_negative_with_config_passpoint_ttls_mschap(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530648 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
649 "Passpoint is not supported on %s" % self.dut.model)
650 config = dict(self.config_passpoint_ttls)
651 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value
652 config = self.gen_negative_passpoint_configs(config)
653 self.eap_negative_connect_logic(config, self.dut)
654
655 @test_tracker_info(uuid="8f49496e-80df-48ce-9c51-42f0c6b81aff")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700656 def passpoint_connect_negative_with_config_passpoint_ttls_mschapv2(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530657 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
658 "Passpoint is not supported on %s" % self.dut.model)
659 config = dict(self.config_passpoint_ttls)
660 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
661 config = self.gen_negative_passpoint_configs(config)
662 self.eap_negative_connect_logic(config, self.dut)
663
664 @test_tracker_info(uuid="6561508f-598e-408d-96b6-15b631664be6")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700665 def passpoint_connect_negative_with_config_passpoint_ttls_gtc(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530666 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
667 "Passpoint is not supported on %s" % self.dut.model)
668 config = dict(self.config_passpoint_ttls)
669 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
670 config = self.gen_negative_passpoint_configs(config)
671 self.eap_negative_connect_logic(config, self.dut)
672
673 # Passpoint connect config store tests
674 """ Test connecting to enterprise networks of different authentication
Roshan Pius58916a32016-06-16 16:26:44 -0700675 types with passpoint support after wifi toggle.
676
677 The authentication types tested are:
678 EAP-TLS
679 EAP-TTLS with MSCHAPV2 as phase2.
680
681 Procedures:
682 For each enterprise wifi network
683 1. Connect to the network.
684 2. Send a GET request to a website and check response.
685 3. Toggle wifi.
686 4. Ensure that the device reconnects to the same network.
687
688 Expect:
689 Successful connection and Internet access through the enterprise
690 networks with passpoint support.
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530691 """
692 @test_tracker_info(uuid="5d5e6bb0-faea-4a6e-a6bc-c87de997a4fd")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700693 def passpoint_connect_config_store_with_config_passpoint_tls(self):
Roshan Pius58916a32016-06-16 16:26:44 -0700694 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530695 "Passpoint is not supported on %s" % self.dut.model)
696 self.eap_connect_toggle_wifi(self.config_passpoint_tls, self.dut)
697
698 @test_tracker_info(uuid="0c80262d-23c1-439f-ad64-7b8ada5d1962")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700699 def passpoint_connect_config_store_with_config_passpoint_ttls_none(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530700 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
701 "Passpoint is not supported on %s" % self.dut.model)
702 config = dict(self.config_passpoint_ttls)
703 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.NONE.value
704 self.eap_connect_toggle_wifi(config, self.dut)
705
706 @test_tracker_info(uuid="786e424c-b5a6-4fe9-a951-b3de16ebb6db")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700707 def passpoint_connect_config_store_with_config_passpoint_ttls_pap(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530708 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
709 "Passpoint is not supported on %s" % self.dut.model)
710 config = dict(self.config_passpoint_ttls)
711 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.PAP.value
712 self.eap_connect_toggle_wifi(config, self.dut)
713
714 @test_tracker_info(uuid="22fd61bf-722a-4016-a778-fc33e94ed211")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700715 def passpoint_connect_config_store_with_config_passpoint_ttls_mschap(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530716 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
717 "Passpoint is not supported on %s" % self.dut.model)
718 config = dict(self.config_passpoint_ttls)
719 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAP.value
720 self.eap_connect_toggle_wifi(config, self.dut)
721
722 @test_tracker_info(uuid="2abd348c-9c66-456b-88ad-55f971717620")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700723 def passpoint_connect_config_store_with_config_passpoint_ttls_mschapv2(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530724 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
725 "Passpoint is not supported on %s" % self.dut.model)
726 config = dict(self.config_passpoint_ttls)
727 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.MSCHAPV2.value
728 self.eap_connect_toggle_wifi(config, self.dut)
729
730 @test_tracker_info(uuid="043e8cdd-db95-4f03-b308-3c8cecf874b1")
Girish Moturu89d8c7f2017-09-05 11:52:54 -0700731 def passpoint_connect_config_store_with_config_passpoint_ttls_gtc(self):
Girish Moturu9cc1cd12017-07-24 13:27:57 +0530732 asserts.skip_if(not self.dut.droid.wifiIsPasspointSupported(),
733 "Passpoint is not supported on %s" % self.dut.model)
734 config = dict(self.config_passpoint_ttls)
735 config[WifiEnums.Enterprise.PHASE2] = WifiEnums.EapPhase2.GTC.value
736 self.eap_connect_toggle_wifi(config, self.dut)