Girish Moturu | 528b544 | 2018-06-07 10:48:14 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python3.4 |
| 2 | # |
| 3 | # Copyright 2018 - The Android Open Source Project |
| 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 acts.signals as signals |
| 18 | |
| 19 | from acts import asserts |
| 20 | from acts.base_test import BaseTestClass |
| 21 | from acts.libs.ota import ota_updater |
| 22 | from acts.test_decorators import test_tracker_info |
| 23 | from acts.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G |
| 24 | |
| 25 | import acts.test_utils.net.net_test_utils as nutils |
| 26 | import acts.test_utils.wifi.wifi_test_utils as wutils |
| 27 | |
| 28 | |
| 29 | class WifiTethering5GPskOTATest(BaseTestClass): |
| 30 | """Wifi Tethering 5G Psk OTA tests""" |
| 31 | |
| 32 | def setup_class(self): |
| 33 | |
| 34 | super(WifiTethering5GPskOTATest, self).setup_class() |
| 35 | ota_updater.initialize(self.user_params, self.android_devices) |
| 36 | |
| 37 | self.hotspot_device = self.android_devices[0] |
| 38 | self.tethered_device = self.android_devices[1] |
| 39 | req_params = ("wifi_hotspot_psk", ) |
| 40 | self.unpack_userparams(req_params) |
| 41 | |
| 42 | # verify hotspot device has lte data and supports tethering |
| 43 | nutils.verify_lte_data_and_tethering_supported(self.hotspot_device) |
| 44 | |
| 45 | # Save a wifi soft ap configuration and verify that it works |
| 46 | wutils.save_wifi_soft_ap_config(self.hotspot_device, |
| 47 | self.wifi_hotspot_psk, |
| 48 | WIFI_CONFIG_APBAND_5G) |
| 49 | self._verify_wifi_tethering() |
| 50 | |
| 51 | # Run OTA below, if ota fails then abort all tests. |
| 52 | try: |
| 53 | ota_updater.update(self.hotspot_device) |
| 54 | except Exception as err: |
Xianyuan Jia | 821cf57 | 2019-10-08 12:24:00 -0700 | [diff] [blame] | 55 | raise signals.TestAbortClass( |
Girish Moturu | 528b544 | 2018-06-07 10:48:14 -0700 | [diff] [blame] | 56 | "Failed up apply OTA update. Aborting tests") |
| 57 | |
| 58 | def on_fail(self, test_name, begin_time): |
| 59 | for ad in self.android_devices: |
| 60 | ad.take_bug_report(test_name, begin_time) |
| 61 | |
| 62 | def teardown_class(self): |
| 63 | wutils.wifi_toggle_state(self.hotspot_device, True) |
| 64 | |
| 65 | """Helper Functions""" |
| 66 | |
| 67 | def _verify_wifi_tethering(self): |
| 68 | """Verify wifi tethering""" |
| 69 | wutils.start_wifi_tethering_saved_config(self.hotspot_device) |
| 70 | wutils.wifi_connect(self.tethered_device, self.wifi_hotspot_psk) |
| 71 | # (TODO: @gmoturu) Change to stop_wifi_tethering. See b/109876061 |
| 72 | wutils.wifi_toggle_state(self.hotspot_device, True) |
| 73 | |
| 74 | """Tests""" |
| 75 | |
Girish Moturu | 2800d18 | 2018-07-27 10:53:38 -0700 | [diff] [blame] | 76 | @test_tracker_info(uuid="111d3a33-3152-4993-b1ba-307daaf2a6ff") |
Girish Moturu | 528b544 | 2018-06-07 10:48:14 -0700 | [diff] [blame] | 77 | def test_wifi_tethering_ota_5g_psk(self): |
Girish Moturu | 2800d18 | 2018-07-27 10:53:38 -0700 | [diff] [blame] | 78 | """ Verify wifi hotspot after ota upgrade |
| 79 | |
| 80 | Steps: |
| 81 | 1. Save a wifi hotspot config with 5g band and psk auth |
| 82 | 2. Do a OTA update |
| 83 | 3. Verify that wifi hotspot works with teh saved config |
| 84 | """ |
Girish Moturu | 528b544 | 2018-06-07 10:48:14 -0700 | [diff] [blame] | 85 | self._verify_wifi_tethering() |