blob: b058a07bbf2b4783b4fb4247666f5fe8480f5cc9 [file] [log] [blame]
Girish Moturuef19d912020-01-22 15:03:18 -08001#!/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
Xianyuan Jia63751fb2020-11-17 00:07:40 +000018import acts_contrib.test_utils.wifi.rpm_controller_utils as rutils
19import acts_contrib.test_utils.wifi.wifi_test_utils as wutils
Girish Moturuef19d912020-01-22 15:03:18 -080020from acts import asserts
Xianyuan Jia63751fb2020-11-17 00:07:40 +000021from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest
Girish Moturuef19d912020-01-22 15:03:18 -080022
23SSID = "DO_NOT_CONNECT"
24TIMEOUT = 60
25WAIT_TIME = 10
26
Girish Moturu61b6b7b2020-04-13 21:04:36 -070027class RttPostFlightTest(WifiBaseTest):
28 """Turns off 802.11mc AP after RTT tests."""
Girish Moturuef19d912020-01-22 15:03:18 -080029
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 Moturuef19d912020-01-22 15:03:18 -080037 ### Tests ###
38
Girish Moturuef19d912020-01-22 15:03:18 -080039 def test_turn_off_80211mc_ap(self):
40 self.rpm_telnet.turn_off(self.rpm_port)
Girish Moturu61b6b7b2020-04-13 21:04:36 -070041 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