Modify the setup network steps to avoid setup network mode simultaneously.

Device may not register to 5G if modify mode preference between 4G and 5G within 1s.Modify setup mode method to suitable one.

Bug: 223835694
Test: Yes, locally
Change-Id: Iad551c91441a26cf521606dc1ee9c19704eca414
diff --git a/acts_tests/acts_contrib/test_utils/tel/tel_5g_test_utils.py b/acts_tests/acts_contrib/test_utils/tel/tel_5g_test_utils.py
index 5b81979..c6e20bc 100644
--- a/acts_tests/acts_contrib/test_utils/tel/tel_5g_test_utils.py
+++ b/acts_tests/acts_contrib/test_utils/tel/tel_5g_test_utils.py
@@ -108,10 +108,10 @@
         return True
 
 
-def provision_both_devices_for_volte(log, ads):
-    # LTE attach and enable VoLTE on both phones
-    tasks = [(phone_setup_volte, (log, ads[0])),
-             (phone_setup_volte, (log, ads[1]))]
+def provision_both_devices_for_volte(log, ads, nw_gen, nr_type=None):
+    # LTE or NR attach and enable VoLTE on both phones
+    tasks = [(phone_setup_volte, (log, ads[0], nw_gen, nr_type)),
+             (phone_setup_volte, (log, ads[1], nw_gen, nr_type))]
     if not multithread_func(log, tasks):
         log.error("phone failed to set up in volte")
         return False
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 05808f9..ec6398c 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
@@ -77,6 +77,7 @@
 from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_phones_default_state
 from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_idle_iwlan
 from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_iwlan
+from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_on_rat
 from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_voice_general
 from acts_contrib.test_utils.tel.tel_phone_setup_utils import wait_for_voice_attach_for_subscription
 from acts_contrib.test_utils.tel.tel_test_utils import _check_file_existence
@@ -847,7 +848,7 @@
 def test_data_connectivity_multi_bearer(
         log,
         android_devices,
-        nw_gen=None,
+        rat=None,
         simultaneous_voice_data=True,
         call_direction=DIRECTION_MOBILE_ORIGINATED,
         nr_type=None):
@@ -875,19 +876,17 @@
     ad_list = [android_devices[0], android_devices[1]]
     ensure_phones_idle(log, ad_list)
 
-    if nw_gen == GEN_5G:
-        if not provision_device_for_5g(log, android_devices, nr_type=nr_type):
-            return False
-    elif nw_gen:
-        if not ensure_network_generation_for_subscription(
-                log, android_devices[0], android_devices[0]
-                .droid.subscriptionGetDefaultDataSubId(), nw_gen,
-                MAX_WAIT_TIME_NW_SELECTION, NETWORK_SERVICE_DATA):
-            log.error("Device failed to reselect in {}s.".format(
-                MAX_WAIT_TIME_NW_SELECTION))
+    if rat:
+        if not phone_setup_on_rat(log,
+                                  android_devices[0],
+                                  rat,
+                                  sub_id=android_devices[0]
+                                  .droid.subscriptionGetDefaultDataSubId(),
+                                  nr_type=nr_type):
             return False
     else:
