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 connectivity tests in telephony
18"""
19
20import time
21from acts.test_decorators import test_tracker_info
22from acts.controllers.anritsu_lib._anritsu_utils import AnritsuError
23from acts.controllers.anritsu_lib.md8475a import MD8475A
24from acts.controllers.anritsu_lib.md8475a import VirtualPhoneStatus
25from acts.test_utils.tel.anritsu_utils import set_system_model_1x
26from acts.test_utils.tel.anritsu_utils import set_system_model_gsm
27from acts.test_utils.tel.anritsu_utils import set_system_model_lte
28from acts.test_utils.tel.anritsu_utils import set_system_model_wcdma
29from acts.test_utils.tel.anritsu_utils import sms_mo_send
30from acts.test_utils.tel.anritsu_utils import sms_mt_receive_verify
31from acts.test_utils.tel.anritsu_utils import set_usim_parameters
32from acts.test_utils.tel.anritsu_utils import set_post_sim_params
33from acts.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED
34from acts.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED
35from acts.test_utils.tel.tel_defines import NETWORK_MODE_CDMA
36from acts.test_utils.tel.tel_defines import NETWORK_MODE_GSM_ONLY
37from acts.test_utils.tel.tel_defines import NETWORK_MODE_GSM_UMTS
38from acts.test_utils.tel.tel_defines import NETWORK_MODE_LTE_GSM_WCDMA
39from acts.test_utils.tel.tel_defines import RAT_1XRTT
40from acts.test_utils.tel.tel_defines import RAT_GSM
41from acts.test_utils.tel.tel_defines import RAT_LTE
42from acts.test_utils.tel.tel_defines import RAT_WCDMA
43from acts.test_utils.tel.tel_defines import RAT_FAMILY_CDMA2000
44from acts.test_utils.tel.tel_defines import RAT_FAMILY_GSM
45from acts.test_utils.tel.tel_defines import RAT_FAMILY_LTE
46from acts.test_utils.tel.tel_defines import RAT_FAMILY_UMTS
47from acts.test_utils.tel.tel_test_utils import ensure_network_rat
48from acts.test_utils.tel.tel_test_utils import ensure_phones_idle
49from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
50from acts.test_utils.tel.tel_test_utils import toggle_volte
51from acts.test_utils.tel.tel_test_utils import set_preferred_apn_by_adb
52from acts.test_utils.tel.tel_defines import CALL_TEARDOWN_PHONE
53from acts.test_utils.tel.tel_defines import RAT_FAMILY_CDMA2000
54from acts.test_utils.tel.tel_defines import RAT_FAMILY_GSM
55from acts.test_utils.tel.tel_defines import RAT_FAMILY_LTE
56from acts.test_utils.tel.tel_defines import RAT_FAMILY_UMTS
57from acts.test_utils.tel.tel_defines import RAT_1XRTT
58from acts.test_utils.tel.tel_defines import NETWORK_MODE_CDMA
59from acts.test_utils.tel.tel_defines import NETWORK_MODE_GSM_ONLY
60from acts.test_utils.tel.tel_defines import NETWORK_MODE_GSM_UMTS
61from acts.test_utils.tel.tel_defines import NETWORK_MODE_LTE_CDMA_EVDO
62from acts.test_utils.tel.tel_defines import NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
63from acts.test_utils.tel.tel_defines import NETWORK_MODE_LTE_GSM_WCDMA
64from acts.utils import rand_ascii_str
65
66SINGLE_PART_LEN = 40
67MULTI_PART_LEN = 180
68SINGLE_PART_LEN_75 = 75
69
70
71class TelLabSmsTest(TelephonyBaseTest):
72    phoneNumber = "911"
73    SETTLING_TIME = 15
74
75    def setup_class(self):
76        super().setup_class()
77        self.ad = self.android_devices[0]
78        self.md8475a_ip_address = self.user_params[
79            "anritsu_md8475a_ip_address"]
80        self.ad.sim_card = getattr(self.ad, "sim_card", None)
81        self.wlan_option = self.user_params.get("anritsu_wlan_option", False)
82        self.md8475_version = self.user_params.get("md8475", "A")
83
84        try:
85            self.anritsu = MD8475A(self.md8475a_ip_address, self.wlan_option,
86                                   self.md8475_version)
87        except AnritsuError:
88            self.log.error("Error in connecting to Anritsu Simulator")
89            return False
90        return True
91
92    def setup_test(self):
93        ensure_phones_idle(self.log, self.android_devices)
94        self.virtualPhoneHandle = self.anritsu.get_VirtualPhone()
95        self.ad.droid.connectivityToggleAirplaneMode(True)
96        return True
97
98    def teardown_test(self):
99        self.log.info("Stopping Simulation")
100        self.anritsu.stop_simulation()
101        self.ad.droid.connectivityToggleAirplaneMode(True)
102        return True
103
104    def teardown_class(self):
105        self.anritsu.disconnect()
106        return True
107
108    def _phone_setup_volte(self, ad):
109        ad.droid.telephonyToggleDataConnection(True)
110        toggle_volte(self.log, ad, True)
111        return ensure_network_rat(
112            self.log,
113            ad,
114            NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA,
115            RAT_FAMILY_LTE,
116            toggle_apm_after_setting=True)
117
118    def _phone_setup_wcdma(self, ad):
119        return ensure_network_rat(
120            self.log,
121            ad,
122            NETWORK_MODE_GSM_UMTS,
123            RAT_FAMILY_UMTS,
124            toggle_apm_after_setting=True)
125
126    def _phone_setup_gsm(self, ad):
127        return ensure_network_rat(
128            self.log,
129            ad,
130            NETWORK_MODE_GSM_ONLY,
131            RAT_FAMILY_GSM,
132            toggle_apm_after_setting=True)
133
134    def _phone_setup_1x(self, ad):
135        return ensure_network_rat(
136            self.log,
137            ad,
138            NETWORK_MODE_CDMA,
139            RAT_FAMILY_CDMA2000,
140            toggle_apm_after_setting=True)
141
142
143    def _setup_sms(self,
144                   set_simulation_func,
145                   phone_setup_func,
146                   rat,
147                   phone_number,
148                   message,
149                   mo_mt=DIRECTION_MOBILE_ORIGINATED):
150        try:
151            [self.bts1] = set_simulation_func(self.anritsu, self.user_params,
152                                              self.ad.sim_card)
153            set_usim_parameters(self.anritsu, self.ad.sim_card)
154            if rat == RAT_LTE:
155                set_post_sim_params(self.anritsu, self.user_params,
156                                    self.ad.sim_card)
157            self.anritsu.start_simulation()
158            self.anritsu.send_command("IMSSTARTVN 1")
159            self.anritsu.send_command("IMSSTARTVN 2")
160            self.anritsu.send_command("IMSSTARTVN 3")
161
162            if rat == RAT_LTE:
163                preferred_network_setting = NETWORK_MODE_LTE_GSM_WCDMA
164                rat_family = RAT_FAMILY_LTE
165            elif rat == RAT_WCDMA:
166                preferred_network_setting = NETWORK_MODE_GSM_UMTS
167                rat_family = RAT_FAMILY_UMTS
168            elif rat == RAT_GSM:
169                preferred_network_setting = NETWORK_MODE_GSM_ONLY
170                rat_family = RAT_FAMILY_GSM
171            elif rat == RAT_1XRTT:
172                preferred_network_setting = NETWORK_MODE_CDMA
173                rat_family = RAT_FAMILY_CDMA2000
174            else:
175                self.log.error("No valid RAT provided for SMS test.")
176                return False
177
178            if phone_setup_func is not None:
179                if not phone_setup_func(self.ad):
180                    self.log.warning(
181                        "phone_setup_func failed. Rebooting UE")
182                    self.ad.reboot()
183                    time.sleep(30)
184                    if self.ad.sim_card == "VzW12349":
185                        set_preferred_apn_by_adb(self.ad, "VZWINTERNET")
186                    if not phone_setup_func(self.ad):
187                        self.log.error("phone_setup_func failed.")
188                        return False
189
190            self.anritsu.wait_for_registration_state()
191            time.sleep(self.SETTLING_TIME)
192            if mo_mt == DIRECTION_MOBILE_ORIGINATED:
193                if not sms_mo_send(self.log, self.ad, self.virtualPhoneHandle,
194                                   phone_number, message, rat):
195                    self.log.error("Phone {} Failed to send SMS"
196                                   .format(self.ad.serial))
197                    return False
198            else:
199                if not sms_mt_receive_verify(self.log, self.ad,
200                                             self.virtualPhoneHandle,
201                                             phone_number, message, rat):
202                    self.log.error("Phone {} Failed to receive MT SMS"
203                                   .format(self.ad.serial))
204                    return False
205
206        except AnritsuError as e:
207            self.log.error("Error in connection with Anritsu Simulator: " +
208                           str(e))
209            return False
210        except Exception as e:
211            self.log.error("Exception during emergency call procedure: " +
212                           str(e))
213            return False
214        return True
215
216    def insert_string_into_message(self, message, string, index):
217        return message[:index] + string + message[index:]
218
219    """ Tests Begin """
220
221    @test_tracker_info(uuid="e7e6187a-3054-4f31-a8e5-cff8b3282674")
222    @TelephonyBaseTest.tel_test_wrap
223    def test_mo_sms_singlepart_lte(self):
224        """ Test MO SMS(less than 160 charcters) functionality on LTE
225
226        Make Sure Phone is in LTE mode
227        Send a SMS from Phone
228        Verify Anritsu receives the SMS
229
230        Returns:
231            True if pass; False if fail
232        """
233        return self._setup_sms(set_system_model_lte, self._phone_setup_volte,
234                               RAT_LTE, self.phoneNumber,
235                               rand_ascii_str(SINGLE_PART_LEN),
236                               DIRECTION_MOBILE_ORIGINATED)
237
238    @test_tracker_info(uuid="40a65c88-c6b1-4044-ac00-2847c2367821")
239    @TelephonyBaseTest.tel_test_wrap
240    def test_mt_sms_singlepart_lte(self):
241        """ Test MT SMS(less than 160 charcters) functionality on LTE
242
243        Make Sure Phone is in LTE mode
244        Send a SMS from Anritsu
245        Verify Phone receives the SMS
246
247        Returns:
248            True if pass; False if fail
249        """
250        return self._setup_sms(set_system_model_lte, self._phone_setup_volte,
251                               RAT_LTE, self.phoneNumber,
252                               rand_ascii_str(SINGLE_PART_LEN),
253                               DIRECTION_MOBILE_TERMINATED)
254
255    @test_tracker_info(uuid="6a439b24-98e5-43a0-84fc-d4050478116d")
256    @TelephonyBaseTest.tel_test_wrap
257    def test_mo_sms_multipart_lte(self):
258        """ Test MO SMS(more than 160 charcters) functionality on LTE
259
260        Make Sure Phone is in LTE mode
261        Send a SMS from Phone
262        Verify Anritsu receives the SMS
263
264        Returns:
265            True if pass; False if fail
266        """
267        return self._setup_sms(set_system_model_lte, self._phone_setup_volte,
268                               RAT_LTE, self.phoneNumber,
269                               rand_ascii_str(MULTI_PART_LEN),
270                               DIRECTION_MOBILE_ORIGINATED)
271
272    @test_tracker_info(uuid="6ba7c165-ff4c-4531-aabe-9695a1d37992")
273    @TelephonyBaseTest.tel_test_wrap
274    def test_mt_sms_multipart_lte(self):
275        """ Test MT SMS(more than 160 charcters) functionality on LTE
276
277        Make Sure Phone is in LTE mode
278        Send a SMS from Anritsu
279        Verify Phone receives the SMS
280
281        Returns:
282            True if pass; False if fail
283        """
284        return self._setup_sms(set_system_model_lte, self._phone_setup_volte,
285                               RAT_LTE, self.phoneNumber,
286                               rand_ascii_str(MULTI_PART_LEN),
287                               DIRECTION_MOBILE_TERMINATED)
288
289    @TelephonyBaseTest.tel_test_wrap
290    def test_mo_sms_singlepart_eacute_lte(self):
291        """ Test MO SMS(single part contains é) functionality on LTE
292
293        Make Sure Phone is in LTE mode
294        Send a SMS from Phone
295        Verify Anritsu receives the SMS
296
297        Returns:
298            True if pass; False if fail
299        """
300        text = self.insert_string_into_message(
301            rand_ascii_str(SINGLE_PART_LEN), "single part contains é", 10)
302        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
303                               text, DIRECTION_MOBILE_ORIGINATED)
304
305    @TelephonyBaseTest.tel_test_wrap
306    def test_mt_sms_singlepart_eacute_lte(self):
307        """ Test MT SMS(single part contains é) functionality on LTE
308
309        Make Sure Phone is in LTE mode
310        Send a SMS from Anritsu
311        Verify Phone receives the SMS
312
313        Returns:
314            True if pass; False if fail
315        """
316        text = self.insert_string_into_message(
317            rand_ascii_str(SINGLE_PART_LEN), "single part contains é", 10)
318        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
319                               text, DIRECTION_MOBILE_TERMINATED)
320
321    @TelephonyBaseTest.tel_test_wrap
322    def test_mo_sms_multipart1_eacute_lte(self):
323        """ Test MO SMS(multi part contains é in first part) functionality on
324        LTE
325
326        Make Sure Phone is in LTE mode
327        Send a SMS from Phone
328        Verify Anritsu receives the SMS
329
330        Returns:
331            True if pass; False if fail
332        """
333        text = self.insert_string_into_message(
334            rand_ascii_str(MULTI_PART_LEN),
335            "multi part contains é in first part", 10)
336        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
337                               text, DIRECTION_MOBILE_ORIGINATED)
338
339    @TelephonyBaseTest.tel_test_wrap
340    def test_mt_sms_multipart1_eacute_lte(self):
341        """ Test MT SMS(multi part contains é in first part) functionality on
342        LTE
343
344        Make Sure Phone is in LTE mode
345        Send a SMS from Anritsu
346        Verify Phone receives the SMS
347
348        Returns:
349            True if pass; False if fail
350        """
351        text = self.insert_string_into_message(
352            rand_ascii_str(MULTI_PART_LEN),
353            "multi part contains é in first part", 10)
354        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
355                               text, DIRECTION_MOBILE_TERMINATED)
356
357    @TelephonyBaseTest.tel_test_wrap
358    def test_mo_sms_multipart2_eacute_lte(self):
359        """ Test MO SMS(multi part contains é in second part) functionality on
360        LTE
361
362        Make Sure Phone is in LTE mode
363        Send a SMS from Phone
364        Verify Anritsu receives the SMS
365
366        Returns:
367            True if pass; False if fail
368        """
369        text = self.insert_string_into_message(
370            rand_ascii_str(MULTI_PART_LEN),
371            "multi part contains é in second part", 170)
372        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
373                               text, DIRECTION_MOBILE_ORIGINATED)
374
375    @TelephonyBaseTest.tel_test_wrap
376    def test_mt_sms_multipart2_eacute_lte(self):
377        """ Test MT SMS(multi part contains é in second part) functionality on
378        LTE
379
380        Make Sure Phone is in LTE mode
381        Send a SMS from Anritsu
382        Verify Phone receives the SMS
383
384        Returns:
385            True if pass; False if fail
386        """
387        text = self.insert_string_into_message(
388            rand_ascii_str(MULTI_PART_LEN),
389            "multi part contains é in second part", 10)
390        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
391                               text, DIRECTION_MOBILE_TERMINATED)
392
393    @TelephonyBaseTest.tel_test_wrap
394    def test_mo_sms_multipart12_eacute_lte(self):
395        """ Test MO SMS(multi part contains é in both parts) functionality on LTE
396
397        Make Sure Phone is in LTE mode
398        Send a SMS from Phone
399        Verify Anritsu receives the SMS
400
401        Returns:
402            True if pass; False if fail
403        """
404        text = rand_ascii_str(MULTI_PART_LEN)
405        text = self.insert_string_into_message(text, "é in first part", 50)
406        text = self.insert_string_into_message(text, "é in second part", 170)
407        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
408                               text, DIRECTION_MOBILE_ORIGINATED)
409
410    @TelephonyBaseTest.tel_test_wrap
411    def test_mt_sms_multipart12_eacute_lte(self):
412        """ Test MT SMS(multi part contains é in both parts) functionality on LTE
413
414        Make Sure Phone is in LTE mode
415        Send a SMS from Anritsu
416        Verify Phone receives the SMS
417
418        Returns:
419            True if pass; False if fail
420        """
421        text = rand_ascii_str(MULTI_PART_LEN)
422        text = self.insert_string_into_message(text, "é in first part", 50)
423        text = self.insert_string_into_message(text, "é in second part", 170)
424        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
425                               text, DIRECTION_MOBILE_TERMINATED)
426
427    @TelephonyBaseTest.tel_test_wrap
428    def test_mo_sms_singlepart_71chars_eacute_lte(self):
429        """ Test MO SMS(single part more than 71 characters with é)
430        functionality on LTE
431
432        Make Sure Phone is in LTE mode
433        Send a SMS from Phone
434        Verify Anritsu receives the SMS
435
436        Returns:
437            True if pass; False if fail
438        """
439        text = self.insert_string_into_message(
440            rand_ascii_str(SINGLE_PART_LEN_75),
441            "single part more than 71 characters with é", 72)
442        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
443                               text, DIRECTION_MOBILE_ORIGINATED)
444
445    @TelephonyBaseTest.tel_test_wrap
446    def test_mt_sms_singlepart_71chars_eacute_lte(self):
447        """ Test MT SMS(single part more than 71 characters with é)
448        functionality on LTE
449
450        Make Sure Phone is in LTE mode
451        Send a SMS from Anritsu
452        Verify  Phone receives the SMS
453
454        Returns:
455            True if pass; False if fail
456        """
457        text = self.insert_string_into_message(
458            rand_ascii_str(SINGLE_PART_LEN_75),
459            "single part more than 71 characters with é", 72)
460        return self._setup_sms(set_system_model_lte, RAT_LTE, self.phoneNumber,
461                               text, DIRECTION_MOBILE_TERMINATED)
462
463    @test_tracker_info(uuid="9637923e-bbb5-4839-924d-325719e67f31")
464    @TelephonyBaseTest.tel_test_wrap
465    def test_mo_sms_singlepart_wcdma(self):
466        """ Test MO SMS(less than 160 charcters) functionality on WCDMA
467
468        Make Sure Phone is in WCDMA mode
469        Send a SMS from Phone
470        Verify Anritsu receives the SMS
471
472        Returns:
473            True if pass; False if fail
474        """
475        return self._setup_sms(
476            set_system_model_wcdma, self._phone_setup_wcdma,
477            RAT_WCDMA, self.phoneNumber,
478            rand_ascii_str(SINGLE_PART_LEN), DIRECTION_MOBILE_ORIGINATED)
479
480    @test_tracker_info(uuid="da8e0850-ca57-4521-84bc-e823f67d01fb")
481    @TelephonyBaseTest.tel_test_wrap
482    def test_mt_sms_singlepart_wcdma(self):
483        """ Test MT SMS(less than 160 charcters) functionality on WCDMA
484
485        Make Sure Phone is in WCDMA mode
486        Send a SMS from Anritsu
487        Verify Phone receives the SMS
488
489        Returns:
490            True if pass; False if fail
491        """
492        return self._setup_sms(
493            set_system_model_wcdma, self._phone_setup_wcdma,
494            RAT_WCDMA, self.phoneNumber,
495            rand_ascii_str(SINGLE_PART_LEN), DIRECTION_MOBILE_TERMINATED)
496
497    @test_tracker_info(uuid="5abfb6b6-3790-40d7-afd5-d4e1fd5e48f2")
498    @TelephonyBaseTest.tel_test_wrap
499    def test_mo_sms_multipart_wcdma(self):
500        """ Test MO SMS(more than 160 charcters) functionality on WCDMA
501
502        Make Sure Phone is in WCDMA mode
503        Send a SMS from Phone
504        Verify Anritsu receives the SMS
505
506        Returns:
507            True if pass; False if fail
508        """
509        return self._setup_sms(
510            set_system_model_wcdma, self._phone_setup_wcdma,
511            RAT_WCDMA, self.phoneNumber,
512            rand_ascii_str(MULTI_PART_LEN), DIRECTION_MOBILE_ORIGINATED)
513
514    @test_tracker_info(uuid="1b3882c8-fc63-4f2b-a9d7-2f082e7aac92")
515    @TelephonyBaseTest.tel_test_wrap
516    def test_mt_sms_multipart_wcdma(self):
517        """ Test MT SMS(more than 160 charcters) functionality on WCDMA
518
519        Make Sure Phone is in WCDMA mode
520        Send a SMS from Anritsu
521        Verify Phone receives the SMS
522
523        Returns:
524            True if pass; False if fail
525        """
526        return self._setup_sms(
527            set_system_model_wcdma, self._phone_setup_wcdma,
528            RAT_WCDMA, self.phoneNumber,
529            rand_ascii_str(MULTI_PART_LEN), DIRECTION_MOBILE_TERMINATED)
530
531    @TelephonyBaseTest.tel_test_wrap
532    def test_mo_sms_singlepart_eacute_wcdma(self):
533        """ Test MO SMS(single part contains é) functionality on WCDMA
534
535        Make Sure Phone is in WCDMA mode
536        Send a SMS from Phone
537        Verify Anritsu receives the SMS
538
539        Returns:
540            True if pass; False if fail
541        """
542        text = self.insert_string_into_message(
543            rand_ascii_str(SINGLE_PART_LEN), "single part contains é", 10)
544        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
545                               self.phoneNumber, text,
546                               DIRECTION_MOBILE_ORIGINATED)
547
548    @TelephonyBaseTest.tel_test_wrap
549    def test_mt_sms_singlepart_eacute_wcdma(self):
550        """ Test MT SMS(single part contains é) functionality on WCDMA
551
552        Make Sure Phone is in WCDMA mode
553        Send a SMS from Anritsu
554        Verify Phone receives the SMS
555
556        Returns:
557            True if pass; False if fail
558        """
559        text = self.insert_string_into_message(
560            rand_ascii_str(SINGLE_PART_LEN), "single part contains é", 10)
561        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
562                               self.phoneNumber, text,
563                               DIRECTION_MOBILE_TERMINATED)
564
565    @TelephonyBaseTest.tel_test_wrap
566    def test_mo_sms_multipart1_eacute_wcdma(self):
567        """ Test MO SMS(multi part contains é in first part) functionality on
568        WCDMA
569
570        Make Sure Phone is in WCDMA mode
571        Send a SMS from Phone
572        Verify Anritsu receives the SMS
573
574        Returns:
575            True if pass; False if fail
576        """
577        text = self.insert_string_into_message(
578            rand_ascii_str(MULTI_PART_LEN),
579            "multi part contains é in first part", 10)
580        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
581                               self.phoneNumber, text,
582                               DIRECTION_MOBILE_ORIGINATED)
583
584    @TelephonyBaseTest.tel_test_wrap
585    def test_mt_sms_multipart1_eacute_wcdma(self):
586        """ Test MT SMS(multi part contains é in first part) functionality on
587        WCDMA
588
589        Make Sure Phone is in WCDMA mode
590        Send a SMS from Anritsu
591        Verify Phone receives the SMS
592
593        Returns:
594            True if pass; False if fail
595        """
596        text = self.insert_string_into_message(
597            rand_ascii_str(MULTI_PART_LEN),
598            "multi part contains é in first part", 10)
599        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
600                               self.phoneNumber, text,
601                               DIRECTION_MOBILE_TERMINATED)
602
603    @TelephonyBaseTest.tel_test_wrap
604    def test_mo_sms_multipart2_eacute_wcdma(self):
605        """ Test MO SMS(multi part contains é in second part) functionality on
606        WCDMA
607
608        Make Sure Phone is in WCDMA mode
609        Send a SMS from Phone
610        Verify Anritsu receives the SMS
611
612        Returns:
613            True if pass; False if fail
614        """
615        text = self.insert_string_into_message(
616            rand_ascii_str(MULTI_PART_LEN),
617            "multi part contains é in second part", 170)
618        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
619                               self.phoneNumber, text,
620                               DIRECTION_MOBILE_ORIGINATED)
621
622    @TelephonyBaseTest.tel_test_wrap
623    def test_mt_sms_multipart2_eacute_wcdma(self):
624        """ Test MT SMS(multi part contains é in second part) functionality on
625        WCDMA
626
627        Make Sure Phone is in WCDMA mode
628        Send a SMS from Anritsu
629        Verify Phone receives the SMS
630
631        Returns:
632            True if pass; False if fail
633        """
634        text = self.insert_string_into_message(
635            rand_ascii_str(MULTI_PART_LEN),
636            "multi part contains é in second part", 10)
637        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
638                               self.phoneNumber, text,
639                               DIRECTION_MOBILE_TERMINATED)
640
641    @TelephonyBaseTest.tel_test_wrap
642    def test_mo_sms_multipart12_eacute_wcdma(self):
643        """ Test MO SMS(multi part contains é in both parts) functionality on WCDMA
644
645        Make Sure Phone is in WCDMA mode
646        Send a SMS from Phone
647        Verify Anritsu receives the SMS
648
649        Returns:
650            True if pass; False if fail
651        """
652        text = rand_ascii_str(MULTI_PART_LEN)
653        text = self.insert_string_into_message(text, "é in first part", 50)
654        text = self.insert_string_into_message(text, "é in second part", 170)
655        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
656                               self.phoneNumber, text,
657                               DIRECTION_MOBILE_ORIGINATED)
658
659    @TelephonyBaseTest.tel_test_wrap
660    def test_mt_sms_multipart12_eacute_wcdma(self):
661        """ Test MT SMS(multi part contains é in both parts) functionality on WCDMA
662
663        Make Sure Phone is in WCDMA mode
664        Send a SMS from Anritsu
665        Verify Phone receives the SMS
666
667        Returns:
668            True if pass; False if fail
669        """
670        text = rand_ascii_str(MULTI_PART_LEN)
671        text = self.insert_string_into_message(text, "é in first part", 50)
672        text = self.insert_string_into_message(text, "é in second part", 170)
673        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
674                               self.phoneNumber, text,
675                               DIRECTION_MOBILE_TERMINATED)
676
677    @TelephonyBaseTest.tel_test_wrap
678    def test_mo_sms_singlepart_71chars_eacute_wcdma(self):
679        """ Test MO SMS(single part more than 71 characters with é)
680        functionality on WCDMA
681
682        Make Sure Phone is in WCDMA mode
683        Send a SMS from Phone
684        Verify Anritsu receives the SMS
685
686        Returns:
687            True if pass; False if fail
688        """
689        text = self.insert_string_into_message(
690            rand_ascii_str(SINGLE_PART_LEN_75),
691            "single part more than 71 characters with é", 72)
692        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
693                               self.phoneNumber, text,
694                               DIRECTION_MOBILE_ORIGINATED)
695
696    @TelephonyBaseTest.tel_test_wrap
697    def test_mt_sms_singlepart_71chars_eacute_wcdma(self):
698        """ Test MT SMS(single part more than 71 characters with é)
699        functionality on WCDMA
700
701        Make Sure Phone is in WCDMA mode
702        Send a SMS from Anritsu
703        Verify  Phone receives the SMS
704
705        Returns:
706            True if pass; False if fail
707        """
708        text = self.insert_string_into_message(
709            rand_ascii_str(SINGLE_PART_LEN_75),
710            "single part more than 71 characters with é", 72)
711        return self._setup_sms(set_system_model_wcdma, RAT_WCDMA,
712                               self.phoneNumber, text,
713                               DIRECTION_MOBILE_TERMINATED)
714
715    @test_tracker_info(uuid="7d6da36b-9ce3-4f19-a276-6f51c2b8b5f7")
716    @TelephonyBaseTest.tel_test_wrap
717    def test_mo_sms_singlepart_gsm(self):
718        """ Test MO SMS(less than 160 charcters) functionality on GSM
719
720        Make Sure Phone is in GSM mode
721        Send a SMS from Phone
722        Verify Anritsu receives the SMS
723
724        Returns:
725            True if pass; False if fail
726        """
727        return self._setup_sms(set_system_model_gsm, self._phone_setup_gsm,
728                               RAT_GSM, self.phoneNumber,
729                               rand_ascii_str(SINGLE_PART_LEN),
730                               DIRECTION_MOBILE_ORIGINATED)
731
732    @test_tracker_info(uuid="8e0d745a-db61-433c-9179-4b28c1aea0d3")
733    @TelephonyBaseTest.tel_test_wrap
734    def test_mt_sms_singlepart_gsm(self):
735        """ Test MT SMS(less than 160 charcters) functionality on GSM
736
737        Make Sure Phone is in GSM mode
738        Send a SMS from Anritsu
739        Verify Phone receives the SMS
740
741        Returns:
742            True if pass; False if fail
743        """
744        return self._setup_sms(set_system_model_gsm, self._phone_setup_gsm,
745                               RAT_GSM, self.phoneNumber,
746                               rand_ascii_str(SINGLE_PART_LEN),
747                               DIRECTION_MOBILE_TERMINATED)
748
749    @test_tracker_info(uuid="35df99ae-f55e-4fd2-993b-13528f50ce4b")
750    @TelephonyBaseTest.tel_test_wrap
751    def test_mo_sms_multipart_gsm(self):
752        """ Test MO SMS(more than 160 charcters) functionality on GSM
753
754        Make Sure Phone is in GSM mode
755        Send a SMS from Phone
756        Verify Anritsu receives the SMS
757
758        Returns:
759            True if pass; False if fail
760        """
761        return self._setup_sms(set_system_model_gsm, self._phone_setup_gsm,
762                               RAT_GSM, self.phoneNumber,
763                               rand_ascii_str(MULTI_PART_LEN),
764                               DIRECTION_MOBILE_ORIGINATED)
765
766    @test_tracker_info(uuid="6bff7780-15f7-4bf5-b7e3-9311d7ba68e7")
767    @TelephonyBaseTest.tel_test_wrap
768    def test_mt_sms_multipart_gsm(self):
769        """ Test MT SMS(more than 160 charcters) functionality on GSM
770
771        Make Sure Phone is in GSM mode
772        Send a SMS from Anritsu
773        Verify Phone receives the SMS
774
775        Returns:
776            True if pass; False if fail
777        """
778        return self._setup_sms(set_system_model_gsm, self._phone_setup_gsm,
779                               RAT_GSM, self.phoneNumber,
780                               rand_ascii_str(MULTI_PART_LEN),
781                               DIRECTION_MOBILE_TERMINATED)
782
783    @TelephonyBaseTest.tel_test_wrap
784    def test_mo_sms_singlepart_eacute_gsm(self):
785        """ Test MO SMS(single part contains é) functionality on GSM
786
787        Make Sure Phone is in GSM mode
788        Send a SMS from Phone
789        Verify Anritsu receives the SMS
790
791        Returns:
792            True if pass; False if fail
793        """
794        text = self.insert_string_into_message(
795            rand_ascii_str(SINGLE_PART_LEN), "single part contains é", 10)
796        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
797                               text, DIRECTION_MOBILE_ORIGINATED)
798
799    @TelephonyBaseTest.tel_test_wrap
800    def test_mt_sms_singlepart_eacute_gsm(self):
801        """ Test MT SMS(single part contains é) functionality on GSM
802
803        Make Sure Phone is in GSM mode
804        Send a SMS from Anritsu
805        Verify Phone receives the SMS
806
807        Returns:
808            True if pass; False if fail
809        """
810        text = self.insert_string_into_message(
811            rand_ascii_str(SINGLE_PART_LEN), "single part contains é", 10)
812        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
813                               text, DIRECTION_MOBILE_TERMINATED)
814
815    @TelephonyBaseTest.tel_test_wrap
816    def test_mo_sms_multipart1_eacute_gsm(self):
817        """ Test MO SMS(multi part contains é in first part) functionality on
818        GSM
819
820        Make Sure Phone is in GSM mode
821        Send a SMS from Phone
822        Verify Anritsu receives the SMS
823
824        Returns:
825            True if pass; False if fail
826        """
827        text = self.insert_string_into_message(
828            rand_ascii_str(MULTI_PART_LEN),
829            "multi part contains é in first part", 10)
830        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
831                               text, DIRECTION_MOBILE_ORIGINATED)
832
833    @TelephonyBaseTest.tel_test_wrap
834    def test_mt_sms_multipart1_eacute_gsm(self):
835        """ Test MT SMS(multi part contains é in first part) functionality on
836        GSM
837
838        Make Sure Phone is in GSM mode
839        Send a SMS from Anritsu
840        Verify Phone receives the SMS
841
842        Returns:
843            True if pass; False if fail
844        """
845        text = self.insert_string_into_message(
846            rand_ascii_str(MULTI_PART_LEN),
847            "multi part contains é in first part", 10)
848        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
849                               text, DIRECTION_MOBILE_TERMINATED)
850
851    @TelephonyBaseTest.tel_test_wrap
852    def test_mo_sms_multipart2_eacute_gsm(self):
853        """ Test MO SMS(multi part contains é in second part) functionality on
854        GSM
855
856        Make Sure Phone is in GSM mode
857        Send a SMS from Phone
858        Verify Anritsu receives the SMS
859
860        Returns:
861            True if pass; False if fail
862        """
863        text = self.insert_string_into_message(
864            rand_ascii_str(MULTI_PART_LEN),
865            "multi part contains é in second part", 170)
866        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
867                               text, DIRECTION_MOBILE_ORIGINATED)
868
869    @TelephonyBaseTest.tel_test_wrap
870    def test_mt_sms_multipart2_eacute_gsm(self):
871        """ Test MT SMS(multi part contains é in second part) functionality on
872        GSM
873
874        Make Sure Phone is in GSM mode
875        Send a SMS from Anritsu
876        Verify Phone receives the SMS
877
878        Returns:
879            True if pass; False if fail
880        """
881        text = self.insert_string_into_message(
882            rand_ascii_str(MULTI_PART_LEN),
883            "multi part contains é in second part", 170)
884        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
885                               text, DIRECTION_MOBILE_TERMINATED)
886
887    @TelephonyBaseTest.tel_test_wrap
888    def test_mo_sms_multipart12_eacute_gsm(self):
889        """ Test MO SMS(multi part contains é in both parts) functionality on GSM
890
891        Make Sure Phone is in GSM mode
892        Send a SMS from Phone
893        Verify Anritsu receives the SMS
894
895        Returns:
896            True if pass; False if fail
897        """
898        text = rand_ascii_str(MULTI_PART_LEN)
899        text = self.insert_string_into_message(text, "é in first part", 50)
900        text = self.insert_string_into_message(text, "é in second part", 170)
901        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
902                               text, DIRECTION_MOBILE_ORIGINATED)
903
904    @TelephonyBaseTest.tel_test_wrap
905    def test_mt_sms_multipart12_eacute_gsm(self):
906        """ Test MT SMS(multi part contains é in both parts) functionality on GSM
907
908        Make Sure Phone is in GSM mode
909        Send a SMS from Anritsu
910        Verify Phone receives the SMS
911
912        Returns:
913            True if pass; False if fail
914        """
915        text = rand_ascii_str(MULTI_PART_LEN)
916        text = self.insert_string_into_message(text, "é in first part", 50)
917        text = self.insert_string_into_message(text, "é in second part", 170)
918        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
919                               text, DIRECTION_MOBILE_TERMINATED)
920
921    @TelephonyBaseTest.tel_test_wrap
922    def test_mo_sms_singlepart_71chars_eacute_gsm(self):
923        """ Test MO SMS(single part more than 71 characters with é)
924        functionality on GSM
925
926        Make Sure Phone is in GSM mode
927        Send a SMS from Phone
928        Verify Anritsu receives the SMS
929
930        Returns:
931            True if pass; False if fail
932        """
933        text = self.insert_string_into_message(
934            rand_ascii_str(SINGLE_PART_LEN_75),
935            "single part more than 71 characters with é", 72)
936        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
937                               text, DIRECTION_MOBILE_ORIGINATED)
938
939    @TelephonyBaseTest.tel_test_wrap
940    def test_mt_sms_singlepart_71chars_eacute_gsm(self):
941        """ Test MT SMS(single part more than 71 characters with é)
942        functionality on GSM
943
944        Make Sure Phone is in GSM mode
945        Send a SMS from Anritsu
946        Verify  Phone receives the SMS
947
948        Returns:
949            True if pass; False if fail
950        """
951        text = self.insert_string_into_message(
952            rand_ascii_str(SINGLE_PART_LEN_75),
953            "single part more than 71 characters with é", 72)
954        return self._setup_sms(set_system_model_gsm, RAT_GSM, self.phoneNumber,
955                               text, DIRECTION_MOBILE_TERMINATED)
956
957    @test_tracker_info(uuid="a044c8f7-4823-4b9e-b2be-572b6c6b1b54")
958    @TelephonyBaseTest.tel_test_wrap
959    def test_mo_sms_singlepart_1x(self):
960        """ Test MO SMS(less than 160 charcters) functionality on CDMA1X
961
962        Make Sure Phone is in CDMA1X mode
963        Send a SMS from Phone
964        Verify Anritsu receives the SMS
965
966        Returns:
967            True if pass; False if fail
968        """
969        return self._setup_sms(
970            set_system_model_1x, self._phone_setup_1x,
971            RAT_1XRTT, self.phoneNumber,
972            rand_ascii_str(SINGLE_PART_LEN), DIRECTION_MOBILE_ORIGINATED)
973
974    @test_tracker_info(uuid="da9afa0e-8a82-4f73-9a49-f506e28edefc")
975    @TelephonyBaseTest.tel_test_wrap
976    def test_mt_sms_singlepart_1x(self):
977        """ Test MT SMS(less than 160 charcters) functionality on CDMA1X
978
979        Make Sure Phone is in CDMA1X mode
980        Send a SMS from Anritsu
981        Verify Phone receives the SMS
982
983        Returns:
984            True if pass; False if fail
985        """
986        return self._setup_sms(
987            set_system_model_1x, self._phone_setup_1x,
988            RAT_1XRTT, self.phoneNumber,
989            rand_ascii_str(SINGLE_PART_LEN), DIRECTION_MOBILE_TERMINATED)
990
991    @test_tracker_info(uuid="dc6c5765-4928-4fec-bb2c-7f127d6e8851")
992    @TelephonyBaseTest.tel_test_wrap
993    def test_mo_sms_multipart_1x(self):
994        """ Test MO SMS(more than 160 charcters) functionality on CDMA1X
995
996        Make Sure Phone is in CDMA1X mode
997        Send a SMS from Phone
998        Verify Anritsu receives the SMS
999
1000        Returns:
1001            True if pass; False if fail
1002        """
1003        return self._setup_sms(
1004            set_system_model_1x, self._phone_setup_1x,
1005            RAT_1XRTT, self.phoneNumber,
1006            rand_ascii_str(MULTI_PART_LEN), DIRECTION_MOBILE_ORIGINATED)
1007
1008    @test_tracker_info(uuid="7e21506d-788c-48fd-8bb1-1603bc4b5261")
1009    @TelephonyBaseTest.tel_test_wrap
1010    def test_mt_sms_multipart_1x(self):
1011        """ Test MT SMS(more than 160 charcters) functionality on CDMA1X
1012
1013        Make Sure Phone is in CDMA1X mode
1014        Send a SMS from Anritsu
1015        Verify Phone receives the SMS
1016
1017        Returns:
1018            True if pass; False if fail
1019        """
1020        # TODO: b/26346258 Anritsu is not sending message.
1021        return self._setup_sms(
1022            set_system_model_1x, self._phone_setup_1x,
1023            RAT_1XRTT, self.phoneNumber,
1024            rand_ascii_str(MULTI_PART_LEN), DIRECTION_MOBILE_TERMINATED)
1025
1026    """ Tests End """
1027