diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2021-03-29 20:44:36 +0000 |
---|---|---|
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | 2021-03-29 20:44:36 +0000 |
commit | aa2a70e22152bbfa47411ed8da6db84d58606ec6 (patch) | |
tree | 38af24ebada980954dfcfd874175fe001419f56f | |
parent | 00c9fdf88de370327322ddc99b179fad0f0ae12c (diff) | |
parent | 10337285da924dacdc5fdbe3be132eedec025d5b (diff) | |
download | connectivity-aa2a70e22152bbfa47411ed8da6db84d58606ec6.tar.gz |
Snap for 7242881 from 10337285da924dacdc5fdbe3be132eedec025d5b to sdk-releaseplatform-tools-31.0.2
Change-Id: Ib61c8c30916e7ef56d24260de2488b80d9c26295
7 files changed, 672 insertions, 75 deletions
diff --git a/acts_tests/acts_contrib/test_utils/tel/GFTInOutBaseTest.py b/acts_tests/acts_contrib/test_utils/tel/GFTInOutBaseTest.py new file mode 100644 index 000000000..7ce16d0cd --- /dev/null +++ b/acts_tests/acts_contrib/test_utils/tel/GFTInOutBaseTest.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python3 +# +# Copyright 2021 - The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +import sys +import collections +import random +import time +import datetime +import os +import logging +import subprocess +import math +import re + +from acts.base_test import BaseTestClass +from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest +from acts.test_decorators import test_tracker_info +from acts.logger import epoch_to_log_line_timestamp +from acts.utils import get_current_epoch_time + +from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_POWER_LEVEL +from acts_contrib.test_utils.tel.gft_inout_defines import IN_SERVICE_POWER_LEVEL +from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import IN_SERVICE_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import WIFI_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import NO_WIFI_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_TIME +from acts_contrib.test_utils.tel.gft_inout_defines import WAIT_FOR_SERVICE_TIME + +CELLULAR_PORT = 0 +WIFI_PORT = 1 +UNKNOWN = "UNKNOWN" + +class GFTInOutBaseTest(TelephonyBaseTest): + def __init__(self, controllers): + TelephonyBaseTest.__init__(self, controllers) + + def setup_test(self): + TelephonyBaseTest.setup_test(self) + + def teardown_test(self): + TelephonyBaseTest.teardown_test(self) + begin_time = get_current_epoch_time() + self._take_bug_report(self.test_name, begin_time) + + + def check_network(self): + """check service state of network + + Returns: + return True if android_devices are in service else return false + """ + for ad in self.android_devices: + network_type_voice = ad.droid.telephonyGetCurrentVoiceNetworkType() + network_type_data = ad.droid.telephonyGetCurrentDataNetworkType() + sim_state = ad.droid.telephonyGetSimState() + wifi_info = ad.droid.wifiGetConnectionInfo() + if wifi_info["supplicant_state"] == "completed": + ad.log.info("Wifi is connected to %s" %(wifi_info["SSID"])) + else: + ad.log.info("wifi_info =%s" %(wifi_info)) + ad.log.info("sim_state=%s" %(sim_state)) + ad.log.info("networkType_voice=%s" %(network_type_voice)) + ad.log.info("network_type_data=%s" %(network_type_data)) + + if network_type_voice == UNKNOWN: + return False + return True + + def adjust_cellular_signal(self, power): + """Sets the attenuation value of cellular port + + Args: + power: power level for attenuator to be set + + Returns: + return True if ceullular port is set + """ + if self.user_params.get("Attenuator"): + self.log.info("adjust cellular signal set mini-circuits to %s" %(power)) + self.attenuators[CELLULAR_PORT].set_atten(power) + return True + else: + return False + + def adjust_wifi_signal(self, power): + """Sets the attenuation value of wifi port + + Args: + power: power level for attenuator to be set + + Returns: + return True if wifi port is set + """ + if self.user_params.get("Attenuator"): + self.log.info("adjust wifi signal set mini-circuits to %s" %(power)) + self.attenuators[WIFI_PORT].set_atten(power) + self.attenuators[2].set_atten(power) + self.attenuators[3].set_atten(power) + return True + + def adjust_attens(self, power): + """Sets the attenuation value of all attenuators in the group + + Args: + power: power level for attenuator to be set + + Returns: + return True if all ports are set + """ + if self.user_params.get("Attenuator"): + self.log.info("set attenuator ports to %s" %(power)) + self.attenuators[0].set_atten(power) + self.attenuators[1].set_atten(power) + self.attenuators[2].set_atten(power) + self.attenuators[3].set_atten(power) + else: + self.log.info("Attenuator is set to False in config file") + return False + return True + + def adjust_atten(self, port , power): + """Sets the attenuation value of given port + + Args: + port: port of attenuator + power: power level for attenuator to be set + + Returns: + return True if given port is set + """ + if self.user_params.get("Attenuator"): + self.log.info("set attenuator port=%s to %s" %(port, power)) + self.attenuators[port].set_atten(power) + else: + self.log.info("Attenuator is set to False in config file") + return False + return True + + def adjust_atten_slowly(self, adjust_level, move_to, step=9 , step_time=5): + """adjust attenuator slowly + + Args: + port: port of attenuator + power: power level for attenuator to be set + + Returns: + return True if given port is set + """ + if move_to == NO_SERVICE_AREA: + self.log.info("Move UE from coverage area to no/poor service area") + power_level = IN_SERVICE_POWER_LEVEL + for x in range (step): + power_level += adjust_level + self.log.info("adjust power level = %s" %power_level) + self.adjust_cellular_signal(power_level) + time.sleep(step_time) + self.log.info("wait device to be in no service state") + self.check_network() + elif move_to == IN_SERVICE_AREA: + # Move UE to service area + self.log.info("Move UE to service area") + power_level = NO_SERVICE_POWER_LEVEL + for x in range (step): + power_level -= adjust_level + self.log.info("adjust power level = %s" %power_level) + self.adjust_cellular_signal(power_level) + time.sleep(step_time) + self.log.info("wait device to be in service state") + self.check_network() + elif move_to == WIFI_AREA: + self.log.info("Move UE to good wifi area") + power_level = IN_SERVICE_POWER_LEVEL + for x in range (step): + power_level += adjust_level + self.log.info("adjust power level = %s" %power_level) + self.adjust_wifi_signal(power_level) + time.sleep(step_time) + self.log.info("wait device to connected to wifi") + self.check_network() + elif move_to == NO_WIFI_AREA: + self.log.info("Move UE to poor/no wifi area") + power_level = NO_SERVICE_POWER_LEVEL + for x in range (step): + power_level -= adjust_level + self.log.info("adjust power level = %s" %power_level) + self.adjust_wifi_signal(power_level) + time.sleep(step_time) + self.log.info("wait device to disconnected from wifi") + self.check_network() + return True + diff --git a/acts_tests/acts_contrib/test_utils/tel/gft_inout_defines.py b/acts_tests/acts_contrib/test_utils/tel/gft_inout_defines.py new file mode 100644 index 000000000..7b7df608a --- /dev/null +++ b/acts_tests/acts_contrib/test_utils/tel/gft_inout_defines.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# +# Copyright 2021 - Google +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +# mini-circuit range is 0-95 dbm +NO_SERVICE_POWER_LEVEL = 95 +IN_SERVICE_POWER_LEVEL = 0 + +# definition for wifi/cellular area +NO_SERVICE_AREA = 0 +IN_SERVICE_AREA = 1 +WIFI_AREA = 2 +NO_WIFI_AREA = 3 + +# time that device will stay at no service area +NO_SERVICE_TIME = 60 + +# timer for wait back to in-service +WAIT_FOR_SERVICE_TIME = 30 + diff --git a/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py b/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py index b0d686c39..8092a420b 100644 --- a/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py +++ b/acts_tests/acts_contrib/test_utils/tel/tel_data_utils.py @@ -92,6 +92,7 @@ from acts_contrib.test_utils.tel.tel_test_utils import active_file_download_task from acts_contrib.test_utils.tel.tel_test_utils import run_multithread_func from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_default_state from acts_contrib.test_utils.tel.tel_test_utils import WIFI_SSID_KEY +from acts_contrib.test_utils.tel.tel_test_utils import is_phone_in_call_active from acts_contrib.test_utils.tel.tel_5g_utils import is_current_network_5g_nsa from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_5g from acts_contrib.test_utils.tel.tel_5g_utils import provision_device_for_5g @@ -1384,6 +1385,7 @@ def test_call_setup_in_active_data_transfer( if not provision_device_for_5g(log, ads[0]): ads[0].log.error("Phone not attached on 5G NSA before call.") return False + elif nw_gen: if not ensure_network_generation(log, ads[0], nw_gen, MAX_WAIT_TIME_NW_SELECTION, @@ -1426,7 +1428,6 @@ def test_call_setup_in_active_data_transfer( log.error("Call setup failed in active data transfer.") if results[0]: ad_download.log.info("Data transfer succeeded.") - return True elif not allow_data_transfer_interruption: ad_download.log.error( "Data transfer failed with parallel phone call.") @@ -1436,6 +1437,8 @@ def test_call_setup_in_active_data_transfer( if not verify_internet_connection(log, ad_download): ad_download.log.error("Internet connection is not available") return False + # Disable airplane mode if test under apm on. + toggle_airplane_mode(log, ads[0], False) if nw_gen == GEN_5G and not is_current_network_5g_nsa(ads[0]): ads[0].log.error("Phone not attached on 5G NSA after call.") return False @@ -1469,6 +1472,7 @@ def test_call_setup_in_active_youtube_video( if not provision_device_for_5g(log, ads[0]): ads[0].log.error("Phone not attached on 5G NSA before call.") return False + elif nw_gen: if not ensure_network_generation(log, ads[0], nw_gen, MAX_WAIT_TIME_NW_SELECTION, @@ -1476,12 +1480,12 @@ def test_call_setup_in_active_youtube_video( ads[0].log.error("Device failed to reselect in %s.", MAX_WAIT_TIME_NW_SELECTION) return False + ads[0].droid.telephonyToggleDataConnection(True) + if not wait_for_cell_data_connection(log, ads[0], True): + ads[0].log.error("Data connection is not on cell") + return False else: ensure_phones_default_state(log, ads) - ads[0].droid.telephonyToggleDataConnection(True) - if not wait_for_cell_data_connection(log, ads[0], True): - ads[0].log.error("Data connection is not on cell") - return False if not verify_internet_connection(log, ads[0]): ads[0].log.error("Internet connection is not available") @@ -1512,6 +1516,8 @@ def test_call_setup_in_active_youtube_video( ad_download.log.warning( "After call hang up, audio is not back to music") ad_download.force_stop_apk("com.google.android.youtube") + # Disable airplane mode if test under apm on. + toggle_airplane_mode(log, ads[0], False) if nw_gen == GEN_5G and not is_current_network_5g_nsa(ads[0]): ads[0].log.error("Phone not attached on 5G NSA after call.") result = False @@ -1957,3 +1963,47 @@ def verify_internet_connection_in_doze_mode(log, log.error("Failed to disable doze mode.") return False return True + + +def test_wifi_cell_switching_in_call(log, + ads, + network_ssid, + network_password, + new_gen=None): + """Test data connection network switching during voice call when phone on <nw_gen> + Args: + log: log object. + ads: android device objects. + network_ssid: wifi network ssid. + network_password: wifi network password. + new_gen: network generation. + Returns: + True if pass, otherwise False. + + """ + result = True + if not call_setup_teardown(log, ads[0], ads[1], None, None, None, + 5): + log.error("Call setup failed") + return False + else: + log.info("Call setup succeed") + + if not wifi_cell_switching(log, + ads[0], + new_gen, + network_ssid, + network_password): + ads[0].log.error("Failed to do WIFI and Cell switch in call") + result = False + + if not is_phone_in_call_active(ads[0]): + return False + else: + if not ads[0].droid.telecomCallGetAudioState(): + ads[0].log.error("Audio is not on call") + result = False + else: + ads[0].log.info("Audio is on call") + hangup_call(log, ads[0]) + return result diff --git a/acts_tests/acts_contrib/test_utils/tel/tel_subscription_utils.py b/acts_tests/acts_contrib/test_utils/tel/tel_subscription_utils.py index 9003f2edf..953f3851c 100644 --- a/acts_tests/acts_contrib/test_utils/tel/tel_subscription_utils.py +++ b/acts_tests/acts_contrib/test_utils/tel/tel_subscription_utils.py @@ -382,6 +382,9 @@ def perform_dds_switch(ad): def set_dds_on_slot_0(ad): sub_id = get_subid_from_slot_index(ad.log, ad, 0) + if sub_id == INVALID_SUB_ID: + ad.log.warning("Invalid sub ID at slot 0") + return False operator = get_operatorname_from_slot_index(ad, 0) if get_default_data_sub_id(ad) == sub_id: ad.log.info("Current DDS is already on %s", operator) @@ -398,6 +401,9 @@ def set_dds_on_slot_0(ad): def set_dds_on_slot_1(ad): sub_id = get_subid_from_slot_index(ad.log, ad, 1) + if sub_id == INVALID_SUB_ID: + ad.log.warning("Invalid sub ID at slot 1") + return False operator = get_operatorname_from_slot_index(ad, 1) if get_default_data_sub_id(ad) == sub_id: ad.log.info("Current DDS is already on %s", operator) diff --git a/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py b/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py index ffa3a3fe1..4b924a831 100755 --- a/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py +++ b/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py @@ -24,6 +24,7 @@ from acts.utils import adb_shell_ping from acts.test_decorators import test_tracker_info from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest from acts_contrib.test_utils.tel.loggers.telephony_metric_logger import TelephonyMetricLogger +from acts_contrib.test_utils.tel.loggers.protos.telephony_metric_pb2 import TelephonyVoiceTestResult from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED from acts_contrib.test_utils.tel.tel_defines import GEN_5G @@ -68,10 +69,13 @@ from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_ from acts_contrib.test_utils.tel.tel_5g_utils import provision_device_for_5g from acts_contrib.test_utils.tel.tel_5g_utils import set_preferred_mode_for_5g from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices +from acts_contrib.test_utils.tel.tel_5g_utils import disable_apm_mode_both_devices from acts_contrib.test_utils.tel.tel_data_utils import call_epdg_to_epdg_wfc from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_data_transfer from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_youtube_video from acts_contrib.test_utils.tel.tel_data_utils import wifi_cell_switching +from acts_contrib.test_utils.tel.tel_data_utils import test_wifi_cell_switching_in_call +CallResult = TelephonyVoiceTestResult.CallResult.Value class Nsa5gVoiceTest(TelephonyBaseTest): @@ -985,5 +989,205 @@ class Nsa5gVoiceTest(TelephonyBaseTest): hangup_call(self.log, ads[0]) return result + @test_tracker_info(uuid="95802175-06d5-4774-8ce8-fdf7922eca20") + @TelephonyBaseTest.tel_test_wrap + def test_5g_nsa_call_mo_vowifi_in_active_youtube(self): + """Test call can be established during active youtube video on 5G NSA. + + Turn off airplane mode, turn on wfc and wifi. + Starting youtube video. + Initiate a MO voice call. Verify call can be established. + + Returns: + True if success. + False if failed. + """ + if not phone_setup_iwlan(self.log, self.android_devices[0], False, + WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, + self.wifi_network_pass): + self.android_devices[0].log.error( + "Failed to setup IWLAN with NON-APM WIFI WFC on") + return False + return test_call_setup_in_active_youtube_video(self.log, + self.android_devices, + GEN_5G, + DIRECTION_MOBILE_ORIGINATED) + + @test_tracker_info(uuid="f827a8b5-039c-4cc1-b030-78a09119acfc") + @TelephonyBaseTest.tel_test_wrap + def test_5g_nsa_call_mt_vowifi_in_active_youtube(self): + """Test call can be established during active youtube_video on 5G NSA. + + Turn off airplane mode, turn on wfc and wifi. + Starting an youtube video. + Initiate a MT voice call. Verify call can be established. + + Returns: + True if success. + False if failed. + """ + if not phone_setup_iwlan(self.log, self.android_devices[0], False, + WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, + self.wifi_network_pass): + self.android_devices[0].log.error( + "Failed to setup iwlan with APM off and WIFI and WFC on") + return False + return test_call_setup_in_active_youtube_video(self.log, + self.android_devices, + GEN_5G, + DIRECTION_MOBILE_TERMINATED) + + @test_tracker_info(uuid="af3254d0-a84a-47c8-8ebc-11517b7b4944") + @TelephonyBaseTest.tel_test_wrap + def test_5g_nsa_call_mo_vowifi_apm_in_active_data_transfer(self): + """Test call can be established during active data connection on 5G NSA. + + Turn on wifi-calling, airplane mode and wifi. + Starting downloading file from Internet. + Initiate a MO voice call. Verify call can be established. + Hangup Voice Call, verify file is downloaded successfully. + + Returns: + True if success. + False if failed. + """ + if not provision_device_for_5g(self.log, self.android_devices[0]): + self.android_devices[0].log.error("Phone not attached on 5G NSA before call.") + return False + + if not phone_setup_iwlan(self.log, self.android_devices[0], True, + WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, + self.wifi_network_pass): + self.android_devices[0].log.error( + "Failed to setup iwlan with APM, WIFI and WFC on") + return False + return test_call_setup_in_active_data_transfer(self.log, + self.android_devices, + None, + DIRECTION_MOBILE_ORIGINATED) + + @test_tracker_info(uuid="5c58af94-8c24-481b-a555-bdbf36db5f6e") + @TelephonyBaseTest.tel_test_wrap + def test_5g_nsa_call_mt_vowifi_apm_in_active_data_transfer(self): + """Test call can be established during active data connection on 5G NSA. + + Turn on wifi-calling, airplane mode and wifi. + Starting downloading file from Internet. + Initiate a MT voice call. Verify call can be established. + Hangup Voice Call, verify file is downloaded successfully. + + Returns: + True if success. + False if failed. + """ + if not provision_device_for_5g(self.log, self.android_devices[0]): + self.android_devices[0].log.error("Phone not attached on 5G NSA before call.") + return False + + if not phone_setup_iwlan(self.log, self.android_devices[0], True, + WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, + self.wifi_network_pass): + self.android_devices[0].log.error( + "Failed to setup iwlan with APM, WIFI and WFC on") + return False + return test_call_setup_in_active_data_transfer(self.log, + self.android_devices, + None, + DIRECTION_MOBILE_TERMINATED) + + @test_tracker_info(uuid="bcd874ae-58e1-4954-88af-bb3dd54d4abf") + @TelephonyBaseTest.tel_test_wrap + def test_5g_nsa_call_mo_vowifi_apm_in_active_youtube(self): + """Test call can be established during active youtube video on 5G NSA. + + Turn on wifi-calling, airplane mode and wifi. + Starting an youtube video. + Initiate a MO voice call. Verify call can be established. + + Returns: + True if success. + False if failed. + """ + if not provision_device_for_5g(self.log, self.android_devices[0]): + self.android_devices[0].log.error("Phone not attached on 5G NSA before call.") + return False + + if not phone_setup_iwlan(self.log, self.android_devices[0], True, + WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, + self.wifi_network_pass): + self.android_devices[0].log.error( + "Failed to setup iwlan with APM, WIFI and WFC on") + return False + return test_call_setup_in_active_youtube_video(self.log, + self.android_devices, + None, + DIRECTION_MOBILE_ORIGINATED) + + @test_tracker_info(uuid="ad96f1cf-0d17-4a39-86cf-cacb5f4cc81c") + @TelephonyBaseTest.tel_test_wrap + def test_5g_nsa_call_mt_vowifi_apm_in_active_youtube(self): + """Test call can be established during active youtube video on 5G NSA. + + Turn on wifi-calling, airplane mode and wifi. + Starting youtube video. + Initiate a MT voice call. Verify call can be established. + + Returns: + True if success. + False if failed. + """ + if not provision_device_for_5g(self.log, self.android_devices[0]): + self.android_devices[0].log.error("Phone not attached on 5G NSA before call.") + return False + + if not phone_setup_iwlan(self.log, self.android_devices[0], True, + WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, + self.wifi_network_pass): + self.android_devices[0].log.error( + "Failed to setup iwlan with APM, WIFI and WFC on") + return False + return test_call_setup_in_active_youtube_video(self.log, + self.android_devices, + None, + DIRECTION_MOBILE_TERMINATED) + + @test_tracker_info(uuid="9d1121c1-aae4-428b-9167-09d4efdb7e37") + @TelephonyBaseTest.tel_test_wrap + def test_5g_nsa_call_wfc_in_call_wifi_toggling(self): + """ General voice to voice call on 5G NSA. TMO Only Test + + 1. Make Sure PhoneA in wfc with APM off. + 2. Make Sure PhoneB in Voice Capable. + 3. Call from PhoneA to PhoneB. + 4. Toggling Wifi connection in call. + 5. Verify call is active. + 6. Hung up the call on PhoneA + + Returns: + True if pass; False if fail. + """ + + ads = self.android_devices + + if not provision_both_devices_for_5g(self.log, ads): + return False + tasks = [(phone_setup_iwlan, + (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, + self.wifi_network_ssid, self.wifi_network_pass)), + (phone_setup_voice_general, (self.log, ads[1]))] + + if not multithread_func(self.log, tasks): + self.log.error("Phone Failed to Set Up Properly.") + return False + return test_wifi_cell_switching_in_call(self.log, + ads, + self.wifi_network_ssid, + self.wifi_network_pass) """ Tests End """ diff --git a/acts_tests/tests/google/tel/lab/TelLabGFTModemConnectivityHelperTest.py b/acts_tests/tests/google/tel/lab/TelLabGFTModemConnectivityHelperTest.py new file mode 100644 index 000000000..295590a28 --- /dev/null +++ b/acts_tests/tests/google/tel/lab/TelLabGFTModemConnectivityHelperTest.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python3 +# +# Copyright 2021 - The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + +import sys +import collections +import random +import time +import datetime +import os +import logging +import json +import subprocess +import math +import re + +from acts import asserts +from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest +from acts_contrib.test_utils.tel.GFTInOutBaseTest import GFTInOutBaseTest +from acts.controllers.android_device import DEFAULT_QXDM_LOG_PATH +from acts.controllers.android_device import DEFAULT_SDM_LOG_PATH +from acts_contrib.test_utils.tel.tel_test_utils import multithread_func +from acts_contrib.test_utils.tel.tel_test_utils import run_multithread_func +from acts_contrib.test_utils.tel.tel_test_utils import hangup_call +from acts_contrib.test_utils.tel.tel_test_utils import initiate_call +from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte + +from acts.test_decorators import test_tracker_info +from acts.logger import epoch_to_log_line_timestamp +from acts.utils import get_current_epoch_time + +from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_POWER_LEVEL +from acts_contrib.test_utils.tel.gft_inout_defines import IN_SERVICE_POWER_LEVEL +from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import IN_SERVICE_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import WIFI_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import NO_WIFI_AREA +from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_TIME +from acts_contrib.test_utils.tel.gft_inout_defines import WAIT_FOR_SERVICE_TIME + + +class TelLabGFTModemConnectivityHelperTest(GFTInOutBaseTest): + def __init__(self, controllers): + GFTInOutBaseTest.__init__(self, controllers) + + def setup_test(self): + self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) + self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) + GFTInOutBaseTest.setup_test(self) + self.check_network() + + + """Tests""" + @test_tracker_info(uuid="c602e556-8273-4c75-b8fa-4d51ba514654") + @TelephonyBaseTest.tel_test_wrap + def test_in_out_no_service(self): + """In/Out service - Stationary idle mode - 1 min + UE is in idle + Move UE from coverage area to no service area and UE shows no service + Wait for 1 min, then re-enter coverage area + + Returns: + True if pass; False if fail. + """ + self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) + self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) + time.sleep(NO_SERVICE_TIME) + self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) + self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) + time.sleep(WAIT_FOR_SERVICE_TIME) + if not self.check_network(): + return False + return True + + + @test_tracker_info(uuid="e58c7347-a930-4a3a-a740-a6d1cfb19ca0") + @TelephonyBaseTest.tel_test_wrap + def test_volte_call_cellular(self, loop=1): + """ UE is in call + Move UE from coverage area to no service area and UE shows no service + Wait for 1 min, then re-enter coverage area + + Args: + loop: cycle + Returns: + True if pass; False if fail. + """ + test_result = True + for x in range (loop): + self.log.info("%s loop: %s/%s" %(self.current_test_name,x+1, loop)) + self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) + self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) + + # Make a MO VoLTE call in service area. + tasks = [(self._initiate_call, (ad, )) for ad in self.android_devices] + if not multithread_func(self.log, tasks): + return False + tasks = [(is_phone_in_call_volte, (ad.log, ad, )) for ad in self.android_devices] + test_result = multithread_func(self.log, tasks) + + # Move to poor service -> no service area + self.adjust_atten_slowly(10, NO_SERVICE_AREA) + time.sleep(NO_SERVICE_TIME) + # check call status + tasks = [(is_phone_in_call_volte, (ad.log, ad, )) for ad in self.android_devices] + test_result = multithread_func(self.log, tasks) + for ad in self.android_devices: + telecom_state = ad.droid.telecomGetCallState() + ad.log.info("telecom_state %s" %(telecom_state)) + # Move back to service area + self.adjust_atten_slowly(10, IN_SERVICE_AREA) + time.sleep(WAIT_FOR_SERVICE_TIME) + return test_result + + def _initiate_call(self, ad): + """ initiate a voice call + + Args: + ad: caller + + Returns: + return True if call initiate successfully + """ + mt = ad.mt_phone_number + ad.log.info("set mt number to %s" %(mt)) + ad.log.info("check network status before initiate call") + self.check_network() + ad.log.info("_initiate_call to %s" %(mt)) + if not initiate_call(self.log, ad, mt): + return False + return True diff --git a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py index 9166fcf26..a5f011787 100644 --- a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py +++ b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py @@ -28,6 +28,7 @@ from acts_contrib.test_utils.tel.tel_data_utils import wifi_cell_switching from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_data_transfer from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_youtube_video from acts_contrib.test_utils.tel.tel_data_utils import call_epdg_to_epdg_wfc +from acts_contrib.test_utils.tel.tel_data_utils import test_wifi_cell_switching_in_call from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED from acts_contrib.test_utils.tel.tel_defines import GEN_2G @@ -4037,34 +4038,17 @@ class TelLiveVoiceTest(TelephonyBaseTest): True if pass; False if fail. """ ads = self.android_devices - result = True + tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_volte, (self.log, ads[1]))] if not multithread_func(self.log, tasks): self.log.error("Phone Failed to Set Up Properly.") return False - if not call_setup_teardown(self.log, ads[0], ads[1], None, None, None, - 5): - self.log.error("Call setup failed") - return False - else: - self.log.info("Call setup succeed") - - if not wifi_cell_switching(self.log, ads[0], self.wifi_network_ssid, - self.wifi_network_pass, GEN_4G): - ads[0].log.error("Failed to do WIFI and Cell switch in call") - result = False - - if not is_phone_in_call_active(ads[0]): - return False - else: - if not ads[0].droid.telecomCallGetAudioState(): - ads[0].log.error("Audio is not on call") - result = False - else: - ads[0].log.info("Audio is on call") - hangup_call(self.log, ads[0]) - return result + return test_wifi_cell_switching_in_call(self.log, + ads, + self.wifi_network_ssid, + self.wifi_network_pass, + new_gen=GEN_4G) @test_tracker_info(uuid="8a853186-cdff-4078-930a-6c619ea89183") @TelephonyBaseTest.tel_test_wrap @@ -4074,7 +4058,7 @@ class TelLiveVoiceTest(TelephonyBaseTest): 1. Make Sure PhoneA in wfc with APM off. 2. Make Sure PhoneB in Voice Capable. 3. Call from PhoneA to PhoneB. - 4. Toggling Wifi connnection in call. + 4. Toggling Wifi connection in call. 5. Verify call is active. 6. Hung up the call on PhoneA @@ -4082,7 +4066,7 @@ class TelLiveVoiceTest(TelephonyBaseTest): True if pass; False if fail. """ ads = self.android_devices - result = True + tasks = [(phone_setup_iwlan, (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED, self.wifi_network_ssid, self.wifi_network_pass)), @@ -4091,28 +4075,11 @@ class TelLiveVoiceTest(TelephonyBaseTest): if not multithread_func(self.log, tasks): self.log.error("Phone Failed to Set Up Properly.") return False - if not call_setup_teardown(self.log, ads[0], ads[1], None, None, None, - 5): - self.log.error("Call setup failed") - return False - else: - self.log.info("Call setup succeed") - - if not wifi_cell_switching(self.log, ads[0], self.wifi_network_ssid, - self.wifi_network_pass, GEN_4G): - ads[0].log.error("Failed to do WIFI and Cell switch in call") - result = False - - if not is_phone_in_call_active(ads[0]): - return False - else: - if not ads[0].droid.telecomCallGetAudioState(): - ads[0].log.error("Audio is not on call") - result = False - else: - ads[0].log.info("Audio is on call") - hangup_call(self.log, ads[0]) - return result + return test_wifi_cell_switching_in_call(self.log, + ads, + self.wifi_network_ssid, + self.wifi_network_pass, + new_gen=GEN_4G) @test_tracker_info(uuid="187bf7b5-d122-4914-82c0-b0709272ee12") @TelephonyBaseTest.tel_test_wrap @@ -4122,7 +4089,7 @@ class TelLiveVoiceTest(TelephonyBaseTest): 1. Make Sure PhoneA in CSFB. 2. Make Sure PhoneB in CSFB. 3. Call from PhoneA to PhoneB. - 4. Toggling Wifi connnection in call. + 4. Toggling Wifi connection in call. 5. Verify call is active. 6. Hung up the call on PhoneA @@ -4130,33 +4097,17 @@ class TelLiveVoiceTest(TelephonyBaseTest): True if pass; False if fail. """ ads = self.android_devices - result = True + tasks = [(phone_setup_csfb, (self.log, ads[0])), (phone_setup_csfb, (self.log, ads[1]))] if not multithread_func(self.log, tasks): self.log.error("Phone Failed to Set Up Properly.") return False - if not call_setup_teardown(self.log, ads[0], ads[1], None, None, None, - 5): - self.log.error("Call setup failed") - return False - else: - self.log.info("Call setup succeed") + return test_wifi_cell_switching_in_call(self.log, + ads, + self.wifi_network_ssid, + self.wifi_network_pass, + new_gen=GEN_3G) - if not wifi_cell_switching(self.log, ads[0], self.wifi_network_ssid, - self.wifi_network_pass, GEN_3G): - ads[0].log.error("Faile to do WIFI and Cell switch in call") - result = False - - if not is_phone_in_call_active(ads[0]): - return False - else: - if not ads[0].droid.telecomCallGetAudioState(): - ads[0].log.error("Audio is not on call") - result = False - else: - ads[0].log.info("Audio is on call") - hangup_call(self.log, ads[0]) - return result """ Tests End """ |