-        log.debug("Skipping network generation since it is None")
+        android_devices[0].log.debug(
+            "Skipping setup network rat since it is None")
 
     if not wait_for_voice_attach_for_subscription(
             log, android_devices[0], android_devices[0]
@@ -1213,24 +1212,34 @@
 def test_call_setup_in_active_data_transfer(
         log,
         ads,
-        nw_gen=None,
+        rat=None,
+        is_airplane_mode=False,
+        wfc_mode=None,
+        wifi_ssid=None,
+        wifi_pwd=None,
+        nr_type=None,
         call_direction=DIRECTION_MOBILE_ORIGINATED,
-        allow_data_transfer_interruption=False,
-        nr_type=None):
+        allow_data_transfer_interruption=False):
     """Test call can be established during active data connection.
 
     Turn off airplane mode, disable WiFi, enable Cellular Data.
-    Make sure phone in <nw_gen>.
+    Make sure phone in <rat>.
     Starting downloading file from Internet.
     Initiate a voice call. Verify call can be established.
     Hangup Voice Call, verify file is downloaded successfully.
     Note: file download will be suspended when call is initiated if voice
           is using voice channel and voice channel and data channel are
           on different RATs.
+
     Args:
         log: log object.
         ads: list of android objects, this list should have two ad.
-        nw_gen: network generation.
+        rat: network rat.
+        is_airplane_mode: True to turn APM on during WFC, False otherwise.
+        wfc_mode: Calling preference of WFC, e.g., Wi-Fi/mobile network.
+        wifi_ssid: Wi-Fi ssid to connect with.
+        wifi_pwd: Password of target Wi-Fi AP.
+        nr_type: 'sa' for 5G standalone, 'nsa' for 5G non-standalone.
         call_direction: MO(DIRECTION_MOBILE_ORIGINATED) or MT(DIRECTION_MOBILE_TERMINATED) call.
         allow_data_transfer_interruption: if allow to interrupt data transfer.
 
@@ -1248,23 +1257,18 @@
                                    caller_verifier, callee_verifier,
                                    wait_time_in_call)
 
-    if nw_gen == GEN_5G:
-        if not provision_device_for_5g(log, ads[0], nr_type=nr_type):
-            return False
-    elif nw_gen:
-        if not ensure_network_generation(log, ads[0], nw_gen,
-                                         MAX_WAIT_TIME_NW_SELECTION,
-                                         NETWORK_SERVICE_DATA):
-            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")
+    if rat:
+        if not phone_setup_on_rat(log,
+                                  ads[0],
+                                  rat,
+                                  is_airplane_mode=is_airplane_mode,
+                                  wfc_mode=wfc_mode,
+                                  wifi_ssid=wifi_ssid,
+                                  wifi_pwd=wifi_pwd,
+                                  nr_type=nr_type):
             return False
     else:
-        ads[0].log.debug("Skipping network generation since it is None")
+        ads[0].log.debug("Skipping setup network rat since it is None")
 
     if not verify_internet_connection(log, ads[0]):
         ads[0].log.error("Internet connection is not available")
@@ -1304,8 +1308,8 @@
             return False
     # Disable airplane mode if test under apm on.
     toggle_airplane_mode(log, ads[0], False)
-    if nw_gen == GEN_5G and not check_current_network_5g(ads[0],
-                                                         nr_type=nr_type):
+    if rat and '5g' in rat and not check_current_network_5g(ads[0],
+                                                            nr_type=nr_type):
         ads[0].log.error("Phone not attached on 5G after call.")
         return False
     return True
@@ -1314,40 +1318,44 @@
 def test_call_setup_in_active_youtube_video(
         log,
         ads,
-        nw_gen=None,
-        call_direction=DIRECTION_MOBILE_ORIGINATED,
-        allow_data_transfer_interruption=False,
-        nr_type=None):
+        rat=None,
+        is_airplane_mode=False,
+        wfc_mode=None,
+        wifi_ssid=None,
+        wifi_pwd=None,
+        nr_type=None,
+        call_direction=DIRECTION_MOBILE_ORIGINATED):
     """Test call can be established during active data connection.
 
     Turn off airplane mode, disable WiFi, enable Cellular Data.
-    Make sure phone in <nw_gen>.
+    Make sure phone in <rat>.
     Starting playing youtube video.
     Initiate a voice call. Verify call can be established.
+
     Args:
         log: log object.
         ads: list of android objects, this list should have two ad.
-        nw_gen: network generation.
+        rat: network rat.
+        is_airplane_mode: True to turn APM on during WFC, False otherwise.
+        wfc_mode: Calling preference of WFC, e.g., Wi-Fi/mobile network.
+        wifi_ssid: Wi-Fi ssid to connect with.
+        wifi_pwd: Password of target Wi-Fi AP.
+        nr_type: 'sa' for 5G standalone, 'nsa' for 5G non-standalone.
         call_direction: MO(DIRECTION_MOBILE_ORIGINATED) or MT(DIRECTION_MOBILE_TERMINATED) call.
