1#!/usr/bin/env python3 2# 3# Copyright 2016 - 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 Test Script for Telephony Pre Check In Sanity 18""" 19 20import math 21import time 22from acts.test_decorators import test_tracker_info 23from acts.controllers.anritsu_lib._anritsu_utils import AnritsuError 24from acts.controllers.anritsu_lib.md8475a import CTCHSetup 25from acts.controllers.anritsu_lib.md8475a import BtsBandwidth 26from acts.controllers.anritsu_lib.md8475a import BtsPacketRate 27from acts.controllers.anritsu_lib.md8475a import BtsServiceState 28from acts.controllers.anritsu_lib.md8475a import MD8475A 29from acts.controllers.anritsu_lib.mg3710a import MG3710A 30from acts_contrib.test_utils.tel.anritsu_utils import LTE_BAND_2 31from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_gsm 32from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_lte 33from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_lte_lte 34from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_lte_wcdma 35from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_wcdma 36from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_wcdma_gsm 37from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_wcdma_wcdma 38from acts_contrib.test_utils.tel.anritsu_utils import set_usim_parameters 39from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_CDMA 40from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_GSM_ONLY 41from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_GSM_UMTS 42from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_LTE_GSM_WCDMA 43from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_CDMA2000 44from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_GSM 45from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_LTE 46from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_UMTS 47from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_network_rat 48from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_phones_idle 49from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode 50from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 51from acts.controllers.anritsu_lib.cell_configurations import \ 52 gsm_band850_ch128_fr869_cid58_cell 53from acts.controllers.anritsu_lib.cell_configurations import \ 54 gsm_band850_ch251_fr893_cid59_cell 55from acts.controllers.anritsu_lib.cell_configurations import \ 56 gsm_band1900_ch512_fr1930_cid51_cell 57from acts.controllers.anritsu_lib.cell_configurations import \ 58 gsm_band1900_ch512_fr1930_cid52_cell 59from acts.controllers.anritsu_lib.cell_configurations import \ 60 gsm_band1900_ch512_fr1930_cid53_cell 61from acts.controllers.anritsu_lib.cell_configurations import \ 62 gsm_band1900_ch512_fr1930_cid54_cell 63from acts.controllers.anritsu_lib.cell_configurations import \ 64 gsm_band1900_ch640_fr1955_cid56_cell 65from acts.controllers.anritsu_lib.cell_configurations import \ 66 gsm_band1900_ch750_fr1977_cid57_cell 67from acts.controllers.anritsu_lib.cell_configurations import \ 68 lte_band2_ch900_fr1960_pcid9_cell 69from acts.controllers.anritsu_lib.cell_configurations import \ 70 lte_band4_ch2000_fr2115_pcid1_cell 71from acts.controllers.anritsu_lib.cell_configurations import \ 72 lte_band4_ch2000_fr2115_pcid2_cell 73from acts.controllers.anritsu_lib.cell_configurations import \ 74 lte_band4_ch2000_fr2115_pcid3_cell 75from acts.controllers.anritsu_lib.cell_configurations import \ 76 lte_band4_ch2000_fr2115_pcid4_cell 77from acts.controllers.anritsu_lib.cell_configurations import \ 78 lte_band4_ch2050_fr2120_pcid7_cell 79from acts.controllers.anritsu_lib.cell_configurations import \ 80 lte_band4_ch2050_fr2120_pcid7_cell 81from acts.controllers.anritsu_lib.cell_configurations import \ 82 lte_band4_ch2250_fr2140_pcid8_cell 83from acts.controllers.anritsu_lib.cell_configurations import \ 84 lte_band12_ch5095_fr737_pcid10_cell 85from acts.controllers.anritsu_lib.cell_configurations import \ 86 wcdma_band1_ch10700_fr2140_cid31_cell 87from acts.controllers.anritsu_lib.cell_configurations import \ 88 wcdma_band1_ch10700_fr2140_cid32_cell 89from acts.controllers.anritsu_lib.cell_configurations import \ 90 wcdma_band1_ch10700_fr2140_cid33_cell 91from acts.controllers.anritsu_lib.cell_configurations import \ 92 wcdma_band1_ch10700_fr2140_cid34_cell 93from acts.controllers.anritsu_lib.cell_configurations import \ 94 wcdma_band1_ch10575_fr2115_cid36_cell 95from acts.controllers.anritsu_lib.cell_configurations import \ 96 wcdma_band1_ch10800_fr2160_cid37_cell 97from acts.controllers.anritsu_lib.cell_configurations import \ 98 wcdma_band2_ch9800_fr1960_cid38_cell 99from acts.controllers.anritsu_lib.cell_configurations import \ 100 wcdma_band2_ch9900_fr1980_cid39_cell 101 102 103class TelLabNeighborCellTest(TelephonyBaseTest): 104 105 # This is the default offset between CallBox Power Level and Phone measure 106 # Power Level. 107 # TODO: Probably need to further tune those values. 108 _LTE_RSSI_OFFSET = -39 109 _WCDMA_RSSI_OFFSET = -31 110 _GSM_RSSI_OFFSET = -30 111 112 _ANRITSU_SETTLING_TIME = 15 113 _SETTLING_TIME = 75 114 _LTE_MCS_DL = 5 115 _LTE_MCS_UL = 5 116 _NRB_DL = 50 117 _NRB_UL = 50 118 _CELL_PARAM_FILE = 'C:\\MX847570\\CellParam\\NEIGHBOR_CELL_TEST_TMO.wnscp' 119 120 # Below are keys should be included in expected cell info. 121 # TARGET_RSSI: This is expected RSSI. 122 TARGET_RSSI = 'target_rssi' 123 # MAX_ERROR_RSSI: This is max error between 'each sample of reported RSSI' 124 # and 'expected RSSI' 125 MAX_ERROR_RSSI = 'max_error_rssi' 126 # MAX_ERROR_AVERAGE_RSSI: This is max error between 127 # 'average value of reported RSSI' and 'expected RSSI' 128 MAX_ERROR_AVERAGE_RSSI = 'max_error_average_rssi' 129 # REPORT_RATE: expected report rate for neighbor cell. 130 REPORT_RATE = 'report_rate' 131 # RAT: expected network rat. 132 RAT = 'rat' 133 # IS_REGISTERED: is the cell registered. 134 # For serving cell, this value should be True; for neighbor cell, should be 135 # False 136 IS_REGISTERED = 'registered' 137 # CID: cell CID info. 138 CID = 'cid' 139 # PCID: cell PCID info. 140 PCID = 'pcid' 141 # PSC: cell PSC info. 142 PSC = 'psc' 143 144 # Keys for calculate average RSSI. Only used in _verify_cell_info 145 RSSI = 'rssi' 146 COUNT = 'count' 147 148 # Pre-defined invalid value. If this value is reported in cell info, just 149 # discard this value. E.g. if in reported cell info, cid is reported as 150 # 0x7fffffff, need to discard this value when calculating unique_id 151 INVALID_VALUE = 0x7fffffff 152 153 def setup_class(self): 154 super().setup_class() 155 self.ad = self.android_devices[0] 156 self.ad.sim_card = getattr(self.ad, "sim_card", None) 157 self.md8475a_ip_address = self.user_params[ 158 "anritsu_md8475a_ip_address"] 159 self.mg3710a_ip_address = self.user_params[ 160 "anritsu_mg3710a_ip_address"] 161 self.wlan_option = self.user_params.get("anritsu_wlan_option", False) 162 self.md8475_version = self.user_params.get("md8475", "A") 163 164 if "lte_rssi_offset" in self.user_params: 165 self._LTE_RSSI_OFFSET = int(self.user_params["lte_rssi_offset"]) 166 if "wcdma_rssi_offset" in self.user_params: 167 self._WCDMA_RSSI_OFFSET = int(self.user_params[ 168 "wcdma_rssi_offset"]) 169 if "gsm_rssi_offset" in self.user_params: 170 self._GSM_RSSI_OFFSET = int(self.user_params["gsm_rssi_offset"]) 171 172 self.md8475a = None 173 self.mg3710a = None 174 try: 175 self.md8475a = MD8475A(self.md8475a_ip_address, self.wlan_option, 176 self.md8475_version) 177 except AnritsuError as e: 178 self.log.error("Error in connecting to Anritsu MD8475A:{}".format( 179 e)) 180 return False 181 182 try: 183 self.mg3710a = MG3710A(self.mg3710a_ip_address) 184 except AnritsuError as e: 185 self.log.error("Error in connecting to Anritsu MG3710A :{}".format( 186 e)) 187 return False 188 return True 189 190 def setup_test(self): 191 self.turn_off_3710a_sg(1) 192 self.turn_off_3710a_sg(2) 193 self.mg3710a.set_arb_pattern_aorb_state("A", "OFF", 1) 194 self.mg3710a.set_arb_pattern_aorb_state("B", "OFF", 1) 195 self.mg3710a.set_arb_pattern_aorb_state("A", "OFF", 2) 196 self.mg3710a.set_arb_pattern_aorb_state("B", "OFF", 2) 197 self.mg3710a.set_freq_relative_display_status("OFF", 1) 198 self.mg3710a.set_freq_relative_display_status("OFF", 2) 199 self.ad.droid.telephonySetPreferredNetworkTypes( 200 NETWORK_MODE_LTE_GSM_WCDMA) 201 ensure_phones_idle(self.log, self.android_devices) 202 toggle_airplane_mode(self.log, self.ad, True) 203 self.ad.droid.telephonyToggleDataConnection(True) 204 self.ad.adb.shell("setprop net.lte.ims.volte.provisioned 1", 205 ignore_status=True) 206 return True 207 208 def teardown_test(self): 209 toggle_airplane_mode(self.log, self.ad, True) 210 self.turn_off_3710a_sg(1) 211 self.turn_off_3710a_sg(2) 212 self.log.info("Stopping Simulation") 213 self.md8475a.stop_simulation() 214 return True 215 216 def teardown_class(self): 217 if self.md8475a is not None: 218 self.md8475a.disconnect() 219 if self.mg3710a is not None: 220 self.mg3710a.disconnect() 221 return True 222 223 def _setup_lte_serving_cell(self, bts, dl_power, cell_id, physical_cellid): 224 bts.output_level = dl_power 225 bts.bandwidth = BtsBandwidth.LTE_BANDWIDTH_10MHz 226 bts.packet_rate = BtsPacketRate.LTE_MANUAL 227 bts.lte_mcs_dl = self._LTE_MCS_DL 228 bts.lte_mcs_ul = self._LTE_MCS_UL 229 bts.nrb_dl = self._NRB_DL 230 bts.nrb_ul = self._NRB_UL 231 bts.cell_id = cell_id 232 bts.physical_cellid = physical_cellid 233 bts.neighbor_cell_mode = "DEFAULT" 234 235 def _setup_lte_neighbhor_cell_md8475a(self, bts, band, dl_power, cell_id, 236 physical_cellid): 237 bts.output_level = dl_power 238 bts.band = band 239 bts.bandwidth = BtsBandwidth.LTE_BANDWIDTH_10MHz 240 bts.cell_id = cell_id 241 bts.physical_cellid = physical_cellid 242 bts.neighbor_cell_mode = "DEFAULT" 243 bts.packet_rate = BtsPacketRate.LTE_MANUAL 244 bts.lte_mcs_dl = self._LTE_MCS_DL 245 bts.lte_mcs_ul = self._LTE_MCS_UL 246 bts.nrb_dl = self._NRB_DL 247 bts.nrb_ul = self._NRB_UL 248 249 def _setup_wcdma_serving_cell(self, bts, dl_power, cell_id): 250 bts.output_level = dl_power 251 bts.cell_id = cell_id 252 bts.neighbor_cell_mode = "DEFAULT" 253 254 def _setup_wcdma_neighbhor_cell_md8475a(self, bts, band, dl_power, 255 cell_id): 256 bts.output_level = dl_power 257 bts.band = band 258 bts.cell_id = cell_id 259 bts.neighbor_cell_mode = "DEFAULT" 260 261 def _setup_lte_cell_md8475a(self, bts, params, dl_power): 262 bts.output_level = dl_power 263 bts.band = params['band'] 264 bts.bandwidth = params['bandwidth'] 265 bts.cell_id = params['cid'] 266 bts.physical_cellid = params['pcid'] 267 bts.mcc = params['mcc'] 268 bts.mnc = params['mnc'] 269 bts.tac = params['tac'] 270 bts.neighbor_cell_mode = "DEFAULT" 271 bts.dl_channel = params['channel'] 272 bts.packet_rate = BtsPacketRate.LTE_MANUAL 273 bts.lte_mcs_dl = self._LTE_MCS_DL 274 bts.lte_mcs_ul = self._LTE_MCS_UL 275 bts.nrb_dl = self._NRB_DL 276 bts.nrb_ul = self._NRB_UL 277 278 def _setup_wcdma_cell_md8475a(self, bts, params, dl_power): 279 bts.output_level = dl_power 280 bts.band = params['band'] 281 bts.cell_id = params['cid'] 282 bts.mcc = params['mcc'] 283 bts.mnc = params['mnc'] 284 bts.lac = params['lac'] 285 bts.rac = params['rac'] 286 bts.neighbor_cell_mode = "DEFAULT" 287 bts.primary_scrambling_code = params['psc'] 288 bts.dl_channel = params['channel'] 289 290 def _setup_gsm_cell_md8475a(self, bts, params, dl_power): 291 bts.output_level = params['power'] 292 bts.band = params['band'] 293 bts.cell_id = params['cid'] 294 bts.mcc = params['mcc'] 295 bts.mnc = params['mnc'] 296 bts.lac = params['lac'] 297 bts.rac = params['rac'] 298 bts.neighbor_cell_mode = "DEFAULT" 299 300 def setup_3710a_waveform(self, sg_number, memory, frequency, power_level, 301 wave_package_name, wave_pattern_name): 302 self.mg3710a.set_frequency(frequency, sg_number) 303 self.mg3710a.set_arb_state("ON", sg_number) 304 self.mg3710a.set_arb_combination_mode("EDIT", sg_number) 305 self.mg3710a.select_waveform(wave_package_name, wave_pattern_name, 306 memory, sg_number) 307 self.mg3710a.set_arb_pattern_aorb_state(memory, "ON", sg_number) 308 self.mg3710a.set_arb_level_aorb(memory, power_level, sg_number) 309 310 def turn_on_3710a_sg(self, sg_number): 311 self.mg3710a.set_modulation_state("ON", sg_number) 312 self.mg3710a.set_rf_output_state("ON", sg_number) 313 314 def turn_off_3710a_sg(self, sg_number): 315 self.mg3710a.set_modulation_state("OFF", sg_number) 316 self.mg3710a.set_rf_output_state("OFF", sg_number) 317 318 def _is_matching_cell(self, expected_cell_info, input_cell_info): 319 """Return if 'input_cell_info' matches 'expected_cell_info'. 320 321 Args: 322 expected_cell_info: expected cell info. (dictionary) 323 input_cell_info: input cell info to test. (dictionary) 324 325 Returns: 326 True if: 327 for each key in key_list, if key exist in expected_cell_info, 328 it should also exist in input_cell_info, and the values should 329 equal in expected_cell_info and input_cell_info 330 False otherwise. 331 """ 332 for key in [ 333 self.CID, self.PCID, self.RAT, self.PSC, self.IS_REGISTERED 334 ]: 335 if key in expected_cell_info: 336 if key not in input_cell_info: 337 return False 338 if input_cell_info[key] != expected_cell_info[key]: 339 return False 340 return True 341 342 def _unique_cell_id(self, input_cell_info): 343 """Get the unique id for cell_info, based on cid, pcid, rat, psc and 344 is_registered. 345 346 Args: 347 input_cell_info: cell info to get unique id. 348 349 Returns: 350 unique id (string) 351 """ 352 unique_id = "" 353 for key in [ 354 self.CID, self.PCID, self.RAT, self.PSC, self.IS_REGISTERED 355 ]: 356 if key in input_cell_info: 357 if input_cell_info[key] != self.INVALID_VALUE: 358 unique_id += key + ":" + str(input_cell_info[key]) + ":" 359 return unique_id 360 361 def _get_rssi_from_cell_info(self, cell_info): 362 """Return the RSSI value reported in cell_info. 363 364 Args: 365 cell_info: cell info to get RSSI. 366 367 Returns: 368 RSSI reported in this cell info. 369 """ 370 rat_to_rssi_tbl = { 371 'lte': 'rsrp', 372 'wcdma': 'signal_strength', 373 'gsm': 'signal_strength' 374 } 375 try: 376 return cell_info[rat_to_rssi_tbl[cell_info[self.RAT]]] 377 except KeyError: 378 return None 379 380 def _is_rssi_in_expected_range(self, actual_rssi, expected_rssi, 381 max_error): 382 """Return if actual_rssi is within expected range. 383 384 Args: 385 actual_rssi: the rssi value to test. 386 expected_rssi: expected rssi value. 387 max_error: max error. 388 389 Returns: 390 if the difference between actual_rssi and expected_rssi is within 391 max_error, return True. Otherwise False. 392 """ 393 if abs(actual_rssi - expected_rssi) > max_error: 394 self.log.error( 395 "Expected RSSI: {}, max error: {}, reported RSSI: {}".format( 396 expected_rssi, max_error, actual_rssi)) 397 return False 398 else: 399 return True 400 401 def _verify_cell_info(self, 402 ad, 403 expected_cell_info_stats, 404 number_of_sample=10, 405 delay_each_sample=5): 406 """Return if reported cell info from ad matches expected_cell_info_stats 407 or not. 408 409 Args: 410 ad: android device object. 411 expected_cell_info_stats: expected cell info list. 412 number_of_sample: number of sample to take from DUT. 413 delay_each_sample: time delay between each sample. 414 415 Returns: 416 True if reported cell info matches with expected_cell_info_stats. 417 False otherwise. 418 419 """ 420 421 cell_info_stats = {} 422 423 for index in range(number_of_sample): 424 info_list = ad.droid.telephonyGetAllCellInfo() 425 426 self.log.info("Received Cell Info List: {}".format(info_list)) 427 428 for sample in info_list: 429 rssi = self._get_rssi_from_cell_info(sample) 430 unique_id = self._unique_cell_id(sample) 431 432 # check cell logic 433 if not unique_id in expected_cell_info_stats: 434 self.log.error("Found unexpected cell!") 435 return False 436 elif not self._is_matching_cell( 437 expected_cell_info_stats[unique_id], sample): 438 self.log.error("Mismatched Cell Info") 439 return False 440 441 # Check RSSI within expected range 442 if not self._is_rssi_in_expected_range( 443 self._get_rssi_from_cell_info(sample), 444 expected_cell_info_stats[unique_id][self.TARGET_RSSI], 445 expected_cell_info_stats[unique_id][ 446 self.MAX_ERROR_RSSI]): 447 self.log.error("Cell Info: {}. Cell RSSI not" + 448 " in expected range".format(sample)) 449 return False 450 if unique_id not in cell_info_stats: 451 cell_info_stats[unique_id] = {self.RSSI: 0, self.COUNT: 0} 452 cell_info_stats[unique_id][self.RSSI] += rssi 453 cell_info_stats[unique_id][self.COUNT] += 1 454 455 time.sleep(delay_each_sample) 456 457 try: 458 for unique_id in expected_cell_info_stats.keys(): 459 expected_cell_info = expected_cell_info_stats[unique_id] 460 461 expected_number_of_sample_reported = math.floor( 462 expected_cell_info[self.REPORT_RATE] * number_of_sample) 463 464 if cell_info_stats[unique_id][ 465 self.COUNT] < expected_number_of_sample_reported: 466 self.log.error( 467 "Insufficient reports {}/{} for {}, expected: {}", 468 expected_cell_info[unique_id][self.COUNT], 469 number_of_sample, expected_cell_info, 470 expected_number_of_sample_reported) 471 return False 472 473 average_rssi = cell_info_stats[unique_id][self.RSSI] / \ 474 cell_info_stats[unique_id][self.COUNT] 475 476 # Check Average RSSI within expected range 477 if not self._is_rssi_in_expected_range( 478 average_rssi, expected_cell_info[self.TARGET_RSSI], 479 expected_cell_info[self.MAX_ERROR_AVERAGE_RSSI]): 480 self.log.error("Cell Average RSSI not in expected range.") 481 return False 482 except KeyError as unique_id: 483 self.log.error("Failed to find key {}".format(unique_id)) 484 self.log.error("Expected cell info not reported {}.".format( 485 expected_cell_info)) 486 return False 487 488 return True 489 490 def lte_intra_freq_ncell(self, 491 ad, 492 pcid_list, 493 init_pwr, 494 power_seq, 495 interval=3, 496 err_margin=1): 497 """Return True if UE measured RSSI follows the powers in BTS simulator 498 499 Args: 500 ad: android device object. 501 pcid: list of PCID of LTE BTS 502 init_pwr: initial downlinl power in dBm for serving and neighbor cell 503 power_seq: power change sequence in dB. 504 interval: time delay in seocnd between each power change. 505 error_margin: error margin in dB to determine measurement pass or fail 506 507 Returns: 508 True if all measurments are within margin. 509 False otherwise. 510 511 """ 512 bts = set_system_model_lte_lte(self.md8475a, self.user_params, 513 self.ad.sim_card) 514 515 self._setup_lte_serving_cell(bts[0], init_pwr, pcid_list[0], 516 pcid_list[0]) 517 self._setup_lte_neighbhor_cell_md8475a(bts[1], LTE_BAND_2, init_pwr, 518 pcid_list[1], pcid_list[1]) 519 set_usim_parameters(self.md8475a, self.ad.sim_card) 520 self.md8475a.send_command("IMSSTARTVN 1") 521 self.md8475a.start_simulation() 522 bts[1].service_state = BtsServiceState.SERVICE_STATE_OUT 523 self.ad.droid.telephonyToggleDataConnection(True) 524 if not ensure_network_rat( 525 self.log, 526 self.ad, 527 NETWORK_MODE_LTE_GSM_WCDMA, 528 RAT_FAMILY_LTE, 529 toggle_apm_after_setting=True): 530 self.log.error("Failed to set rat family {}, preferred network:{}". 531 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 532 return False 533 self.md8475a.wait_for_registration_state() 534 time.sleep(1) 535 bts[1].service_state = BtsServiceState.SERVICE_STATE_IN 536 537 n_bts = len(pcid_list) # number of total BTS 538 if n_bts >= 3: 539 self.setup_3710a_waveform("1", "A", "1960MHZ", init_pwr, "LTE", 540 "10M_B1_CID2") 541 self.turn_on_3710a_sg(1) 542 if n_bts == 4: 543 self.setup_3710a_waveform("1", "B", "1960MHZ", init_pwr, "LTE", 544 "10M_B1_CID3") 545 self.log.info("Wait for {} seconds to settle".format( 546 self._ANRITSU_SETTLING_TIME)) 547 time.sleep(self._ANRITSU_SETTLING_TIME) 548 cell_list = ad.droid.telephonyGetAllCellInfo() 549 self.log.info("Received Cell Info List: {}".format(cell_list)) 550 init_rsrp_list = [] 551 for pcid in pcid_list: 552 for cell in cell_list: 553 if cell['pcid'] == pcid: 554 init_rsrp_list.append(cell['rsrp']) 555 break 556 self.log.info("init_rsrp_list = {}".format(init_rsrp_list)) 557 error_seq = [] 558 for power in power_seq: 559 self.log.info("power = {}".format(power)) 560 for i in range(2): 561 bts[i].output_level = init_pwr + power[i] 562 if n_bts >= 3: 563 self.mg3710a.set_arb_level_aorb("A", init_pwr + power[2], "1") 564 if n_bts == 4: 565 self.mg3710a.set_arb_level_aorb("B", init_pwr + power[2], "1") 566 time.sleep(interval) 567 cell_list = ad.droid.telephonyGetAllCellInfo() 568 delta = [] 569 error = [] 570 for pcid, init_rsrp, pwr in zip(pcid_list, init_rsrp_list, power): 571 found = False 572 for cell in cell_list: 573 if cell['pcid'] == pcid: 574 found = True 575 self.log.info("pcid {}, rsrp = {}".format(pcid, cell[ 576 'rsrp'])) 577 delta.append(cell['rsrp'] - init_rsrp) 578 error.append(cell['rsrp'] - init_rsrp - pwr) 579 if not found: 580 self.log.info("pcid {} not found!".format(pcid)) 581 delta.append(-99) 582 error.append(-99) 583 self.log.info("delta = {}".format(delta)) 584 self.log.info("error = {}".format(error)) 585 error_seq.append(error) 586 self.log.info("error_seq = {}".format(error_seq)) 587 for error in error_seq: 588 for err in error: 589 if err != -99 and abs(err) > err_margin: 590 self.log.error( 591 "Test failed! Measured power error is greater than margin." 592 ) 593 return False 594 return True 595 596 """ Tests Begin """ 597 598 @test_tracker_info(uuid="17a42861-abb5-480b-9139-89219fa304b2") 599 @TelephonyBaseTest.tel_test_wrap 600 def test_2lte_intra_freq_ncell_away_close(self): 601 """ Test phone moving away from Neighbor Intra Freq cell then 602 close back while serving cell stays the same power 603 604 Setup a two LTE cell configuration on MD8475A 605 Make Sure Phone is in LTE mode 606 Verify the reported RSSI follows the DL power change in MD8475A 607 608 Returns: 609 True if pass; False if fail 610 """ 611 pcid = [0, 1] 612 init_pwr = -30 # initial DL power for all cells 613 power_seq = [ 614 [0, -1], # power change sequence reference to init_pwr 615 [0, -2], 616 [0, -3], 617 [0, -4], 618 [0, -3], 619 [0, -2], 620 [0, -1], 621 [0, 0], 622 [0, 1], 623 [0, 3], 624 [0, 4], 625 [0, 5], 626 [0, 6], 627 [0, 7], 628 [0, 8], 629 [0, 9], 630 [0, 10], 631 [0, 9], 632 [0, 8], 633 [0, 7], 634 [0, 6], 635 [0, 5], 636 [0, 4], 637 [0, 3], 638 [0, 2], 639 [0, 1], 640 [0, 0] 641 ] 642 643 return self.lte_intra_freq_ncell(self.ad, pcid, init_pwr, power_seq) 644 645 @test_tracker_info(uuid="117f404b-fb78-474a-86ba-209e6a54c9a8") 646 @TelephonyBaseTest.tel_test_wrap 647 def test_2lte_intra_freq_scell_away_close(self): 648 """ Test phone moving away from serving cell then close back while 649 neighbor Intra Freq cell stays the same power 650 651 Setup a two LTE cell configuration on MD8475A 652 Make Sure Phone is in LTE mode 653 Verify the reported RSSI follows the DL power change in MD8475A 654 655 Returns: 656 True if pass; False if fail 657 """ 658 pcid = [0, 1] 659 init_pwr = -30 # initial DL power for all cells 660 power_seq = [ 661 [-1, 0], # power change sequence reference to init_pwr 662 [-2, 0], 663 [-3, 0], 664 [-4, 0], 665 [-5, 0], 666 [-6, 0], 667 [-7, 0], 668 [-8, 0], 669 [-9, 0], 670 [-10, 0], 671 [-9, 0], 672 [-8, 0], 673 [-7, 0], 674 [-6, 0], 675 [-5, 0], 676 [-4, 0], 677 [-3, 0], 678 [-2, 0], 679 [-1, 0], 680 [0, 0], 681 [1, 0], 682 [2, 0], 683 [3, 0], 684 [4, 0], 685 [3, 0], 686 [2, 0], 687 [1, 0], 688 [0, 0] 689 ] 690 691 return self.lte_intra_freq_ncell(self.ad, pcid, init_pwr, power_seq) 692 693 @test_tracker_info(uuid="d1eec95f-40e9-4099-a669-9a88e56049ca") 694 @TelephonyBaseTest.tel_test_wrap 695 def test_2lte_intra_freq_ncell_away_close_2(self): 696 """ Test phone moving away from serving cell and close to neighbor 697 Intra Freq cell, then back and forth 698 699 Setup a two LTE cell configuration on MD8475A 700 Make Sure Phone is in LTE mode 701 Verify the reported RSSI follows the DL power change in MD8475A 702 703 Returns: 704 True if pass; False if fail 705 """ 706 pcid = [0, 1] 707 init_pwr = -30 # initial DL power for all cells 708 power_seq = [ 709 [-1, 1], # power change sequence reference to init_pwr 710 [-2, 2], 711 [-3, 3], 712 [-4, 4], 713 [-5, 5], 714 [-4, 4], 715 [-3, 3], 716 [-2, 2], 717 [-1, 1], 718 [-0, 0], 719 [1, -1], 720 [2, -2], 721 [1, -1], 722 [0, 0] 723 ] 724 725 return self.lte_intra_freq_ncell(self.ad, pcid, init_pwr, power_seq) 726 727 @test_tracker_info(uuid="c642a85b-4970-429c-81c4-f635392879be") 728 @TelephonyBaseTest.tel_test_wrap 729 def test_2lte_intra_freq_2cell_synced(self): 730 """ Test phone moving away and back to both serving cell and neighbor 731 Intra Freq cell 732 733 Setup a two LTE cell configuration on MD8475A 734 Make Sure Phone is in LTE mode 735 Verify the reported RSSI follows the DL power change in MD8475A and MG3710A 736 737 Returns: 738 True if pass; False if fail 739 """ 740 pcid = [0, 1] 741 init_pwr = -30 # initial DL power for all cells 742 power_seq = [ 743 [-1, -1], # power change sequence reference to init_pwr 744 [-3, -3], 745 [-5, -5], 746 [-7, -7], 747 [-5, -5], 748 [-3, -3], 749 [-1, -1], 750 [1, 1], 751 [3, 3], 752 [5, 5], 753 [7, 7], 754 [3, 3], 755 [0, 0] 756 ] 757 758 return self.lte_intra_freq_ncell(self.ad, pcid, init_pwr, power_seq) 759 760 @test_tracker_info(uuid="9144fab6-c7e1-4de2-a01d-7a15c117ec70") 761 @TelephonyBaseTest.tel_test_wrap 762 def test_3lte_intra_freq_scell_reversed(self): 763 """ Test phone moving away and back between 2 neighbor cells while maintain 764 same rssi with serving cell 765 766 Setup a two LTE cell configuration on MD8475A 767 Make Sure Phone is in LTE mode 768 Verify the reported RSSI follows the DL power change in MD8475A and MG3710A 769 770 Returns: 771 True if pass; False if fail 772 """ 773 pcid = [0, 1, 2] 774 init_pwr = -30 # initial DL power for all cells 775 power_seq = [ 776 [0, 1, -1], # power change sequence reference to init_pwr 777 [0, 2, -2], 778 [0, 3, -3], 779 [0, 4, -4], 780 [0, 3, -3], 781 [0, 2, -2], 782 [0, 1, -1], 783 [0, 0, 0], 784 [0, -1, 1], 785 [0, -2, 2], 786 [0, -3, 3], 787 [0, -4, 4], 788 [0, -3, 3], 789 [0, -2, 2], 790 [0, -1, 1], 791 [0, 0, 0] 792 ] 793 794 return self.lte_intra_freq_ncell(self.ad, pcid, init_pwr, power_seq) 795 796 @test_tracker_info(uuid="7bfbea72-e6fa-45ae-bf7e-b9b42063abe7") 797 @TelephonyBaseTest.tel_test_wrap 798 def test_3lte_intra_freq_3cell_synced(self): 799 """ Test phone moving away and back to both serving cell and neighbor 800 Intra Freq cell 801 802 Setup a two LTE cell configuration on MD8475A 803 Make Sure Phone is in LTE mode 804 Verify the reported RSSI follows the DL power change in MD8475A 805 806 Returns: 807 True if pass; False if fail 808 """ 809 pcid = [0, 1, 2] 810 init_pwr = -30 # initial DL power for all cells 811 power_seq = [ 812 [-1, -1, -1], # power change sequence reference to init_pwr 813 [-3, -3, -3], 814 [-5, -5, -5], 815 [-7, -7, -7], 816 [-5, -5, -5], 817 [-3, -3, -3], 818 [-1, -1, -1], 819 [1, 1, 1], 820 [3, 3, 3], 821 [5, 5, 5], 822 [7, 7, 7], 823 [3, 3, 3], 824 [0, 0, 0] 825 ] 826 827 return self.lte_intra_freq_ncell(self.ad, pcid, init_pwr, power_seq) 828 829 @test_tracker_info(uuid="b4577ae1-6435-4a15-9449-e02013dfb032") 830 @TelephonyBaseTest.tel_test_wrap 831 def test_ncells_intra_lte_0_cells(self): 832 """ Test Number of neighbor cells reported by Phone when no neighbor 833 cells are present (Phone camped on LTE) 834 835 Setup a single LTE cell configuration on MD8475A 836 Make Sure Phone is in LTE mode 837 Verify the number of neighbor cells reported by Phone 838 839 Returns: 840 True if pass; False if fail 841 """ 842 serving_cell_cid = 11 843 serving_cell_pcid = 11 844 serving_cell_dlpower = -20 845 expected_cell_info_list = [ 846 # Serving Cell 847 { 848 self.CID: serving_cell_cid, 849 self.PCID: serving_cell_pcid, 850 self.REPORT_RATE: 1, 851 self.IS_REGISTERED: True, 852 self.RAT: 'lte', 853 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + serving_cell_dlpower, 854 self.MAX_ERROR_RSSI: 3, 855 self.MAX_ERROR_AVERAGE_RSSI: 3 856 } 857 ] 858 expected_cell_info_stats = {} 859 for sample in expected_cell_info_list: 860 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 861 862 [bts1] = set_system_model_lte(self.md8475a, self.user_params, 863 self.ad.sim_card) 864 self._setup_lte_serving_cell(bts1, serving_cell_dlpower, 865 serving_cell_cid, serving_cell_pcid) 866 set_usim_parameters(self.md8475a, self.ad.sim_card) 867 self.md8475a.start_simulation() 868 869 if not ensure_network_rat( 870 self.log, 871 self.ad, 872 NETWORK_MODE_LTE_GSM_WCDMA, 873 RAT_FAMILY_LTE, 874 toggle_apm_after_setting=True): 875 self.log.error("Failed to set rat family {}, preferred network:{}". 876 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 877 return False 878 self.md8475a.wait_for_registration_state() 879 time.sleep(self._SETTLING_TIME) 880 return self._verify_cell_info(self.ad, expected_cell_info_stats) 881 882 @test_tracker_info(uuid="fe2cc07b-9676-41ab-b7ff-112d3ef84980") 883 @TelephonyBaseTest.tel_test_wrap 884 def test_ncells_intra_lte_1_cells(self): 885 """ Test Number of neighbor cells reported by Phone when one neighbor 886 cell is present (Phone camped on LTE) 887 888 Setup a two LTE cell configuration on MD8475A 889 Make Sure Phone is in LTE mode 890 Verify the number of neighbor cells reported by Phone 891 892 Returns: 893 True if pass; False if fail 894 """ 895 serving_cell_cid = 11 896 serving_cell_pcid = 11 897 neigh_cell_cid = 22 898 neigh_cell_pcid = 22 899 serving_cell_dlpower = -20 900 neigh_cell_dlpower = -24 901 902 expected_cell_info_list = [ 903 # Serving Cell 904 { 905 self.CID: serving_cell_cid, 906 self.PCID: serving_cell_pcid, 907 self.REPORT_RATE: 1, 908 self.IS_REGISTERED: True, 909 self.RAT: 'lte', 910 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + serving_cell_dlpower, 911 self.MAX_ERROR_RSSI: 3, 912 self.MAX_ERROR_AVERAGE_RSSI: 3 913 }, 914 # Neighbor Cells 915 { 916 self.PCID: neigh_cell_pcid, 917 self.REPORT_RATE: 0.1, 918 self.IS_REGISTERED: False, 919 self.RAT: 'lte', 920 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_dlpower, 921 self.MAX_ERROR_RSSI: 4, 922 self.MAX_ERROR_AVERAGE_RSSI: 3 923 } 924 ] 925 expected_cell_info_stats = {} 926 for sample in expected_cell_info_list: 927 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 928 929 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 930 self.ad.sim_card) 931 932 self._setup_lte_serving_cell(bts1, serving_cell_dlpower, 933 serving_cell_cid, serving_cell_pcid) 934 self._setup_lte_neighbhor_cell_md8475a(bts2, LTE_BAND_2, 935 neigh_cell_dlpower, 936 neigh_cell_cid, neigh_cell_pcid) 937 set_usim_parameters(self.md8475a, self.ad.sim_card) 938 self.md8475a.send_command("IMSSTARTVN 1") 939 self.md8475a.start_simulation() 940 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 941 942 if not ensure_network_rat( 943 self.log, 944 self.ad, 945 NETWORK_MODE_LTE_GSM_WCDMA, 946 RAT_FAMILY_LTE, 947 toggle_apm_after_setting=True): 948 self.log.error("Failed to set rat family {}, preferred network:{}". 949 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 950 return False 951 self.md8475a.wait_for_registration_state() 952 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 953 self.log.info("Wait for {} seconds to settle".format( 954 self._SETTLING_TIME)) 955 time.sleep(self._SETTLING_TIME) 956 return self._verify_cell_info(self.ad, expected_cell_info_stats) 957 958 @test_tracker_info(uuid="8abc7903-4ea7-407a-946b-455d7f767c3e") 959 @TelephonyBaseTest.tel_test_wrap 960 def test_ncells_intra_lte_2_cells(self): 961 """ Test Number of neighbor cells reported by Phone when two neighbor 962 cells are present (Phone camped on LTE) 963 964 Setup a two LTE cell configuration on MD8475A 965 Setup one waveform on MG3710A 966 Make Sure Phone is in LTE mode 967 Verify the number of neighbor cells reported by Phone 968 969 Returns: 970 True if pass; False if fail 971 """ 972 serving_cell_cid = 11 973 serving_cell_pcid = 11 974 neigh_cell_1_cid = 22 975 neigh_cell_1_pcid = 22 976 neigh_cell_2_cid = 1 977 neigh_cell_2_pcid = 1 978 serving_cell_dlpower = -20 979 neigh_cell_1_dlpower = -24 980 neigh_cell_2_dlpower = -23 981 982 expected_cell_info_list = [ 983 # Serving Cell 984 { 985 self.CID: serving_cell_cid, 986 self.PCID: serving_cell_pcid, 987 self.REPORT_RATE: 1, 988 self.IS_REGISTERED: True, 989 self.RAT: 'lte', 990 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + serving_cell_dlpower, 991 self.MAX_ERROR_RSSI: 3, 992 self.MAX_ERROR_AVERAGE_RSSI: 3 993 }, 994 # Neighbor Cells 995 { 996 self.PCID: neigh_cell_1_pcid, 997 self.REPORT_RATE: 0.1, 998 self.IS_REGISTERED: False, 999 self.RAT: 'lte', 1000 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_1_dlpower, 1001 self.MAX_ERROR_RSSI: 4, 1002 self.MAX_ERROR_AVERAGE_RSSI: 3 1003 }, 1004 { 1005 self.PCID: neigh_cell_2_pcid, 1006 self.REPORT_RATE: 0.1, 1007 self.IS_REGISTERED: False, 1008 self.RAT: 'lte', 1009 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_2_dlpower, 1010 self.MAX_ERROR_RSSI: 4, 1011 self.MAX_ERROR_AVERAGE_RSSI: 3 1012 } 1013 ] 1014 expected_cell_info_stats = {} 1015 for sample in expected_cell_info_list: 1016 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1017 1018 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1019 self.ad.sim_card) 1020 1021 self._setup_lte_serving_cell(bts1, serving_cell_dlpower, 1022 serving_cell_cid, serving_cell_pcid) 1023 self._setup_lte_neighbhor_cell_md8475a( 1024 bts2, LTE_BAND_2, neigh_cell_1_dlpower, neigh_cell_1_cid, 1025 neigh_cell_1_pcid) 1026 set_usim_parameters(self.md8475a, self.ad.sim_card) 1027 self.md8475a.start_simulation() 1028 if not ensure_network_rat( 1029 self.log, 1030 self.ad, 1031 NETWORK_MODE_LTE_GSM_WCDMA, 1032 RAT_FAMILY_LTE, 1033 toggle_apm_after_setting=True): 1034 self.log.error("Failed to set rat family {}, preferred network:{}". 1035 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1036 return False 1037 self.md8475a.wait_for_registration_state() 1038 1039 self.setup_3710a_waveform("1", "A", "1960MHZ", neigh_cell_2_dlpower, 1040 "LTE", "10M_B1_CID1") 1041 self.turn_on_3710a_sg(1) 1042 time.sleep(self._SETTLING_TIME) 1043 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1044 1045 @test_tracker_info(uuid="623b3d16-bc48-4353-abc3-054ca6351a97") 1046 @TelephonyBaseTest.tel_test_wrap 1047 def test_ncells_intra_lte_3_cells(self): 1048 """ Test Number of neighbor cells reported by Phone when three neighbor 1049 cells are present (Phone camped on LTE) 1050 1051 Setup two LTE cell configuration on MD8475A 1052 Setup two waveform on MG3710A 1053 Make Sure Phone is in LTE mode 1054 Verify the number of neighbor cells reported by Phone 1055 1056 Returns: 1057 True if pass; False if fail 1058 """ 1059 serving_cell_cid = 11 1060 serving_cell_pcid = 11 1061 neigh_cell_1_cid = 1 1062 neigh_cell_1_pcid = 1 1063 neigh_cell_2_cid = 2 1064 neigh_cell_2_pcid = 2 1065 neigh_cell_3_cid = 3 1066 neigh_cell_3_pcid = 3 1067 serving_cell_dlpower = -20 1068 neigh_cell_1_dlpower = -24 1069 neigh_cell_2_dlpower = -22 1070 neigh_cell_3_dlpower = -23 1071 1072 expected_cell_info_list = [ 1073 # Serving Cell 1074 { 1075 self.CID: serving_cell_cid, 1076 self.PCID: serving_cell_pcid, 1077 self.REPORT_RATE: 1, 1078 self.IS_REGISTERED: True, 1079 self.RAT: 'lte', 1080 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + serving_cell_dlpower, 1081 self.MAX_ERROR_RSSI: 3, 1082 self.MAX_ERROR_AVERAGE_RSSI: 3 1083 }, 1084 # Neighbor Cells 1085 { 1086 self.PCID: neigh_cell_1_pcid, 1087 self.REPORT_RATE: 0.1, 1088 self.IS_REGISTERED: False, 1089 self.RAT: 'lte', 1090 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_1_dlpower, 1091 self.MAX_ERROR_RSSI: 4, 1092 self.MAX_ERROR_AVERAGE_RSSI: 3 1093 }, 1094 { 1095 self.PCID: neigh_cell_2_pcid, 1096 self.REPORT_RATE: 0.1, 1097 self.IS_REGISTERED: False, 1098 self.RAT: 'lte', 1099 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_2_dlpower, 1100 self.MAX_ERROR_RSSI: 4, 1101 self.MAX_ERROR_AVERAGE_RSSI: 3 1102 }, 1103 { 1104 self.PCID: neigh_cell_3_pcid, 1105 self.REPORT_RATE: 0.1, 1106 self.IS_REGISTERED: False, 1107 self.RAT: 'lte', 1108 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_3_dlpower, 1109 self.MAX_ERROR_RSSI: 4, 1110 self.MAX_ERROR_AVERAGE_RSSI: 3 1111 } 1112 ] 1113 expected_cell_info_stats = {} 1114 for sample in expected_cell_info_list: 1115 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1116 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1117 self.ad.sim_card) 1118 self._setup_lte_serving_cell(bts1, serving_cell_dlpower, 1119 serving_cell_cid, serving_cell_pcid) 1120 1121 self._setup_lte_neighbhor_cell_md8475a( 1122 bts2, LTE_BAND_2, neigh_cell_1_dlpower, neigh_cell_1_cid, 1123 neigh_cell_1_pcid) 1124 set_usim_parameters(self.md8475a, self.ad.sim_card) 1125 self.md8475a.start_simulation() 1126 if not ensure_network_rat( 1127 self.log, 1128 self.ad, 1129 NETWORK_MODE_LTE_GSM_WCDMA, 1130 RAT_FAMILY_LTE, 1131 toggle_apm_after_setting=True): 1132 self.log.error("Failed to set rat family {}, preferred network:{}". 1133 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1134 return False 1135 self.md8475a.wait_for_registration_state() 1136 1137 self.setup_3710a_waveform("1", "A", "1960MHZ", neigh_cell_2_dlpower, 1138 "LTE", "10M_B1_CID2") 1139 1140 self.setup_3710a_waveform("1", "B", "1960MHZ", neigh_cell_3_dlpower, 1141 "LTE", "10M_B1_CID3") 1142 self.turn_on_3710a_sg(1) 1143 time.sleep(self._SETTLING_TIME) 1144 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1145 1146 @test_tracker_info(uuid="3e094e3d-e7b7-447a-9a7a-8060c5b17e88") 1147 @TelephonyBaseTest.tel_test_wrap 1148 def test_ncells_intra_lte_4_cells(self): 1149 """ Test Number of neighbor cells reported by Phone when four neighbor 1150 cells are present (Phone camped on LTE) 1151 1152 Setup two LTE cell configuration on MD8475A 1153 Setup three waveform on MG3710A 1154 Make Sure Phone is in LTE mode 1155 Verify the number of neighbor cells reported by Phone 1156 1157 Returns: 1158 True if pass; False if fail 1159 """ 1160 serving_cell_cid = 11 1161 serving_cell_pcid = 11 1162 neigh_cell_1_cid = 1 1163 neigh_cell_1_pcid = 1 1164 neigh_cell_2_cid = 2 1165 neigh_cell_2_pcid = 2 1166 neigh_cell_3_cid = 3 1167 neigh_cell_3_pcid = 3 1168 neigh_cell_4_cid = 5 1169 neigh_cell_4_pcid = 5 1170 serving_cell_dlpower = -20 1171 neigh_cell_1_dlpower = -24 1172 neigh_cell_2_dlpower = -22 1173 neigh_cell_3_dlpower = -24 1174 neigh_cell_4_dlpower = -22 1175 1176 expected_cell_info_list = [ 1177 # Serving Cell 1178 { 1179 self.CID: serving_cell_cid, 1180 self.PCID: serving_cell_pcid, 1181 self.REPORT_RATE: 1, 1182 self.IS_REGISTERED: True, 1183 self.RAT: 'lte', 1184 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + serving_cell_dlpower, 1185 self.MAX_ERROR_RSSI: 3, 1186 self.MAX_ERROR_AVERAGE_RSSI: 3 1187 }, 1188 # Neighbor Cells 1189 { 1190 self.PCID: neigh_cell_1_pcid, 1191 self.REPORT_RATE: 0.1, 1192 self.IS_REGISTERED: False, 1193 self.RAT: 'lte', 1194 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_1_dlpower, 1195 self.MAX_ERROR_RSSI: 4, 1196 self.MAX_ERROR_AVERAGE_RSSI: 3 1197 }, 1198 { 1199 self.PCID: neigh_cell_2_pcid, 1200 self.REPORT_RATE: 0.1, 1201 self.IS_REGISTERED: False, 1202 self.RAT: 'lte', 1203 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_2_dlpower, 1204 self.MAX_ERROR_RSSI: 4, 1205 self.MAX_ERROR_AVERAGE_RSSI: 3 1206 }, 1207 { 1208 self.PCID: neigh_cell_3_pcid, 1209 self.REPORT_RATE: 0.1, 1210 self.IS_REGISTERED: False, 1211 self.RAT: 'lte', 1212 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_3_dlpower, 1213 self.MAX_ERROR_RSSI: 4, 1214 self.MAX_ERROR_AVERAGE_RSSI: 3 1215 }, 1216 { 1217 self.PCID: neigh_cell_4_pcid, 1218 self.REPORT_RATE: 0.1, 1219 self.IS_REGISTERED: False, 1220 self.RAT: 'lte', 1221 self.TARGET_RSSI: self._LTE_RSSI_OFFSET + neigh_cell_4_dlpower, 1222 self.MAX_ERROR_RSSI: 4, 1223 self.MAX_ERROR_AVERAGE_RSSI: 3 1224 } 1225 ] 1226 expected_cell_info_stats = {} 1227 for sample in expected_cell_info_list: 1228 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1229 1230 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1231 self.ad.sim_card) 1232 self._setup_lte_serving_cell(bts1, serving_cell_dlpower, 1233 serving_cell_cid, serving_cell_pcid) 1234 1235 self._setup_lte_neighbhor_cell_md8475a( 1236 bts2, LTE_BAND_2, neigh_cell_1_dlpower, neigh_cell_1_cid, 1237 neigh_cell_1_pcid) 1238 set_usim_parameters(self.md8475a, self.ad.sim_card) 1239 self.md8475a.start_simulation() 1240 1241 if not ensure_network_rat( 1242 self.log, 1243 self.ad, 1244 NETWORK_MODE_LTE_GSM_WCDMA, 1245 RAT_FAMILY_LTE, 1246 toggle_apm_after_setting=True): 1247 self.log.error("Failed to set rat family {}, preferred network:{}". 1248 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1249 return False 1250 self.md8475a.wait_for_registration_state() 1251 1252 self.setup_3710a_waveform("1", "A", "1960MHZ", neigh_cell_2_dlpower, 1253 "LTE", "10M_B1_CID2") 1254 1255 self.setup_3710a_waveform("1", "B", "1960MHZ", neigh_cell_3_dlpower, 1256 "LTE", "10M_B1_CID3") 1257 1258 self.setup_3710a_waveform("2", "A", "1960MHZ", neigh_cell_4_dlpower, 1259 "LTE", "10M_B1_CID5") 1260 self.turn_on_3710a_sg(1) 1261 self.turn_on_3710a_sg(2) 1262 time.sleep(self._SETTLING_TIME) 1263 1264 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1265 1266 @test_tracker_info(uuid="7e9a9c30-9284-4440-b85e-f94b83e0373f") 1267 @TelephonyBaseTest.tel_test_wrap 1268 def test_neighbor_cell_reporting_lte_intrafreq_0_tmo(self): 1269 """ Test Number of neighbor cells reported by Phone when no neighbor 1270 cells are present (Phone camped on LTE) 1271 1272 Setup a single LTE cell configuration on MD8475A 1273 Make Sure Phone is in LTE mode 1274 Verify the number of neighbor cells reported by Phone 1275 1276 Returns: 1277 True if pass; False if fail 1278 """ 1279 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1280 serving_cell['power'] = -20 1281 1282 expected_cell_info_list = [ 1283 # Serving Cell 1284 { 1285 self.CID: serving_cell[self.CID], 1286 self.PCID: serving_cell[self.PCID], 1287 self.REPORT_RATE: 1, 1288 self.IS_REGISTERED: True, 1289 self.RAT: 'lte', 1290 self.TARGET_RSSI: 1291 self._LTE_RSSI_OFFSET + serving_cell['power'], 1292 self.MAX_ERROR_RSSI: 3, 1293 self.MAX_ERROR_AVERAGE_RSSI: 3 1294 } 1295 ] 1296 1297 expected_cell_info_stats = {} 1298 for sample in expected_cell_info_list: 1299 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1300 1301 [bts1] = set_system_model_lte(self.md8475a, self.user_params, 1302 self.ad.sim_card) 1303 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1304 set_usim_parameters(self.md8475a, self.ad.sim_card) 1305 self.md8475a.start_simulation() 1306 1307 if not ensure_network_rat( 1308 self.log, 1309 self.ad, 1310 NETWORK_MODE_LTE_GSM_WCDMA, 1311 RAT_FAMILY_LTE, 1312 toggle_apm_after_setting=True): 1313 self.log.error("Failed to set rat family {}, preferred network:{}". 1314 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1315 return False 1316 self.md8475a.wait_for_registration_state() 1317 time.sleep(self._SETTLING_TIME) 1318 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1319 1320 @test_tracker_info(uuid="13bd7000-5a45-43f5-9e54-001e0aa09262") 1321 @TelephonyBaseTest.tel_test_wrap 1322 def test_neighbor_cell_reporting_lte_intrafreq_1_tmo(self): 1323 """ Test Number of neighbor cells reported by Phone when one neighbor 1324 cell is present (Phone camped on LTE) 1325 1326 Setup a two LTE cell configuration on MD8475A 1327 Make Sure Phone is in LTE mode 1328 Verify the number of neighbor cells reported by Phone 1329 1330 Returns: 1331 True if pass; False if fail 1332 """ 1333 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1334 neighbor_cell = lte_band4_ch2000_fr2115_pcid2_cell 1335 serving_cell['power'] = -20 1336 neighbor_cell['power'] = -24 1337 expected_cell_info_list = [ 1338 # Serving Cell 1339 { 1340 self.CID: serving_cell[self.CID], 1341 self.PCID: serving_cell[self.PCID], 1342 self.REPORT_RATE: 1, 1343 self.IS_REGISTERED: True, 1344 self.RAT: 'lte', 1345 self.TARGET_RSSI: 1346 self._LTE_RSSI_OFFSET + serving_cell['power'], 1347 self.MAX_ERROR_RSSI: 3, 1348 self.MAX_ERROR_AVERAGE_RSSI: 3 1349 }, 1350 # Neighbor Cells 1351 { 1352 self.PCID: neighbor_cell[self.PCID], 1353 self.REPORT_RATE: 0.1, 1354 self.IS_REGISTERED: False, 1355 self.RAT: 'lte', 1356 self.TARGET_RSSI: 1357 self._LTE_RSSI_OFFSET + neighbor_cell['power'], 1358 self.MAX_ERROR_RSSI: 4, 1359 self.MAX_ERROR_AVERAGE_RSSI: 3 1360 } 1361 ] 1362 expected_cell_info_stats = {} 1363 for sample in expected_cell_info_list: 1364 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1365 1366 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 1367 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1368 self.ad.sim_card) 1369 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1370 self._setup_lte_cell_md8475a(bts2, neighbor_cell, 1371 neighbor_cell['power']) 1372 bts1.neighbor_cell_mode = "USERDATA" 1373 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 1374 bts1.set_neighbor_cell_name("LTE", 1, "LTE_4_C2000_F2115_PCID2") 1375 set_usim_parameters(self.md8475a, self.ad.sim_card) 1376 self.md8475a.start_simulation() 1377 # To make sure phone camps on BTS1 1378 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 1379 1380 if not ensure_network_rat( 1381 self.log, 1382 self.ad, 1383 NETWORK_MODE_LTE_GSM_WCDMA, 1384 RAT_FAMILY_LTE, 1385 toggle_apm_after_setting=True): 1386 self.log.error("Failed to set rat family {}, preferred network:{}". 1387 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1388 return False 1389 self.md8475a.wait_for_registration_state() 1390 time.sleep(self._ANRITSU_SETTLING_TIME) 1391 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 1392 time.sleep(self._SETTLING_TIME) 1393 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1394 1395 @test_tracker_info(uuid="5dca3a16-73a0-448a-a35d-22ebd253a570") 1396 @TelephonyBaseTest.tel_test_wrap 1397 def test_neighbor_cell_reporting_lte_intrafreq_2_tmo(self): 1398 """ Test Number of neighbor cells reported by Phone when two neighbor 1399 cells are present (Phone camped on LTE) 1400 1401 Setup one LTE cell configuration on MD8475A 1402 Setup two waveform on MG3710A 1403 Make Sure Phone is in LTE mode 1404 Verify the number of neighbor cells reported by Phone 1405 1406 Returns: 1407 True if pass; False if fail 1408 """ 1409 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1410 neighbor_cell_1 = lte_band4_ch2000_fr2115_pcid2_cell 1411 neighbor_cell_2 = lte_band4_ch2000_fr2115_pcid3_cell 1412 serving_cell['power'] = -20 1413 neighbor_cell_1['power'] = -24 1414 neighbor_cell_2['power'] = -23 1415 1416 expected_cell_info_list = [ 1417 # Serving Cell 1418 { 1419 self.CID: serving_cell[self.CID], 1420 self.PCID: serving_cell[self.PCID], 1421 self.REPORT_RATE: 1, 1422 self.IS_REGISTERED: True, 1423 self.RAT: 'lte', 1424 self.TARGET_RSSI: 1425 self._LTE_RSSI_OFFSET + serving_cell['power'], 1426 self.MAX_ERROR_RSSI: 3, 1427 self.MAX_ERROR_AVERAGE_RSSI: 3 1428 }, 1429 # Neighbor Cells 1430 { 1431 self.PCID: neighbor_cell_1[self.PCID], 1432 self.REPORT_RATE: 0.1, 1433 self.IS_REGISTERED: False, 1434 self.RAT: 'lte', 1435 self.TARGET_RSSI: 1436 self._LTE_RSSI_OFFSET + neighbor_cell_1['power'], 1437 self.MAX_ERROR_RSSI: 4, 1438 self.MAX_ERROR_AVERAGE_RSSI: 3 1439 }, 1440 { 1441 self.PCID: neighbor_cell_2[self.PCID], 1442 self.REPORT_RATE: 0.1, 1443 self.IS_REGISTERED: False, 1444 self.RAT: 'lte', 1445 self.TARGET_RSSI: 1446 self._LTE_RSSI_OFFSET + neighbor_cell_2['power'], 1447 self.MAX_ERROR_RSSI: 4, 1448 self.MAX_ERROR_AVERAGE_RSSI: 3 1449 } 1450 ] 1451 expected_cell_info_stats = {} 1452 for sample in expected_cell_info_list: 1453 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1454 1455 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 1456 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1457 self.ad.sim_card) 1458 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1459 self._setup_lte_cell_md8475a(bts2, neighbor_cell_1, 1460 neighbor_cell_1['power']) 1461 bts1.neighbor_cell_mode = "USERDATA" 1462 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 1463 bts1.set_neighbor_cell_name("LTE", 1, "LTE_4_C2000_F2115_PCID2") 1464 bts1.set_neighbor_cell_type("LTE", 2, "CELLNAME") 1465 bts1.set_neighbor_cell_name("LTE", 2, "LTE_4_C2000_F2115_PCID3") 1466 set_usim_parameters(self.md8475a, self.ad.sim_card) 1467 self.md8475a.start_simulation() 1468 # To make sure phone camps on BTS1 1469 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 1470 1471 if not ensure_network_rat( 1472 self.log, 1473 self.ad, 1474 NETWORK_MODE_LTE_GSM_WCDMA, 1475 RAT_FAMILY_LTE, 1476 toggle_apm_after_setting=True): 1477 self.log.error("Failed to set rat family {}, preferred network:{}". 1478 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1479 return False 1480 self.md8475a.wait_for_registration_state() 1481 time.sleep(self._ANRITSU_SETTLING_TIME) 1482 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 1483 self.setup_3710a_waveform("1", "A", "2115MHz", 1484 neighbor_cell_2['power'], "LTE", 1485 "lte_4_ch2000_pcid3") 1486 self.turn_on_3710a_sg(1) 1487 time.sleep(self._SETTLING_TIME) 1488 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1489 1490 @test_tracker_info(uuid="860152de-8aa0-422e-b5b0-28bf244076f4") 1491 @TelephonyBaseTest.tel_test_wrap 1492 def test_neighbor_cell_reporting_lte_intrafreq_3_tmo(self): 1493 """ Test Number of neighbor cells reported by Phone when three neighbor 1494 cells are present (Phone camped on LTE) 1495 1496 Setup a one LTE cell configuration on MD8475A 1497 Setup three waveforms on MG3710A 1498 Make Sure Phone is in LTE mode 1499 Verify the number of neighbor cells reported by Phone 1500 1501 Returns: 1502 True if pass; False if fail 1503 """ 1504 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1505 neighbor_cell_1 = lte_band4_ch2000_fr2115_pcid2_cell 1506 neighbor_cell_2 = lte_band4_ch2000_fr2115_pcid3_cell 1507 neighbor_cell_3 = lte_band4_ch2000_fr2115_pcid4_cell 1508 serving_cell['power'] = -20 1509 neighbor_cell_1['power'] = -24 1510 neighbor_cell_2['power'] = -23 1511 neighbor_cell_3['power'] = -22 1512 1513 expected_cell_info_list = [ 1514 # Serving Cell 1515 { 1516 self.CID: serving_cell[self.CID], 1517 self.PCID: serving_cell[self.PCID], 1518 self.REPORT_RATE: 1, 1519 self.IS_REGISTERED: True, 1520 self.RAT: 'lte', 1521 self.TARGET_RSSI: 1522 self._LTE_RSSI_OFFSET + serving_cell['power'], 1523 self.MAX_ERROR_RSSI: 3, 1524 self.MAX_ERROR_AVERAGE_RSSI: 3 1525 }, 1526 # Neighbor Cells 1527 { 1528 self.PCID: neighbor_cell_1[self.PCID], 1529 self.REPORT_RATE: 0.1, 1530 self.IS_REGISTERED: False, 1531 self.RAT: 'lte', 1532 self.TARGET_RSSI: 1533 self._LTE_RSSI_OFFSET + neighbor_cell_1['power'], 1534 self.MAX_ERROR_RSSI: 4, 1535 self.MAX_ERROR_AVERAGE_RSSI: 3 1536 }, 1537 { 1538 self.PCID: neighbor_cell_2[self.PCID], 1539 self.REPORT_RATE: 0.1, 1540 self.IS_REGISTERED: False, 1541 self.RAT: 'lte', 1542 self.TARGET_RSSI: 1543 self._LTE_RSSI_OFFSET + neighbor_cell_2['power'], 1544 self.MAX_ERROR_RSSI: 4, 1545 self.MAX_ERROR_AVERAGE_RSSI: 3 1546 }, 1547 { 1548 self.PCID: neighbor_cell_3[self.PCID], 1549 self.REPORT_RATE: 0.1, 1550 self.IS_REGISTERED: False, 1551 self.RAT: 'lte', 1552 self.TARGET_RSSI: 1553 self._LTE_RSSI_OFFSET + neighbor_cell_3['power'], 1554 self.MAX_ERROR_RSSI: 4, 1555 self.MAX_ERROR_AVERAGE_RSSI: 3 1556 } 1557 ] 1558 expected_cell_info_stats = {} 1559 for sample in expected_cell_info_list: 1560 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1561 1562 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 1563 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1564 self.ad.sim_card) 1565 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1566 self._setup_lte_cell_md8475a(bts2, neighbor_cell_1, 1567 neighbor_cell_1['power']) 1568 bts1.neighbor_cell_mode = "USERDATA" 1569 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 1570 bts1.set_neighbor_cell_name("LTE", 1, "LTE_4_C2000_F2115_PCID2") 1571 bts1.set_neighbor_cell_type("LTE", 2, "CELLNAME") 1572 bts1.set_neighbor_cell_name("LTE", 2, "LTE_4_C2000_F2115_PCID3") 1573 bts1.set_neighbor_cell_type("LTE", 3, "CELLNAME") 1574 bts1.set_neighbor_cell_name("LTE", 3, "LTE_4_C2000_F2115_PCID4") 1575 set_usim_parameters(self.md8475a, self.ad.sim_card) 1576 self.md8475a.start_simulation() 1577 # To make sure phone camps on BTS1 1578 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 1579 1580 if not ensure_network_rat( 1581 self.log, 1582 self.ad, 1583 NETWORK_MODE_LTE_GSM_WCDMA, 1584 RAT_FAMILY_LTE, 1585 toggle_apm_after_setting=True): 1586 self.log.error("Failed to set rat family {}, preferred network:{}". 1587 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1588 return False 1589 self.md8475a.wait_for_registration_state() 1590 time.sleep(self._ANRITSU_SETTLING_TIME) 1591 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 1592 self.setup_3710a_waveform("1", "A", "2115MHz", 1593 neighbor_cell_2['power'], "LTE", 1594 "lte_4_ch2000_pcid3") 1595 1596 self.setup_3710a_waveform("1", "B", "2115MHz", 1597 neighbor_cell_3['power'], "LTE", 1598 "lte_4_ch2000_pcid4") 1599 self.turn_on_3710a_sg(1) 1600 time.sleep(self._SETTLING_TIME) 1601 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1602 1603 @test_tracker_info(uuid="8c5b63ba-1322-47b6-adce-5224cbc0995a") 1604 @TelephonyBaseTest.tel_test_wrap 1605 def test_neighbor_cell_reporting_lte_interfreq_1_tmo(self): 1606 """ Test Number of neighbor cells reported by Phone when two neighbor 1607 cells(inter frequency) are present (Phone camped on LTE) 1608 1609 Setup a a LTE cell configuration on MD8475A 1610 Setup two LTE waveforms(inter frequency) on MG3710A 1611 Make Sure Phone is in LTE mode 1612 Verify the number of neighbor cells reported by Phone 1613 1614 Returns: 1615 True if pass; False if fail 1616 """ 1617 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1618 neighbor_cell_1 = lte_band4_ch2050_fr2120_pcid7_cell 1619 serving_cell['power'] = -20 1620 neighbor_cell_1['power'] = -23 1621 expected_cell_info_list = [ 1622 # Serving Cell 1623 { 1624 self.CID: serving_cell[self.CID], 1625 self.PCID: serving_cell[self.PCID], 1626 self.REPORT_RATE: 1, 1627 self.IS_REGISTERED: True, 1628 self.RAT: 'lte', 1629 self.TARGET_RSSI: 1630 self._LTE_RSSI_OFFSET + serving_cell['power'], 1631 self.MAX_ERROR_RSSI: 3, 1632 self.MAX_ERROR_AVERAGE_RSSI: 3 1633 }, 1634 # Neighbor Cells 1635 { 1636 self.PCID: neighbor_cell_1[self.PCID], 1637 self.REPORT_RATE: 0.1, 1638 self.IS_REGISTERED: False, 1639 self.RAT: 'lte', 1640 self.TARGET_RSSI: 1641 self._LTE_RSSI_OFFSET + neighbor_cell_1['power'], 1642 self.MAX_ERROR_RSSI: 4, 1643 self.MAX_ERROR_AVERAGE_RSSI: 3 1644 } 1645 ] 1646 expected_cell_info_stats = {} 1647 for sample in expected_cell_info_list: 1648 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1649 1650 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 1651 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1652 self.ad.sim_card) 1653 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1654 self._setup_lte_cell_md8475a(bts2, neighbor_cell_1, 1655 neighbor_cell_1['power']) 1656 bts1.neighbor_cell_mode = "USERDATA" 1657 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 1658 bts1.set_neighbor_cell_name("LTE", 1, "LTE_4_C2050_F2120_PCID7") 1659 set_usim_parameters(self.md8475a, self.ad.sim_card) 1660 self.md8475a.start_simulation() 1661 # To make sure phone camps on BTS1 1662 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 1663 1664 self.ad.droid.telephonyToggleDataConnection(False) 1665 if not ensure_network_rat( 1666 self.log, 1667 self.ad, 1668 NETWORK_MODE_LTE_GSM_WCDMA, 1669 RAT_FAMILY_LTE, 1670 toggle_apm_after_setting=True): 1671 self.log.error("Failed to set rat family {}, preferred network:{}". 1672 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1673 return False 1674 self.md8475a.wait_for_registration_state() 1675 time.sleep(self._ANRITSU_SETTLING_TIME) 1676 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 1677 time.sleep(self._ANRITSU_SETTLING_TIME) 1678 self.md8475a.set_packet_preservation() 1679 time.sleep(self._SETTLING_TIME) 1680 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1681 1682 @test_tracker_info(uuid="97853501-a328-4706-bb3f-c5e708b1ccb8") 1683 @TelephonyBaseTest.tel_test_wrap 1684 def test_neighbor_cell_reporting_lte_interfreq_2_tmo(self): 1685 """ Test Number of neighbor cells reported by Phone when two neighbor 1686 cells(inter frequency) are present (Phone camped on LTE) 1687 1688 Setup a a LTE cell configuration on MD8475A 1689 Setup two LTE waveforms(inter frequency) on MG3710A 1690 Make Sure Phone is in LTE mode 1691 Verify the number of neighbor cells reported by Phone 1692 1693 Returns: 1694 True if pass; False if fail 1695 """ 1696 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1697 neighbor_cell_1 = lte_band4_ch2050_fr2120_pcid7_cell 1698 neighbor_cell_2 = lte_band4_ch2250_fr2140_pcid8_cell 1699 serving_cell['power'] = -20 1700 neighbor_cell_1['power'] = -23 1701 neighbor_cell_2['power'] = -22 1702 1703 expected_cell_info_list = [ 1704 # Serving Cell 1705 { 1706 self.CID: serving_cell[self.CID], 1707 self.PCID: serving_cell[self.PCID], 1708 self.REPORT_RATE: 1, 1709 self.IS_REGISTERED: True, 1710 self.RAT: 'lte', 1711 self.TARGET_RSSI: 1712 self._LTE_RSSI_OFFSET + serving_cell['power'], 1713 self.MAX_ERROR_RSSI: 3, 1714 self.MAX_ERROR_AVERAGE_RSSI: 3 1715 }, 1716 # Neighbor Cells 1717 { 1718 self.PCID: neighbor_cell_1[self.PCID], 1719 self.REPORT_RATE: 0.1, 1720 self.IS_REGISTERED: False, 1721 self.RAT: 'lte', 1722 self.TARGET_RSSI: 1723 self._LTE_RSSI_OFFSET + neighbor_cell_1['power'], 1724 self.MAX_ERROR_RSSI: 4, 1725 self.MAX_ERROR_AVERAGE_RSSI: 3 1726 }, 1727 { 1728 self.PCID: neighbor_cell_2[self.PCID], 1729 self.REPORT_RATE: 0.1, 1730 self.IS_REGISTERED: False, 1731 self.RAT: 'lte', 1732 self.TARGET_RSSI: 1733 self._LTE_RSSI_OFFSET + neighbor_cell_2['power'], 1734 self.MAX_ERROR_RSSI: 4, 1735 self.MAX_ERROR_AVERAGE_RSSI: 3 1736 } 1737 ] 1738 expected_cell_info_stats = {} 1739 for sample in expected_cell_info_list: 1740 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1741 1742 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 1743 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1744 self.ad.sim_card) 1745 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1746 self._setup_lte_cell_md8475a(bts2, neighbor_cell_1, 1747 neighbor_cell_1['power']) 1748 bts1.neighbor_cell_mode = "USERDATA" 1749 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 1750 bts1.set_neighbor_cell_name("LTE", 1, "LTE_4_C2050_F2120_PCID7") 1751 bts1.set_neighbor_cell_type("LTE", 2, "CELLNAME") 1752 bts1.set_neighbor_cell_name("LTE", 2, "LTE_4_C2250_F2140_PCID8") 1753 set_usim_parameters(self.md8475a, self.ad.sim_card) 1754 self.md8475a.start_simulation() 1755 # To make sure phone camps on BTS1 1756 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 1757 1758 self.ad.droid.telephonyToggleDataConnection(False) 1759 if not ensure_network_rat( 1760 self.log, 1761 self.ad, 1762 NETWORK_MODE_LTE_GSM_WCDMA, 1763 RAT_FAMILY_LTE, 1764 toggle_apm_after_setting=True): 1765 self.log.error("Failed to set rat family {}, preferred network:{}". 1766 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1767 return False 1768 self.md8475a.wait_for_registration_state() 1769 time.sleep(self._ANRITSU_SETTLING_TIME) 1770 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 1771 time.sleep(self._ANRITSU_SETTLING_TIME) 1772 self.setup_3710a_waveform("1", "A", "2140MHz", 1773 neighbor_cell_2['power'], "LTE", 1774 "lte_4_ch2250_pcid8") 1775 1776 self.turn_on_3710a_sg(1) 1777 self.md8475a.set_packet_preservation() 1778 time.sleep(self._SETTLING_TIME) 1779 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1780 1781 @test_tracker_info(uuid="74bd528c-e1c5-476d-9ee0-ebfc7bbc5de1") 1782 @TelephonyBaseTest.tel_test_wrap 1783 def test_neighbor_cell_reporting_lte_interband_2_tmo(self): 1784 """ Test Number of neighbor cells reported by Phone when two neighbor 1785 cells(inter band) are present (Phone camped on LTE) 1786 1787 Setup one LTE cell configuration on MD8475A 1788 Setup two LTE waveforms((inter band)) on MG3710A 1789 Make Sure Phone is in LTE mode 1790 Verify the number of neighbor cells reported by Phone 1791 1792 Returns: 1793 True if pass; False if fail 1794 """ 1795 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1796 neighbor_cell_1 = lte_band2_ch900_fr1960_pcid9_cell 1797 neighbor_cell_2 = lte_band12_ch5095_fr737_pcid10_cell 1798 serving_cell['power'] = -20 1799 neighbor_cell_1['power'] = -24 1800 neighbor_cell_2['power'] = -22 1801 1802 expected_cell_info_list = [ 1803 # Serving Cell 1804 { 1805 self.CID: serving_cell[self.CID], 1806 self.PCID: serving_cell[self.PCID], 1807 self.REPORT_RATE: 1, 1808 self.IS_REGISTERED: True, 1809 self.RAT: 'lte', 1810 self.TARGET_RSSI: 1811 self._LTE_RSSI_OFFSET + serving_cell['power'], 1812 self.MAX_ERROR_RSSI: 3, 1813 self.MAX_ERROR_AVERAGE_RSSI: 3 1814 }, 1815 # Neighbor Cells 1816 { 1817 self.PCID: neighbor_cell_1[self.PCID], 1818 self.REPORT_RATE: 0.1, 1819 self.IS_REGISTERED: False, 1820 self.RAT: 'lte', 1821 self.TARGET_RSSI: 1822 self._LTE_RSSI_OFFSET + neighbor_cell_1['power'], 1823 self.MAX_ERROR_RSSI: 4, 1824 self.MAX_ERROR_AVERAGE_RSSI: 3 1825 }, 1826 { 1827 self.PCID: neighbor_cell_2[self.PCID], 1828 self.REPORT_RATE: 0.1, 1829 self.IS_REGISTERED: False, 1830 self.RAT: 'lte', 1831 self.TARGET_RSSI: 1832 self._LTE_RSSI_OFFSET + neighbor_cell_2['power'], 1833 self.MAX_ERROR_RSSI: 4, 1834 self.MAX_ERROR_AVERAGE_RSSI: 3 1835 } 1836 ] 1837 expected_cell_info_stats = {} 1838 for sample in expected_cell_info_list: 1839 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1840 1841 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 1842 [bts1, bts2] = set_system_model_lte_lte(self.md8475a, self.user_params, 1843 self.ad.sim_card) 1844 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1845 self._setup_lte_cell_md8475a(bts2, neighbor_cell_1, 1846 neighbor_cell_1['power']) 1847 bts1.neighbor_cell_mode = "USERDATA" 1848 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 1849 bts1.set_neighbor_cell_name("LTE", 1, "LTE_2_C900_F1960_PCID9") 1850 bts1.set_neighbor_cell_type("LTE", 2, "CELLNAME") 1851 bts1.set_neighbor_cell_name("LTE", 2, "LTE_12_C5095_F737_PCID10") 1852 set_usim_parameters(self.md8475a, self.ad.sim_card) 1853 self.md8475a.start_simulation() 1854 # To make sure phone camps on BTS1 1855 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 1856 1857 self.ad.droid.telephonyToggleDataConnection(False) 1858 if not ensure_network_rat( 1859 self.log, 1860 self.ad, 1861 NETWORK_MODE_LTE_GSM_WCDMA, 1862 RAT_FAMILY_LTE, 1863 toggle_apm_after_setting=True): 1864 self.log.error("Failed to set rat family {}, preferred network:{}". 1865 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1866 return False 1867 self.md8475a.wait_for_registration_state() 1868 time.sleep(self._ANRITSU_SETTLING_TIME) 1869 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 1870 self.setup_3710a_waveform("1", "A", "737.5MHz", 1871 neighbor_cell_2['power'], "LTE", 1872 "lte_12_ch5095_pcid10") 1873 self.turn_on_3710a_sg(1) 1874 time.sleep(self._ANRITSU_SETTLING_TIME) 1875 self.md8475a.set_packet_preservation() 1876 time.sleep(self._SETTLING_TIME) 1877 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1878 1879 @test_tracker_info(uuid="6289e3e4-9316-4b82-bd0b-dde53f26da0d") 1880 @TelephonyBaseTest.tel_test_wrap 1881 def test_neighbor_cell_reporting_lte_interrat_1_tmo(self): 1882 """ Test Number of neighbor cells reported by Phone when two neighbor 1883 cells(inter RAT) are present (Phone camped on LTE) 1884 1885 Setup one LTE and one WCDMA cell configuration on MD8475A 1886 Setup one GSM waveform on MG3710A 1887 Make Sure Phone is in LTE mode 1888 Verify the number of neighbor cells reported by Phone 1889 1890 Returns: 1891 True if pass; False if fail 1892 """ 1893 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1894 neighbor_cell_1 = wcdma_band1_ch10700_fr2140_cid31_cell 1895 serving_cell['power'] = -20 1896 neighbor_cell_1['power'] = -24 1897 1898 expected_cell_info_list = [ 1899 # Serving Cell 1900 { 1901 self.CID: serving_cell[self.CID], 1902 self.PCID: serving_cell[self.PCID], 1903 self.REPORT_RATE: 1, 1904 self.IS_REGISTERED: True, 1905 self.RAT: 'lte', 1906 self.TARGET_RSSI: 1907 self._LTE_RSSI_OFFSET + serving_cell['power'], 1908 self.MAX_ERROR_RSSI: 3, 1909 self.MAX_ERROR_AVERAGE_RSSI: 3 1910 }, 1911 # Neighbor Cells 1912 { 1913 self.PSC: neighbor_cell_1[self.PSC], 1914 self.REPORT_RATE: 0.1, 1915 self.IS_REGISTERED: False, 1916 self.RAT: 'wcdma', 1917 self.TARGET_RSSI: 1918 self._WCDMA_RSSI_OFFSET + neighbor_cell_1['power'], 1919 self.MAX_ERROR_RSSI: 4, 1920 self.MAX_ERROR_AVERAGE_RSSI: 3 1921 } 1922 ] 1923 expected_cell_info_stats = {} 1924 for sample in expected_cell_info_list: 1925 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 1926 1927 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 1928 [bts1, bts2] = set_system_model_lte_wcdma( 1929 self.md8475a, self.user_params, self.ad.sim_card) 1930 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 1931 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell_1, 1932 neighbor_cell_1['power']) 1933 bts1.neighbor_cell_mode = "USERDATA" 1934 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 1935 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_1_C10700_F2140_CID31") 1936 set_usim_parameters(self.md8475a, self.ad.sim_card) 1937 self.md8475a.start_simulation() 1938 # To make sure phone camps on BTS1 1939 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 1940 1941 self.ad.droid.telephonyToggleDataConnection(False) 1942 if not ensure_network_rat( 1943 self.log, 1944 self.ad, 1945 NETWORK_MODE_LTE_GSM_WCDMA, 1946 RAT_FAMILY_LTE, 1947 toggle_apm_after_setting=True): 1948 self.log.error("Failed to set rat family {}, preferred network:{}". 1949 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 1950 return False 1951 self.md8475a.wait_for_registration_state() 1952 time.sleep(self._ANRITSU_SETTLING_TIME) 1953 self.md8475a.set_packet_preservation() 1954 time.sleep(self._SETTLING_TIME) 1955 return self._verify_cell_info(self.ad, expected_cell_info_stats) 1956 1957 @test_tracker_info(uuid="9be4e4a8-f79a-4283-9a85-371a9bddfa5d") 1958 @TelephonyBaseTest.tel_test_wrap 1959 def test_neighbor_cell_reporting_lte_interrat_2_tmo(self): 1960 """ Test Number of neighbor cells reported by Phone when two neighbor 1961 cells(inter RAT) are present (Phone camped on LTE) 1962 1963 Setup one LTE and one WCDMA cell configuration on MD8475A 1964 Setup one GSM waveform on MG3710A 1965 Make Sure Phone is in LTE mode 1966 Verify the number of neighbor cells reported by Phone 1967 1968 Returns: 1969 True if pass; False if fail 1970 """ 1971 serving_cell = lte_band4_ch2000_fr2115_pcid1_cell 1972 neighbor_cell_1 = wcdma_band1_ch10700_fr2140_cid31_cell 1973 neighbor_cell_2 = gsm_band1900_ch512_fr1930_cid51_cell 1974 serving_cell['power'] = -20 1975 neighbor_cell_1['power'] = -24 1976 neighbor_cell_2['power'] = -22 1977 expected_cell_info_list = [ 1978 # Serving Cell 1979 { 1980 self.CID: serving_cell[self.CID], 1981 self.PCID: serving_cell[self.PCID], 1982 self.REPORT_RATE: 1, 1983 self.IS_REGISTERED: True, 1984 self.RAT: 'lte', 1985 self.TARGET_RSSI: 1986 self._LTE_RSSI_OFFSET + serving_cell['power'], 1987 self.MAX_ERROR_RSSI: 3, 1988 self.MAX_ERROR_AVERAGE_RSSI: 3 1989 }, 1990 # Neighbor Cells 1991 { 1992 self.PSC: neighbor_cell_1[self.PSC], 1993 self.REPORT_RATE: 0.1, 1994 self.IS_REGISTERED: False, 1995 self.RAT: 'wcdma', 1996 self.TARGET_RSSI: 1997 self._WCDMA_RSSI_OFFSET + neighbor_cell_1['power'], 1998 self.MAX_ERROR_RSSI: 4, 1999 self.MAX_ERROR_AVERAGE_RSSI: 3 2000 }, 2001 { 2002 self.CID: neighbor_cell_2[self.CID], 2003 self.REPORT_RATE: 0.1, 2004 self.IS_REGISTERED: False, 2005 self.RAT: 'gsm', 2006 self.TARGET_RSSI: 2007 self._GSM_RSSI_OFFSET + neighbor_cell_2['power'], 2008 self.MAX_ERROR_RSSI: 4, 2009 self.MAX_ERROR_AVERAGE_RSSI: 3 2010 } 2011 ] 2012 expected_cell_info_stats = {} 2013 for sample in expected_cell_info_list: 2014 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2015 2016 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2017 [bts1, bts2] = set_system_model_lte_wcdma( 2018 self.md8475a, self.user_params, self.ad.sim_card) 2019 self._setup_lte_cell_md8475a(bts1, serving_cell, serving_cell['power']) 2020 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell_1, 2021 neighbor_cell_1['power']) 2022 bts1.neighbor_cell_mode = "USERDATA" 2023 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 2024 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_1_C10700_F2140_CID31") 2025 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 2026 bts1.set_neighbor_cell_name("GSM", 1, "GSM_1900_C512_F1930_CID51") 2027 set_usim_parameters(self.md8475a, self.ad.sim_card) 2028 self.md8475a.start_simulation() 2029 # To make sure phone camps on BTS1 2030 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2031 2032 self.ad.droid.telephonyToggleDataConnection(False) 2033 if not ensure_network_rat( 2034 self.log, 2035 self.ad, 2036 NETWORK_MODE_LTE_GSM_WCDMA, 2037 RAT_FAMILY_LTE, 2038 toggle_apm_after_setting=True): 2039 self.log.error("Failed to set rat family {}, preferred network:{}". 2040 format(RAT_FAMILY_LTE, NETWORK_MODE_LTE_GSM_WCDMA)) 2041 return False 2042 self.md8475a.wait_for_registration_state() 2043 time.sleep(self._ANRITSU_SETTLING_TIME) 2044 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2045 self.setup_3710a_waveform("1", "A", "1930.2MHz", 2046 neighbor_cell_2['power'], "GSM", 2047 "gsm_lac51_cid51") 2048 self.turn_on_3710a_sg(1) 2049 time.sleep(self._ANRITSU_SETTLING_TIME) 2050 self.md8475a.set_packet_preservation() 2051 time.sleep(self._SETTLING_TIME) 2052 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2053 2054 @test_tracker_info(uuid="14db7a3d-b18b-4b87-9d84-fb0c00d3971e") 2055 @TelephonyBaseTest.tel_test_wrap 2056 def test_neighbor_cell_reporting_wcdma_intrafreq_0_tmo(self): 2057 """ Test Number of neighbor cells reported by Phone when no neighbor 2058 cells are present (Phone camped on WCDMA) 2059 2060 Setup a single WCDMA cell configuration on MD8475A 2061 Make Sure Phone camped on WCDMA 2062 Verify the number of neighbor cells reported by Phone 2063 2064 Returns: 2065 True if pass; False if fail 2066 """ 2067 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2068 serving_cell['power'] = -20 2069 expected_cell_info_list = [ 2070 # Serving Cell 2071 { 2072 self.CID: serving_cell[self.CID], 2073 self.PSC: serving_cell[self.PSC], 2074 self.REPORT_RATE: 1, 2075 self.IS_REGISTERED: True, 2076 self.RAT: 'wcdma', 2077 self.TARGET_RSSI: 2078 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2079 self.MAX_ERROR_RSSI: 3, 2080 self.MAX_ERROR_AVERAGE_RSSI: 3 2081 } 2082 ] 2083 expected_cell_info_stats = {} 2084 for sample in expected_cell_info_list: 2085 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2086 2087 [bts1] = set_system_model_wcdma(self.md8475a, self.user_params, 2088 self.ad.sim_card) 2089 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2090 serving_cell['power']) 2091 set_usim_parameters(self.md8475a, self.ad.sim_card) 2092 self.md8475a.start_simulation() 2093 2094 if not ensure_network_rat( 2095 self.log, 2096 self.ad, 2097 NETWORK_MODE_GSM_UMTS, 2098 RAT_FAMILY_UMTS, 2099 toggle_apm_after_setting=True): 2100 self.log.error("Failed to set rat family {}, preferred network:{}". 2101 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2102 return False 2103 self.md8475a.wait_for_registration_state() 2104 time.sleep(self._SETTLING_TIME) 2105 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2106 2107 @test_tracker_info(uuid="1a227d1e-9991-4646-b51a-8156f24485da") 2108 @TelephonyBaseTest.tel_test_wrap 2109 def test_neighbor_cell_reporting_wcdma_intrafreq_1_tmo(self): 2110 """ Test Number of neighbor cells reported by Phone when one neighbor 2111 cells is present (Phone camped on WCDMA) 2112 2113 Setup two WCDMA cell configuration on MD8475A 2114 Make Sure Phone camped on WCDMA 2115 Verify the number of neighbor cells reported by Phone 2116 2117 Returns: 2118 True if pass; False if fail 2119 """ 2120 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2121 neighbor_cell = wcdma_band1_ch10700_fr2140_cid34_cell 2122 serving_cell['power'] = -20 2123 neighbor_cell['power'] = -24 2124 expected_cell_info_list = [ 2125 # Serving Cell 2126 { 2127 self.CID: serving_cell[self.CID], 2128 self.PSC: serving_cell[self.PSC], 2129 self.REPORT_RATE: 1, 2130 self.IS_REGISTERED: True, 2131 self.RAT: 'wcdma', 2132 self.TARGET_RSSI: 2133 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2134 self.MAX_ERROR_RSSI: 3, 2135 self.MAX_ERROR_AVERAGE_RSSI: 3 2136 }, 2137 # Neighbor Cells 2138 { 2139 self.PSC: neighbor_cell[self.PSC], 2140 self.REPORT_RATE: 0.1, 2141 self.IS_REGISTERED: False, 2142 self.RAT: 'wcdma', 2143 self.TARGET_RSSI: 2144 self._WCDMA_RSSI_OFFSET + neighbor_cell['power'], 2145 self.MAX_ERROR_RSSI: 4, 2146 self.MAX_ERROR_AVERAGE_RSSI: 3 2147 } 2148 ] 2149 expected_cell_info_stats = {} 2150 for sample in expected_cell_info_list: 2151 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2152 2153 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2154 [bts1, bts2] = set_system_model_wcdma_wcdma( 2155 self.md8475a, self.user_params, self.ad.sim_card) 2156 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2157 serving_cell['power']) 2158 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell, 2159 neighbor_cell['power']) 2160 bts1.neighbor_cell_mode = "USERDATA" 2161 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 2162 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_1_C10700_F2140_CID34") 2163 set_usim_parameters(self.md8475a, self.ad.sim_card) 2164 self.md8475a.start_simulation() 2165 # To make sure phone camps on BTS1 2166 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2167 2168 if not ensure_network_rat( 2169 self.log, 2170 self.ad, 2171 NETWORK_MODE_GSM_UMTS, 2172 RAT_FAMILY_UMTS, 2173 toggle_apm_after_setting=True): 2174 self.log.error("Failed to set rat family {}, preferred network:{}". 2175 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2176 return False 2177 self.md8475a.wait_for_registration_state() 2178 time.sleep(self._ANRITSU_SETTLING_TIME) 2179 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2180 time.sleep(self._SETTLING_TIME) 2181 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2182 2183 @test_tracker_info(uuid="170689a0-0db1-4a14-8b87-5a1b6c9b8581") 2184 @TelephonyBaseTest.tel_test_wrap 2185 def test_neighbor_cell_reporting_wcdma_intrafreq_2_tmo(self): 2186 """ Test Number of neighbor cells reported by Phone when two neighbor 2187 cells are present (Phone camped on WCDMA) 2188 2189 Setup two WCDMA cell configuration on MD8475A 2190 Setup one WCDMA waveform on MG3710A 2191 Make Sure Phone camped on WCDMA 2192 Verify the number of neighbor cells reported by Phone 2193 2194 Returns: 2195 True if pass; False if fail 2196 """ 2197 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2198 neighbor_cell_1 = wcdma_band1_ch10700_fr2140_cid32_cell 2199 neighbor_cell_2 = wcdma_band1_ch10700_fr2140_cid33_cell 2200 serving_cell['power'] = -20 2201 neighbor_cell_1['power'] = -24 2202 neighbor_cell_2['power'] = -22 2203 expected_cell_info_list = [ 2204 # Serving Cell 2205 { 2206 self.CID: serving_cell[self.CID], 2207 self.PSC: serving_cell[self.PSC], 2208 self.REPORT_RATE: 1, 2209 self.IS_REGISTERED: True, 2210 self.RAT: 'wcdma', 2211 self.TARGET_RSSI: 2212 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2213 self.MAX_ERROR_RSSI: 3, 2214 self.MAX_ERROR_AVERAGE_RSSI: 3 2215 }, 2216 # Neighbor Cells 2217 { 2218 self.PSC: neighbor_cell_1[self.PSC], 2219 self.REPORT_RATE: 0.1, 2220 self.IS_REGISTERED: False, 2221 self.RAT: 'wcdma', 2222 self.TARGET_RSSI: 2223 self._WCDMA_RSSI_OFFSET + neighbor_cell_1['power'], 2224 self.MAX_ERROR_RSSI: 4, 2225 self.MAX_ERROR_AVERAGE_RSSI: 3 2226 }, 2227 { 2228 self.PSC: neighbor_cell_2[self.PSC], 2229 self.REPORT_RATE: 0.1, 2230 self.IS_REGISTERED: False, 2231 self.RAT: 'wcdma', 2232 self.TARGET_RSSI: 2233 self._WCDMA_RSSI_OFFSET + neighbor_cell_2['power'], 2234 self.MAX_ERROR_RSSI: 4, 2235 self.MAX_ERROR_AVERAGE_RSSI: 3 2236 } 2237 ] 2238 expected_cell_info_stats = {} 2239 for sample in expected_cell_info_list: 2240 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2241 2242 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2243 [bts1, bts2] = set_system_model_wcdma_wcdma( 2244 self.md8475a, self.user_params, self.ad.sim_card) 2245 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2246 serving_cell['power']) 2247 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell_1, 2248 neighbor_cell_1['power']) 2249 bts1.neighbor_cell_mode = "USERDATA" 2250 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 2251 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_1_C10700_F2140_CID32") 2252 bts1.set_neighbor_cell_type("WCDMA", 2, "CELLNAME") 2253 bts1.set_neighbor_cell_name("WCDMA", 2, "WCDM_1_C10700_F2140_CID33") 2254 set_usim_parameters(self.md8475a, self.ad.sim_card) 2255 self.md8475a.start_simulation() 2256 # To make sure phone camps on BTS1 2257 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2258 2259 if not ensure_network_rat( 2260 self.log, 2261 self.ad, 2262 NETWORK_MODE_GSM_UMTS, 2263 RAT_FAMILY_UMTS, 2264 toggle_apm_after_setting=True): 2265 self.log.error("Failed to set rat family {}, preferred network:{}". 2266 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2267 return False 2268 self.md8475a.wait_for_registration_state() 2269 time.sleep(self._ANRITSU_SETTLING_TIME) 2270 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2271 self.setup_3710a_waveform("1", "A", "2140MHz", 2272 neighbor_cell_2['power'], "WCDMA", 2273 "wcdma_1_psc33_cid33") 2274 self.turn_on_3710a_sg(1) 2275 time.sleep(self._SETTLING_TIME) 2276 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2277 2278 @test_tracker_info(uuid="3ec77512-4d5b-40c9-b733-cf358f999e15") 2279 @TelephonyBaseTest.tel_test_wrap 2280 def test_neighbor_cell_reporting_wcdma_intrafreq_3_tmo(self): 2281 """ Test Number of neighbor cells reported by Phone when three neighbor 2282 cells are present (Phone camped on WCDMA) 2283 2284 Setup two WCDMA cell configuration on MD8475A 2285 Setup two WCDMA waveform on MG3710A 2286 Make Sure Phone camped on WCDMA 2287 Verify the number of neighbor cells reported by Phone 2288 2289 Returns: 2290 True if pass; False if fail 2291 """ 2292 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2293 neighbor_cell_1 = wcdma_band1_ch10700_fr2140_cid32_cell 2294 neighbor_cell_2 = wcdma_band1_ch10700_fr2140_cid33_cell 2295 neighbor_cell_3 = wcdma_band1_ch10700_fr2140_cid34_cell 2296 serving_cell['power'] = -20 2297 neighbor_cell_1['power'] = -24 2298 neighbor_cell_2['power'] = -23 2299 neighbor_cell_3['power'] = -22 2300 2301 expected_cell_info_list = [ 2302 # Serving Cell 2303 { 2304 self.CID: serving_cell[self.CID], 2305 self.PSC: serving_cell[self.PSC], 2306 self.REPORT_RATE: 1, 2307 self.IS_REGISTERED: True, 2308 self.RAT: 'wcdma', 2309 self.TARGET_RSSI: 2310 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2311 self.MAX_ERROR_RSSI: 3, 2312 self.MAX_ERROR_AVERAGE_RSSI: 3 2313 }, 2314 # Neighbor Cells 2315 { 2316 self.PSC: neighbor_cell_1[self.PSC], 2317 self.REPORT_RATE: 0.1, 2318 self.IS_REGISTERED: False, 2319 self.RAT: 'wcdma', 2320 self.TARGET_RSSI: 2321 self._WCDMA_RSSI_OFFSET + neighbor_cell_1['power'], 2322 self.MAX_ERROR_RSSI: 4, 2323 self.MAX_ERROR_AVERAGE_RSSI: 3 2324 }, 2325 { 2326 self.PSC: neighbor_cell_2[self.PSC], 2327 self.REPORT_RATE: 0.1, 2328 self.IS_REGISTERED: False, 2329 self.RAT: 'wcdma', 2330 self.TARGET_RSSI: 2331 self._WCDMA_RSSI_OFFSET + neighbor_cell_2['power'], 2332 self.MAX_ERROR_RSSI: 4, 2333 self.MAX_ERROR_AVERAGE_RSSI: 3 2334 }, 2335 { 2336 self.PSC: neighbor_cell_3[self.PSC], 2337 self.REPORT_RATE: 0.1, 2338 self.IS_REGISTERED: False, 2339 self.RAT: 'wcdma', 2340 self.TARGET_RSSI: 2341 self._WCDMA_RSSI_OFFSET + neighbor_cell_3['power'], 2342 self.MAX_ERROR_RSSI: 4, 2343 self.MAX_ERROR_AVERAGE_RSSI: 3 2344 } 2345 ] 2346 expected_cell_info_stats = {} 2347 for sample in expected_cell_info_list: 2348 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2349 2350 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2351 [bts1, bts2] = set_system_model_wcdma_wcdma( 2352 self.md8475a, self.user_params, self.ad.sim_card) 2353 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2354 serving_cell['power']) 2355 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell_1, 2356 neighbor_cell_1['power']) 2357 bts1.neighbor_cell_mode = "USERDATA" 2358 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 2359 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_1_C10700_F2140_CID32") 2360 bts1.set_neighbor_cell_type("WCDMA", 2, "CELLNAME") 2361 bts1.set_neighbor_cell_name("WCDMA", 2, "WCDM_1_C10700_F2140_CID33") 2362 bts1.set_neighbor_cell_type("WCDMA", 3, "CELLNAME") 2363 bts1.set_neighbor_cell_name("WCDMA", 3, "WCDM_1_C10700_F2140_CID34") 2364 set_usim_parameters(self.md8475a, self.ad.sim_card) 2365 self.md8475a.start_simulation() 2366 # To make sure phone camps on BTS1 2367 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2368 2369 if not ensure_network_rat( 2370 self.log, 2371 self.ad, 2372 NETWORK_MODE_GSM_UMTS, 2373 RAT_FAMILY_UMTS, 2374 toggle_apm_after_setting=True): 2375 self.log.error("Failed to set rat family {}, preferred network:{}". 2376 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2377 return False 2378 self.md8475a.wait_for_registration_state() 2379 time.sleep(self._ANRITSU_SETTLING_TIME) 2380 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2381 self.setup_3710a_waveform("1", "A", "2140MHz", 2382 neighbor_cell_2['power'], "WCDMA", 2383 "wcdma_1_psc33_cid33") 2384 2385 self.setup_3710a_waveform("2", "A", "2140MHz", 2386 neighbor_cell_3['power'], "WCDMA", 2387 "wcdma_1_psc34_cid34") 2388 self.turn_on_3710a_sg(1) 2389 self.turn_on_3710a_sg(2) 2390 time.sleep(self._SETTLING_TIME) 2391 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2392 2393 @test_tracker_info(uuid="6f39e4a5-81da-4f47-8022-f22d82ff6f31") 2394 @TelephonyBaseTest.tel_test_wrap 2395 def test_neighbor_cell_reporting_wcdma_interfreq_1_tmo(self): 2396 """ Test Number of neighbor cells reported by Phone when two neighbor 2397 cells(inter frequency) are present (Phone camped on WCDMA) 2398 2399 Setup a two WCDMA cell configuration on MD8475A 2400 Setup one WCDMA waveform on MG3710A 2401 Make Sure Phone camped on WCDMA 2402 Verify the number of neighbor cells reported by Phonene 2403 2404 Returns: 2405 True if pass; False if fail 2406 """ 2407 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2408 neighbor_cell_1 = wcdma_band1_ch10800_fr2160_cid37_cell 2409 serving_cell['power'] = -20 2410 neighbor_cell_1['power'] = -24 2411 2412 expected_cell_info_list = [ 2413 # Serving Cell 2414 { 2415 self.CID: serving_cell[self.CID], 2416 self.PSC: serving_cell[self.PSC], 2417 self.REPORT_RATE: 1, 2418 self.IS_REGISTERED: True, 2419 self.RAT: 'wcdma', 2420 self.TARGET_RSSI: 2421 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2422 self.MAX_ERROR_RSSI: 3, 2423 self.MAX_ERROR_AVERAGE_RSSI: 3 2424 }, 2425 # Neighbor Cells 2426 { 2427 self.PSC: neighbor_cell_1[self.PSC], 2428 self.REPORT_RATE: 0.1, 2429 self.IS_REGISTERED: False, 2430 self.RAT: 'wcdma', 2431 self.TARGET_RSSI: 2432 self._WCDMA_RSSI_OFFSET + neighbor_cell_1['power'], 2433 self.MAX_ERROR_RSSI: 4, 2434 self.MAX_ERROR_AVERAGE_RSSI: 3 2435 } 2436 ] 2437 expected_cell_info_stats = {} 2438 for sample in expected_cell_info_list: 2439 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2440 2441 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2442 [bts1, bts2] = set_system_model_wcdma_wcdma( 2443 self.md8475a, self.user_params, self.ad.sim_card) 2444 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2445 serving_cell['power']) 2446 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell_1, 2447 neighbor_cell_1['power']) 2448 bts1.neighbor_cell_mode = "USERDATA" 2449 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 2450 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_1_C10800_F2160_CID37") 2451 set_usim_parameters(self.md8475a, self.ad.sim_card) 2452 self.md8475a.start_simulation() 2453 #To make sure phone camps on BTS1 2454 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2455 2456 self.ad.droid.telephonyToggleDataConnection(False) 2457 if not ensure_network_rat( 2458 self.log, 2459 self.ad, 2460 NETWORK_MODE_GSM_UMTS, 2461 RAT_FAMILY_UMTS, 2462 toggle_apm_after_setting=True): 2463 self.log.error("Failed to set rat family {}, preferred network:{}". 2464 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2465 return False 2466 self.md8475a.wait_for_registration_state() 2467 time.sleep(self._ANRITSU_SETTLING_TIME) 2468 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2469 time.sleep(self._SETTLING_TIME) 2470 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2471 2472 @test_tracker_info(uuid="992d9ffb-2538-447b-b7e8-f40061063686") 2473 @TelephonyBaseTest.tel_test_wrap 2474 def test_neighbor_cell_reporting_wcdma_interfreq_2_tmo(self): 2475 """ Test Number of neighbor cells reported by Phone when two neighbor 2476 cells(inter frequency) are present (Phone camped on WCDMA) 2477 2478 Setup a two WCDMA cell configuration on MD8475A 2479 Setup one WCDMA waveform on MG3710A 2480 Make Sure Phone camped on WCDMA 2481 Verify the number of neighbor cells reported by Phonene 2482 2483 Returns: 2484 True if pass; False if fail 2485 """ 2486 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2487 neighbor_cell_1 = wcdma_band1_ch10575_fr2115_cid36_cell 2488 neighbor_cell_2 = wcdma_band1_ch10800_fr2160_cid37_cell 2489 serving_cell['power'] = -20 2490 neighbor_cell_1['power'] = -24 2491 neighbor_cell_2['power'] = -23 2492 expected_cell_info_list = [ 2493 # Serving Cell 2494 { 2495 self.CID: serving_cell[self.CID], 2496 self.PSC: serving_cell[self.PSC], 2497 self.REPORT_RATE: 1, 2498 self.IS_REGISTERED: True, 2499 self.RAT: 'wcdma', 2500 self.TARGET_RSSI: 2501 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2502 self.MAX_ERROR_RSSI: 3, 2503 self.MAX_ERROR_AVERAGE_RSSI: 3 2504 }, 2505 # Neighbor Cells 2506 { 2507 self.PSC: neighbor_cell_1[self.PSC], 2508 self.REPORT_RATE: 0.1, 2509 self.IS_REGISTERED: False, 2510 self.RAT: 'wcdma', 2511 self.TARGET_RSSI: 2512 self._WCDMA_RSSI_OFFSET + neighbor_cell_1['power'], 2513 self.MAX_ERROR_RSSI: 4, 2514 self.MAX_ERROR_AVERAGE_RSSI: 3 2515 }, 2516 { 2517 self.PSC: neighbor_cell_2[self.PSC], 2518 self.REPORT_RATE: 0.1, 2519 self.IS_REGISTERED: False, 2520 self.RAT: 'wcdma', 2521 self.TARGET_RSSI: 2522 self._WCDMA_RSSI_OFFSET + neighbor_cell_2['power'], 2523 self.MAX_ERROR_RSSI: 4, 2524 self.MAX_ERROR_AVERAGE_RSSI: 3 2525 } 2526 ] 2527 expected_cell_info_stats = {} 2528 for sample in expected_cell_info_list: 2529 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2530 2531 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2532 [bts1, bts2] = set_system_model_wcdma_wcdma( 2533 self.md8475a, self.user_params, self.ad.sim_card) 2534 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2535 serving_cell['power']) 2536 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell_1, 2537 neighbor_cell_1['power']) 2538 bts1.neighbor_cell_mode = "USERDATA" 2539 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 2540 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_1_C10575_F2115_CID36") 2541 bts1.set_neighbor_cell_type("WCDMA", 2, "CELLNAME") 2542 bts1.set_neighbor_cell_name("WCDMA", 2, "WCDM_1_C10800_F2160_CID37") 2543 set_usim_parameters(self.md8475a, self.ad.sim_card) 2544 self.md8475a.start_simulation() 2545 # To make sure phone camps on BTS1 2546 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2547 2548 self.ad.droid.telephonyToggleDataConnection(False) 2549 if not ensure_network_rat( 2550 self.log, 2551 self.ad, 2552 NETWORK_MODE_GSM_UMTS, 2553 RAT_FAMILY_UMTS, 2554 toggle_apm_after_setting=True): 2555 self.log.error("Failed to set rat family {}, preferred network:{}". 2556 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2557 return False 2558 self.md8475a.wait_for_registration_state() 2559 time.sleep(self._ANRITSU_SETTLING_TIME) 2560 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2561 self.setup_3710a_waveform("1", "A", "2160MHz", 2562 neighbor_cell_2['power'], "WCDMA", 2563 "wcdma_1_psc37_cid37") 2564 self.turn_on_3710a_sg(1) 2565 time.sleep(self._SETTLING_TIME) 2566 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2567 2568 @test_tracker_info(uuid="60cb8c15-3cb3-4ead-9e59-a8aee819e9ef") 2569 @TelephonyBaseTest.tel_test_wrap 2570 def test_neighbor_cell_reporting_wcdma_interband_2_tmo(self): 2571 """ Test Number of neighbor cells reported by Phone when two neighbor 2572 cells(inter band) are present (Phone camped on WCDMA) 2573 2574 Setup a two WCDMA cell configuration on MD8475A 2575 Setup one WCDMA waveform on MG3710A 2576 Make Sure Phone camped on WCDMA 2577 Verify the number of neighbor cells reported by Phone 2578 2579 Returns: 2580 True if pass; False if fail 2581 """ 2582 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2583 neighbor_cell_1 = wcdma_band2_ch9800_fr1960_cid38_cell 2584 neighbor_cell_2 = wcdma_band2_ch9900_fr1980_cid39_cell 2585 serving_cell['power'] = -20 2586 neighbor_cell_1['power'] = -23 2587 neighbor_cell_2['power'] = -22 2588 2589 expected_cell_info_list = [ 2590 # Serving Cell 2591 { 2592 self.CID: serving_cell[self.CID], 2593 self.PSC: serving_cell[self.PSC], 2594 self.REPORT_RATE: 1, 2595 self.IS_REGISTERED: True, 2596 self.RAT: 'wcdma', 2597 self.TARGET_RSSI: 2598 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2599 self.MAX_ERROR_RSSI: 3, 2600 self.MAX_ERROR_AVERAGE_RSSI: 3 2601 }, 2602 # Neighbor Cells 2603 { 2604 self.PSC: neighbor_cell_1[self.PSC], 2605 self.REPORT_RATE: 0.1, 2606 self.IS_REGISTERED: False, 2607 self.RAT: 'wcdma', 2608 self.TARGET_RSSI: 2609 self._WCDMA_RSSI_OFFSET + neighbor_cell_1['power'], 2610 self.MAX_ERROR_RSSI: 4, 2611 self.MAX_ERROR_AVERAGE_RSSI: 3 2612 }, 2613 { 2614 self.PSC: neighbor_cell_2[self.PSC], 2615 self.REPORT_RATE: 0.1, 2616 self.IS_REGISTERED: False, 2617 self.RAT: 'wcdma', 2618 self.TARGET_RSSI: 2619 self._WCDMA_RSSI_OFFSET + neighbor_cell_2['power'], 2620 self.MAX_ERROR_RSSI: 4, 2621 self.MAX_ERROR_AVERAGE_RSSI: 3 2622 } 2623 ] 2624 expected_cell_info_stats = {} 2625 for sample in expected_cell_info_list: 2626 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2627 2628 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2629 [bts1, bts2] = set_system_model_wcdma_wcdma( 2630 self.md8475a, self.user_params, self.ad.sim_card) 2631 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2632 serving_cell['power']) 2633 self._setup_wcdma_cell_md8475a(bts2, neighbor_cell_1, 2634 neighbor_cell_1['power']) 2635 bts1.neighbor_cell_mode = "USERDATA" 2636 bts1.set_neighbor_cell_type("WCDMA", 1, "CELLNAME") 2637 bts1.set_neighbor_cell_name("WCDMA", 1, "WCDM_2_C9800_F1960_CID38") 2638 bts1.set_neighbor_cell_type("WCDMA", 2, "CELLNAME") 2639 bts1.set_neighbor_cell_name("WCDMA", 2, "WCDM_2_C9900_F1980_CID39") 2640 set_usim_parameters(self.md8475a, self.ad.sim_card) 2641 self.md8475a.start_simulation() 2642 # To make sure phone camps on BTS1 2643 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2644 2645 self.ad.droid.telephonyToggleDataConnection(False) 2646 if not ensure_network_rat( 2647 self.log, 2648 self.ad, 2649 NETWORK_MODE_GSM_UMTS, 2650 RAT_FAMILY_UMTS, 2651 toggle_apm_after_setting=True): 2652 self.log.error("Failed to set rat family {}, preferred network:{}". 2653 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2654 return False 2655 self.md8475a.wait_for_registration_state() 2656 time.sleep(self._ANRITSU_SETTLING_TIME) 2657 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2658 self.setup_3710a_waveform("1", "A", "1980MHz", 2659 neighbor_cell_2['power'], "WCDMA", 2660 "wcdma_2_psc39_cid39") 2661 self.turn_on_3710a_sg(1) 2662 time.sleep(self._SETTLING_TIME) 2663 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2664 2665 @test_tracker_info(uuid="daa29f27-f67b-47ee-9a30-1c9572eedf2f") 2666 @TelephonyBaseTest.tel_test_wrap 2667 def test_neighbor_cell_reporting_wcdma_interrat_1_tmo(self): 2668 """ Test Number of neighbor cells reported by Phone when two neighbor 2669 cells are present (Phone camped on WCDMA) 2670 2671 Setup a two WCDMA cell configuration on MD8475A 2672 Setup one WCDMA waveform on MG3710A 2673 Make Sure Phone camped on WCDMA 2674 Verify the number of neighbor cells reported by Phone 2675 2676 Returns: 2677 True if pass; False if fail 2678 """ 2679 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2680 neighbor_cell_1 = gsm_band1900_ch512_fr1930_cid51_cell 2681 neighbor_cell_2 = lte_band4_ch2000_fr2115_pcid1_cell 2682 serving_cell['power'] = -20 2683 neighbor_cell_1['power'] = -23 2684 neighbor_cell_2['power'] = -22 2685 2686 expected_cell_info_list = [ 2687 # Serving Cell 2688 { 2689 self.CID: serving_cell[self.CID], 2690 self.PSC: serving_cell[self.PSC], 2691 self.REPORT_RATE: 1, 2692 self.IS_REGISTERED: True, 2693 self.RAT: 'wcdma', 2694 self.TARGET_RSSI: 2695 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2696 self.MAX_ERROR_RSSI: 3, 2697 self.MAX_ERROR_AVERAGE_RSSI: 3 2698 }, 2699 # Neighbor Cells 2700 { 2701 self.CID: neighbor_cell_1[self.CID], 2702 self.REPORT_RATE: 0.1, 2703 self.IS_REGISTERED: False, 2704 self.RAT: 'gsm', 2705 self.TARGET_RSSI: 2706 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 2707 self.MAX_ERROR_RSSI: 4, 2708 self.MAX_ERROR_AVERAGE_RSSI: 3 2709 }, 2710 { 2711 self.PCID: neighbor_cell_2[self.PCID], 2712 self.REPORT_RATE: 0.1, 2713 self.IS_REGISTERED: False, 2714 self.RAT: 'lte', 2715 self.TARGET_RSSI: 2716 self._LTE_RSSI_OFFSET + neighbor_cell_2['power'], 2717 self.MAX_ERROR_RSSI: 4, 2718 self.MAX_ERROR_AVERAGE_RSSI: 3 2719 } 2720 ] 2721 expected_cell_info_stats = {} 2722 for sample in expected_cell_info_list: 2723 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2724 2725 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2726 [bts1, bts2] = set_system_model_lte_wcdma( 2727 self.md8475a, self.user_params, self.ad.sim_card) 2728 self._setup_wcdma_cell_md8475a(bts2, serving_cell, 2729 serving_cell['power']) 2730 self._setup_lte_cell_md8475a(bts1, neighbor_cell_2, 2731 neighbor_cell_2['power']) 2732 bts2.neighbor_cell_mode = "USERDATA" 2733 bts2.set_neighbor_cell_type("LTE", 1, "CELLNAME") 2734 bts2.set_neighbor_cell_name("LTE", 1, "LTE_4_C2000_F2115_PCID1") 2735 set_usim_parameters(self.md8475a, self.ad.sim_card) 2736 self.md8475a.start_simulation() 2737 # To make sure phone camps on BTS1 2738 bts1.service_state = BtsServiceState.SERVICE_STATE_OUT 2739 2740 self.ad.droid.telephonyToggleDataConnection(False) 2741 if not ensure_network_rat( 2742 self.log, 2743 self.ad, 2744 NETWORK_MODE_GSM_UMTS, 2745 RAT_FAMILY_UMTS, 2746 toggle_apm_after_setting=True): 2747 self.log.error("Failed to set rat family {}, preferred network:{}". 2748 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2749 return False 2750 self.md8475a.wait_for_registration_state() 2751 time.sleep(self._ANRITSU_SETTLING_TIME) 2752 bts1.service_state = BtsServiceState.SERVICE_STATE_IN 2753 time.sleep(self._SETTLING_TIME) 2754 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2755 2756 @test_tracker_info(uuid="08e5d666-fae6-48a3-b03b-de7b7b3f5982") 2757 @TelephonyBaseTest.tel_test_wrap 2758 def test_neighbor_cell_reporting_wcdma_interrat_2_tmo(self): 2759 """ Test Number of neighbor cells reported by Phone when two neighbor 2760 cells are present (Phone camped on WCDMA) 2761 2762 Setup a two WCDMA cell configuration on MD8475A 2763 Setup one WCDMA waveform on MG3710A 2764 Make Sure Phone camped on WCDMA 2765 Verify the number of neighbor cells reported by Phone 2766 2767 Returns: 2768 True if pass; False if fail 2769 """ 2770 serving_cell = wcdma_band1_ch10700_fr2140_cid31_cell 2771 neighbor_cell_1 = gsm_band1900_ch512_fr1930_cid51_cell 2772 neighbor_cell_2 = lte_band4_ch2000_fr2115_pcid1_cell 2773 serving_cell['power'] = -20 2774 neighbor_cell_1['power'] = -23 2775 neighbor_cell_2['power'] = -22 2776 2777 expected_cell_info_list = [ 2778 # Serving Cell 2779 { 2780 self.CID: serving_cell[self.CID], 2781 self.PSC: serving_cell[self.PSC], 2782 self.REPORT_RATE: 1, 2783 self.IS_REGISTERED: True, 2784 self.RAT: 'wcdma', 2785 self.TARGET_RSSI: 2786 self._WCDMA_RSSI_OFFSET + serving_cell['power'], 2787 self.MAX_ERROR_RSSI: 3, 2788 self.MAX_ERROR_AVERAGE_RSSI: 3 2789 }, 2790 # Neighbor Cells 2791 { 2792 self.CID: neighbor_cell_1[self.CID], 2793 self.REPORT_RATE: 0.1, 2794 self.IS_REGISTERED: False, 2795 self.RAT: 'gsm', 2796 self.TARGET_RSSI: 2797 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 2798 self.MAX_ERROR_RSSI: 4, 2799 self.MAX_ERROR_AVERAGE_RSSI: 3 2800 }, 2801 { 2802 self.PCID: neighbor_cell_2[self.PCID], 2803 self.REPORT_RATE: 0.1, 2804 self.IS_REGISTERED: False, 2805 self.RAT: 'lte', 2806 self.TARGET_RSSI: 2807 self._LTE_RSSI_OFFSET + neighbor_cell_2['power'], 2808 self.MAX_ERROR_RSSI: 4, 2809 self.MAX_ERROR_AVERAGE_RSSI: 3 2810 } 2811 ] 2812 expected_cell_info_stats = {} 2813 for sample in expected_cell_info_list: 2814 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2815 2816 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2817 [bts1, bts2] = set_system_model_wcdma_gsm( 2818 self.md8475a, self.user_params, self.ad.sim_card) 2819 self._setup_wcdma_cell_md8475a(bts1, serving_cell, 2820 serving_cell['power']) 2821 self._setup_gsm_cell_md8475a(bts2, neighbor_cell_1, 2822 neighbor_cell_1['power']) 2823 bts1.neighbor_cell_mode = "USERDATA" 2824 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 2825 bts1.set_neighbor_cell_name("GSM", 1, "GSM_1900_C512_F1930_CID51") 2826 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 2827 bts1.set_neighbor_cell_name("LTE", 1, "LTE_4_C2000_F2115_PCID1") 2828 set_usim_parameters(self.md8475a, self.ad.sim_card) 2829 self.md8475a.start_simulation() 2830 # To make sure phone camps on BTS1 2831 bts2.service_state = BtsServiceState.SERVICE_STATE_OUT 2832 2833 self.ad.droid.telephonyToggleDataConnection(False) 2834 if not ensure_network_rat( 2835 self.log, 2836 self.ad, 2837 NETWORK_MODE_GSM_UMTS, 2838 RAT_FAMILY_UMTS, 2839 toggle_apm_after_setting=True): 2840 self.log.error("Failed to set rat family {}, preferred network:{}". 2841 format(RAT_FAMILY_UMTS, NETWORK_MODE_GSM_UMTS)) 2842 return False 2843 self.md8475a.wait_for_registration_state() 2844 time.sleep(self._ANRITSU_SETTLING_TIME) 2845 bts2.service_state = BtsServiceState.SERVICE_STATE_IN 2846 self.setup_3710a_waveform("1", "A", "2115MHz", 2847 neighbor_cell_2['power'], "LTE", 2848 "lte_4_ch2000_pcid1") 2849 self.turn_on_3710a_sg(1) 2850 time.sleep(self._SETTLING_TIME) 2851 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2852 2853 @test_tracker_info(uuid="bebbe764-4c8c-4aaf-81b9-c61509a9695e") 2854 @TelephonyBaseTest.tel_test_wrap 2855 def test_neighbor_cell_reporting_gsm_intrafreq_0_tmo(self): 2856 """ Test Number of neighbor cells reported by Phone when no neighbor 2857 cells are present (Phone camped on GSM) 2858 2859 Setup one GSM cell configuration on MD8475A 2860 Make Sure Phone camped on GSM 2861 Verify the number of neighbor cells reported by Phone 2862 2863 Returns: 2864 True if pass; False if fail 2865 """ 2866 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 2867 serving_cell['power'] = -30 2868 2869 expected_cell_info_list = [ 2870 # Serving Cell 2871 { 2872 self.CID: serving_cell[self.CID], 2873 self.REPORT_RATE: 1, 2874 self.IS_REGISTERED: True, 2875 self.RAT: 'gsm', 2876 self.TARGET_RSSI: 2877 self._GSM_RSSI_OFFSET + serving_cell['power'], 2878 self.MAX_ERROR_RSSI: 3, 2879 self.MAX_ERROR_AVERAGE_RSSI: 3 2880 } 2881 ] 2882 expected_cell_info_stats = {} 2883 for sample in expected_cell_info_list: 2884 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2885 2886 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 2887 self.ad.sim_card) 2888 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 2889 set_usim_parameters(self.md8475a, self.ad.sim_card) 2890 self.md8475a.start_simulation() 2891 if not ensure_network_rat( 2892 self.log, 2893 self.ad, 2894 NETWORK_MODE_GSM_ONLY, 2895 RAT_FAMILY_GSM, 2896 toggle_apm_after_setting=True): 2897 self.log.error("Failed to set rat family {}, preferred network:{}". 2898 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 2899 return False 2900 self.md8475a.wait_for_registration_state() 2901 time.sleep(self._SETTLING_TIME) 2902 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2903 2904 @test_tracker_info(uuid="861dd399-d6f6-4e9f-9e8d-0718966ea45a") 2905 @TelephonyBaseTest.tel_test_wrap 2906 def test_neighbor_cell_reporting_gsm_intrafreq_1_tmo(self): 2907 """ Test Number of neighbor cells reported by Phone when one neighbor 2908 cell is present (Phone camped on GSM) 2909 2910 Setup one GSM cell configuration on MD8475A 2911 Make Sure Phone camped on GSM 2912 Verify the number of neighbor cells reported by Phone 2913 2914 Returns: 2915 True if pass; False if fail 2916 """ 2917 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 2918 neighbor_cell = gsm_band1900_ch512_fr1930_cid52_cell 2919 serving_cell['power'] = -20 2920 neighbor_cell['power'] = -22 2921 2922 expected_cell_info_list = [ 2923 # Serving Cell 2924 { 2925 self.CID: serving_cell[self.CID], 2926 self.REPORT_RATE: 1, 2927 self.IS_REGISTERED: True, 2928 self.RAT: 'gsm', 2929 self.TARGET_RSSI: 2930 self._GSM_RSSI_OFFSET + serving_cell['power'], 2931 self.MAX_ERROR_RSSI: 3, 2932 self.MAX_ERROR_AVERAGE_RSSI: 3 2933 }, 2934 # Neighbor Cells 2935 { 2936 self.CID: neighbor_cell_1[self.CID], 2937 self.REPORT_RATE: 0.1, 2938 self.IS_REGISTERED: False, 2939 self.RAT: 'gsm', 2940 self.TARGET_RSSI: 2941 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 2942 self.MAX_ERROR_RSSI: 4, 2943 self.MAX_ERROR_AVERAGE_RSSI: 3 2944 } 2945 ] 2946 expected_cell_info_stats = {} 2947 for sample in expected_cell_info_list: 2948 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 2949 2950 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 2951 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 2952 self.ad.sim_card) 2953 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 2954 bts1.neighbor_cell_mode = "USERDATA" 2955 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 2956 bts1.set_neighbor_cell_name("GSM", 1, "GSM_1900_C512_F1930_CID52") 2957 set_usim_parameters(self.md8475a, self.ad.sim_card) 2958 self.md8475a.start_simulation() 2959 2960 if not ensure_network_rat( 2961 self.log, 2962 self.ad, 2963 NETWORK_MODE_GSM_ONLY, 2964 RAT_FAMILY_GSM, 2965 toggle_apm_after_setting=True): 2966 self.log.error("Failed to set rat family {}, preferred network:{}". 2967 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 2968 return False 2969 self.md8475a.wait_for_registration_state() 2970 time.sleep(self._ANRITSU_SETTLING_TIME) 2971 self.setup_3710a_waveform("1", "A", "1930.2MHz", 2972 neighbor_cell['power'], "GSM", 2973 "gsm_lac52_cid52") 2974 2975 self.turn_on_3710a_sg(1) 2976 time.sleep(self._SETTLING_TIME) 2977 return self._verify_cell_info(self.ad, expected_cell_info_stats) 2978 2979 @test_tracker_info(uuid="58627a33-45bd-436d-85b2-1ca711f56794") 2980 @TelephonyBaseTest.tel_test_wrap 2981 def test_neighbor_cell_reporting_gsm_intrafreq_2_tmo(self): 2982 """ Test Number of neighbor cells reported by Phone when two neighbor 2983 cells are present (Phone camped on GSM) 2984 2985 Setup one GSM cell configuration on MD8475A 2986 Setup two GSM waveforms on MG3710A 2987 Make Sure Phone camped on GSM 2988 Verify the number of neighbor cells reported by Phone 2989 2990 Returns: 2991 True if pass; False if fail 2992 """ 2993 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 2994 neighbor_cell_1 = gsm_band1900_ch512_fr1930_cid52_cell 2995 neighbor_cell_2 = gsm_band1900_ch512_fr1930_cid53_cell 2996 serving_cell['power'] = -20 2997 neighbor_cell_1['power'] = -24 2998 neighbor_cell_2['power'] = -22 2999 3000 expected_cell_info_list = [ 3001 # Serving Cell 3002 { 3003 self.CID: serving_cell[self.CID], 3004 self.REPORT_RATE: 1, 3005 self.IS_REGISTERED: True, 3006 self.RAT: 'gsm', 3007 self.TARGET_RSSI: 3008 self._GSM_RSSI_OFFSET + serving_cell['power'], 3009 self.MAX_ERROR_RSSI: 3, 3010 self.MAX_ERROR_AVERAGE_RSSI: 3 3011 }, 3012 # Neighbor Cells 3013 { 3014 self.CID: neighbor_cell_1[self.CID], 3015 self.REPORT_RATE: 0.1, 3016 self.IS_REGISTERED: False, 3017 self.RAT: 'gsm', 3018 self.TARGET_RSSI: 3019 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 3020 self.MAX_ERROR_RSSI: 4, 3021 self.MAX_ERROR_AVERAGE_RSSI: 3 3022 }, 3023 { 3024 self.CID: neighbor_cell_2[self.CID], 3025 self.REPORT_RATE: 0.1, 3026 self.IS_REGISTERED: False, 3027 self.RAT: 'gsm', 3028 self.TARGET_RSSI: 3029 self._GSM_RSSI_OFFSET + neighbor_cell_2['power'], 3030 self.MAX_ERROR_RSSI: 4, 3031 self.MAX_ERROR_AVERAGE_RSSI: 3 3032 } 3033 ] 3034 expected_cell_info_stats = {} 3035 for sample in expected_cell_info_list: 3036 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 3037 3038 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 3039 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 3040 self.ad.sim_card) 3041 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 3042 bts1.neighbor_cell_mode = "USERDATA" 3043 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 3044 bts1.set_neighbor_cell_name("GSM", 1, "GSM_1900_C512_F1930_CID52") 3045 bts1.set_neighbor_cell_type("GSM", 2, "CELLNAME") 3046 bts1.set_neighbor_cell_name("GSM", 2, "GSM_1900_C512_F1930_CID53") 3047 set_usim_parameters(self.md8475a, self.ad.sim_card) 3048 self.md8475a.start_simulation() 3049 3050 if not ensure_network_rat( 3051 self.log, 3052 self.ad, 3053 NETWORK_MODE_GSM_ONLY, 3054 RAT_FAMILY_GSM, 3055 toggle_apm_after_setting=True): 3056 self.log.error("Failed to set rat family {}, preferred network:{}". 3057 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 3058 return False 3059 self.md8475a.wait_for_registration_state() 3060 self.setup_3710a_waveform("1", "A", "1930.2MHz", 3061 neighbor_cell_1['power'], "GSM", 3062 "gsm_lac52_cid52") 3063 3064 self.setup_3710a_waveform("2", "A", "1930.2MHz", 3065 neighbor_cell_2['power'], "GSM", 3066 "gsm_lac53_cid53") 3067 self.turn_on_3710a_sg(1) 3068 self.turn_on_3710a_sg(2) 3069 time.sleep(self._SETTLING_TIME) 3070 return self._verify_cell_info(self.ad, expected_cell_info_stats) 3071 3072 @test_tracker_info(uuid="3ff3439a-2e45-470a-a2d6-c63e37379f19") 3073 @TelephonyBaseTest.tel_test_wrap 3074 def test_neighbor_cell_reporting_gsm_intrafreq_3_tmo(self): 3075 """ Test Number of neighbor cells reported by Phone when three neighbor 3076 cells are present (Phone camped on GSM) 3077 3078 Setup one GSM cell configuration on MD8475A 3079 Setup three GSM waveforms on MG3710A 3080 Make Sure Phone camped on GSM 3081 Verify the number of neighbor cells reported by Phone 3082 3083 Returns: 3084 True if pass; False if fail 3085 """ 3086 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 3087 neighbor_cell_1 = gsm_band1900_ch512_fr1930_cid52_cell 3088 neighbor_cell_2 = gsm_band1900_ch512_fr1930_cid53_cell 3089 neighbor_cell_3 = gsm_band1900_ch512_fr1930_cid54_cell 3090 serving_cell['power'] = -20 3091 neighbor_cell_1['power'] = -24 3092 neighbor_cell_2['power'] = -22 3093 neighbor_cell_3['power'] = -24 3094 3095 expected_cell_info_list = [ 3096 # Serving Cell 3097 { 3098 self.CID: serving_cell[self.CID], 3099 self.REPORT_RATE: 1, 3100 self.IS_REGISTERED: True, 3101 self.RAT: 'gsm', 3102 self.TARGET_RSSI: 3103 self._GSM_RSSI_OFFSET + serving_cell['power'], 3104 self.MAX_ERROR_RSSI: 3, 3105 self.MAX_ERROR_AVERAGE_RSSI: 3 3106 }, 3107 # Neighbor Cells 3108 { 3109 self.CID: neighbor_cell_1[self.CID], 3110 self.REPORT_RATE: 0.1, 3111 self.IS_REGISTERED: False, 3112 self.RAT: 'gsm', 3113 self.TARGET_RSSI: 3114 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 3115 self.MAX_ERROR_RSSI: 4, 3116 self.MAX_ERROR_AVERAGE_RSSI: 3 3117 }, 3118 { 3119 self.CID: neighbor_cell_2[self.CID], 3120 self.REPORT_RATE: 0.1, 3121 self.IS_REGISTERED: False, 3122 self.RAT: 'gsm', 3123 self.TARGET_RSSI: 3124 self._GSM_RSSI_OFFSET + neighbor_cell_2['power'], 3125 self.MAX_ERROR_RSSI: 4, 3126 self.MAX_ERROR_AVERAGE_RSSI: 3 3127 }, 3128 { 3129 self.CID: neighbor_cell_3[self.CID], 3130 self.REPORT_RATE: 0.1, 3131 self.IS_REGISTERED: False, 3132 self.RAT: 'gsm', 3133 self.TARGET_RSSI: 3134 self._GSM_RSSI_OFFSET + neighbor_cell_3['power'], 3135 self.MAX_ERROR_RSSI: 4, 3136 self.MAX_ERROR_AVERAGE_RSSI: 3 3137 } 3138 ] 3139 expected_cell_info_stats = {} 3140 for sample in expected_cell_info_list: 3141 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 3142 3143 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 3144 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 3145 self.ad.sim_card) 3146 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 3147 bts1.neighbor_cell_mode = "USERDATA" 3148 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 3149 bts1.set_neighbor_cell_name("GSM", 1, "GSM_1900_C512_F1930_CID52") 3150 bts1.set_neighbor_cell_type("GSM", 2, "CELLNAME") 3151 bts1.set_neighbor_cell_name("GSM", 2, "GSM_1900_C512_F1930_CID53") 3152 bts1.set_neighbor_cell_type("GSM", 3, "CELLNAME") 3153 bts1.set_neighbor_cell_name("GSM", 3, "GSM_1900_C512_F1930_CID53") 3154 set_usim_parameters(self.md8475a, self.ad.sim_card) 3155 self.md8475a.start_simulation() 3156 3157 if not ensure_network_rat( 3158 self.log, 3159 self.ad, 3160 NETWORK_MODE_GSM_ONLY, 3161 RAT_FAMILY_GSM, 3162 toggle_apm_after_setting=True): 3163 self.log.error("Failed to set rat family {}, preferred network:{}". 3164 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 3165 return False 3166 self.md8475a.wait_for_registration_state() 3167 self.setup_3710a_waveform("1", "A", "1930.2MHz", 3168 neighbor_cell_1['power'], "GSM", 3169 "gsm_lac52_cid52") 3170 3171 self.setup_3710a_waveform("2", "A", "1930.2MHz", 3172 neighbor_cell_2['power'], "GSM", 3173 "gsm_lac53_cid53") 3174 3175 self.setup_3710a_waveform("2", "B", "1930.2MHz", 3176 neighbor_cell_3['power'], "GSM", 3177 "gsm_lac54_cid54") 3178 self.turn_on_3710a_sg(1) 3179 self.turn_on_3710a_sg(2) 3180 time.sleep(self._SETTLING_TIME) 3181 return self._verify_cell_info(self.ad, expected_cell_info_stats) 3182 3183 @test_tracker_info(uuid="0cac1370-144e-40a4-b6bc-66691926f898") 3184 @TelephonyBaseTest.tel_test_wrap 3185 def test_neighbor_cell_reporting_gsm_interfreq_1_tmo(self): 3186 """ Test Number of neighbor cells reported by Phone when one neighbor 3187 cells(inter frequency) is present (Phone camped on GSM) 3188 3189 Setup one GSM cell configuration on MD8475A 3190 Setup two GSM waveforms on MG3710A 3191 Make Sure Phone camped on GSM 3192 Verify the number of neighbor cells reported by Phone 3193 3194 Returns: 3195 True if pass; False if fail 3196 """ 3197 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 3198 neighbor_cell_1 = gsm_band1900_ch640_fr1955_cid56_cell 3199 serving_cell['power'] = -20 3200 neighbor_cell_1['power'] = -24 3201 3202 expected_cell_info_list = [ 3203 # Serving Cell 3204 { 3205 self.CID: serving_cell[self.CID], 3206 self.REPORT_RATE: 1, 3207 self.IS_REGISTERED: True, 3208 self.RAT: 'gsm', 3209 self.TARGET_RSSI: 3210 self._GSM_RSSI_OFFSET + serving_cell['power'], 3211 self.MAX_ERROR_RSSI: 3, 3212 self.MAX_ERROR_AVERAGE_RSSI: 3 3213 }, 3214 # Neighbor Cells 3215 { 3216 self.CID: neighbor_cell_1[self.CID], 3217 self.REPORT_RATE: 0.1, 3218 self.IS_REGISTERED: False, 3219 self.RAT: 'gsm', 3220 self.TARGET_RSSI: 3221 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 3222 self.MAX_ERROR_RSSI: 4, 3223 self.MAX_ERROR_AVERAGE_RSSI: 3 3224 } 3225 ] 3226 expected_cell_info_stats = {} 3227 for sample in expected_cell_info_list: 3228 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 3229 3230 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 3231 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 3232 self.ad.sim_card) 3233 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 3234 bts1.neighbor_cell_mode = "USERDATA" 3235 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 3236 bts1.set_neighbor_cell_name("GSM", 1, "GSM_1900_C640_F1955_CID56") 3237 set_usim_parameters(self.md8475a, self.ad.sim_card) 3238 self.md8475a.start_simulation() 3239 3240 self.ad.droid.telephonyToggleDataConnection(False) 3241 if not ensure_network_rat( 3242 self.log, 3243 self.ad, 3244 NETWORK_MODE_GSM_ONLY, 3245 RAT_FAMILY_GSM, 3246 toggle_apm_after_setting=True): 3247 self.log.error("Failed to set rat family {}, preferred network:{}". 3248 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 3249 return False 3250 self.md8475a.wait_for_registration_state() 3251 self.setup_3710a_waveform("1", "A", "1955.8MHz", 3252 neighbor_cell_1['power'], "GSM", 3253 "gsm_lac56_cid56") 3254 3255 self.turn_on_3710a_sg(1) 3256 time.sleep(self._SETTLING_TIME) 3257 return self._verify_cell_info(self.ad, expected_cell_info_stats) 3258 3259 @test_tracker_info(uuid="5f0367dd-08b5-4871-a784-51a0f76e229b") 3260 @TelephonyBaseTest.tel_test_wrap 3261 def test_neighbor_cell_reporting_gsm_interfreq_2_tmo(self): 3262 """ Test Number of neighbor cells reported by Phone when two neighbor 3263 cells(inter frequency) are present (Phone camped on GSM) 3264 3265 Setup one GSM cell configuration on MD8475A 3266 Setup two GSM waveforms on MG3710A 3267 Make Sure Phone camped on GSM 3268 Verify the number of neighbor cells reported by Phone 3269 3270 Returns: 3271 True if pass; False if fail 3272 """ 3273 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 3274 neighbor_cell_1 = gsm_band1900_ch640_fr1955_cid56_cell 3275 neighbor_cell_2 = gsm_band1900_ch750_fr1977_cid57_cell 3276 serving_cell['power'] = -20 3277 neighbor_cell_1['power'] = -24 3278 neighbor_cell_2['power'] = -22 3279 3280 expected_cell_info_list = [ 3281 # Serving Cell 3282 { 3283 self.CID: serving_cell[self.CID], 3284 self.REPORT_RATE: 1, 3285 self.IS_REGISTERED: True, 3286 self.RAT: 'gsm', 3287 self.TARGET_RSSI: 3288 self._GSM_RSSI_OFFSET + serving_cell['power'], 3289 self.MAX_ERROR_RSSI: 3, 3290 self.MAX_ERROR_AVERAGE_RSSI: 3 3291 }, 3292 # Neighbor Cells 3293 { 3294 self.CID: neighbor_cell_1[self.CID], 3295 self.REPORT_RATE: 0.1, 3296 self.IS_REGISTERED: False, 3297 self.RAT: 'gsm', 3298 self.TARGET_RSSI: 3299 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 3300 self.MAX_ERROR_RSSI: 4, 3301 self.MAX_ERROR_AVERAGE_RSSI: 3 3302 }, 3303 { 3304 self.CID: neighbor_cell_2[self.CID], 3305 self.REPORT_RATE: 0.1, 3306 self.IS_REGISTERED: False, 3307 self.RAT: 'gsm', 3308 self.TARGET_RSSI: 3309 self._GSM_RSSI_OFFSET + neighbor_cell_2['power'], 3310 self.MAX_ERROR_RSSI: 4, 3311 self.MAX_ERROR_AVERAGE_RSSI: 3 3312 } 3313 ] 3314 expected_cell_info_stats = {} 3315 for sample in expected_cell_info_list: 3316 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 3317 3318 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 3319 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 3320 self.ad.sim_card) 3321 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 3322 bts1.neighbor_cell_mode = "USERDATA" 3323 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 3324 bts1.set_neighbor_cell_name("GSM", 1, "GSM_1900_C640_F1955_CID56") 3325 bts1.set_neighbor_cell_type("GSM", 2, "CELLNAME") 3326 bts1.set_neighbor_cell_name("GSM", 2, "GSM_1900_C750_F1977_CID57") 3327 set_usim_parameters(self.md8475a, self.ad.sim_card) 3328 self.md8475a.start_simulation() 3329 3330 self.ad.droid.telephonyToggleDataConnection(False) 3331 if not ensure_network_rat( 3332 self.log, 3333 self.ad, 3334 NETWORK_MODE_GSM_ONLY, 3335 RAT_FAMILY_GSM, 3336 toggle_apm_after_setting=True): 3337 self.log.error("Failed to set rat family {}, preferred network:{}". 3338 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 3339 return False 3340 self.md8475a.wait_for_registration_state() 3341 self.setup_3710a_waveform("1", "A", "1955.8MHz", 3342 neighbor_cell_1['power'], "GSM", 3343 "gsm_lac56_cid56") 3344 3345 self.setup_3710a_waveform("2", "A", "1977.8MHz", 3346 neighbor_cell_2['power'], "GSM", 3347 "gsm_lac57_cid57") 3348 self.turn_on_3710a_sg(1) 3349 self.turn_on_3710a_sg(2) 3350 time.sleep(self._SETTLING_TIME) 3351 return self._verify_cell_info(self.ad, expected_cell_info_stats) 3352 3353 @test_tracker_info(uuid="b195153f-f6a0-4ec4-bb53-29c30ec0a034") 3354 @TelephonyBaseTest.tel_test_wrap 3355 def test_neighbor_cell_reporting_gsm_interband_2_tmo(self): 3356 """ Test Number of neighbor cells reported by Phone when two neighbor 3357 cells(inter band) are present (Phone camped on GSM) 3358 3359 Setup one GSM cell configuration on MD8475A 3360 Setup two GSM waveforms on MG3710A 3361 Make Sure Phone camped on GSM 3362 Verify the number of neighbor cells reported by Phone 3363 3364 Returns: 3365 True if pass; False if fail 3366 """ 3367 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 3368 neighbor_cell_1 = gsm_band850_ch128_fr869_cid58_cell 3369 neighbor_cell_2 = gsm_band850_ch251_fr893_cid59_cell 3370 serving_cell['power'] = -20 3371 neighbor_cell_1['power'] = -24 3372 neighbor_cell_2['power'] = -22 3373 3374 expected_cell_info_list = [ 3375 # Serving Cell 3376 { 3377 self.CID: serving_cell[self.CID], 3378 self.REPORT_RATE: 1, 3379 self.IS_REGISTERED: True, 3380 self.RAT: 'gsm', 3381 self.TARGET_RSSI: 3382 self._GSM_RSSI_OFFSET + serving_cell['power'], 3383 self.MAX_ERROR_RSSI: 3, 3384 self.MAX_ERROR_AVERAGE_RSSI: 3 3385 }, 3386 # Neighbor Cells 3387 { 3388 self.CID: neighbor_cell_1[self.CID], 3389 self.REPORT_RATE: 0.1, 3390 self.IS_REGISTERED: False, 3391 self.RAT: 'gsm', 3392 self.TARGET_RSSI: 3393 self._GSM_RSSI_OFFSET + neighbor_cell_1['power'], 3394 self.MAX_ERROR_RSSI: 4, 3395 self.MAX_ERROR_AVERAGE_RSSI: 3 3396 }, 3397 { 3398 self.CID: neighbor_cell_2[self.CID], 3399 self.REPORT_RATE: 0.1, 3400 self.IS_REGISTERED: False, 3401 self.RAT: 'gsm', 3402 self.TARGET_RSSI: 3403 self._GSM_RSSI_OFFSET + neighbor_cell_2['power'], 3404 self.MAX_ERROR_RSSI: 4, 3405 self.MAX_ERROR_AVERAGE_RSSI: 3 3406 } 3407 ] 3408 expected_cell_info_stats = {} 3409 for sample in expected_cell_info_list: 3410 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 3411 3412 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 3413 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 3414 self.ad.sim_card) 3415 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 3416 bts1.neighbor_cell_mode = "USERDATA" 3417 bts1.set_neighbor_cell_type("GSM", 1, "CELLNAME") 3418 bts1.set_neighbor_cell_name("GSM", 1, "GSM_850_C128_F869_CID58") 3419 bts1.set_neighbor_cell_type("GSM", 2, "CELLNAME") 3420 bts1.set_neighbor_cell_name("GSM", 2, "GSM_850_C251_F893_CID59") 3421 set_usim_parameters(self.md8475a, self.ad.sim_card) 3422 self.md8475a.start_simulation() 3423 3424 self.ad.droid.telephonyToggleDataConnection(False) 3425 if not ensure_network_rat( 3426 self.log, 3427 self.ad, 3428 NETWORK_MODE_GSM_ONLY, 3429 RAT_FAMILY_GSM, 3430 toggle_apm_after_setting=True): 3431 self.log.error("Failed to set rat family {}, preferred network:{}". 3432 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 3433 return False 3434 self.md8475a.wait_for_registration_state() 3435 self.setup_3710a_waveform("1", "A", "869MHz", neighbor_cell_1['power'], 3436 "GSM", "gsm_lac58_cid58") 3437 3438 self.setup_3710a_waveform("2", "A", "893MHz", neighbor_cell_2['power'], 3439 "GSM", "gsm_lac59_cid59") 3440 self.turn_on_3710a_sg(1) 3441 self.turn_on_3710a_sg(2) 3442 time.sleep(self._SETTLING_TIME) 3443 return self._verify_cell_info(self.ad, expected_cell_info_stats) 3444 3445 @test_tracker_info(uuid="209f62c1-7950-447c-9101-abe930da20ba") 3446 @TelephonyBaseTest.tel_test_wrap 3447 def test_neighbor_cell_reporting_gsm_interrat_2_tmo(self): 3448 """ Test Number of neighbor cells reported by Phone when no neighbor 3449 cells(inter RAT) are present (Phone camped on GSM) 3450 3451 Setup one GSM cell configuration on MD8475A 3452 Setup one LTE and one GSM waveforms on MG3710A 3453 Make Sure Phone camped on GSM 3454 Verify the number of neighbor cells reported by Phone 3455 3456 Returns: 3457 True if pass; False if fail 3458 """ 3459 serving_cell = gsm_band1900_ch512_fr1930_cid51_cell 3460 neighbor_cell_1 = lte_band4_ch2000_fr2115_pcid1_cell 3461 neighbor_cell_2 = wcdma_band1_ch10700_fr2140_cid31_cell 3462 serving_cell['power'] = -20 3463 neighbor_cell_1['power'] = -24 3464 neighbor_cell_2['power'] = -22 3465 3466 expected_cell_info_list = [ 3467 # Serving Cell 3468 { 3469 self.CID: serving_cell[self.CID], 3470 self.REPORT_RATE: 1, 3471 self.IS_REGISTERED: True, 3472 self.RAT: 'gsm', 3473 self.TARGET_RSSI: 3474 self._GSM_RSSI_OFFSET + serving_cell['power'], 3475 self.MAX_ERROR_RSSI: 3, 3476 self.MAX_ERROR_AVERAGE_RSSI: 3 3477 }, 3478 # Neighbor Cells 3479 { 3480 self.PCID: neighbor_cell_1[self.PCID], 3481 self.REPORT_RATE: 0.1, 3482 self.IS_REGISTERED: False, 3483 self.RAT: 'lte', 3484 self.TARGET_RSSI: 3485 self._LTE_RSSI_OFFSET + neighbor_cell_1['power'], 3486 self.MAX_ERROR_RSSI: 4, 3487 self.MAX_ERROR_AVERAGE_RSSI: 3 3488 }, 3489 { 3490 self.PSC: neighbor_cell_2[self.PSC], 3491 self.REPORT_RATE: 0.1, 3492 self.IS_REGISTERED: False, 3493 self.RAT: 'wcdma', 3494 self.TARGET_RSSI: 3495 self._WCDMA_RSSI_OFFSET + neighbor_cell_2['power'], 3496 self.MAX_ERROR_RSSI: 4, 3497 self.MAX_ERROR_AVERAGE_RSSI: 3 3498 } 3499 ] 3500 expected_cell_info_stats = {} 3501 for sample in expected_cell_info_list: 3502 expected_cell_info_stats[self._unique_cell_id(sample)] = sample 3503 3504 self.md8475a.load_cell_paramfile(self._CELL_PARAM_FILE) 3505 [bts1] = set_system_model_gsm(self.md8475a, self.user_params, 3506 self.ad.sim_card) 3507 self._setup_gsm_cell_md8475a(bts1, serving_cell, serving_cell['power']) 3508 bts1.neighbor_cell_mode = "USERDATA" 3509 bts1.set_neighbor_cell_type("LTE", 1, "CELLNAME") 3510 bts1.set_neighbor_cell_name("LTE", 1, "LTE_4_C2000_F2115_PCID1") 3511 bts1.set_neighbor_cell_type("WCDMA", 2, "CELLNAME") 3512 bts1.set_neighbor_cell_name("WCDMA", 2, "WCDM_1_C10700_F2140_CID31") 3513 set_usim_parameters(self.md8475a, self.ad.sim_card) 3514 self.md8475a.start_simulation() 3515 self.ad.droid.telephonyToggleDataConnection(False) 3516 if not ensure_network_rat( 3517 self.log, 3518 self.ad, 3519 NETWORK_MODE_GSM_ONLY, 3520 RAT_FAMILY_GSM, 3521 toggle_apm_after_setting=True): 3522 self.log.error("Failed to set rat family {}, preferred network:{}". 3523 format(RAT_FAMILY_GSM, NETWORK_MODE_GSM_ONLY)) 3524 return False 3525 self.md8475a.wait_for_registration_state() 3526 self.setup_3710a_waveform("1", "A", "2115MHz", 3527 neighbor_cell_1['power'], "LTE", 3528 "lte_1_ch2000_pcid1") 3529 3530 self.setup_3710a_waveform("2", "A", "2140MHz", 3531 neighbor_cell_2['power'], "WCDMA", 3532 "wcdma_1_psc31_cid31") 3533 self.turn_on_3710a_sg(1) 3534 self.turn_on_3710a_sg(2) 3535 time.sleep(self._SETTLING_TIME) 3536 return self._verify_cell_info(self.ad, expected_cell_info_stats) 3537 3538 """ Tests End """ 3539