1#!/usr/bin/env python3.4
2#
3#   Copyright 2021 - 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    Test Script for 5G NSA MMWAVE SMS scenarios
18"""
19
20from acts.test_decorators import test_tracker_info
21from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
22from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED
23from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED
24from acts_contrib.test_utils.tel.tel_message_utils import message_test
25from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_phones_idle
26from acts_contrib.test_utils.tel.tel_test_utils import set_phone_silent_mode
27from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode
28
29
30class Nsa5gMmwSmsTest(TelephonyBaseTest):
31    def setup_class(self):
32        super().setup_class()
33        for ad in self.android_devices:
34            set_phone_silent_mode(self.log, ad, True)
35
36    def setup_test(self):
37        TelephonyBaseTest.setup_test(self)
38
39    def teardown_test(self):
40        ensure_phones_idle(self.log, self.android_devices)
41
42    """ Tests Begin """
43
44    @test_tracker_info(uuid="fb333cd5-2eaa-4d63-be26-fdf1e67d01b0")
45    @TelephonyBaseTest.tel_test_wrap
46    def test_5g_nsa_mmw_sms_mo_mt(self):
47        """Test SMS between two phones in 5g NSA MMW
48
49        Provision devices in 5g NSA MMW
50        Send and Verify SMS from PhoneA to PhoneB
51        Verify both devices are still on 5g NSA MMW
52
53        Returns:
54            True if success.
55            False if failed.
56        """
57        return message_test(self.log,
58                            self.android_devices[0],
59                            self.android_devices[1],
60                            mo_rat='5g_nsa_mmwave',
61                            mt_rat='5g_nsa_mmwave')
62
63    @test_tracker_info(uuid="3afc92e8-69f7-4ead-a416-4df9753da27a")
64    @TelephonyBaseTest.tel_test_wrap
65    def test_5g_nsa_mmw_sms_mo_general(self):
66        """Test MO SMS for 1 phone in 5g NSA MMW. The other phone in any network
67
68        Provision PhoneA in 5g NSA MMW
69        Send and Verify SMS from PhoneA to PhoneB
70        Verify phoneA is still on 5g NSA MMW
71
72        Returns:
73            True if success.
74            False if failed.
75        """
76        return message_test(self.log,
77                            self.android_devices[0],
78                            self.android_devices[1],
79                            mo_rat='5g_nsa_mmwave',
80                            mt_rat='default')
81
82    @test_tracker_info(uuid="ee57da72-8e30-42ad-a7b3-d05bb4762724")
83    @TelephonyBaseTest.tel_test_wrap
84    def test_5g_nsa_mmw_sms_mt_general(self):
85        """Test MT SMS for 1 phone in 5g NSA MMW. The other phone in any network
86
87        Provision PhoneB in 5g NSA MMW
88        Send and Verify SMS from PhoneB to PhoneA
89        Verify phoneA is still on 5g NSA MMW
90
91        Returns:
92            True if success.
93            False if failed.
94        """
95        return message_test(self.log,
96                            self.android_devices[1],
97                            self.android_devices[0],
98                            mo_rat='default',
99                            mt_rat='5g_nsa_mmwave')
100
101    @test_tracker_info(uuid="1f75e117-f0f5-45fe-8896-91e0d2e61e9c")
102    @TelephonyBaseTest.tel_test_wrap
103    def test_5g_nsa_mmw_sms_mo_mt_volte(self):
104        """Test SMS between two phones with VoLTE on 5g NSA MMW
105
106        Provision devices on VoLTE
107        Provision devices in 5g NSA MMW
108        Send and Verify SMS from PhoneA to PhoneB
109        Verify both devices are still on 5g NSA MMW
110
111        Returns:
112            True if success.
113            False if failed.
114        """
115        return message_test(self.log,
116                            self.android_devices[0],
117                            self.android_devices[1],
118                            mo_rat='5g_nsa_mmw_volte',
119                            mt_rat='5g_nsa_mmw_volte')
120
121    @test_tracker_info(uuid="f58fe4ed-77e0-40ff-8599-27d95cb27e14")
122    @TelephonyBaseTest.tel_test_wrap
123    def test_5g_nsa_mmw_sms_mo_volte(self):
124        """Test MO SMS with VoLTE on 5g NSA MMW. The other phone in any network
125
126        Provision PhoneA on VoLTE
127        Provision PhoneA in 5g NSA MMW
128        Send and Verify SMS from PhoneA to PhoneB
129        Verify PhoneA is still on 5g NSA MMW
130
131        Returns:
132            True if success.
133            False if failed.
134        """
135        return message_test(self.log,
136                            self.android_devices[0],
137                            self.android_devices[1],
138                            mo_rat='5g_nsa_mmw_volte',
139                            mt_rat='default')
140
141    @test_tracker_info(uuid="f60ac2b0-0feb-441e-9048-fe1b2878f8b6")
142    @TelephonyBaseTest.tel_test_wrap
143    def test_5g_nsa_mmw_sms_mt_volte(self):
144        """Test MT SMS with VoLTE on 5g NSA MMW. The other phone in any network
145
146        Provision PhoneA on VoLTE
147        Provision PhoneA in 5g NSA MMW
148        Send and Verify SMS from PhoneB to PhoneA
149        Verify phoneA is still on 5g NSA MMW
150
151        Returns:
152            True if success.
153            False if failed.
154        """
155        return message_test(self.log,
156                            self.android_devices[1],
157                            self.android_devices[0],
158                            mo_rat='default',
159                            mt_rat='5g_nsa_mmw_volte')
160
161    @test_tracker_info(uuid="6b27d804-abcd-4558-894d-545428a5dff4")
162    @TelephonyBaseTest.tel_test_wrap
163    def test_5g_nsa_mmw_sms_mo_iwlan(self):
164        """ Test MO SMS for 1 phone in APM,
165        WiFi connected, WFC Cell Preferred mode.
166
167        Disable APM on both devices
168        Provision PhoneA in 5g NSA MMW
169        Provision PhoneA for WFC Cell Pref with APM ON
170        Send and Verify SMS from PhoneA to PhoneB
171
172        Returns:
173            True if pass; False if fail.
174        """
175        apm_mode = [
176            toggle_airplane_mode(self.log, ad, False)
177            for ad in self.android_devices
178        ]
179        return message_test(self.log,
180                            self.android_devices[0],
181                            self.android_devices[1],
182                            mo_rat='5g_nsa_mmw_wfc',
183                            mt_rat='general',
184                            is_airplane_mode=True,
185                            wfc_mode=WFC_MODE_CELLULAR_PREFERRED,
186                            wifi_ssid=self.wifi_network_ssid,
187                            wifi_pwd=self.wifi_network_pass)
188
189    @test_tracker_info(uuid="0b848508-a1e8-4652-9e13-74749a7ccd2e")
190    @TelephonyBaseTest.tel_test_wrap
191    def test_5g_nsa_mmw_sms_mt_iwlan(self):
192        """ Test MT SMS for 1 phone in APM,
193        WiFi connected, WFC Cell Preferred mode.
194
195        Disable APM on both devices
196        Provision PhoneA in 5g NSA MMW
197        Provision PhoneA for WFC Cell Pref with APM ON
198        Send and Verify SMS from PhoneB to PhoneA
199
200        Returns:
201            True if pass; False if fail.
202        """
203        apm_mode = [
204            toggle_airplane_mode(self.log, ad, False)
205            for ad in self.android_devices
206        ]
207        return message_test(self.log,
208                            self.android_devices[1],
209                            self.android_devices[0],
210                            mo_rat='general',
211                            mt_rat='5g_nsa_mmw_wfc',
212                            is_airplane_mode=True,
213                            wfc_mode=WFC_MODE_CELLULAR_PREFERRED,
214                            wifi_ssid=self.wifi_network_ssid,
215                            wifi_pwd=self.wifi_network_pass)
216
217    @test_tracker_info(uuid="9fc07594-6dbf-4b7a-b5a5-f4c06032fa35")
218    @TelephonyBaseTest.tel_test_wrap
219    def test_5g_nsa_mmw_sms_mo_iwlan_apm_off(self):
220        """ Test MO SMS for 1 Phone in APM off, WiFi connected,
221        WFC WiFi Preferred mode.
222
223        Disable APM on both devices
224        Provision PhoneA in 5g NSA MMW
225        Provision PhoneA for WFC Wifi Pref with APM OFF
226        Send and Verify SMS from PhoneA to PhoneB
227        Verify 5g NSA MMW attach for PhoneA
228
229        Returns:
230            True if pass; False if fail.
231        """
232        apm_mode = [
233            toggle_airplane_mode(self.log, ad, False)
234            for ad in self.android_devices
235        ]
236        return message_test(self.log,
237                            self.android_devices[0],
238                            self.android_devices[1],
239                            mo_rat='5g_nsa_mmw_wfc',
240                            mt_rat='general',
241                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
242                            wifi_ssid=self.wifi_network_ssid,
243                            wifi_pwd=self.wifi_network_pass)
244
245    @test_tracker_info(uuid="b76c0eaf-6e6b-4da7-87a0-26895f93a554")
246    @TelephonyBaseTest.tel_test_wrap
247    def test_5g_nsa_mmw_sms_mt_iwlan_apm_off(self):
248        """ Test MT SMS for 1 Phone in APM off, WiFi connected,
249        WFC WiFi Preferred mode.
250
251        Disable APM on both devices
252        Provision PhoneA in 5g NSA MMW
253        Provision PhoneA for WFC Wifi Pref with APM OFF
254        Send and Verify SMS from PhoneB to PhoneA
255        Verify 5g NSA MMW attach for PhoneA
256
257        Returns:
258            True if pass; False if fail.
259        """
260        apm_mode = [
261            toggle_airplane_mode(self.log, ad, False)
262            for ad in self.android_devices
263        ]
264        return message_test(self.log,
265                            self.android_devices[1],
266                            self.android_devices[0],
267                            mo_rat='general',
268                            mt_rat='5g_nsa_mmw_wfc',
269                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
270                            wifi_ssid=self.wifi_network_ssid,
271                            wifi_pwd=self.wifi_network_pass)
272
273    @test_tracker_info(uuid="43694343-e6f0-4430-972f-53f61c7b51b0")
274    @TelephonyBaseTest.tel_test_wrap
275    def test_5g_nsa_mmw_sms_long_message_mo_mt(self):
276        """Test SMS basic function between two phone. Phones in 5G NSA MMW network.
277
278        Airplane mode is off.
279        Send SMS from PhoneA to PhoneB.
280        Verify received message on PhoneB is correct.
281
282        Returns:
283            True if success.
284            False if failed.
285        """
286        return message_test(self.log,
287                            self.android_devices[0],
288                            self.android_devices[1],
289                            mo_rat='5g_nsa_mmwave',
290                            mt_rat='5g_nsa_mmwave',
291                            long_msg=True)
292
293    @test_tracker_info(uuid="846dcf2d-911f-46a0-adb1-e32667b8ebd3")
294    @TelephonyBaseTest.tel_test_wrap
295    def test_5g_nsa_mmw_sms_long_message_mo(self):
296        """Test MO long SMS function for 1 phone in 5G NSA MMW network.
297
298        Disable APM on PhoneA
299        Provision PhoneA in 5g NSA MMW
300        Send SMS from PhoneA to PhoneB
301        Verify received message on PhoneB is correct
302
303        Returns:
304            True if success.
305            False if failed.
306        """
307        return message_test(self.log,
308                            self.android_devices[0],
309                            self.android_devices[1],
310                            mo_rat='5g_nsa_mmwave',
311                            mt_rat='default',
312                            long_msg=True)
313
314    @test_tracker_info(uuid="4d2951c3-d80c-4860-8dd9-9709cb7dfaa8")
315    @TelephonyBaseTest.tel_test_wrap
316    def test_5g_nsa_mmw_sms_long_message_mt(self):
317        """Test MT long SMS function for 1 phone in 5G NSA MMW network.
318
319        Disable APM on PhoneA
320        Provision PhoneA in 5g NSA MMW
321        Send SMS from PhoneB to PhoneA
322        Verify received message on PhoneA is correct
323
324        Returns:
325            True if success.
326            False if failed.
327        """
328        return message_test(self.log,
329                            self.android_devices[1],
330                            self.android_devices[0],
331                            mo_rat='default',
332                            mt_rat='5g_nsa_mmwave',
333                            long_msg=True)
334
335    @test_tracker_info(uuid="bee8b263-fe61-4a5c-a857-eb849426f0c7")
336    @TelephonyBaseTest.tel_test_wrap
337    def test_5g_nsa_mmw_sms_mo_mt_in_call_volte(self):
338        """ Test MO SMS during a MO VoLTE call over 5G NSA MMW.
339
340        Provision devices on VoLTE
341        Provision devices in 5g NSA MMW
342        Make a Voice call from PhoneA to PhoneB
343        Send and Verify SMS from PhoneA to PhoneB
344        Verify both devices are still on 5g NSA
345
346        Returns:
347            True if pass; False if fail.
348        """
349        return message_test(self.log,
350                            self.android_devices[0],
351                            self.android_devices[1],
352                            mo_rat='5g_nsa_mmw_volte',
353                            mt_rat='5g_nsa_mmw_volte',
354                            msg_in_call=True)
355
356    @test_tracker_info(uuid="1a5ca91a-91f6-4b5d-b4b9-f436bb3870ff")
357    @TelephonyBaseTest.tel_test_wrap
358    def test_5g_nsa_mmw_sms_mo_in_call_volte(self):
359        """ Test MO SMS during a MO VoLTE call over 5G NSA MMW.
360
361        Provision PhoneA on VoLTE
362        Provision PhoneA in 5g NSA MMW
363        Make a Voice call from PhoneA to PhoneB
364        Send and Verify SMS from PhoneA to PhoneB
365        Verify phoneA is still on 5g NSA
366
367        Returns:
368            True if pass; False if fail.
369        """
370        return message_test(self.log,
371                            self.android_devices[0],
372                            self.android_devices[1],
373                            mo_rat='5g_nsa_mmw_volte',
374                            mt_rat='default',
375                            msg_in_call=True)
376
377    @test_tracker_info(uuid="8a334ce7-a431-4fdc-bd65-f094d5ae727b")
378    @TelephonyBaseTest.tel_test_wrap
379    def test_5g_nsa_mmw_sms_mt_in_call_volte(self):
380        """ Test MT SMS during a MT VoLTE call over 5G NSA.
381
382        Provision PhoneA on VoLTE
383        Provision PhoneA in 5g NSA MMW
384        Make a Voice call from PhoneB to PhoneA
385        Send and Verify SMS from PhoneB to PhoneA
386        Verify phoneA is still on 5g NSA
387
388        Returns:
389            True if pass; False if fail.
390        """
391        return message_test(self.log,
392                            self.android_devices[1],
393                            self.android_devices[0],
394                            mo_rat='default',
395                            mt_rat='5g_nsa_mmw_volte',
396                            msg_in_call=True)
397
398    @test_tracker_info(uuid="ff29b86c-df34-4c6e-b880-baa321442fcf")
399    @TelephonyBaseTest.tel_test_wrap
400    def test_5g_nsa_mmw_sms_mo_mt_iwlan(self):
401        """ Test SMS text function between two phones,
402        Phones in APM, WiFi connected, WFC Cell Preferred mode.
403
404        Disable APM on both devices
405        Provision devices in 5g NSA MMW
406        Provision devices for WFC Cell Pref with APM ON
407        Send and Verify SMS from PhoneA to PhoneB
408
409        Returns:
410            True if pass; False if fail.
411        """
412        apm_mode = [
413            toggle_airplane_mode(self.log, ad, False)
414            for ad in self.android_devices
415        ]
416        return message_test(self.log,
417                            self.android_devices[0],
418                            self.android_devices[1],
419                            mo_rat='5g_nsa_mmw_wfc',
420                            mt_rat='5g_nsa_mmw_wfc',
421                            is_airplane_mode=True,
422                            wfc_mode=WFC_MODE_CELLULAR_PREFERRED,
423                            wifi_ssid=self.wifi_network_ssid,
424                            wifi_pwd=self.wifi_network_pass)
425
426    @test_tracker_info(uuid="010a85d9-84d5-4893-aa43-478490bbf03c")
427    @TelephonyBaseTest.tel_test_wrap
428    def test_5g_nsa_mmw_sms_mo_mt_iwlan_apm_off(self):
429        """ Test MO SMS, Phone in APM off, WiFi connected, WFC WiFi Preferred mode.
430
431        Disable APM on both devices
432        Provision devices in 5g NSA MMW
433        Provision devices for WFC Wifi Pref with APM OFF
434        Send and Verify SMS from PhoneA to PhoneB
435        Verify 5g NSA MMW attach for both devices
436
437        Returns:
438            True if pass; False if fail.
439        """
440        apm_mode = [
441            toggle_airplane_mode(self.log, ad, False)
442            for ad in self.android_devices
443        ]
444        return message_test(self.log,
445                            self.android_devices[0],
446                            self.android_devices[1],
447                            mo_rat='5g_nsa_mmw_wfc',
448                            mt_rat='5g_nsa_mmw_wfc',
449                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
450                            wifi_ssid=self.wifi_network_ssid,
451                            wifi_pwd=self.wifi_network_pass)
452
453    @test_tracker_info(uuid="40c11bd3-e0a2-46f9-b7f0-ccb8366e85b7")
454    @TelephonyBaseTest.tel_test_wrap
455    def test_5g_nsa_mmw_sms_mo_mt_in_call_iwlan(self):
456        """ Test MO SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode.
457
458        Disable APM on both devices
459        Provision devices in 5g NSA MMW
460        Provision devices for WFC Wifi Pref with APM ON
461        Make a Voice call from PhoneA to PhoneB
462        Send and Verify SMS from PhoneA to PhoneB
463
464        Returns:
465            True if pass; False if fail.
466        """
467        apm_mode = [
468            toggle_airplane_mode(self.log, ad, False)
469            for ad in self.android_devices
470        ]
471        return message_test(self.log,
472                            self.android_devices[0],
473                            self.android_devices[1],
474                            mo_rat='5g_nsa_mmw_wfc',
475                            mt_rat='5g_nsa_mmw_wfc',
476                            msg_in_call=True,
477                            is_airplane_mode=True,
478                            wfc_mode=WFC_MODE_WIFI_PREFERRED,
479                            wifi_ssid=self.wifi_network_ssid,
480                            wifi_pwd=self.wifi_network_pass)
481
482    """ Tests End """
483