Girish Moturu | ef19d91 | 2020-01-22 15:03:18 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python3.4 |
| 2 | # |
| 3 | # Copyright 2020 - 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 time |
Xianyuan Jia | 63751fb | 2020-11-17 00:07:40 +0000 | [diff] [blame] | 18 | import acts_contrib.test_utils.wifi.rpm_controller_utils as rutils |
| 19 | import acts_contrib.test_utils.wifi.wifi_test_utils as wutils |
Girish Moturu | ef19d91 | 2020-01-22 15:03:18 -0800 | [diff] [blame] | 20 | from acts import asserts |
Xianyuan Jia | 63751fb | 2020-11-17 00:07:40 +0000 | [diff] [blame] | 21 | from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest |
Girish Moturu | ef19d91 | 2020-01-22 15:03:18 -0800 | [diff] [blame] | 22 | |
| 23 | SSID = "DO_NOT_CONNECT" |
| 24 | TIMEOUT = 60 |
| 25 | WAIT_TIME = 10 |
| 26 | |
Girish Moturu | 61b6b7b | 2020-04-13 21:04:36 -0700 | [diff] [blame] | 27 | class RttPostFlightTest(WifiBaseTest): |
| 28 | """Turns off 802.11mc AP after RTT tests.""" |
Girish Moturu | ef19d91 | 2020-01-22 15:03:18 -0800 | [diff] [blame] | 29 | |
| 30 | def setup_class(self): |
| 31 | super().setup_class() |
| 32 | self.dut = self.android_devices[0] |
| 33 | required_params = ["rpm_ip", "rpm_port"] |
| 34 | self.unpack_userparams(req_param_names=required_params) |
| 35 | self.rpm_telnet = rutils.create_telnet_session(self.rpm_ip) |
| 36 | |
Girish Moturu | ef19d91 | 2020-01-22 15:03:18 -0800 | [diff] [blame] | 37 | ### Tests ### |
| 38 | |
Girish Moturu | ef19d91 | 2020-01-22 15:03:18 -0800 | [diff] [blame] | 39 | def test_turn_off_80211mc_ap(self): |
| 40 | self.rpm_telnet.turn_off(self.rpm_port) |
Girish Moturu | 61b6b7b | 2020-04-13 21:04:36 -0700 | [diff] [blame] | 41 | curr_time = time.time() |
| 42 | while time.time() < curr_time + TIMEOUT: |
| 43 | time.sleep(WAIT_TIME) |
| 44 | if not wutils.start_wifi_connection_scan_and_check_for_network( |
| 45 | self.dut, SSID): |
| 46 | return True |
| 47 | self.log.error("Failed to turn off AP") |
| 48 | return False |