class LabWcdmaSmsCsMt(LabWcdmaSmsCsBase): """ WCDMA Mobile Terminated SMS over CS on network simulator class. """ def __init__(self, tc_name, global_config): """ Constructor """ LabWcdmaSmsCsBase.__init__(self, tc_name, global_config) # Set an artificial phone number self._destination_number = "123456789" self._sms_sent = SmsMessage(self._sms_text, self._destination_number, "CSD", self._ns_messaging_3g, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, "MT") # ------------------------------------------------------------------------------ def set_up(self): """ Set up the test configuration """ # Call the LAB_GSM_SMS_CS_BASE Setup function LabWcdmaSmsCsBase.set_up(self) self._sms_sent.configure_sms() return Global.SUCCESS, "No errors" # ------------------------------------------------------------------------------ def run_test(self): """ Execute the test """ # Call the LAB_GSM_SMS_CS_BASE run_test function LabWcdmaSmsCsBase.run_test(self) # Calculate how many SMS will be sent to equipment time.sleep(self._wait_btwn_cmd) # Send SMS self._sms_sent.send_sms() # get sms received and Compare sent and received SMS (Text, Destination number) (result_verdict, result_message) = self._sms_sent.get_sms() self._logger.info(result_message) return result_verdict, result_message
class LabFitTelWcdmaVcSmsCsMt(LabFitTelWcdmaVcSmsCsBase): """ Lab reception of SMS Cs during a WCDMA voice call class. """ def __init__(self, tc_name, global_config): """ Constructor """ # Call wcdma fit tel voice call sms base Init function LabFitTelWcdmaVcSmsCsBase.__init__(self, tc_name, global_config) # Read PHONE_NUMBER from testcase xml parameters if self._tc_parameters.get_param_value("PHONE_NUMBER") not in (None, ''): self._is_phone_number_checked = True if str(self._tc_parameters.get_param_value( "PHONE_NUMBER")).isdigit(): self._phone_number = self._tc_parameters.get_param_value( "PHONE_NUMBER") # If value of PHONE_NUMBER from testcase xml is [PHONE_NUMBER], the value used # will be the phoneNumber defined in the Phone_Catalog.xml elif self._tc_parameters.get_param_value( "PHONE_NUMBER") == "[PHONE_NUMBER]": self._phone_number = str(self._device.get_phone_number()) else: self._phone_number = None else: self._phone_number = None self._sms_sent = SmsMessage(self._sms_text, self._phone_number, "CSD", self._messaging_3g, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, "MT") # ------------------------------------------------------------------------------ def set_up(self): """ Set up the test configuration """ # Call wcdma fit tel voice call sms base Setup function LabFitTelWcdmaVcSmsCsBase.set_up(self) self._sms_sent.configure_sms() return Global.SUCCESS, "No errors" # ------------------------------------------------------------------------------ def run_test(self): """ Execute the test """ # Call wcdma fit tel voice call sms base run_test function LabFitTelWcdmaVcSmsCsBase.run_test(self) # Check call state still "CONNECTED" during 5 seconds self._ns_voice_call_3g.check_call_connected(5) # Calculate how many SMS will be sent to equipment time.sleep(self._wait_btwn_cmd) # Send SMS self._sms_sent.send_sms() # Check call state still "CONNECTED" during 5 seconds self._ns_voice_call_3g.check_call_connected(5) # get sms received and Compare sent and received SMS (Text, Destination number) (result_verdict, result_message) = self._sms_sent.get_sms() self._logger.info(result_message) # Check call state still "CONNECTED" during 5 seconds self._ns_voice_call_3g.check_call_connected(5) # Stop voice call self._logger.info("Release voice call") self._voicecall_api.release() return result_verdict, result_message
class LabEgprsSmsPsMo(LabEgprsSmsPsBase): """ EGPRS Mobile Originated SMS over PS on network simulator class. """ def __init__(self, tc_name, global_config): """ Constructor """ # Call LAB_EGPRS_SMS_PS_BASE init function LabEgprsSmsPsBase.__init__(self, tc_name, global_config) # Read SMS Service Center address self._sms_service_center_address = global_config.benchConfig.\ get_parameters("CELLULAR_NETWORK").get_param_value("SMSC", "default") # Read DESTINATION_NUMBER from xml UseCase parameter file self._destination_number = \ self._tc_parameters.get_param_value("DESTINATION_NUMBER") if self._destination_number.upper() == "[PHONE_NUMBER]": self._destination_number = str(self._device.get_phone_number()) self._sms = SmsMessage(self._sms_text, self._destination_number, "GPRS", self._ns_messaging_2g, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, "MO") def set_up(self): """ Set up the test configuration .. warning:: Set the Data coding scheme using DATA_CODING_SCHEME value """ # Call the LAB_GSM_SMS_CS_BASE Setup function LabEgprsSmsPsBase.set_up(self) # Set the default SMS service center time.sleep(self._wait_btwn_cmd) self._messaging_api.set_service_center_address( self._sms_service_center_address) return Global.SUCCESS, "No errors" # ------------------------------------------------------------------------------ def run_test(self): """ Execute the test """ # Call LAB_EGPRS_SMS_PS_BASE run_test function LabEgprsSmsPsBase.run_test(self) # Calculate how many SMS will be sent to equipment time.sleep(self._wait_btwn_cmd) self._sms.configure_sms() # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER time.sleep(self._wait_btwn_cmd) self._sms.send_sms() # Check SMS delivery status OK before timeout using # SMS_TRANSFER_TIMEOUT value and number of SMS to be received return self._sms.get_sms()
class LabFitTelWcdmaVcSmsCsMo(LabFitTelWcdmaVcSmsCsBase): """ Lab send of SMS Cs during a WCDMA voice call class. """ def __init__(self, tc_name, global_config): """ Constructor """ # Call wcdma fit tel voice call sms base Init function LabFitTelWcdmaVcSmsCsBase.__init__(self, tc_name, global_config) # Read SMS Service Center address self._sms_service_center_address = global_config.benchConfig.\ get_parameters("CELLULAR_NETWORK").get_param_value("SMSC", "default") # Read PHONE_NUMBER from testcase xml parameters if self._tc_parameters.get_param_value("PHONE_NUMBER") not in (None, ''): self._is_phone_number_checked = True if str(self._tc_parameters.get_param_value("PHONE_NUMBER")).isdigit(): self._phone_number = self._tc_parameters.get_param_value("PHONE_NUMBER") # If value of PHONE_NUMBER from testcase xml is [PHONE_NUMBER], the value used # will be the phoneNumber defined in the Phone_Catalog.xml elif self._tc_parameters.get_param_value("PHONE_NUMBER") == "[PHONE_NUMBER]": self._phone_number = str(self._device.get_phone_number()) else: self._phone_number = None else: self._phone_number = None self._sms_sent = SmsMessage(self._sms_text, self._phone_number, "CSD", self._messaging_3g, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, "MO", self._sms_service_center_address) # ------------------------------------------------------------------------------ def set_up(self): """ Set up the test configuration """ # Call wcdma fit tel voice call sms base Setup function LabFitTelWcdmaVcSmsCsBase.set_up(self) # Set the preferred connection type to CS Domain ("CSD") self._sms_sent.configure_sms() return Global.SUCCESS, "No errors" # ------------------------------------------------------------------------------ def run_test(self): """ Execute the test """ # Call wcdma fit tel voice call sms base run_test function LabFitTelWcdmaVcSmsCsBase.run_test(self) # Check call state still "CONNECTED" during 5 seconds self._ns_voice_call_3g.check_call_connected(5) # [SEND MO SMS PROCESS] self._sms_sent.send_sms() time.sleep(self._wait_btwn_cmd) # Check call state still "CONNECTED" during 5 seconds self._ns_voice_call_3g.check_call_connected(5) # Check SMS delivery status OK before timeout using # SMS_TRANSFER_TIMEOUT value and number of SMS to be received (result_verdict, result_message) = self._sms_sent.get_sms() self._logger.info(result_message) # Check call state still "CONNECTED" during 5 seconds self._ns_voice_call_3g.check_call_connected(5) # Stop voice call self._logger.info("Release voice call") self._voicecall_api.release() return result_verdict, result_message
class LabMobilityLteSms(LabMobilityLte3gsmBase): """ Usecase base for mobility LTE handover use cases """ def __init__(self, tc_name, global_config): """ Constructor """ LabMobilityLte3gsmBase.__init__(self, tc_name, global_config) # Read PHONE_NUMBER from testcase xml parameters self._phone_number = \ str(self._tc_parameters.get_param_value("PHONE_NUMBER")) if self._phone_number.upper() == "[PHONE_NUMBER]": self._phone_number = str(self._device.get_phone_number()) # Read SMS_TEXT from testcase xml file self._sms_text = self._tc_parameters.get_param_value("SMS_TEXT") # Read SMS_DIRECTION from testcase xml file self._sms_direction = str( self._tc_parameters.get_param_value("SMS_DIRECTION")) # Read SMS_TRANSFER_TIMOUT from testcase xml file self._sms_transfer_timeout = \ int(self._tc_parameters.get_param_value("SMS_TRANSFER_TIMEOUT")) # Read DATA_CODING_SCHEME from xml UseCase parameter file self._data_coding_sheme = \ self._tc_parameters.get_param_value("DATA_CODING_SCHEME") dcs = DataCodingScheme(self._data_coding_sheme) dcs.decode() # Get number of bits per character setted in DCS self._nb_bits_per_char = dcs.compute_character_size() character_set = dcs.get_character_set() if character_set == "7BITS": self._content_type = "CTEX" else: self._content_type = "CDAT" # Instantiate Messaging UECmd for SMS UseCases self._messaging_api = self._device.get_uecmd("SmsMessaging") self._sms = SmsMessage(self._sms_text, self._phone_number, "LCSD", self._ns_3gsm_messaging, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, self._sms_direction) # ------------------------------------------------------------------------------ def set_up(self): """ Set up the test configuration """ # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) # Set LTE cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # MO or MT SMS instance self._sms.configure_sms() # Disable flight mode self._networking_api.set_flight_mode("off") # Check registration state is connected using # registrationTimeout from Device_Catalog.xml self._modem_api.check_cdk_registration_bfor_timeout( self._registration_timeout) # Set the APN time.sleep(self._wait_btwn_cmd) self._logger.info("Setting APN " + str(self._apn) + "...") self._networking_api.set_apn(self._ssid, self._apn) # Activate PDP context time.sleep(self._wait_btwn_cmd) self._logger.info("Active PDP Context...") self._networking_api.activate_pdp_context(self._ssid, check=False) # Check Data Connection State => CON before timeout self._ns_lte_data.check_data_connection_state( "CON", self._registration_timeout, blocking=False, cell_id=self._ns_lte_cell_id) # Check that DUT is registered on the good RAT self._modem_api.check_network_type_before_timeout( self._ns_lte_data.get_network_type(), self._registration_timeout) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set External EPC connection between Network Simulators self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) return Global.SUCCESS, "No errors" # ------------------------------------------------------------------------------ def run_test(self): """ Execute the test """ # Call LabMobilityLte3gsmBase run_test function LabMobilityLte3gsmBase.run_test(self) # Clear old SMS on phone self._messaging_api.delete_all_sms() # Clear old SMS on Network Simulator self._ns_3gsm_messaging.clear_message_data() self._sms.send_sms() self._sms.get_sms() return Global.SUCCESS, "No errors"