Added 5G NSA checking to parallel Stress Test

Bug: 175345900
Test: automation
Change-Id: I14d9c2244e69bec7b5018230cb862ad18f764b33
diff --git a/acts_tests/acts_contrib/test_utils/tel/tel_test_utils.py b/acts_tests/acts_contrib/test_utils/tel/tel_test_utils.py
index 46cdf9d..32ab37c 100644
--- a/acts_tests/acts_contrib/test_utils/tel/tel_test_utils.py
+++ b/acts_tests/acts_contrib/test_utils/tel/tel_test_utils.py
@@ -1645,7 +1645,8 @@
                   video=False,
                   voice_type_init=None,
                   call_stats_check=False,
-                  result_info=result_dict):
+                  result_info=result_dict,
+                  nsa_5g_for_stress=False):
     """Make phone call from caller to callee.
 
     Args:
@@ -1693,6 +1694,11 @@
             ad.adb.shell("i2cset -fy 3 64 6 1 b", ignore_status=True)
             ad.adb.shell("i2cset -fy 3 65 6 1 b", ignore_status=True)
         ad.droid.telephonyStopTrackingCallStateChangeForSubscription(sub_id)
+
+        if nsa_5g_for_stress:
+            if not is_current_network_5g_nsa(ad):
+                ad.log.error("Phone is not attached on 5G NSA")
+
         if incall_ui_display == INCALL_UI_DISPLAY_FOREGROUND:
             ad.droid.telecomShowInCallScreen()
         elif incall_ui_display == INCALL_UI_DISPLAY_BACKGROUND:
@@ -2339,7 +2345,8 @@
                         slot_id_callee=None,
                         voice_type_init=None,
                         call_stats_check=False,
-                        result_info=result_dict):
+                        result_info=result_dict,
+                        nsa_5g_for_stress=False):
     """ Call process, including make a phone call from caller,
     accept from callee, and hang up. The call is on default voice subscription
 
@@ -2378,7 +2385,8 @@
         log, ad_caller, ad_callee, subid_caller, subid_callee, ad_hangup,
         verify_caller_func, verify_callee_func, wait_time_in_call,
         incall_ui_display, dialing_number_length, video_state,
-        voice_type_init, call_stats_check, result_info)
+        voice_type_init, call_stats_check, result_info, nsa_5g_for_stress)
+
 
 
 def call_setup_teardown_for_subscription(
@@ -2396,7 +2404,8 @@
         video_state=None,
         voice_type_init=None,
         call_stats_check=False,
-        result_info=result_dict):
+        result_info=result_dict,
+        nsa_5g_for_stress=False):
     """ Call process, including make a phone call from caller,
     accept from callee, and hang up. The call is on specified subscription
 
@@ -2587,6 +2596,12 @@
                         ad.droid.telecomEndCall()
                 except Exception as e:
                     log.error(str(e))
+
+        if nsa_5g_for_stress:
+            for ad in (ad_caller, ad_callee):
+                if not is_current_network_5g_nsa(ad):
+                    ad.log.error("Phone not attached on 5G NSA")
+
         if ad_hangup or not tel_result_wrapper:
             for ad in (ad_caller, ad_callee):
                 if not wait_for_call_id_clearing(
diff --git a/acts_tests/tests/google/tel/live/TelLiveStressTest.py b/acts_tests/tests/google/tel/live/TelLiveStressTest.py
index f9df1bf..99478ff 100644
--- a/acts_tests/tests/google/tel/live/TelLiveStressTest.py
+++ b/acts_tests/tests/google/tel/live/TelLiveStressTest.py
@@ -104,6 +104,7 @@
 from acts_contrib.test_utils.tel.tel_subscription_utils import set_subid_for_message
 from acts_contrib.test_utils.tel.tel_subscription_utils import set_subid_for_outgoing_call
 from acts_contrib.test_utils.tel.tel_subscription_utils import set_always_allow_mms_data
+from acts_contrib.test_utils.tel.tel_5g_utils import provision_device_for_5g
 from acts.utils import get_current_epoch_time
 from acts.utils import rand_ascii_str
 
@@ -196,6 +197,7 @@
                                   "CALL_HANGUP_FAIL": 0,
                                   "CALL_ID_CLEANUP_FAIL": 0 }
         self.call_stats_check = self.user_params.get("call_stats_check", False)
+        self.nsa_5g_for_stress = self.user_params.get("nsa_5g_for_stress", False)
         return True
 
     def setup_test(self):
@@ -265,6 +267,12 @@
                 ad.log.error("Phone failed to enable VoLTE.")
                 return False
             ad.log.info("Phone VOLTE is enabled successfully.")
+            # TODO: b/186865335 Move 5G methods to NR directory
+            if self.nsa_5g_for_stress:
+                if not provision_device_for_5g(self.log, ad):
+                    ad.log.error("Phone failed to attach 5G NSA.")
+                    return False
+                ad.log.info("Phone 5G NSA VOLTE is enabled successfully.")
         return True
 
     def _setup_lte_volte_disabled(self):
@@ -474,7 +482,8 @@
                 incall_ui_display=INCALL_UI_DISPLAY_BACKGROUND,
                 call_stats_check=self.call_stats_check,
                 voice_type_init=voice_type_init,
-                result_info = self.result_info
+                result_info = self.result_info,
+                nsa_5g_for_stress=self.nsa_5g_for_stress
             ) and wait_for_in_call_active(self.dut, 60, 3)
         else:
             call_setup_result = call_setup_teardown(
@@ -489,7 +498,8 @@
                 slot_id_callee=slot_id_callee,
                 call_stats_check=self.call_stats_check,
                 voice_type_init=voice_type_init,
-                result_info = self.result_info)
+                result_info = self.result_info,
+                nsa_5g_for_stress=self.nsa_5g_for_stress)
             self.result_collection[RESULTS_LIST[call_setup_result.result_value]] += 1
 
         if not call_setup_result: