blob: 4e7ce69c07d12e44d770f87c38aa60c73a8373cd [file] [log] [blame]
import os
import re
from acts import utils
from acts import signals
from acts.base_test import BaseTestClass
from import EventSmsSentSuccess
from import get_iccid_by_adb
from import is_sim_ready_by_adb
class GnssSimInventoryTest(BaseTestClass):
""" GNSS SIM Inventory Tests"""
def setup_class(self):
super().setup_class() = self.android_devices[0]
def check_device_status(self):
if int("settings get global airplane_mode_on")) != 0:"Force airplane mode off")
utils.force_airplane_mode(, False)
if not is_sim_ready_by_adb(,
raise signals.TestFailure("SIM card is not loaded and ready.")
def get_imsi(self):"Get imsi from netpolicy.xml")
tmp_imsi ="cat /data/system/netpolicy.xml")
imsi = re.compile(r'(\d{15})').search(tmp_imsi).group(1)
return imsi
except Exception as e:
raise signals.TestFailure("Fail to get imsi : %s" % e)
def get_iccid(self):
iccid = str(get_iccid_by_adb(
if not isinstance(iccid, int):"Unable to get iccid via adb. Changed to isub.")
tmp_iccid ="dumpsys isub | grep iccid")
iccid = re.compile(r'(\d{20})').search(tmp_iccid).group(1)
return iccid
raise signals.TestFailure("Fail to get iccid")
def test_gnss_sim_inventory(self):
sim_inventory_recipient = "0958787507"
sms_message = "imsi: %s, iccid: %s, ldap: %s, model: %s, sn: %s" % (
self.get_imsi(), self.get_iccid(), os.getlogin(),,
try:"Send SMS by SL4A."),
sms_message, True), 10)
except Exception as e:
raise signals.TestFailure(e)