Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python3.4 |
| 2 | # |
| 3 | # Copyright 2020 - 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 SMS scenarios |
| 18 | """ |
| 19 | |
| 20 | import time |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 21 | from acts.utils import rand_ascii_str |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 22 | from acts.test_decorators import test_tracker_info |
| 23 | from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest |
| 24 | from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 25 | from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_idle |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 26 | from acts_contrib.test_utils.tel.tel_test_utils import hangup_call |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 27 | from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 28 | from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 29 | from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 30 | from acts_contrib.test_utils.tel.tel_5g_utils import disable_apm_mode_both_devices |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 31 | from acts_contrib.test_utils.tel.tel_5g_utils import provision_device_for_5g |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 32 | from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_volte |
| 33 | from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_cell_pref |
| 34 | from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_wifi_pref |
| 35 | from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 36 | from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_csfb |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 37 | from acts_contrib.test_utils.tel.tel_sms_utils import _sms_test_mo |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 38 | from acts_contrib.test_utils.tel.tel_sms_utils import _long_sms_test_mo |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 39 | from acts_contrib.test_utils.tel.tel_sms_utils import test_sms_mo_in_call |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 40 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 41 | |
| 42 | class Nsa5gSmsTest(TelephonyBaseTest): |
| 43 | def setup_class(self): |
| 44 | super().setup_class() |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 45 | |
| 46 | def setup_test(self): |
| 47 | TelephonyBaseTest.setup_test(self) |
| 48 | |
| 49 | def teardown_test(self): |
| 50 | ensure_phones_idle(self.log, self.android_devices) |
| 51 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 52 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 53 | """ Tests Begin """ |
| 54 | |
Pratik Sheth | f9d0d2b | 2021-03-19 15:38:44 -0700 | [diff] [blame] | 55 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 56 | @test_tracker_info(uuid="4a64a262-7433-4a7f-b5c6-a36ff60aeaa2") |
| 57 | @TelephonyBaseTest.tel_test_wrap |
| 58 | def test_5g_nsa_sms_mo_mt(self): |
| 59 | """Test SMS between two phones in 5g NSA |
| 60 | |
| 61 | Provision devices in 5g NSA |
| 62 | Send and Verify SMS from PhoneA to PhoneB |
| 63 | Verify both devices are still on 5g NSA |
| 64 | |
| 65 | Returns: |
| 66 | True if success. |
| 67 | False if failed. |
| 68 | """ |
| 69 | ads = self.android_devices |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 70 | if not provision_device_for_5g(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 71 | return False |
| 72 | |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 73 | if not _sms_test_mo(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 74 | return False |
| 75 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 76 | if not verify_5g_attach_for_both_devices(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 77 | return False |
| 78 | |
| 79 | self.log.info("PASS - SMS test over 5G NSA validated") |
| 80 | return True |
| 81 | |
Pratik Sheth | f9d0d2b | 2021-03-19 15:38:44 -0700 | [diff] [blame] | 82 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 83 | @test_tracker_info(uuid="2ce809d4-cbf6-4233-81ad-43f91107b201") |
| 84 | @TelephonyBaseTest.tel_test_wrap |
| 85 | def test_5g_nsa_sms_mo_mt_volte(self): |
| 86 | """Test SMS between two phones with VoLTE on 5G NSA |
| 87 | |
| 88 | Provision devices on VoLTE |
| 89 | Provision devices in 5g NSA |
| 90 | Send and Verify SMS from PhoneA to PhoneB |
| 91 | Verify both devices are still on 5g NSA |
| 92 | |
| 93 | Returns: |
| 94 | True if success. |
| 95 | False if failed. |
| 96 | """ |
| 97 | |
| 98 | ads = self.android_devices |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 99 | if not provision_both_devices_for_volte(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 100 | return False |
| 101 | |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 102 | if not provision_device_for_5g(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 103 | return False |
| 104 | |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 105 | if not _sms_test_mo(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 106 | return False |
| 107 | |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 108 | if not hangup_call(self.log, ads[0]): |
| 109 | ads[0].log.info("Failed to hang up call.!") |
| 110 | return False |
| 111 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 112 | if not verify_5g_attach_for_both_devices(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 113 | return False |
| 114 | |
| 115 | self.log.info("PASS - VoLTE SMS test over 5G NSA validated") |
| 116 | return True |
| 117 | |
Pratik Sheth | f9d0d2b | 2021-03-19 15:38:44 -0700 | [diff] [blame] | 118 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 119 | @test_tracker_info(uuid="49bfb4b3-a6ec-45d4-ad96-09282fb07d1d") |
| 120 | @TelephonyBaseTest.tel_test_wrap |
| 121 | def test_5g_nsa_sms_mo_mt_in_call_volte(self): |
| 122 | """ Test MO SMS during a MO VoLTE call over 5G NSA. |
| 123 | |
| 124 | Provision devices on VoLTE |
| 125 | Provision devices in 5g NSA |
| 126 | Make a Voice call from PhoneA to PhoneB |
| 127 | Send and Verify SMS from PhoneA to PhoneB |
| 128 | Verify both devices are still on 5g NSA |
| 129 | |
| 130 | Returns: |
| 131 | True if pass; False if fail. |
| 132 | """ |
| 133 | ads = self.android_devices |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 134 | if not provision_both_devices_for_volte(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 135 | return False |
| 136 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 137 | |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 138 | if not provision_device_for_5g(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 139 | return False |
| 140 | |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 141 | if not test_sms_mo_in_call(self.log, |
| 142 | ads, |
| 143 | caller_func=is_phone_in_call_volte): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 144 | return False |
| 145 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 146 | if not verify_5g_attach_for_both_devices(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 147 | return False |
| 148 | return True |
| 149 | |
Pratik Sheth | f9d0d2b | 2021-03-19 15:38:44 -0700 | [diff] [blame] | 150 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 151 | @test_tracker_info(uuid="1f914d5c-ac24-4794-9fcb-cb28e483d69a") |
| 152 | @TelephonyBaseTest.tel_test_wrap |
| 153 | def test_5g_nsa_sms_mo_mt_iwlan(self): |
| 154 | """ Test SMS text function between two phones, |
| 155 | Phones in APM, WiFi connected, WFC Cell Preferred mode. |
| 156 | |
| 157 | Disable APM on both devices |
| 158 | Provision devices in 5g NSA |
| 159 | Provision devices for WFC Cell Pref with APM ON |
| 160 | Send and Verify SMS from PhoneA to PhoneB |
| 161 | |
| 162 | Returns: |
| 163 | True if pass; False if fail. |
| 164 | """ |
| 165 | |
| 166 | ads = self.android_devices |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 167 | if not disable_apm_mode_both_devices(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 168 | return False |
| 169 | |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 170 | if not provision_device_for_5g(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 171 | return False |
| 172 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 173 | if not provision_both_devices_for_wfc_cell_pref(self.log, |
| 174 | ads, |
| 175 | self.wifi_network_ssid, |
| 176 | self.wifi_network_pass, |
| 177 | apm_mode=True): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 178 | return False |
| 179 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 180 | |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 181 | if not _sms_test_mo(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 182 | return False |
| 183 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 184 | self.log.info("PASS - iwlan sms test over 5g nsa validated") |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 185 | return True |
| 186 | |
Pratik Sheth | f9d0d2b | 2021-03-19 15:38:44 -0700 | [diff] [blame] | 187 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 188 | @test_tracker_info(uuid="7274be32-b9dd-4ce3-83d1-f32ab14ce05e") |
| 189 | @TelephonyBaseTest.tel_test_wrap |
| 190 | def test_5g_nsa_sms_mo_mt_iwlan_apm_off(self): |
| 191 | """ Test MO SMS, Phone in APM off, WiFi connected, WFC WiFi Preferred mode. |
| 192 | |
| 193 | Disable APM on both devices |
| 194 | Provision devices in 5g NSA |
| 195 | Provision devices for WFC Wifi Pref with APM OFF |
| 196 | Send and Verify SMS from PhoneA to PhoneB |
| 197 | Verify 5g NSA attach for both devices |
| 198 | |
| 199 | Returns: |
| 200 | True if pass; False if fail. |
| 201 | """ |
| 202 | |
| 203 | ads = self.android_devices |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 204 | if not disable_apm_mode_both_devices(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 205 | return False |
| 206 | |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 207 | if not provision_device_for_5g(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 208 | return False |
| 209 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 210 | if not provision_both_devices_for_wfc_wifi_pref(self.log, |
| 211 | ads, |
| 212 | self.wifi_network_ssid, |
| 213 | self.wifi_network_pass, |
| 214 | apm_mode=False): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 215 | return False |
| 216 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 217 | |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 218 | if not _sms_test_mo(self.log, ads): |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 219 | self.log.error("failed to send receive sms over 5g nsa") |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 220 | return False |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 221 | self.log.info("PASS - iwlan sms test over 5g nsa validated") |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 222 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 223 | if not verify_5g_attach_for_both_devices(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 224 | return False |
| 225 | return True |
| 226 | |
Pratik Sheth | f9d0d2b | 2021-03-19 15:38:44 -0700 | [diff] [blame] | 227 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 228 | @test_tracker_info(uuid="2d1787f2-d6fe-4b41-b389-2a8f817594e4") |
| 229 | @TelephonyBaseTest.tel_test_wrap |
| 230 | def test_5g_nsa_sms_mo_mt_in_call_iwlan(self): |
| 231 | """ Test MO SMS, Phone in APM, WiFi connected, WFC WiFi Preferred mode. |
| 232 | |
| 233 | Disable APM on both devices |
| 234 | Provision devices in 5g NSA |
| 235 | Provision devices for WFC Wifi Pref with APM ON |
| 236 | Make a Voice call from PhoneA to PhoneB |
| 237 | Send and Verify SMS from PhoneA to PhoneB |
| 238 | |
| 239 | Returns: |
| 240 | True if pass; False if fail. |
| 241 | """ |
| 242 | |
| 243 | ads = self.android_devices |
| 244 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 245 | if not disable_apm_mode_both_devices(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 246 | return False |
| 247 | |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 248 | if not provision_device_for_5g(self.log, ads): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 249 | return False |
| 250 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 251 | if not provision_both_devices_for_wfc_wifi_pref(self.log, |
| 252 | ads, |
| 253 | self.wifi_network_ssid, |
| 254 | self.wifi_network_pass, |
| 255 | apm_mode=True): |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 256 | return False |
| 257 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 258 | |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 259 | return test_sms_mo_in_call(self.log, |
| 260 | ads, |
| 261 | caller_func=is_phone_in_call_iwlan) |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 262 | |
Pratik Sheth | f9d0d2b | 2021-03-19 15:38:44 -0700 | [diff] [blame] | 263 | |
Pratik Sheth | 8ad702b | 2021-03-05 09:44:49 -0800 | [diff] [blame] | 264 | @test_tracker_info(uuid="784062e8-02a4-49ce-8fc1-5359ab40bbdd") |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 265 | @TelephonyBaseTest.tel_test_wrap |
| 266 | def test_5g_nsa_sms_long_message_mo_mt(self): |
| 267 | """Test SMS basic function between two phone. Phones in nsa 5G network. |
| 268 | |
| 269 | Airplane mode is off. |
| 270 | Send SMS from PhoneA to PhoneB. |
| 271 | Verify received message on PhoneB is correct. |
| 272 | |
| 273 | Returns: |
| 274 | True if success. |
| 275 | False if failed. |
| 276 | """ |
| 277 | |
| 278 | ads = self.android_devices |
| 279 | |
| 280 | if not disable_apm_mode_both_devices(self.log, ads): |
| 281 | return False |
| 282 | |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 283 | if not provision_device_for_5g(self.log, ads): |
Pratik Sheth | aec72b7 | 2021-02-09 15:44:28 -0800 | [diff] [blame] | 284 | return False |
| 285 | |
| 286 | return _long_sms_test_mo(self.log, ads) |
| 287 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 288 | |
Pratik Sheth | 0df9f22 | 2021-04-05 17:55:51 -0700 | [diff] [blame] | 289 | @test_tracker_info(uuid="45dbd61a-6a90-473e-9cfa-03e2408d5f15") |
Pei Huang | 47d6a0b | 2021-04-05 23:35:49 +0800 | [diff] [blame] | 290 | @TelephonyBaseTest.tel_test_wrap |
| 291 | def test_5g_nsa_sms_mo_mt_in_call_csfb(self): |
| 292 | """ Test MO/MT SMS during a MO csfb call over 5G NSA. |
| 293 | |
| 294 | Disable APM on both devices |
| 295 | Set up PhoneA/B are in CSFB mode. |
| 296 | Provision PhoneA/B in 5g NSA. |
| 297 | Make sure PhoneA/B is able to make/receive call. |
| 298 | Call from PhoneA to PhoneB, accept on PhoneB, send SMS on PhoneA, |
| 299 | receive SMS on PhoneB. |
| 300 | |
| 301 | Returns: |
| 302 | True if pass; False if fail. |
| 303 | """ |
| 304 | ads = self.android_devices |
| 305 | |
| 306 | if not disable_apm_mode_both_devices(self.log, ads): |
| 307 | return False |
| 308 | |
| 309 | if not provision_both_devices_for_csfb(self.log, ads): |
| 310 | return False |
| 311 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 312 | |
| 313 | if not provision_both_devices_for_5g(self.log, ads): |
| 314 | return False |
| 315 | |
| 316 | return test_sms_mo_in_call(self.log, |
| 317 | ads, |
| 318 | caller_func=is_phone_in_call_csfb) |
| 319 | |
Jaineel | 4e4a96a | 2020-12-03 15:11:10 -0800 | [diff] [blame] | 320 | """ Tests End """ |