1#!/usr/bin/env python3.4
2#
3#   Copyright 2018 - Google
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16"""
17    Connectivity Monitor and Telephony Troubleshooter Tests
18"""
19
20from acts.test_decorators import test_tracker_info
21from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
22from acts.test_utils.tel.tel_defines import CAPABILITY_VOLTE
23from TelLiveConnectivityMonitorBaseTest import TelLiveConnectivityMonitorBaseTest
24from TelLiveConnectivityMonitorBaseTest import ACTIONS
25from TelLiveConnectivityMonitorBaseTest import TROUBLES
26
27
28class TelLiveConnectivityMonitorTest(TelLiveConnectivityMonitorBaseTest):
29    """ Tests Begin """
30
31    @test_tracker_info(uuid="fee3d03d-701b-4727-9320-426ff6b29974")
32    @TelephonyBaseTest.tel_test_wrap
33    def test_volte_call_drop_triggered_suggestion(self):
34        """Telephony Monitor Functional Test
35
36        Steps:
37            1. Verify Connectivity Monitor is on
38            2. Force Trigger a call drop : media timeout and ensure it is
39               notified by Connectivity Monitor
40
41        Expected Results:
42            feature work fine, and does report to User about Call Drop
43
44        Returns:
45            True is pass, False if fail.
46        """
47        return self.forced_call_drop_test(setup="volte")
48
49    @test_tracker_info(uuid="8c3ee59a-74e5-4885-8f42-8a15d4550d5f")
50    @TelephonyBaseTest.tel_test_wrap
51    def test_csfb_call_drop_triggered_suggestion(self):
52        """Telephony Monitor Functional Test
53
54        Steps:
55            1. Verify Connectivity Monitor is on
56            2. Force Trigger a call drop : media timeout and ensure it is
57               notified by Connectivity Monitor
58
59        Expected Results:
60            feature work fine, and does report to User about Call Drop
61
62        Returns:
63            True is pass, False if fail.
64        """
65        return self.forced_call_drop_test(setup="csfb")
66
67    @test_tracker_info(uuid="6cd12786-c048-4925-8745-1d5d30094257")
68    @TelephonyBaseTest.tel_test_wrap
69    def test_3g_call_drop_triggered_suggestion(self):
70        """Telephony Monitor Functional Test
71
72        Steps:
73            1. Verify Connectivity Monitor is on
74            2. Force Trigger a call drop : media timeout and ensure it is
75               notified by Connectivity Monitor
76
77        Expected Results:
78            feature work fine, and does report to User about Call Drop
79
80        Returns:
81            True is pass, False if fail.
82        """
83        return self.forced_call_drop_test(setup="3g")
84
85    @test_tracker_info(uuid="51166448-cea6-480b-93d8-7063f940ce0a")
86    @TelephonyBaseTest.tel_test_wrap
87    def test_2g_call_drop_triggered_suggestion(self):
88        """Telephony Monitor Functional Test
89
90        Steps:
91            1. Verify Connectivity Monitor is on
92            2. Force Trigger a call drop : media timeout and ensure it is
93               notified by Connectivity Monitor
94
95        Expected Results:
96            feature work fine, and does report to User about Call Drop
97
98        Returns:
99            True is pass, False if fail.
100        """
101        return self.forced_call_drop_test(setup="2g")
102
103    @test_tracker_info(uuid="409f3331-5d64-4793-b300-2b3d3fa50ba5")
104    @TelephonyBaseTest.tel_test_wrap
105    def test_wfc_apm_call_drop_triggered_suggestion(self):
106        """Telephony Monitor Functional Test
107
108        Steps:
109            1. Verify Connectivity Monitor is on
110            2. Force Trigger a call drop : media timeout and ensure it is
111               notified by Connectivity Monitor
112
113        Expected Results:
114            feature work fine, and does report to User about Call Drop
115
116        Returns:
117            True is pass, False if fail.
118        """
119        return self.forced_call_drop_test(setup="wfc_apm")
120
121    @test_tracker_info(uuid="336c383f-ec19-4447-af37-7f9bb0bac4dd")
122    @TelephonyBaseTest.tel_test_wrap
123    def test_wfc_non_apm_call_drop_triggered_suggestion(self):
124        """Telephony Monitor Functional Test
125
126        Steps:
127            1. Verify Connectivity Monitor is on
128            2. Force Trigger a call drop : media timeout and ensure it is
129               notified by Connectivity Monitor
130
131        Expected Results:
132            feature work fine, and does report to User about Call Drop
133
134        Returns:
135            True is pass, False if fail.
136        """
137        return self.forced_call_drop_test(setup="wfc_non_apm")
138
139    @test_tracker_info(uuid="fd8d22ac-66b2-4e91-a922-8ecec45c85e6")
140    @TelephonyBaseTest.tel_test_wrap
141    def test_vt_call_drop_triggered_suggestion(self):
142        """Telephony Monitor Functional Test
143
144        Steps:
145            1. Verify Connectivity Monitor is on
146            2. Force Trigger a call drop : media timeout and ensure it is
147               notified by Connectivity Monitor
148
149        Expected Results:
150            feature work fine, and does report to User about Call Drop
151
152        Returns:
153            True is pass, False if fail.
154        """
155        return self.forced_call_drop_test(setup="vt")
156
157    @test_tracker_info(uuid="11c4068e-9710-4a40-8587-79d32a68a37e")
158    @TelephonyBaseTest.tel_test_wrap
159    def test_volte_call_drop_after_user_data_wipe(self):
160        """Telephony Monitor Functional Test
161
162        Steps:
163            1. Verify Connectivity Monitor is on
164            2. Force Trigger a call drop : media timeout and ensure it is
165               notified by Connectivity Monitor
166
167        Expected Results:
168            feature work fine, and does report to User about Call Drop
169
170        Returns:
171            True is pass, False if fail.
172        """
173        return self.call_drop_test_after_wipe(setup="volte")
174
175    @test_tracker_info(uuid="8c7083e1-7c06-40c9-9a58-485adceb8690")
176    @TelephonyBaseTest.tel_test_wrap
177    def test_csfb_call_drop_after_user_data_wipe(self):
178        """Telephony Monitor Functional Test
179
180        Steps:
181            1. Verify Connectivity Monitor is on
182            2. Force Trigger a call drop : media timeout and ensure it is
183               notified by Connectivity Monitor
184
185        Expected Results:
186            feature work fine, and does report to User about Call Drop
187
188        Returns:
189            True is pass, False if fail.
190        """
191        return self.call_drop_test_after_wipe(setup="csfb")
192
193    @test_tracker_info(uuid="a7938250-ea3c-4d37-85fe-72edf67c61f7")
194    @TelephonyBaseTest.tel_test_wrap
195    def test_3g_call_drop_after_user_data_wipe(self):
196        """Telephony Monitor Functional Test
197
198        Steps:
199            1. Verify Connectivity Monitor is on
200            2. Force Trigger a call drop : media timeout and ensure it is
201               notified by Connectivity Monitor
202
203        Expected Results:
204            feature work fine, and does report to User about Call Drop
205
206        Returns:
207            True is pass, False if fail.
208        """
209        return self.call_drop_test_after_wipe(setup="3g")
210
211    @test_tracker_info(uuid="24f498c4-26c5-447f-8e7d-fc3ff1d1e9d5")
212    @TelephonyBaseTest.tel_test_wrap
213    def test_2g_call_drop_after_user_data_wipe(self):
214        """Telephony Monitor Functional Test
215
216        Steps:
217            1. Verify Connectivity Monitor is on
218            2. Force Trigger a call drop : media timeout and ensure it is
219               notified by Connectivity Monitor
220
221        Expected Results:
222            feature work fine, and does report to User about Call Drop
223
224        Returns:
225            True is pass, False if fail.
226        """
227        return self.call_drop_test_after_wipe(setup="2g")
228
229    @test_tracker_info(uuid="9fd0fc1e-9480-40b7-bd6f-fe6ac95c2018")
230    @TelephonyBaseTest.tel_test_wrap
231    def test_wfc_apm_call_drop_after_user_data_wipe(self):
232        """Telephony Monitor Functional Test
233
234        Steps:
235            1. Verify Connectivity Monitor is on
236            2. Force Trigger a call drop : media timeout and ensure it is
237               notified by Connectivity Monitor
238
239        Expected Results:
240            feature work fine, and does report to User about Call Drop
241
242        Returns:
243            True is pass, False if fail.
244        """
245        return self.call_drop_test_after_wipe(setup="wfc_apm")
246
247    @test_tracker_info(uuid="8fd9f1a0-b1e0-4469-8617-608ed0682f91")
248    @TelephonyBaseTest.tel_test_wrap
249    def test_wfc_non_apm_call_drop_after_user_data_wipe(self):
250        """Telephony Monitor Functional Test
251
252        Steps:
253            1. Verify Connectivity Monitor is on
254            2. Force Trigger a call drop : media timeout and ensure it is
255               notified by Connectivity Monitor
256
257        Expected Results:
258            feature work fine, and does report to User about Call Drop
259
260        Returns:
261            True is pass, False if fail.
262        """
263        return self.call_drop_test_after_wipe(setup="wfc_non_apm")
264
265    @test_tracker_info(uuid="86056126-9c0b-4702-beb5-49b66368a806")
266    @TelephonyBaseTest.tel_test_wrap
267    def test_vt_call_drop_after_user_data_wipe(self):
268        """Telephony Monitor Functional Test
269
270        Steps:
271            1. Verify Connectivity Monitor is on
272            2. Force Trigger a call drop : media timeout and ensure it is
273               notified by Connectivity Monitor
274
275        Expected Results:
276            feature work fine, and does report to User about Call Drop
277
278        Returns:
279            True is pass, False if fail.
280        """
281        return self.call_drop_test_after_wipe(setup="vt")
282
283    @test_tracker_info(uuid="96ee7af3-96cf-48a7-958b-834684b670dc")
284    @TelephonyBaseTest.tel_test_wrap
285    def test_stats_and_suggestion_after_reboot(self):
286        """Telephony Monitor Functional Test
287
288        Steps:
289            1. Verify Connectivity Monitor is on
290            2. Force Trigger a call drop : media timeout and ensure it is
291               notified by Connectivity Monitor
292
293        Expected Results:
294            feature work fine, and does report to User about Call Drop
295
296        Returns:
297            True is pass, False if fail.
298        """
299        return self.call_drop_test_after_reboot(setup="volte")
300
301    @test_tracker_info(uuid="6b9c8f45-a3cc-4fa8-9a03-bc439ed5b415")
302    @TelephonyBaseTest.tel_test_wrap
303    def test_call_drops_equally_across_all_types(self):
304        """Telephony Monitor Functional Test
305
306        Steps:
307            1. Verify Connectivity Monitor is on
308            2. Force Trigger a call drop : media timeout and ensure it is
309               notified by Connectivity Monitor
310
311        Expected Results:
312            feature work fine, and does report to User about Call Drop
313
314        Returns:
315            True is pass, False if fail.
316        """
317        self.setup_wfc_non_apm()
318        return self.call_drop_test_after_same_type_healthy_call(
319            setup="wfc_non_apm")
320
321    @test_tracker_info(uuid="f2633204-c2ac-4c57-9465-ef6de3223de3")
322    @TelephonyBaseTest.tel_test_wrap
323    def test_volte_call_drop_with_wifi_on_cellular_preferred(self):
324        """Telephony Monitor Functional Test
325
326        Steps:
327            1. Verify Connectivity Monitor is on
328            2. Force Trigger a call drop : media timeout and ensure it is
329               notified by Connectivity Monitor
330
331        Expected Results:
332            feature work fine, and does report to User about Call Drop
333
334        Returns:
335            True is pass, False if fail.
336        """
337        self.setup_volte()
338        self.connect_to_wifi()
339        return self.call_drop_triggered_suggestion_test(setup="volte")
340
341    @test_tracker_info(uuid="ec274cb6-0b75-4026-94a7-0228a43a0f5f")
342    @TelephonyBaseTest.tel_test_wrap
343    def test_csfb_call_drop_with_wifi_on_cellular_preferred(self):
344        """Telephony Monitor Functional Test
345
346        Steps:
347            1. Verify Connectivity Monitor is on
348            2. Force Trigger a call drop : media timeout and ensure it is
349               notified by Connectivity Monitor
350
351        Expected Results:
352            feature work fine, and does report to User about Call Drop
353
354        Returns:
355            True is pass, False if fail.
356        """
357        self.setup_csfb()
358        self.connect_to_wifi()
359        return self.call_drop_triggered_suggestion_test(setup="csfb")
360
361    @test_tracker_info(uuid="b9b439c0-4200-47d6-824b-f12b64dfeecd")
362    @TelephonyBaseTest.tel_test_wrap
363    def test_3g_call_drop_with_wifi_on_cellular_preferred(self):
364        """Telephony Monitor Functional Test
365
366        Steps:
367            1. Verify Connectivity Monitor is on
368            2. Force Trigger a call drop : media timeout and ensure it is
369               notified by Connectivity Monitor
370
371        Expected Results:
372            feature work fine, and does report to User about Call Drop
373
374        Returns:
375            True is pass, False if fail.
376        """
377        self.setup_3g()
378        self.connect_to_wifi()
379        return self.call_drop_triggered_suggestion_test(setup="3g")
380
381    @test_tracker_info(uuid="a4e43270-f7fa-4709-bbe2-c7368af39227")
382    @TelephonyBaseTest.tel_test_wrap
383    def test_wfc_non_apm_toggling_wifi_call_drop(self):
384        """Connectivity Monitor Off Test
385
386        Steps:
387            1. Verify Connectivity Monitor can be turned off
388            2. Force Trigger a call drop : media timeout and ensure it is
389               not notified by Connectivity Monitor
390
391        Expected Results:
392            feature work fine, and does not report to User about Call Drop
393
394        Returns:
395            True is pass, False if fail.
396        """
397        self.setup_volte()
398        self.setup_wfc_non_apm()
399        return self.call_setup_and_connectivity_monitor_checking(
400            setup="wfc_non_apm", triggers=["toggle_wifi", "toogle_wifi"])
401
402    @test_tracker_info(uuid="1c880cf8-082c-4451-b890-22081177d084")
403    @TelephonyBaseTest.tel_test_wrap
404    def test_wfc_apm_call_toggling_wifi(self):
405        """Telephony Monitor Functional Test
406
407        Steps:
408            1. Verify Connectivity Monitor is on
409            2. Force Trigger a call drop : media timeout and ensure it is
410               notified by Connectivity Monitor
411
412        Expected Results:
413            feature work fine, and does report to User about Call Drop
414
415        Returns:
416            True is pass, False if fail.
417        """
418        self.setup_volte()
419        self.setup_wfc_apm()
420        return self.call_setup_and_connectivity_monitor_checking(
421            setup="wfc_apm", triggers=["toggle_wifi", "toggle_wifi"])
422
423    @test_tracker_info(uuid="")
424    @TelephonyBaseTest.tel_test_wrap
425    def test_call_drop_by_toggling_apm_with_connectivity_monitor_volte(self):
426        """Telephony Monitor Functional Test
427
428        Steps:
429            1. Verify Connectivity Monitor is on
430            2. Force Trigger a call drop : media timeout and ensure it is
431               not counted as call drop by Connectivity Monitor
432
433        Expected Results:
434            feature work fine, and does report to User about Call Drop
435
436        Returns:
437            True is pass, False if fail.
438        """
439        self.setup_volte()
440        return self.call_setup_and_connectivity_monitor_checking(
441            setup="volte", triggers=["toggle_apm"])
442
443    @test_tracker_info(uuid="8e1ba024-3b43-4a7d-adc8-2252da81c55c")
444    @TelephonyBaseTest.tel_test_wrap
445    def test_call_drop_by_toggling_apm_with_connectivity_monitor_csfb(self):
446        """Telephony Monitor Functional Test
447
448        Steps:
449            1. Verify Connectivity Monitor is on
450            2. Force Trigger a call drop : media timeout and ensure it is
451               notified by Connectivity Monitor
452
453        Expected Results:
454            feature work fine, and does report to User about Call Drop
455
456        Returns:
457            True is pass, False if fail.
458        """
459        self.setup_csfb()
460        return self.call_setup_and_connectivity_monitor_checking(
461            setup="csfb", triggers=["toggle_apm"])
462
463    @test_tracker_info(uuid="fe6afae4-fa04-435f-8bbc-4a63f5fb525c")
464    @TelephonyBaseTest.tel_test_wrap
465    def test_call_drop_by_toggling_apm_with_connectivity_monitor_3g(self):
466        """Telephony Monitor Functional Test
467
468        Steps:
469            1. Verify Connectivity Monitor is on
470            2. Force Trigger a call drop : media timeout and ensure it is
471               notified by Connectivity Monitor
472
473        Expected Results:
474            feature work fine, and does report to User about Call Drop
475
476        Returns:
477            True is pass, False if fail.
478        """
479        self.setup_3g()
480        return self.call_setup_and_connectivity_monitor_checking(
481            setup="3g", triggers=["toggle_apm"])
482
483    @test_tracker_info(uuid="cc089e2b-d0e1-42a3-80de-597986be3d4e")
484    @TelephonyBaseTest.tel_test_wrap
485    def test_call_drop_by_toggling_apm_with_connectivity_monitor_2g(self):
486        """Telephony Monitor Functional Test
487
488        Steps:
489            1. Verify Connectivity Monitor is on
490            2. Force Trigger a call drop : media timeout and ensure it is
491               notified by Connectivity Monitor
492
493        Expected Results:
494            feature work fine, and does report to User about Call Drop
495
496        Returns:
497            True is pass, False if fail.
498        """
499        self.setup_2g()
500        return self.call_setup_and_connectivity_monitor_checking(
501            setup="2g", triggers=["toggle_apm"])
502
503    @test_tracker_info(uuid="f8ba9655-572c-4a90-be59-6a5bc9a8fad0")
504    @TelephonyBaseTest.tel_test_wrap
505    def test_call_drop_by_toggling_apm_with_connectivity_monitor_wfc_apm(self):
506        """Telephony Monitor Functional Test
507
508        Steps:
509            1. Verify Connectivity Monitor is on
510            2. Force Trigger a call drop : media timeout and ensure it is
511               notified by Connectivity Monitor
512
513        Expected Results:
514            feature work fine, and does report to User about Call Drop
515
516        Returns:
517            True is pass, False if fail.
518        """
519        self.setup_wfc_apm()
520        return self.call_setup_and_connectivity_monitor_checking(
521            setup="wfc_apm", triggers=["toggle_apm"])
522
523    @test_tracker_info(uuid="f2995df9-f56d-442c-977a-141e3269481f")
524    @TelephonyBaseTest.tel_test_wrap
525    def test_call_drop_by_toggling_apm_with_connectivity_monitor_wfc_non_apm(
526            self):
527        """Telephony Monitor Functional Test
528
529        Steps:
530            1. Verify Connectivity Monitor is on
531            2. Force Trigger a call drop : media timeout and ensure it is
532               notified by Connectivity Monitor
533
534        Expected Results:
535            feature work fine, and does report to User about Call Drop
536
537        Returns:
538            True is pass, False if fail.
539        """
540        self.setup_wfc_non_apm()
541        return self.call_setup_and_connectivity_monitor_checking(
542            setup="wfc_non_apm", triggers=["toggle_apm"])
543
544    @test_tracker_info(uuid="cb52110c-7470-4886-b71f-e32f0e489cbd")
545    @TelephonyBaseTest.tel_test_wrap
546    def test_call_drop_by_toggling_apm_with_connectivity_monitor_vt(self):
547        """Telephony Monitor Functional Test
548
549        Steps:
550            1. Verify Connectivity Monitor is on
551            2. Force Trigger a call drop : media timeout and ensure it is
552               notified by Connectivity Monitor
553
554        Expected Results:
555            feature work fine, and does report to User about Call Drop
556
557        Returns:
558            True is pass, False if fail.
559        """
560        self.setup_vt()
561        return self.call_setup_and_connectivity_monitor_checking(
562            setup="vt", triggers=["toggle_apm"])
563
564    @test_tracker_info(uuid="b91a1e8d-3630-4b81-bc8c-c7d3dad42c77")
565    @TelephonyBaseTest.tel_test_wrap
566    def test_healthy_call_with_connectivity_monitor_volte(self):
567        """Telephony Monitor Functional Test
568
569        Steps:
570            1. Verify Connectivity Monitor is on
571            2. No call drop during the call
572            3. Verify the call summary report
573
574        Expected Results:
575            feature work fine, and healthy call is added to report
576
577        Returns:
578            True is pass, False if fail.
579        """
580        self.setup_volte()
581        return self.healthy_call_test(setup="volte", count=1)
582
583    @test_tracker_info(uuid="2f581f6a-087f-4d12-a75c-a62778cb741b")
584    @TelephonyBaseTest.tel_test_wrap
585    def test_healthy_call_with_connectivity_monitor_csfb(self):
586        """Telephony Monitor Functional Test
587
588        Steps:
589            1. Verify Connectivity Monitor is on
590            2. Force Trigger a call drop : media timeout and ensure it is
591               notified by Connectivity Monitor
592
593        Expected Results:
594            feature work fine, and does report to User about Call Drop
595
596        Returns:
597            True is pass, False if fail.
598        """
599        self.setup_csfb()
600        return self.healthy_call_test(setup="csfb", count=1)
601
602    @test_tracker_info(uuid="a5989001-8201-4356-9903-581d0e361b38")
603    @TelephonyBaseTest.tel_test_wrap
604    def test_healthy_call_with_connectivity_monitor_wfc_apm(self):
605        """Telephony Monitor Functional Test
606
607        Steps:
608            1. Verify Connectivity Monitor is on
609            2. Make a call and hung up the call
610            3. Verify the healthy call is added to the call summary report
611
612        Expected Results:
613            feature work fine
614
615        Returns:
616            True is pass, False if fail.
617        """
618        self.setup_wfc_apm()
619        return self.healthy_call_test(setup="wfc_apm", count=1)
620
621
622""" Tests End """
623