-        allow_data_transfer_interruption: if allow to interrupt data transfer.
 
     Returns:
         True if success.
         False if failed.
     """
-    if nw_gen == GEN_5G:
-        if not provision_device_for_5g(log, ads[0], nr_type=nr_type):
-            return False
-    elif nw_gen:
-        if not ensure_network_generation(log, ads[0], nw_gen,
-                                         MAX_WAIT_TIME_NW_SELECTION,
-                                         NETWORK_SERVICE_DATA):
-            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")
+    if rat:
+        if not phone_setup_on_rat(log,
+                                  ads[0],
+                                  rat,
+                                  is_airplane_mode=is_airplane_mode,
+                                  wfc_mode=wfc_mode,
+                                  wifi_ssid=wifi_ssid,
+                                  wifi_pwd=wifi_pwd,
+                                  nr_type=nr_type):
             return False
     else:
         ensure_phones_default_state(log, ads)
@@ -1383,8 +1391,8 @@
     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 check_current_network_5g(ads[0],
-                                                         nr_type=nr_type):
+    if rat and '5g' in rat and not check_current_network_5g(ads[0],
+                                                            nr_type=nr_type):
         ads[0].log.error("Phone not attached on 5G after call.")
         result = False
     return result
diff --git a/acts_tests/tests/google/nr/nsa5g/Nsa5gDataTest.py b/acts_tests/tests/google/nr/nsa5g/Nsa5gDataTest.py
index 8dfc5a6..3c8068a 100755
--- a/acts_tests/tests/google/nr/nsa5g/Nsa5gDataTest.py
+++ b/acts_tests/tests/google/nr/nsa5g/Nsa5gDataTest.py
@@ -369,11 +369,8 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
-        if not phone_setup_volte(ads[0].log, ads[0]):
-            ads[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_data_connectivity_multi_bearer(self.log, ads, GEN_5G, nr_type='nsa')
+        return test_data_connectivity_multi_bearer(
+            self.log, self.android_devices, '5g_volte', nr_type='nsa')
 
 
     @test_tracker_info(uuid="e88b226e-3842-4c45-a33e-d4fee7d8f6f0")
diff --git a/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py b/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py
index 38cbe45..230f4c5 100644
--- a/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py
+++ b/acts_tests/tests/google/nr/nsa5g/Nsa5gVoiceTest.py
@@ -119,10 +119,8 @@
             TestFailure if not success.
         """
         ads = self.android_devices
-        if not provision_both_devices_for_volte(self.log, ads):
-            return False
-
-        if not provision_device_for_5g(self.log, ads, nr_type='nsa'):
+        if not provision_both_devices_for_volte(self.log, ads, GEN_5G,
+                                                nr_type='nsa'):
             return False
 
         # VoLTE calls
@@ -157,15 +155,12 @@
         ads = self.android_devices
 
         # LTE attach
