1#!/usr/bin/env python3
2#
3#   Copyright 2016 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16"""
17Sanity tests for voice tests in telephony
18"""
19import time
20
21from acts.test_decorators import test_tracker_info
22from acts.controllers.anritsu_lib._anritsu_utils import AnritsuError
23from acts.controllers.anritsu_lib.md8475a import CsfbType
24from acts.controllers.anritsu_lib.md8475a import MD8475A
25from acts.controllers.anritsu_lib.md8475a import VirtualPhoneAutoAnswer
26from acts_contrib.test_utils.tel.anritsu_utils import WAIT_TIME_ANRITSU_REG_AND_CALL
27from acts_contrib.test_utils.tel.anritsu_utils import call_mo_setup_teardown
28from acts_contrib.test_utils.tel.anritsu_utils import ims_call_cs_teardown
29from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_1x
30from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_1x_evdo
31from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_gsm
32from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_lte
33from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_lte_1x
34from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_lte_wcdma
35from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_lte_gsm
36from acts_contrib.test_utils.tel.anritsu_utils import set_system_model_wcdma
37from acts_contrib.test_utils.tel.anritsu_utils import set_usim_parameters
38from acts_contrib.test_utils.tel.anritsu_utils import set_post_sim_params
39from acts_contrib.test_utils.tel.tel_defines import CALL_TEARDOWN_PHONE
40from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_CDMA2000
41from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_GSM
42from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_LTE
43from acts_contrib.test_utils.tel.tel_defines import RAT_FAMILY_UMTS
44from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_CDMA
45from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_GSM_ONLY
46from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_GSM_UMTS
47from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_LTE_CDMA_EVDO
48from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
49from acts_contrib.test_utils.tel.tel_defines import NETWORK_MODE_LTE_GSM_WCDMA
50from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL
51from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL_FOR_IMS
52from acts_contrib.test_utils.tel.tel_ims_utils import toggle_volte
53from acts_contrib.test_utils.tel.tel_logging_utils import start_qxdm_loggers
54from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_network_rat
55from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode_by_adb
56from acts_contrib.test_utils.tel.tel_test_utils import set_preferred_apn_by_adb
57from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_idle_volte
58from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
59
60DEFAULT_CALL_NUMBER = "0123456789"
61
62
63class TelLabVoiceTest(TelephonyBaseTest):
64    def setup_class(self):
65        super().setup_class()
66        try:
67            self.stress_test_number = int(
68                self.user_params["stress_test_number"])
69            self.log.info("Executing {} calls per test in stress test mode".
70                          format(self.stress_test_number))
71        except KeyError:
72            self.stress_test_number = 0
73            self.log.info(
74                "No 'stress_test_number' defined: running single iteration tests"
75            )
76
77        self.ad = self.android_devices[0]
78        self.ad.sim_card = getattr(self.ad, "sim_card", None)
79        self.md8475a_ip_address = self.user_params[
80            "anritsu_md8475a_ip_address"]
81        self.wlan_option = self.user_params.get("anritsu_wlan_option", False)
82        self.md8475_version = self.user_params.get("md8475", "A")
83
84        setattr(self, 'voice_call_number', DEFAULT_CALL_NUMBER)
85        if 'voice_call_number' in self.user_params:
86            self.voice_call_number = self.user_params['voice_call_number']
87            self.log.info("Using provided voice call number: {}".format(
88                self.voice_call_number))
89
90        if self.ad.sim_card == "VzW12349":
91            set_preferred_apn_by_adb(self.ad, "VZWINTERNET")
92
93        try:
94            self.anritsu = MD8475A(self.md8475a_ip_address, self.wlan_option,
95                                   self.md8475_version)
96        except AnritsuError:
97            self.log.error("Error in connecting to Anritsu Simulator")
98            return False
99        return True
100
101    def setup_test(self):
102        try:
103            if getattr(self, "qxdm_log", True):
104                start_qxdm_loggers(self.log, self.android_devices)
105            self.ad.droid.telephonyFactoryReset()
106            if self.ad.sim_card == "VzW12349":
107                self.ad.droid.imsSetVolteProvisioning(True)
108        except Exception as e:
109            self.ad.log.error(e)
110        toggle_airplane_mode_by_adb(self.log, self.ad, True)
111        # get a handle to virtual phone
112        self.virtualPhoneHandle = self.anritsu.get_VirtualPhone()
113        return True
114
115    def teardown_test(self):
116        self.log.info("Stopping Simulation")
117        self.anritsu.stop_simulation()
118        toggle_airplane_mode_by_adb(self.log, self.ad, True)
119        return True
120
121    def teardown_class(self):
122        self.anritsu.disconnect()
123        return True
124
125    def _setup_voice_call(self,
126                          set_simulation_func,
127                          phone_setup_func,
128                          phone_idle_func_after_registration=None,
129                          is_ims_call=False,
130                          is_wait_for_registration=True,
131                          csfb_type=None,
132                          srvcc=None,
133                          mo=True,
134                          voice_number=DEFAULT_CALL_NUMBER,
135                          teardown_side=CALL_TEARDOWN_PHONE,
136                          wait_time_in_call=WAIT_TIME_IN_CALL):
137        try:
138            set_simulation_func(self.anritsu, self.user_params,
139                                self.ad.sim_card)
140            set_usim_parameters(self.anritsu, self.ad.sim_card)
141            if is_ims_call or srvcc or csfb_type:
142                set_post_sim_params(self.anritsu, self.user_params,
143                                    self.ad.sim_card)
144            self.virtualPhoneHandle.auto_answer = (VirtualPhoneAutoAnswer.ON,
145                                                   2)
146            if srvcc != None:
147                if srvcc == "Alert":
148                    self.anritsu.send_command("IMSCSCFAUTOANSWER 1,DISABLE")
149                self.anritsu.start_simulation()
150                self.anritsu.send_command("IMSSTARTVN 1")
151                self.anritsu.send_command("IMSSTARTVN 2")
152                self.anritsu.send_command("IMSSTARTVN 3")
153                check_ims_reg = True
154                check_ims_calling = True
155            else:
156                self.anritsu.start_simulation()
157            if is_ims_call or csfb_type:
158                self.anritsu.send_command("IMSSTARTVN 1")
159                self.anritsu.send_command("IMSSTARTVN 2")
160                self.anritsu.send_command("IMSSTARTVN 3")
161
162            iterations = 1
163            if self.stress_test_number > 0:
164                iterations = self.stress_test_number
165            successes = 0
166            for i in range(1, iterations + 1):
167                if self.stress_test_number:
168                    self.log.info(
169                        "Running iteration {} of {}".format(i, iterations))
170                # FIXME: There's no good reason why this must be true;
171                # I can only assume this was done to work around a problem
172                self.ad.droid.telephonyToggleDataConnection(False)
173
174                # turn off all other BTS to ensure UE registers on BTS1
175                sim_model = (self.anritsu.get_simulation_model()).split(",")
176                no_of_bts = len(sim_model)
177                for i in range(2, no_of_bts + 1):
178                    self.anritsu.send_command(
179                        "OUTOFSERVICE OUT,BTS{}".format(i))
180
181                if phone_setup_func is not None:
182                    if not phone_setup_func(self.ad):
183                        self.log.warning(
184                            "phone_setup_func failed. Rebooting UE")
185                        self.ad.reboot()
186                        time.sleep(30)
187                        if self.ad.sim_card == "VzW12349":
188                            set_preferred_apn_by_adb(self.ad, "VZWINTERNET")
189                        if not phone_setup_func(self.ad):
190                            self.log.error("phone_setup_func failed.")
191                            continue
192
193                if is_wait_for_registration:
194                    self.anritsu.wait_for_registration_state()
195
196                if phone_idle_func_after_registration:
197                    if not phone_idle_func_after_registration(self.log,
198                                                              self.ad):
199                        continue
200
201                for i in range(2, no_of_bts + 1):
202                    self.anritsu.send_command(
203                        "OUTOFSERVICE IN,BTS{}".format(i))
204
205                time.sleep(WAIT_TIME_ANRITSU_REG_AND_CALL)
206                if srvcc:
207                    if not ims_call_cs_teardown(
208                            self.log, self.ad, self.anritsu, voice_number,
209                            CALL_TEARDOWN_PHONE, False, check_ims_reg,
210                            check_ims_calling, srvcc, mo,
211                            WAIT_TIME_IN_CALL_FOR_IMS, WAIT_TIME_IN_CALL):
212                        if mo:
213                            self.log.error(
214                                "Phone {} Failed to make voice call to {}"
215                                .format(self.ad.serial, voice_number))
216                        else:
217                            self.log.error(
218                                "Phone {} failed to answer voice call."
219                                .format(self.ad.serial))
220                        continue
221                else:
222                    if not call_mo_setup_teardown(
223                            self.log, self.ad, self.anritsu, voice_number,
224                            CALL_TEARDOWN_PHONE, False, WAIT_TIME_IN_CALL,
225                            is_ims_call):
226                        self.log.error(
227                            "Phone {} Failed to make voice call to {}"
228                            .format(self.ad.serial, voice_number))
229                        continue
230                successes += 1
231                if self.stress_test_number:
232                    self.log.info("Passed iteration {}".format(i))
233            if self.stress_test_number:
234                self.log.info("Total of {} successes out of {} attempts".
235                              format(successes, iterations))
236            return True if successes == iterations else False
237
238        except AnritsuError as e:
239            self.log.error("Error in connection with Anritsu Simulator: " +
240                           str(e))
241            return False
242        except Exception as e:
243            self.log.error("Exception during voice call procedure: " + str(e))
244            return False
245        return True
246
247    def _phone_setup_lte_wcdma(self, ad):
248        toggle_volte(self.log, ad, False)
249        return ensure_network_rat(
250            self.log,
251            ad,
252            NETWORK_MODE_LTE_GSM_WCDMA,
253            RAT_FAMILY_LTE,
254            toggle_apm_after_setting=True)
255
256    def _phone_setup_lte_1x(self, ad):
257        return ensure_network_rat(
258            self.log,
259            ad,
260            NETWORK_MODE_LTE_CDMA_EVDO,
261            RAT_FAMILY_LTE,
262            toggle_apm_after_setting=True)
263
264    def _phone_setup_wcdma(self, ad):
265        return ensure_network_rat(
266            self.log,
267            ad,
268            NETWORK_MODE_GSM_UMTS,
269            RAT_FAMILY_UMTS,
270            toggle_apm_after_setting=True)
271
272    def _phone_setup_gsm(self, ad):
273        return ensure_network_rat(
274            self.log,
275            ad,
276            NETWORK_MODE_GSM_ONLY,
277            RAT_FAMILY_GSM,
278            toggle_apm_after_setting=True)
279
280    def _phone_setup_1x(self, ad):
281        return ensure_network_rat(
282            self.log,
283            ad,
284            NETWORK_MODE_CDMA,
285            RAT_FAMILY_CDMA2000,
286            toggle_apm_after_setting=True)
287
288    def _phone_setup_airplane_mode(self, ad):
289        return toggle_airplane_mode_by_adb(self.log, ad, True)
290
291    def _phone_setup_volte_airplane_mode(self, ad):
292        toggle_volte(self.log, ad, True)
293        return toggle_airplane_mode_by_adb(self.log, ad, True)
294
295    def _phone_setup_volte(self, ad):
296        ad.droid.telephonyToggleDataConnection(True)
297        toggle_volte(self.log, ad, True)
298        return ensure_network_rat(
299            self.log,
300            ad,
301            NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
302            RAT_FAMILY_LTE,
303            toggle_apm_after_setting=True)
304
305    """ Tests Begin """
306
307    @test_tracker_info(uuid="56c42e16-3936-4c51-8b8b-4866f54cc0bc")
308    @TelephonyBaseTest.tel_test_wrap
309    def test_voice_call_lte_wcdma_csfb_redirection(self):
310        """ Test Voice call functionality on LTE (CSFB to WCDMA).
311            CSFB type is REDIRECTION
312
313        Steps:
314        1. Setup CallBox on LTE and WCDMA network, make sure DUT register on LTE network.
315        2. Make an voice call to DEFAULT_CALL_NUMBER. Make sure DUT CSFB to WCDMA.
316        3. Make sure Anritsu receives the call and accept.
317        4. Tear down the call.
318
319        Expected Results:
320        2. Voice call succeed. DUT CSFB to WCDMA.
321        3. Anritsu can accept the call.
322        4. Tear down call succeed.
323
324        Returns:
325            True if pass; False if fail
326        """
327        return self._setup_voice_call(
328            set_system_model_lte_wcdma,
329            self._phone_setup_lte_wcdma,
330            voice_number=self.voice_call_number,
331            csfb_type=CsfbType.CSFB_TYPE_REDIRECTION)
332
333    @test_tracker_info(uuid="dcc1428f-9b7d-4064-8313-f1f5e428e0c7")
334    @TelephonyBaseTest.tel_test_wrap
335    def test_voice_call_lte_wcdma_csfb_handover(self):
336        """ Test Voice call functionality on LTE (CSFB to WCDMA).
337            CSFB type is HANDOVER
338
339        Steps:
340        1. Setup CallBox on LTE and WCDMA network, make sure DUT register on LTE network.
341        2. Make an voice call to DEFAULT_CALL_NUMBER. Make sure DUT CSFB to WCDMA.
342        3. Make sure Anritsu receives the call and accept.
343        4. Tear down the call.
344
345        Expected Results:
346        2. Voice call succeed. DUT CSFB to WCDMA.
347        3. Anritsu can accept the call.
348        4. Tear down call succeed.
349
350        Returns:
351            True if pass; False if fail
352        """
353        return self._setup_voice_call(
354            set_system_model_lte_wcdma,
355            self._phone_setup_lte_wcdma,
356            voice_number=self.voice_call_number,
357            csfb_type=CsfbType.CSFB_TYPE_HANDOVER)
358
359    @test_tracker_info(uuid="e250b134-d5e9-48ca-b224-eb0e07648275")
360    @TelephonyBaseTest.tel_test_wrap
361    def test_voice_call_lte_1x_csfb(self):
362        """ Test Voice call functionality on LTE (CSFB to 1x).
363
364        Steps:
365        1. Setup CallBox on LTE and CDMA 1X network, make sure DUT register on LTE network.
366        2. Make an voice call to DEFAULT_CALL_NUMBER. Make sure DUT CSFB to 1x.
367        3. Make sure Anritsu receives the call and accept.
368        4. Tear down the call.
369
370        Expected Results:
371        2. Voice call succeed. DUT CSFB to 1x.
372        3. Anritsu can accept the call.
373        4. Tear down call succeed.
374
375        Returns:
376            True if pass; False if fail
377        """
378        return self._setup_voice_call(
379            set_system_model_lte_1x,
380            self._phone_setup_lte_1x,
381            voice_number=self.voice_call_number)
382
383    @test_tracker_info(uuid="fcbe0f5d-51c2-46c8-8ff3-2daa1d91b936")
384    @TelephonyBaseTest.tel_test_wrap
385    def test_voice_call_wcdma(self):
386        """ Test Voice call functionality on WCDMA
387
388        Steps:
389        1. Setup CallBox on WCDMA network, make sure DUT register on WCDMA network.
390        2. Make an voice call to DEFAULT_CALL_NUMBER.
391        3. Make sure Anritsu receives the call and accept.
392        4. Tear down the call.
393
394        Expected Results:
395        2. Voice call succeed.
396        3. Anritsu can accept the call.
397        4. Tear down call succeed.
398
399        Returns:
400            True if pass; False if fail
401        """
402        return self._setup_voice_call(
403            set_system_model_wcdma,
404            self._phone_setup_wcdma,
405            voice_number=self.voice_call_number)
406
407    @test_tracker_info(uuid="077f851b-2c8e-4b1d-adc2-0326d3346157")
408    @TelephonyBaseTest.tel_test_wrap
409    def test_voice_call_gsm(self):
410        """ Test Voice call functionality on GSM
411
412        Steps:
413        1. Setup CallBox on GSM network, make sure DUT register on GSM network.
414        2. Make an voice call to DEFAULT_CALL_NUMBER.
415        3. Make sure Anritsu receives the call and accept.
416        4. Tear down the call.
417
418        Expected Results:
419        2. Voice call succeed.
420        3. Anritsu can accept the call.
421        4. Tear down call succeed.
422
423        Returns:
424            True if pass; False if fail
425        """
426        return self._setup_voice_call(
427            set_system_model_gsm,
428            self._phone_setup_gsm,
429            voice_number=self.voice_call_number)
430
431    @test_tracker_info(uuid="80376fb3-44fc-43b7-be99-2ccd3bd2913e")
432    @TelephonyBaseTest.tel_test_wrap
433    def test_voice_call_1x(self):
434        """ Test Voice call functionality on CDMA 1X
435
436        Steps:
437        1. Setup CallBox on 1x network, make sure DUT register on 1x network.
438        2. Make an voice call to DEFAULT_CALL_NUMBER.
439        3. Make sure Anritsu receives the call and accept.
440        4. Tear down the call.
441
442        Expected Results:
443        2. Voice call succeed.
444        3. Anritsu can accept the call.
445        4. Tear down call succeed.
446
447        Returns:
448            True if pass; False if fail
449        """
450        return self._setup_voice_call(
451            set_system_model_1x,
452            self._phone_setup_1x,
453            voice_number=self.voice_call_number)
454
455    @test_tracker_info(uuid="1f8ae218-042d-4114-9fc7-4401a503b3b4")
456    @TelephonyBaseTest.tel_test_wrap
457    def test_voice_call_1x_evdo(self):
458        """ Test Voice call functionality on CDMA 1X with EVDO
459
460        Steps:
461        1. Setup CallBox on 1x and EVDO network, make sure DUT register on 1x network.
462        2. Make an voice call to DEFAULT_CALL_NUMBER.
463        3. Make sure Anritsu receives the call and accept.
464        4. Tear down the call.
465
466        Expected Results:
467        2. Voice call succeed.
468        3. Anritsu can accept the call.
469        4. Tear down call succeed.
470
471        Returns:
472            True if pass; False if fail
473        """
474        return self._setup_voice_call(
475            set_system_model_1x_evdo,
476            self._phone_setup_1x,
477            voice_number=self.voice_call_number)
478
479    @test_tracker_info(uuid="7641ffc0-c1b3-42b8-92d6-00ae53719f8d")
480    @TelephonyBaseTest.tel_test_wrap
481    def test_voice_call_volte_wcdma_srvcc(self):
482        """ Test Voice call functionality,
483        VoLTE to WCDMA SRVCC
484        Steps:
485        1. Setup CallBox on VoLTE network with WCDMA.
486        2. Turn on DUT and enable VoLTE. Make an voice call to DEFAULT_CALL_NUMBER.
487        3. Check if VoLTE voice call connected successfully.
488        4. Handover the call to WCDMA and check if the call is still up.
489        5. Tear down the call.
490
491        Expected Results:
492        1. VoLTE Voice call is made successfully.
493        2. After SRVCC, the DEFAULT_CALL_NUMBER call is not dropped.
494        3. Tear down call succeed.
495
496        Returns:
497            True if pass; False if fail
498        """
499        return self._setup_voice_call(
500            set_system_model_lte_wcdma,
501            self._phone_setup_volte,
502            phone_idle_volte,
503            srvcc="InCall",
504            voice_number=self.voice_call_number,
505            wait_time_in_call=WAIT_TIME_IN_CALL_FOR_IMS)
506
507    @test_tracker_info(uuid="0d63e797-b4bc-4094-98c3-70060e5ea91b")
508    @TelephonyBaseTest.tel_test_wrap
509    def test_voice_call_volte_gsm_srvcc(self):
510        """ Test Voice call functionality,
511        VoLTE to GSM SRVCC
512        Steps:
513        1. Setup CallBox on VoLTE network with GSM.
514        2. Turn on DUT and enable VoLTE. Make an voice call to DEFAULT_CALL_NUMBER.
515        3. Check if VoLTE voice call connected successfully.
516        4. Handover the call to GSM and check if the call is still up.
517        5. Tear down the call.
518
519        Expected Results:
520        1. VoLTE Voice call is made successfully.
521        2. After SRVCC, the DEFAULT_CALL_NUMBER call is not dropped.
522        3. Tear down call succeed.
523
524        Returns:
525            True if pass; False if fail
526        """
527        return self._setup_voice_call(
528            set_system_model_lte_gsm,
529            self._phone_setup_volte,
530            phone_idle_volte,
531            srvcc="InCall",
532            voice_number=self.voice_call_number,
533            wait_time_in_call=WAIT_TIME_IN_CALL_FOR_IMS)
534
535    @test_tracker_info(uuid="f73f6cc0-79c8-47b3-9867-ea7390dfee41")
536    @TelephonyBaseTest.tel_test_wrap
537    def test_voice_call_volte_wcdma_asrvcc(self):
538        """ Test Voice call functionality,
539        VoLTE to WCDMA aSRVCC
540        Steps:
541        1. Setup CallBox on VoLTE network with WCDMA.
542        2. Turn on DUT and enable VoLTE. Make an voice call to DEFAULT_CALL_NUMBER.
543        3. Check if Virtual UA in CSCF server rings.
544        4. Handover the call to WCDMA and check if the call is connected.
545        5. Tear down the call.
546
547        Expected Results:
548        1. Virtual UA is rining.
549        2. After aSRVCC, the DEFAULT_CALL_NUMBER call is connected.
550        3. Tear down call succeed.
551
552        Returns:
553            True if pass; False if fail
554        """
555        return self._setup_voice_call(
556            set_system_model_lte_wcdma,
557            self._phone_setup_volte,
558            phone_idle_volte,
559            srvcc="Alert",
560            voice_number=self.voice_call_number)
561
562    @test_tracker_info(uuid="823e8e10-58bd-476d-ba4b-ec436ac424fb")
563    @TelephonyBaseTest.tel_test_wrap
564    def test_voice_call_volte_gsm_asrvcc(self):
565        """ Test Voice call functionality,
566        VoLTE to GSM aSRVCC
567        Steps:
568        1. Setup CallBox on VoLTE network with GSM.
569        2. Turn on DUT and enable VoLTE. Make an voice call to DEFAULT_CALL_NUMBER.
570        3. Check if Virtual UA in CSCF server rings.
571        4. Handover the call to GSM and check if the call is connected.
572        5. Tear down the call.
573
574        Expected Results:
575        1. Virtual UA is rining.
576        2. After aSRVCC, the DEFAULT_CALL_NUMBER call is connected.
577        3. Tear down call succeed.
578
579        Returns:
580            True if pass; False if fail
581        """
582        return self._setup_voice_call(
583            set_system_model_lte_gsm,
584            self._phone_setup_volte,
585            phone_idle_volte,
586            srvcc="Alert",
587            voice_number=self.voice_call_number,
588            wait_time_in_call=WAIT_TIME_IN_CALL_FOR_IMS)
589
590    @test_tracker_info(uuid="cd066cb1-6d12-4e29-90b9-f44054f00a00")
591    @TelephonyBaseTest.tel_test_wrap
592    def test_voice_call_volte_wcdma_asrvcc_mt(self):
593        """ Test Voice call functionality,
594        MT VoLTE to WCDMA aSRVCC
595        Steps:
596        1. Setup CallBox on VoLTE network with WCDMA.
597        2. Turn on DUT and enable VoLTE. Make a VoLTE call from MD8475A to UE.
598        3. Check if Virtual UA in CSCF server calling.
599        4. Handover the call to WCDMA and check if the call is connected.
600        5. Tear down the call.
601
602        Expected Results:
603        1. Virtual UA is rining.
604        2. After aSRVCC, the DEFAULT_CALL_NUMBER call is connected.
605        3. Tear down call succeed.
606
607        Returns:
608            True if pass; False if fail
609        """
610        return self._setup_voice_call(
611            set_system_model_lte_wcdma,
612            self._phone_setup_volte,
613            phone_idle_volte,
614            srvcc="Alert",
615            mo=False,
616            voice_number=self.voice_call_number)
617
618    @test_tracker_info(uuid="b23ebec3-7e5c-4aca-a749-e34307c56d58")
619    @TelephonyBaseTest.tel_test_wrap
620    def test_voice_call_volte_gsm_asrvcc_mt(self):
621        """ Test Voice call functionality,
622        MT VoLTE to GSM aSRVCC
623        Steps:
624        1. Setup CallBox on VoLTE network with GSM.
625        2. Turn on DUT and enable VoLTE. Make a VoLTE call from MD8475A to UE.
626        3. Check if Virtual UA in CSCF server calling.
627        4. Handover the call to GSM and check if the call is connected.
628        5. Tear down the call.
629
630        Expected Results:
631        1. Virtual UA is rining.
632        2. After aSRVCC, the DEFAULT_CALL_NUMBER call is connected.
633        3. Tear down call succeed.
634
635        Returns:
636            True if pass; False if fail
637        """
638        return self._setup_voice_call(
639            set_system_model_lte_gsm,
640            self._phone_setup_volte,
641            phone_idle_volte,
642            srvcc="Alert",
643            mo=False,
644            voice_number=self.voice_call_number,
645            wait_time_in_call=WAIT_TIME_IN_CALL_FOR_IMS)
646
647    @test_tracker_info(uuid="b81b3a0e-a7e3-4b30-889f-7c015bdc6980")
648    @TelephonyBaseTest.tel_test_wrap
649    def test_voice_call_volte(self):
650        """ Test Voice call functionality on VoLTE
651
652        Steps:
653        1. Setup CallBox on VoLTE network.
654        2. Turn on DUT and enable VoLTE. Make an voice call to DEFAULT_CALL_NUMBER.
655        3. Make sure Anritsu receives the call and accept.
656        4. Tear down the call.
657
658        Expected Results:
659        2. Voice call succeed.
660        3. Anritsu can accept the call.
661        4. Tear down call succeed.
662
663        Returns:
664            True if pass; False if fail
665        """
666        return self._setup_voice_call(
667            set_system_model_lte,
668            self._phone_setup_volte,
669            phone_idle_volte,
670            is_ims_call=True,
671            voice_number=self.voice_call_number,
672            wait_time_in_call=WAIT_TIME_IN_CALL_FOR_IMS)
673
674    """ Tests End """
675