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 17import time 18import acts_contrib.test_utils.wifi.rpm_controller_utils as rutils 19import acts_contrib.test_utils.wifi.wifi_test_utils as wutils 20from acts import asserts 21from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest 22 23SSID = "DO_NOT_CONNECT" 24TIMEOUT = 60 25WAIT_TIME = 10 26 27class RttPostFlightTest(WifiBaseTest): 28 """Turns off 802.11mc AP after RTT tests.""" 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 37 ### Tests ### 38 39 def test_turn_off_80211mc_ap(self): 40 self.rpm_telnet.turn_off(self.rpm_port) 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 49