-        tasks = [(phone_setup_volte, (self.log, ads[0])),
+        tasks = [(phone_setup_volte, (self.log, ads[0], GEN_5G, 'nsa')),
                  (phone_setup_voice_3g, (self.log, ads[1]))]
         if not multithread_func(self.log, tasks):
             self.log.error("Phone failed to set up in volte/3g")
             return False
 
-        if not provision_device_for_5g(self.log, ads[0], nr_type='nsa'):
-            return False
-
         # VoLTE to 3G
         result = two_phone_call_short_seq(
             self.log, ads[0], None, is_phone_in_call_volte, ads[1],
@@ -200,10 +195,8 @@
             TestFailure if not success.
         """
         ads = self.android_devices
-        if not provision_both_devices_for_volte(self.log, ads):
-            return False
-
-        if not provision_device_for_5g(self.log, ads, nr_type='nsa'):
+        if not provision_both_devices_for_volte(self.log, ads, GEN_5G,
+                                                nr_type='nsa'):
             return False
 
         if not phone_setup_call_hold_unhold_test(self.log,
@@ -232,10 +225,8 @@
             TestFailure if not success.
         """
         ads = self.android_devices
-        if not provision_both_devices_for_volte(self.log, ads):
-            return False
-
-        if not provision_device_for_5g(self.log, ads, nr_type='nsa'):
+        if not provision_both_devices_for_volte(self.log, ads, GEN_5G,
+                                                nr_type='nsa'):
             return False
 
         if not phone_setup_call_hold_unhold_test(self.log,
@@ -267,14 +258,12 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
-        if not phone_setup_volte(self.log, ads[0]):
-            ads[0].log.error("failed to setup volte")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       ads,
-                                                       GEN_5G,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='5g_volte',
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
 
     @test_tracker_info(uuid="aaa98e51-0bde-472a-abc3-5dc180f56a08")
@@ -295,14 +284,12 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
-        if not phone_setup_volte(self.log, ads[0]):
-            ads[0].log.error("failed to setup volte")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       ads,
-                                                       GEN_5G,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='5g_volte',
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
 
     @test_tracker_info(uuid="96b7d8c9-d32a-4abf-8326-6b060d116ac2")
@@ -346,14 +333,12 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
-        if not phone_setup_volte(self.log, ads[0]):
-            ads[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       ads,
-                                                       GEN_5G,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='5g_volte',
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="4e138477-3536-48bd-ab8a-7fb7c228b3e6")
     @TelephonyBaseTest.tel_test_wrap
@@ -371,14 +356,12 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
-        if not phone_setup_volte(self.log, ads[0]):
-            ads[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       ads,
-                                                       GEN_5G,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='5g_volte',
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
 
     @test_tracker_info(uuid="0d477f6f-3464-4b32-a5e5-0fd134f2753d")
@@ -398,19 +381,16 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
-        if not phone_setup_iwlan(self.log, ads[0], False,
-                                 WFC_MODE_WIFI_PREFERRED,
-                                 self.wifi_network_ssid,
-                                 self.wifi_network_pass):
-            ads[0].log.error(
-                "Failed to setup iwlan with APM off and WIFI and WFC on")
-            return False
-
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       ads,
-                                                       GEN_5G,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=False,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
 
     @test_tracker_info(uuid="4d1d7dd9-b373-4361-8301-8517ef77b57b")
@@ -430,19 +410,16 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
-        if not phone_setup_iwlan(self.log, ads[0], False,
-                                 WFC_MODE_WIFI_PREFERRED,
-                                 self.wifi_network_ssid,
-                                 self.wifi_network_pass):
-            ads[0].log.error(
-                "Failed to setup iwlan with APM off and WIFI and WFC on")
-            return False
-
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       ads,
-                                                       GEN_5G,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=False,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
 
     @test_tracker_info(uuid="e360bc3a-96b3-4fdf-9bf3-fe3aa08b1af5")
@@ -713,10 +690,11 @@
             TestFailure if not success.
         """
         ads = self.android_devices
-        if not provision_both_devices_for_volte(self.log, ads):
-            return False
 
-        if not provision_device_for_5g(self.log, ads[1], nr_type='nsa'):
+        tasks = [(phone_setup_volte, (self.log, ads[0])),
+                (phone_setup_volte, (self.log, ads[1], GEN_5G, 'nsa'))]
+        if not multithread_func(self.log, tasks):
+            self.log.error("phone failed to set up in volte")
             return False
 
         result = two_phone_call_long_seq(
@@ -749,10 +727,10 @@
         MINIMUM_SUCCESS_RATE = .95
         ads = self.android_devices
 
-        if not provision_both_devices_for_volte(self.log, ads):
-            return False
-
-        if not provision_device_for_5g(self.log, ads[1], nr_type='nsa'):
+        tasks = [(phone_setup_volte, (self.log, ads[0])),
+                (phone_setup_volte, (self.log, ads[1], GEN_5G, 'nsa'))]
+        if not multithread_func(self.log, tasks):
+            self.log.error("phone failed to set up in volte")
             return False
 
         success_count = 0
@@ -948,17 +926,16 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=False,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="f827a8b5-039c-4cc1-b030-78a09119acfc")
     @TelephonyBaseTest.tel_test_wrap
@@ -973,17 +950,16 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=False,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="af3254d0-a84a-47c8-8ebc-11517b7b4944")
     @TelephonyBaseTest.tel_test_wrap
@@ -999,21 +975,16 @@
             True if success.
             False if failed.
         """
-        if not provision_device_for_5g(self.log, self.android_devices[0], nr_type='nsa'):
-            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)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=True,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="5c58af94-8c24-481b-a555-bdbf36db5f6e")
     @TelephonyBaseTest.tel_test_wrap
@@ -1029,21 +1000,16 @@
             True if success.
             False if failed.
         """
-        if not provision_device_for_5g(self.log, self.android_devices[0], nr_type='nsa'):
-            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)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=True,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="bcd874ae-58e1-4954-88af-bb3dd54d4abf")
     @TelephonyBaseTest.tel_test_wrap
@@ -1058,21 +1024,16 @@
             True if success.
             False if failed.
         """
-        if not provision_device_for_5g(self.log, self.android_devices[0], nr_type='nsa'):
-            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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=True,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="ad96f1cf-0d17-4a39-86cf-cacb5f4cc81c")
     @TelephonyBaseTest.tel_test_wrap
@@ -1087,21 +1048,16 @@
             True if success.
             False if failed.
         """
-        if not provision_device_for_5g(self.log, self.android_devices[0], nr_type='nsa'):
-            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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='5g_wfc',
+            is_airplane_mode=True,
+            wfc_mode=WFC_MODE_WIFI_PREFERRED,
+            wifi_ssid=self.wifi_network_ssid,
+            wifi_pwd=self.wifi_network_pass,
+            nr_type='nsa',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="9d1121c1-aae4-428b-9167-09d4efdb7e37")
     @TelephonyBaseTest.tel_test_wrap
diff --git a/acts_tests/tests/google/tel/live/TelLiveDataTest.py b/acts_tests/tests/google/tel/live/TelLiveDataTest.py
index cd297ba..b5c8d69 100755
--- a/acts_tests/tests/google/tel/live/TelLiveDataTest.py
+++ b/acts_tests/tests/google/tel/live/TelLiveDataTest.py
@@ -329,13 +329,10 @@
             True if success.
             False if failed.
         """
-        ads = self.android_devices
         self.number_of_devices = 1
 
-        if not phone_setup_volte(self.log, self.android_devices[0]):
-            self.log.error("Failed to setup VoLTE")
-            return False
-        return test_data_connectivity_multi_bearer(self.log, ads, GEN_4G)
+        return test_data_connectivity_multi_bearer(
+            self.log, self.android_devices, 'volte')
 
     @test_tracker_info(uuid="5c9cb076-0c26-4517-95dc-2ec4974e8ce3")
     @TelephonyBaseTest.tel_test_wrap
@@ -354,7 +351,8 @@
             False if failed.
         """
 
-        return test_data_connectivity_multi_bearer(self.log, self.android_devices, GEN_3G)
+        return test_data_connectivity_multi_bearer(
+            self.log, self.android_devices, '3g')
 
     @test_tracker_info(uuid="314bbf1c-073f-4d48-9817-a6e14f96f3c0")
     @TelephonyBaseTest.tel_test_wrap
@@ -371,8 +369,8 @@
             False if failed.
         """
 
-        return test_data_connectivity_multi_bearer(self.log, self.android_devices,
-            GEN_2G, False, DIRECTION_MOBILE_ORIGINATED)
+        return test_data_connectivity_multi_bearer(self.log,
+            self.android_devices, '2g', False, DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="549271ff-1034-4d02-8d92-b9d1b2bb912e")
     @TelephonyBaseTest.tel_test_wrap
@@ -389,8 +387,8 @@
             False if failed.
         """
 
-        return test_data_connectivity_multi_bearer(self.log, self.android_devices,
-            GEN_2G, False, DIRECTION_MOBILE_TERMINATED)
+        return test_data_connectivity_multi_bearer(self.log,
+            self.android_devices, '2g', False, DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="111de471-559a-4bc3-9d3e-de18f098c162")
     @TelephonyBaseTest.tel_test_wrap
diff --git a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py
index 2d055ea..0a1948f 100644
--- a/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py
+++ b/acts_tests/tests/google/tel/live/TelLiveVoiceTest.py
@@ -3164,10 +3164,11 @@
             True if success.
             False if failed.
         """
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       None,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="d750d66b-2091-4e8d-baa2-084b9d2bbff5")
     @TelephonyBaseTest.tel_test_wrap
@@ -3187,10 +3188,11 @@
             True if success.
             False if failed.
         """
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       None,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="35703e83-b3e6-40af-aeaf-6b983d6205f4")
     @TelephonyBaseTest.tel_test_wrap
@@ -3210,13 +3212,11 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_volte(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='volte',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="a0f658d9-4212-44db-b3e8-7202f1eec04d")
     @TelephonyBaseTest.tel_test_wrap
@@ -3236,13 +3236,11 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_volte(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='volte',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="e0b264ec-fc29-411e-b018-684b7ff5a37e")
     @TelephonyBaseTest.tel_test_wrap
@@ -3262,14 +3260,12 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_csfb(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_ORIGINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='csfb',
+            call_direction=DIRECTION_MOBILE_ORIGINATED,
+            allow_data_transfer_interruption=True)
 
     @test_tracker_info(uuid="98f04a27-74e1-474d-90d1-a4a45cdb6f5b")
     @TelephonyBaseTest.tel_test_wrap
@@ -3289,14 +3285,12 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_csfb(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_TERMINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='csfb',
+            call_direction=DIRECTION_MOBILE_TERMINATED,
+            allow_data_transfer_interruption=True)
 
     @test_tracker_info(uuid="359b1ee1-36a6-427b-9d9e-4d77231fcb09")
     @TelephonyBaseTest.tel_test_wrap
@@ -3317,14 +3311,12 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_3g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup 3G")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_3G,
-                                                       DIRECTION_MOBILE_ORIGINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='3g',
+            call_direction=DIRECTION_MOBILE_ORIGINATED,
+            allow_data_transfer_interruption=True)
 
     @test_tracker_info(uuid="b172bbb4-2d6e-4d83-a381-ebfdf23bc30e")
     @TelephonyBaseTest.tel_test_wrap
@@ -3345,14 +3337,12 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_3g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup 3G")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_3G,
-                                                       DIRECTION_MOBILE_TERMINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='3g',
+            call_direction=DIRECTION_MOBILE_TERMINATED,
+            allow_data_transfer_interruption=True)
 
     @test_tracker_info(uuid="f5d9bfd0-0996-4c18-b11e-c6113dc201e2")
     @TelephonyBaseTest.tel_test_wrap
@@ -3373,14 +3363,12 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_2g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup voice in 2G")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_2G,
-                                                       DIRECTION_MOBILE_ORIGINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='2g',
+            call_direction=DIRECTION_MOBILE_ORIGINATED,
+            allow_data_transfer_interruption=True)
 
     @test_tracker_info(uuid="99cfd1be-b992-48bf-a50e-fc3eec8e5a67")
     @TelephonyBaseTest.tel_test_wrap
@@ -3401,14 +3389,12 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_2g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup voice in 2G")
-            return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       GEN_2G,
-                                                       DIRECTION_MOBILE_TERMINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat='2g',
+            call_direction=DIRECTION_MOBILE_TERMINATED,
+            allow_data_transfer_interruption=True)
 
     @test_tracker_info(uuid="12677cf2-40d3-4bb1-8afa-91ebcbd0f862")
     @TelephonyBaseTest.tel_test_wrap
@@ -3431,10 +3417,11 @@
             self.android_devices[0].log.error(
                 "Failed to setup IWLAN with NON-APM WIFI WFC on")
             return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       None,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="84adcc19-43bb-4ea3-9284-7322ab139aac")
     @TelephonyBaseTest.tel_test_wrap
@@ -3457,10 +3444,11 @@
             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_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       None,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="42566255-c33f-406c-abab-932a0aaa01a8")
     @TelephonyBaseTest.tel_test_wrap
@@ -3488,10 +3476,11 @@
             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)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="fbf52f60-449b-46f2-9486-36d338a1b070")
     @TelephonyBaseTest.tel_test_wrap
@@ -3519,10 +3508,11 @@
             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)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="d1bf0739-ffb7-4bf8-ab94-570619f812a8")
     @TelephonyBaseTest.tel_test_wrap
@@ -3547,10 +3537,11 @@
             self.android_devices[0].log.error(
                 "Failed to setup iwlan with APM, WIFI")
             return False
-        return test_call_setup_in_active_data_transfer(self.log,
-                                                       self.android_devices,
-                                                       None,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="76b2cdaf-b783-4c1a-b91b-207f82ffa816")
     @TelephonyBaseTest.tel_test_wrap
@@ -3575,10 +3566,11 @@
             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)
+        return test_call_setup_in_active_data_transfer(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="1dc9f03f-1b6c-4c17-993b-3acafdc26ea3")
     @TelephonyBaseTest.tel_test_wrap
@@ -3594,10 +3586,11 @@
             True if success.
             False if failed.
         """
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       None,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="32bc8fab-a0b9-4d47-8afb-940d1fdcde02")
     @TelephonyBaseTest.tel_test_wrap
