1#!/usr/bin/env python3 2# 3# Copyright 2022 - 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. 16import time 17from acts import asserts 18from acts.test_decorators import test_tracker_info 19from acts.libs.utils.multithread import multithread_func 20from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 21from acts_contrib.test_utils.tel.GFTInOutBaseTest import GFTInOutBaseTest 22from acts_contrib.test_utils.tel.gft_inout_defines import VOICE_CALL 23from acts_contrib.test_utils.tel.gft_inout_defines import VOLTE_CALL 24from acts_contrib.test_utils.tel.gft_inout_defines import CSFB_CALL 25from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_POWER_LEVEL 26from acts_contrib.test_utils.tel.gft_inout_defines import IN_SERVICE_POWER_LEVEL 27from acts_contrib.test_utils.tel.gft_inout_utils import check_no_service_time 28from acts_contrib.test_utils.tel.gft_inout_utils import check_back_to_service_time 29from acts_contrib.test_utils.tel.gft_inout_utils import mo_voice_call 30from acts_contrib.test_utils.tel.gft_inout_utils import check_ims_state 31from acts_contrib.test_utils.tel.tel_defines import SERVICE_STATE_IN_SERVICE 32from acts_contrib.test_utils.tel.tel_data_utils import wait_for_cell_data_connection 33from acts_contrib.test_utils.tel.tel_ims_utils import toggle_volte 34from acts_contrib.test_utils.tel.tel_data_utils import active_file_download_test 35from acts_contrib.test_utils.tel.tel_test_utils import get_service_state_by_adb 36from acts_contrib.test_utils.tel.tel_voice_utils import hangup_call 37 38IDLE_CASE = 1 39DATA_TRANSFER_CASE = 2 40PDP_OFF_CASE = 3 41IN_CALL_CASE = 4 42CALL_DATA_CASE = 5 43 44 45class TelLabGFTInOutServiceTest(GFTInOutBaseTest): 46 def __init__(self, controllers): 47 GFTInOutBaseTest.__init__(self, controllers) 48 self.my_error_msg = "" 49 50 def setup_test(self): 51 self.check_network() 52 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 53 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 54 for ad in self.android_devices: 55 ad.droid.wifiToggleState(False) 56 GFTInOutBaseTest.setup_test(self) 57 self.check_network() 58 self.my_error_msg = "" 59 60 @test_tracker_info(uuid="c602e556-8273-4c75-b8fa-4d51ba514654") 61 @TelephonyBaseTest.tel_test_wrap 62 def test_in_out_no_service_idle_1min(self, idle_time=60): 63 """ UE is in idle 64 Move UE from coverage area to no service area and UE shows no service 65 Wait for 1 min, then re-enter coverage area 66 Args: 67 idle_time: idle time in service area 68 Returns: 69 True if pass; False if fail. 70 """ 71 return self._test_in_out_service_idle(idle_time) 72 73 @test_tracker_info(uuid="c602e556-8273-4c75-b8fa-4d51ba514654") 74 @TelephonyBaseTest.tel_test_wrap 75 def test_in_out_no_service_idle_2min(self, idle_time=120): 76 """ UE is in idle 77 Move UE from coverage area to no service area and UE shows no service 78 Wait for 2 min, then re-enter coverage area 79 Args: 80 idle_time: idle time in service area 81 Returns: 82 True if pass; False if fail. 83 """ 84 return self._test_in_out_service_idle(idle_time) 85 @test_tracker_info(uuid="1d437482-caff-4695-9f3f-f3daf6793540") 86 @TelephonyBaseTest.tel_test_wrap 87 def test_in_out_no_service_idle_5min(self, idle_time=300): 88 """ UE is in idle 89 Move UE from coverage area to no service area and UE shows no service 90 Wait for 5 min, then re-enter coverage area 91 Args: 92 loop: cycle 93 idle_time: idle time in service area 94 Returns: 95 True if pass; False if fail. 96 """ 97 return self._test_in_out_service_idle(idle_time) 98 @test_tracker_info(uuid="339b4bf5-57a1-48f0-b26a-83a7db21b08b") 99 @TelephonyBaseTest.tel_test_wrap 100 def test_in_out_no_service_idle_10min(self, idle_time=600): 101 """ UE is in idle 102 Move UE from coverage area to no service area and UE shows no service 103 Wait for 10 min, then re-enter coverage area 104 Args: 105 loop: cycle 106 idle_time: idle time in service area 107 Returns: 108 True if pass; False if fail. 109 """ 110 return self._test_in_out_service_idle(idle_time) 111 @test_tracker_info(uuid="65ebac02-8d5a-48c2-bd26-6d931d6048f1") 112 @TelephonyBaseTest.tel_test_wrap 113 def test_in_out_no_service_data_transfer_1min(self, idle_time=60): 114 """ In/Out service - Stationary data transfer - 1 min 115 UE is performing data transfer (E.g. Use FTP or browse tools) 116 move UE from coverage area to no service area and UE shows no service 117 Wait for 1 min, then re-enter coverage area 118 Args: 119 idle_time: idle time in service area 120 Returns: 121 True if pass; False if fail. 122 """ 123 return self._test_in_out_service_idle(idle_time, DATA_TRANSFER_CASE) 124 @test_tracker_info(uuid="ec3e7de4-bcf6-4a8a-ae04-868bd7925191") 125 @TelephonyBaseTest.tel_test_wrap 126 def test_in_out_no_service_data_transfer_2min(self, idle_time=120): 127 """ In/Out service - Stationary data transfer - 2 min 128 Args: 129 idle_time: idle time in service area 130 Returns: 131 True if pass; False if fail. 132 """ 133 return self._test_in_out_service_idle(idle_time, DATA_TRANSFER_CASE) 134 @test_tracker_info(uuid="8bd7017d-0a88-4423-a94b-1e37060bba1d") 135 @TelephonyBaseTest.tel_test_wrap 136 def test_in_out_no_service_data_transfer_5min(self, idle_time=300): 137 """ In/Out service - Stationary data transfer - 5 min 138 Args: 139 idle_time: idle time in service area 140 Returns: 141 True if pass; False if fail. 142 """ 143 return self._test_in_out_service_idle(idle_time, DATA_TRANSFER_CASE) 144 @test_tracker_info(uuid="c3b9c52d-41d3-449c-99ff-4bb830ca0219") 145 @TelephonyBaseTest.tel_test_wrap 146 def test_in_out_no_service_data_transfer_10min(self, idle_time=600): 147 """ In/Out service - Stationary data transfer - 10 min 148 Args: 149 idle_time: idle time in service area 150 file_name: download filename 151 Returns: 152 True if pass; False if fail. 153 """ 154 return self._test_in_out_service_idle(idle_time, DATA_TRANSFER_CASE) 155 @test_tracker_info(uuid="86a6b3b3-e754-4bde-b418-d4273b1ad907") 156 @TelephonyBaseTest.tel_test_wrap 157 def test_in_out_service_incall_1min(self, idle_time=60): 158 """ In/Out service - Stationary incall - 1 min 159 Args: 160 idle_time: idle time in service area 161 Returns: 162 True if pass; False if fail. 163 """ 164 return self._test_in_out_service_idle(idle_time, IN_CALL_CASE) 165 @test_tracker_info(uuid="0f8772cd-6f86-48eb-b583-4cbaf80a21a9") 166 @TelephonyBaseTest.tel_test_wrap 167 def test_in_out_service_incall_2min(self, idle_time=120): 168 """ In/Out service - Stationary incall - 2 min 169 Args: 170 idle_time: idle time in service area 171 Returns: 172 True if pass; False if fail. 173 """ 174 return self._test_in_out_service_idle(idle_time, IN_CALL_CASE) 175 @test_tracker_info(uuid="11f24c0f-db33-4eb3-b847-9aed447eb820") 176 @TelephonyBaseTest.tel_test_wrap 177 def test_in_out_service_incall_5min(self, idle_time=300): 178 """ In/Out service - Stationary incall - 5 min 179 Args: 180 idle_time: idle time in service area 181 Returns: 182 True if pass; False if fail. 183 """ 184 return self._test_in_out_service_idle(idle_time, IN_CALL_CASE) 185 @test_tracker_info(uuid="e318921b-de6b-428b-b2c4-3db7786d7558") 186 @TelephonyBaseTest.tel_test_wrap 187 def test_in_out_service_incall_10min(self, idle_time=600): 188 """ In/Out service - Stationary incall - 10 min 189 Args: 190 idle_time: idle time in service area 191 Returns: 192 True if pass; False if fail. 193 """ 194 return self._test_in_out_service_idle(idle_time, IN_CALL_CASE) 195 @test_tracker_info(uuid="f6cf0019-e123-4ebd-990b-0fa5b236840c") 196 @TelephonyBaseTest.tel_test_wrap 197 def test_in_out_service_call_date_1min(self, idle_time=60): 198 """ In/Out service - Stationary incall + data transfer - 1 mins 199 Args: 200 idle_time: idle time in service area 201 Returns: 202 True if pass; False if fail. 203 """ 204 return self._test_in_out_service_idle(idle_time, CALL_DATA_CASE) 205 @test_tracker_info(uuid="2f49a9de-0383-4ec6-a8ee-c62f52ea0cf2") 206 @TelephonyBaseTest.tel_test_wrap 207 def test_in_out_service_call_date_2min(self, idle_time=120): 208 """ In/Out service - Stationary incall + data transfer - 2 mins 209 Args: 210 idle_time: idle time in service area 211 Returns: 212 True if pass; False if fail. 213 """ 214 return self._test_in_out_service_idle(idle_time, CALL_DATA_CASE) 215 @test_tracker_info(uuid="73a6eedb-791f-4486-b815-8067a95efd5c") 216 @TelephonyBaseTest.tel_test_wrap 217 def test_in_out_service_call_date_5min(self, idle_time=300): 218 """ In/Out service - Stationary incall + data transfer - 5 mins 219 Args: 220 idle_time: idle time in service area 221 Returns: 222 True if pass; False if fail. 223 """ 224 return self._test_in_out_service_idle(idle_time, CALL_DATA_CASE) 225 @test_tracker_info(uuid="5cfbc90a-97e1-43e9-a69e-4ce2815c544d") 226 @TelephonyBaseTest.tel_test_wrap 227 def test_in_out_service_call_date_10min(self, idle_time=600): 228 """ In/Out service - Stationary incall + data transfer - 10 mins 229 Args: 230 idle_time: idle time in service area 231 Returns: 232 True if pass; False if fail. 233 """ 234 return self._test_in_out_service_idle(idle_time, CALL_DATA_CASE) 235 236 237 @test_tracker_info(uuid="c70180c9-5a36-4dc5-9ccc-3e6c0b5e6d37") 238 @TelephonyBaseTest.tel_test_wrap 239 def test_in_out_service_pdp_off_1min(self, idle_time=60): 240 """ In/Out service - Stationary data off - 1 min 241 Disable UE mobile data 242 Move UE from coverage area to no service area and UE shows no service 243 Wait for 1 min, then re-enter coverage area 244 Args: 245 idle_time: idle time in service area 246 Returns: 247 True if pass; False if fail. 248 """ 249 return self._test_in_out_service_idle(idle_time, PDP_OFF_CASE) 250 251 @test_tracker_info(uuid="50cc8e73-d96f-45a6-91cd-bf51de5241d2") 252 @TelephonyBaseTest.tel_test_wrap 253 def test_in_out_service_pdp_off_2min(self, idle_time=120): 254 """ In/Out service - Stationary data off - 2 min 255 Args: 256 idle_time: idle time in service area 257 Returns: 258 True if pass; False if fail. 259 """ 260 return self._test_in_out_service_idle(idle_time, PDP_OFF_CASE) 261 @test_tracker_info(uuid="1f25d40c-1bfe-4d18-b57c-d7be69664f0d") 262 @TelephonyBaseTest.tel_test_wrap 263 def test_in_out_service_pdp_off_5min(self, idle_time=300): 264 """ In/Out service - Stationary data off - 5 min 265 Args: 266 idle_time: idle time in service area 267 Returns: 268 True if pass; False if fail. 269 """ 270 return self._test_in_out_service_idle(idle_time, PDP_OFF_CASE) 271 @test_tracker_info(uuid="b076b0d0-a105-4be9-aa0b-db0d782f70f2") 272 @TelephonyBaseTest.tel_test_wrap 273 def test_in_out_service_pdp_off_10min(self, idle_time=600): 274 """ In/Out service - Stationary data off - 10 min 275 Args: 276 idle_time: idle time in service area 277 Returns: 278 True if pass; False if fail. 279 """ 280 return self._test_in_out_service_idle(idle_time, PDP_OFF_CASE) 281 def _test_in_out_service_idle(self, idle_time, case= IDLE_CASE, loop=1): 282 """ UE is in idle 283 Move UE from coverage area to no service area and UE shows no service 284 Args: 285 idle_time: idle time in service area 286 case: include IDLE_CAS, DATA_TRANSFER_CASE, PDP_OFF_CASE, 287 IN_CALL_CASE, CALL_DATA_CASE 288 loop: cycle 289 Returns: 290 True if pass; False if fail. 291 """ 292 test_result = True 293 if 'autoio_cycle' in self.user_params: 294 loop = self.user_params.get('autoio_cycle') 295 for x in range (loop): 296 self.log.info("%s loop: %s/%s" %(self.current_test_name,x+1, loop)) 297 if case == IDLE_CASE: 298 if not self._in_out_service_idle_only(idle_time): 299 test_result = False 300 elif case == DATA_TRANSFER_CASE: 301 if not self._data_transfer_mode(idle_time): 302 test_result = False 303 elif case == PDP_OFF_CASE: 304 if not self._in_out_service_pdp_off(idle_time): 305 test_result = False 306 elif case == IN_CALL_CASE: 307 if not self._in_call_in_out_service(idle_time): 308 test_result = False 309 elif case == CALL_DATA_CASE: 310 if not self._call_data_in_out_service(idle_time): 311 test_result = False 312 asserts.assert_true(test_result, "Fail: %s." %(self.my_error_msg), 313 extras={"failure_cause": self.my_error_msg}) 314 return test_result 315 316 def _in_out_service_idle_only(self, no_service_time=60, check_back_to_service=True, 317 check_no_service=True): 318 """ Move UE from coverage area to no service area and UE shows no service 319 Wait for no_service_time sec , then re-enter coverage area 320 Args: 321 no_service_time: stay at no service area time in sec 322 check_back_to_service: check device is back to service flag 323 check_no_service: check device is no service flag 324 Returns: 325 True if pass; False if fail. 326 """ 327 test_result = True 328 error_msg = "" 329 if 'check_no_service' in self.user_params: 330 loop = self.user_params.get('check_no_service') 331 if 'check_back_to_service' in self.user_params: 332 loop = self.user_params.get('check_back_to_service') 333 for ad in self.android_devices: 334 network_type = ad.droid.telephonyGetNetworkType() 335 service_state = get_service_state_by_adb(self.log,ad) 336 ad.log.info("service_state=%s. network_type=%s" 337 %(service_state ,network_type)) 338 if service_state != SERVICE_STATE_IN_SERVICE: 339 error_msg = "Device is not ready for test. Service_state=%s." %(service_state) 340 ad.log.info("Device is not ready for test. Service_state=%s." %(service_state)) 341 self.my_error_msg += error_msg 342 return False 343 self.log.info("Move UE from coverage area to no service area") 344 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 345 if check_no_service: 346 tasks = [(check_no_service_time, (ad, )) for ad in self.android_devices] 347 if not multithread_func(self.log, tasks): 348 self.check_network() 349 error_msg = "Device does not become no service" 350 self.my_error_msg += error_msg 351 self.log.info(error_msg) 352 return False 353 else: 354 self.log.info("wait for %s sec in no/limited service area" %(no_service_time)) 355 time.sleep(no_service_time) 356 self.log.info("Move UE back to service area") 357 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 358 if check_back_to_service: 359 test_result = self._check_after_no_service() 360 return test_result 361 362 def _data_transfer_mode(self, idle_time, file_name="10MB"): 363 """ Download file and in/out service 364 Args: 365 idle_time: stay at no service area time in sec 366 file_name: file to be download 367 Returns: 368 True if pass; False if fail. 369 """ 370 error_msg ="" 371 tasks_a = [(self._in_out_service_idle_only, (idle_time, False,))] 372 tasks_b = [(active_file_download_test, (self.log, ad, file_name)) 373 for ad in self.android_devices] 374 tasks_b.extend(tasks_a) 375 if not multithread_func(self.log, tasks_b): 376 error_msg = " data transfer fail. " 377 self.my_error_msg += error_msg 378 self.log.info(error_msg) 379 return self._check_after_no_service() 380 381 def _in_out_service_pdp_off(self, idle_time): 382 """ UE is in idle 383 Disable UE mobile data 384 Move UE from coverage area to no/limited service area 385 enable UE mobile data 386 After UE show no service, re-enter coverage area 387 Args: 388 idle_time: idle time in service area 389 Returns: 390 True if pass; False if fail. 391 """ 392 error_msg ="" 393 for ad in self.android_devices: 394 ad.log.info("Turn off mobile data") 395 ad.droid.telephonyToggleDataConnection(False) 396 if not wait_for_cell_data_connection(self.log, ad, False): 397 self.my_error_msg += "fail to turn off mobile data" 398 return False 399 if not self._in_out_service_idle_only(idle_time, False): 400 return False 401 for ad in self.android_devices: 402 ad.log.info("Turn on mobile data") 403 ad.droid.telephonyToggleDataConnection(True) 404 #If True, it will wait for status to be DATA_STATE_CONNECTED 405 if not wait_for_cell_data_connection(self.log, ad, True): 406 self.my_error_msg += "fail to turn on mobile data" 407 return False 408 return self._check_after_no_service() 409 410 def _in_call_in_out_service(self, idle_time): 411 """ UE is in call 412 Move UE from coverage area to no/limited service area 413 After UE show no service, re-enter coverage area 414 Args: 415 idle_time: idle time in service area 416 Returns: 417 True if pass; False if fail. 418 """ 419 error_msg = "" 420 tasks = [(mo_voice_call, (self.log, ad, VOICE_CALL, False)) for ad in self.android_devices] 421 if not multithread_func(self.log, tasks): 422 error_msg = "MO voice call fail" 423 self.my_error_msg += error_msg 424 self.log.info(error_msg) 425 return False 426 if not self._in_out_service_idle_only(idle_time, False): 427 return False 428 return self._check_after_no_service() 429 430 def _call_data_in_out_service(self, idle_time): 431 """ UE is performing data transfer (E.g. Use FTP or browse tools) 432 UE makes a MO call 433 Move UE from coverage area to no/limited service area 434 After UE show no service, re-enter coverage area 435 Args: 436 idle_time: idle time in service area 437 Returns: 438 True if pass; False if fail. 439 """ 440 tasks_a = [(active_file_download_test, (self.log, ad, )) for ad in self.android_devices] 441 tasks_b= [(mo_voice_call, (self.log, ad, VOICE_CALL, False)) for ad in self.android_devices] 442 tasks_b.extend(tasks_a) 443 if not multithread_func(self.log, tasks_b): 444 error_msg = "fail to perfrom data transfer/voice call" 445 self.my_error_msg += error_msg 446 return False 447 if not self._in_out_service_idle_only(idle_time, False): 448 return False 449 return self._check_after_no_service() 450 451 def _check_after_no_service(self): 452 """ check device is back to service or not 453 Returns: 454 True if pass; False if fail. 455 """ 456 tasks = [(check_back_to_service_time, (ad,)) for ad in self.android_devices] 457 if not multithread_func(self.log, tasks): 458 error_msg = "Device is not back to the service" 459 self.my_error_msg += error_msg 460 self.log.info(error_msg) 461 return False 462 return True 463 464 465 @test_tracker_info(uuid="4b8fee71-0d9b-4355-b175-84ea3c2a222a") 466 @TelephonyBaseTest.tel_test_wrap 467 def test_ID_1_1_5_ims_on_off(self, loop=1): 468 ''' 469 1.1.5 - In/Out service - IMS on -> no service 470 -> service area -> IMS off 471 472 Args: 473 loop: repeat this test cases for how many times 474 475 Returns: 476 True if pass; False if fail 477 Raises: 478 TestFailure if not success. 479 ''' 480 error_msg = "" 481 test_result = True 482 if 'ims_cycle' in self.user_params: 483 loop = self.user_params.get('ims_cycle') 484 485 for x in range (loop): 486 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 487 self.my_error_msg += "cylce%s: " %(x+1) 488 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 489 490 self.log.info("Turn on IMS") 491 tasks = [(toggle_volte, (self.log, ad, True)) for ad in self.android_devices] 492 if not multithread_func(self.log, tasks): 493 self._on_fail("fail to toggle volte, ") 494 return False 495 496 tasks = [(check_ims_state, (ad, )) for ad in self.android_devices] 497 if not multithread_func(self.log, tasks): 498 self._on_fail("ims is not register, ") 499 return False 500 501 self.log.info("Move to no service area") 502 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 503 time.sleep(60) 504 505 self.log.info("Turn off IMS") 506 tasks = [(toggle_volte, (self.log, ad, False)) for ad in self.android_devices] 507 if not multithread_func(self.log, tasks): 508 self._on_fail("fail to toggle volte, ") 509 return False 510 self.log.info("Move back to service area and verify device status") 511 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 512 tasks = [(self.verify_device_status, (ad, VOICE_CALL)) 513 for ad in self.android_devices] 514 test_result = multithread_func(self.log, tasks) 515 if not test_result: 516 self._on_fail("verify_device_status fail, ") 517 return False 518 if not test_result: 519 asserts.assert_true(test_result, "[Fail]%s" %(error_msg), 520 extras={"failure_cause": error_msg}) 521 return test_result 522 523 524 @test_tracker_info(uuid="6b963676-fd28-4626-ad54-e1aa04274a37") 525 @TelephonyBaseTest.tel_test_wrap 526 def test_ID_1_1_6_ims_on_off(self, loop=1): 527 ''' 528 1.1.6 - In/Out service - IMS on -> Enter no service area 529 -> service area -> IMS off 530 531 Args: 532 loop: repeat this test cases for how many times 533 534 Returns: 535 True if pass; False if fail 536 ''' 537 error_msg = "" 538 test_result = True 539 if 'ims_cycle' in self.user_params: 540 loop = self.user_params.get('ims_cylce') 541 542 for x in range (loop): 543 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 544 self.my_error_msg += "cylce%s: " %(x+1) 545 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 546 547 tasks = [(check_ims_state, (ad, )) for ad in self.android_devices] 548 multithread_func(self.log, tasks) 549 550 self.log.info("Turn on IMS") 551 tasks = [(toggle_volte, (self.log, ad, True)) for ad in self.android_devices] 552 if not multithread_func(self.log, tasks): 553 self._on_fail("fail to toggle volte, ") 554 return False 555 556 tasks = [(check_ims_state, (ad, )) for ad in self.android_devices] 557 if not multithread_func(self.log, tasks): 558 self._on_fail("ims is not register, ") 559 return False 560 561 self.log.info("Move to no service area") 562 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 563 time.sleep(60) 564 565 self.log.info("Move back to service area") 566 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 567 self.log.info("Turn off IMS") 568 tasks = [(toggle_volte, (self.log, ad, False)) for ad in self.android_devices] 569 if not multithread_func(self.log, tasks): 570 self._on_fail("fail to toggle volte, ") 571 return False 572 tasks = [(self.verify_device_status, (ad, VOICE_CALL)) 573 for ad in self.android_devices] 574 test_result = multithread_func(self.log, tasks) 575 if not test_result: 576 self._on_fail( "verify_device_status fail, ") 577 return False 578 return test_result 579 580 @test_tracker_info(uuid="640db83f-6ba8-4df5-9c8c-dcf52a1904a1") 581 @TelephonyBaseTest.tel_test_wrap 582 def test_ID_1_1_7_ims_on_off(self, loop=1): 583 ''' 584 1.1.7 - In/Out service - IMS off 585 -> IMS on under no service area -> Back service area 586 587 Args: 588 loop: repeat this test cases for how many times 589 590 Returns: 591 True if pass; False if fail 592 ''' 593 error_msg = "" 594 test_result = True 595 if 'ims_cycle' in self.user_params: 596 loop = self.user_params.get('ims_cylce') 597 598 for x in range (loop): 599 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 600 self.my_error_msg += "cylce%s: " %(x+1) 601 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 602 603 tasks = [(check_ims_state, (ad, )) for ad in self.android_devices] 604 multithread_func(self.log, tasks) 605 606 self.log.info("Turn off IMS") 607 tasks = [(toggle_volte, (self.log, ad, False)) for ad in self.android_devices] 608 if not multithread_func(self.log, tasks): 609 self._on_fail("fail to toggle volte, ") 610 return False 611 612 tasks = [(check_ims_state, (ad, )) for ad in self.android_devices] 613 if not multithread_func(self.log, tasks): 614 self._on_fail("ims is not register, ") 615 return False 616 617 self.log.info("CSFB call in service area") 618 tasks = [(mo_voice_call, (self.log, ad, CSFB_CALL, True, 30)) 619 for ad in self.android_devices] 620 if not multithread_func(self.log, tasks): 621 self._on_fail("csfb_call_fail, ") 622 return False 623 624 self.log.info("Move to no service area then turn on IMS") 625 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 626 time.sleep(60) 627 tasks = [(toggle_volte, (self.log, ad, True)) for ad in self.android_devices] 628 if not multithread_func(self.log, tasks): 629 self._on_fail("fail to toggle volte, ") 630 return False 631 632 self.log.info("Move back to service area and verify device status, VOLTE call") 633 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 634 tasks = [(self.verify_device_status, (ad, VOLTE_CALL)) 635 for ad in self.android_devices] 636 test_result = multithread_func(self.log, tasks) 637 if not test_result: 638 self._on_fail( "verify_device_status fail, ") 639 return False 640 return test_result 641 642 643 @test_tracker_info(uuid="fcb72af6-b9d0-4911-9819-79abc58d5213") 644 @TelephonyBaseTest.tel_test_wrap 645 def test_ID_1_1_8_ims_on_off(self, loop=1, sleepTimer=15): 646 ''' 647 1.1.8 - In/Out service - IMS off -> Enter no service area 648 -> service area -> IMS on 649 650 Args: 651 loop: repeat this test cases for how many times 652 653 Returns: 654 True if pass; False if fail 655 Raises: 656 TestFailure if not success. 657 ''' 658 error_msg = "" 659 test_result = True 660 if 'ims_cycle' in self.user_params: 661 loop = self.user_params.get('ims_cylce') 662 663 for x in range (loop): 664 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 665 self.my_error_msg += "cylce%s: " %(x+1) 666 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 667 668 tasks = [(check_ims_state, (ad, )) for ad in self.android_devices] 669 multithread_func(self.log, tasks) 670 671 self.log.info("Turn off IMS") 672 tasks = [(toggle_volte, (self.log, ad, False)) for ad in self.android_devices] 673 if not multithread_func(self.log, tasks): 674 self._on_fail("fail to toggle volte ") 675 return False 676 677 tasks = [(check_ims_state, (ad, )) for ad in self.android_devices] 678 if not multithread_func(self.log, tasks): 679 self._on_fail("ims is not register, ") 680 return False 681 682 self.log.info("CSFB call in service area") 683 tasks = [(mo_voice_call, (self.log, ad, CSFB_CALL, true, 30)) 684 for ad in self.android_devices] 685 if not multithread_func(self.log, tasks): 686 self._on_fail("csfb_call_fail, ") 687 return False 688 689 self.log.info("Move to no service area") 690 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 691 time.sleep(60) 692 self.log.info("Move back to service area") 693 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 694 self.log.info("Turn on ims") 695 tasks = [(toggle_volte, (self.log, ad, True)) for ad in self.android_devices] 696 if not multithread_func(self.log, tasks): 697 self._on_fail("fail to toggle volte ") 698 return False 699 self.log.info("Verify device status, VOLTE call") 700 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 701 tasks = [(self.verify_device_status, (ad, VOLTE_CALL)) 702 for ad in self.android_devices] 703 test_result = multithread_func(self.log, tasks) 704 if not test_result: 705 self._on_fail("verify_device_status fail, ") 706 return False 707 return test_result 708 709 710 @test_tracker_info(uuid="36250121-fe44-4953-ba9f-b806d7bb0e28") 711 @TelephonyBaseTest.tel_test_wrap 712 def test_ID_1_1_49_in_out_service_dialing(self, loop=1): 713 ''' 714 1.1.49 - In/Out service - Stationary dialing stage 715 716 Args: 717 loop: repeat this test cases for how many times 718 719 Returns: 720 True if pass; False if fail 721 ''' 722 error_msg = "" 723 test_result = True 724 if 'autoio_cycle' in self.user_params: 725 loop = self.user_params.get('autoio_cycle') 726 727 for x in range (loop): 728 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 729 self.my_error_msg += "cylce%s: " %(x+1) 730 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 731 for ad in self.android_devices: 732 ad.log.info("initiate voice call to %s " %(ad.mt_phone_number)) 733 ad.droid.telecomCallNumber(ad.mt_phone_number) 734 self.log.info("Move to no service area") 735 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 736 time.sleep(30) 737 tasks = [(hangup_call, (self.log, ad)) for ad in self.android_devices] 738 multithread_func(self.log, tasks) 739 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 740 if not self._check_after_no_service(): 741 return False 742 return test_result 743