@@ -3613,10 +3606,11 @@
             True if success.
             False if failed.
         """
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       None,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="72204212-e0c8-4447-be3f-ae23b2a63a1c")
     @TelephonyBaseTest.tel_test_wrap
@@ -3632,13 +3626,11 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_volte(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='volte',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="84cd3ab9-a2b2-4ef9-b531-ee6201bec128")
     @TelephonyBaseTest.tel_test_wrap
@@ -3654,13 +3646,11 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_volte(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='volte',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="a8dca8d3-c44c-40a6-be56-931b4be5499b")
     @TelephonyBaseTest.tel_test_wrap
@@ -3676,14 +3666,11 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_csfb(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_ORIGINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='csfb',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="d11f7263-f51d-4ea3-916a-0df4f52023ce")
     @TelephonyBaseTest.tel_test_wrap
@@ -3699,14 +3686,11 @@
             True if success.
             False if failed.
         """
-        if not phone_setup_csfb(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup VoLTE")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_4G,
-                                                       DIRECTION_MOBILE_TERMINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='csfb',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="676378b4-94b7-4ad7-8242-7ccd2bf1efba")
     @TelephonyBaseTest.tel_test_wrap
@@ -3723,14 +3707,11 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_3g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup 3G")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_3G,
-                                                       DIRECTION_MOBILE_ORIGINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='3g',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="6216fc6d-2aa2-4eb9-90e2-5791cb31c12e")
     @TelephonyBaseTest.tel_test_wrap
@@ -3747,14 +3728,11 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_3g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup 3G")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_3G,
-                                                       DIRECTION_MOBILE_TERMINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='3g',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="58ec9783-6f8e-49f6-8dae-9dd33108b6f9")
     @TelephonyBaseTest.tel_test_wrap
@@ -3771,14 +3749,11 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_2g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup voice in 2G")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_2G,
-                                                       DIRECTION_MOBILE_ORIGINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='2g',
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="e8ba7c0c-48a3-4fc6-aa34-a2e1c570521a")
     @TelephonyBaseTest.tel_test_wrap
@@ -3795,14 +3770,11 @@
             False if failed.
         """
         self.check_band_support(self.android_devices[0])
-        if not phone_setup_voice_2g(self.log, self.android_devices[0]):
-            self.android_devices[0].log.error("Failed to setup voice in 2G")
-            return False
-        return test_call_setup_in_active_youtube_video(self.log,
-                                                       self.android_devices,
-                                                       GEN_2G,
-                                                       DIRECTION_MOBILE_TERMINATED,
-                                                       allow_data_transfer_interruption=True)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat='2g',
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="eb8971c1-b34a-430f-98df-0d4554c7ab12")
     @TelephonyBaseTest.tel_test_wrap
@@ -3824,10 +3796,11 @@
             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,
-                                                       None,
-                                                       DIRECTION_MOBILE_ORIGINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="275a93d6-1f39-40c8-893f-ff77afd09e54")
     @TelephonyBaseTest.tel_test_wrap
@@ -3849,10 +3822,11 @@
             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,
-                                                       None,
-                                                       DIRECTION_MOBILE_TERMINATED)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="ea087709-d4df-4223-b80c-1b33bacbd5a2")
     @TelephonyBaseTest.tel_test_wrap
@@ -3879,10 +3853,11 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="44cc14e0-60c7-4fdb-ad26-31fdc4e52aaf")
     @TelephonyBaseTest.tel_test_wrap
@@ -3909,10 +3884,11 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="e115e8a6-25bf-41fc-aeb8-8f4c922c50e4")
     @TelephonyBaseTest.tel_test_wrap
@@ -3934,10 +3910,11 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="d754d3dd-0b02-4f13-bc65-fdafa254196b")
     @TelephonyBaseTest.tel_test_wrap
@@ -3959,10 +3936,11 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="88822edf-4c4a-4bc4-9280-2f27ee9e28d5")
     @TelephonyBaseTest.tel_test_wrap
@@ -3986,10 +3964,11 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_ORIGINATED)
 
     @test_tracker_info(uuid="c4b066b0-3cfd-4831-9c61-5d6b132648c4")
     @TelephonyBaseTest.tel_test_wrap
@@ -4013,10 +3992,11 @@
             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)
+        return test_call_setup_in_active_youtube_video(
+            self.log,
+            self.android_devices,
+            rat=None,
+            call_direction=DIRECTION_MOBILE_TERMINATED)
 
     @test_tracker_info(uuid="f367de12-1fd8-488d-816f-091deaacb791")
     @TelephonyBaseTest.tel_test_wrap