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 __init__(self, tc_name, global_config): """ Constructor """ # Call gsm voice call base Init function LabFitTelGsmVcSmsCsBase.__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, "GSM", self._messaging_2g, 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 __init__(self, tc_name, global_config): """ Constructor """ # Call LabGsmSmsCsBase init function LabWcdmaSmsCsBase.__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 = \ str(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, "CSD", self._ns_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)
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
def _send_sms(self, ns_messaging): """ Send sms from equipment or DUT :type ns_messaging: IMessaging3G :param ns_messaging: network simulator messaging :rtype: Verdict, message """ nb_segments = \ compute_sms_segments(self._sms_text, self._nb_bits_per_char) if "MT" in self._sms_type: # [SEND MT SMS DIRECTLY BY EQUIPMENT] # register on intent to receive incoming sms self._messaging_api.register_for_sms_reception() # Construct SMS sms_sent = SmsMessage(self._sms_text, self._sms_sender, "GSM") # Configure the type of the message to send CUSTOM TEXT. ns_messaging.select_sms_content(self._content_type) # Set the custom text message to send, using SMS_TEXT parameter if self._content_type == "CTEX": ns_messaging.set_custom_sms_text(self._sms_text) elif self._content_type == "CDAT": ns_messaging.set_custom_sms_data(self._sms_text) # Send MT SMS to CDK using SMS parameters : # - SMS_TEXT ns_messaging.send_sms() # Check sms acknowledged by network simulator ns_messaging.check_sms_state('ACK', self._sms_transfer_timeout) else: # [SEND MO SMS BY DUT] # Construct SMS sms_sent = SmsMessage(self._sms_text, self._sms_sender, "GSM") self._messaging_api.send_sms(self._sms_sender, self._sms_text) # Get received sms sms_received = self._messaging_api.wait_for_incoming_sms( self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received) return result_verdict, result_message
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 run_test(self): """ Execute the test """ # Call the LAB_WCDMA_SMS_CS_BASE run_test function LabWcdmaSmsPsBase.run_test(self) # Calculate how many SMS will be sent to equipment time.sleep(self._wait_btwn_cmd) nb_segments = compute_sms_segments( self._sms_text, self._nb_bits_per_char) if nb_segments > 1: # Enable message queuing self._ns_messaging_3g.set_sms_message_queuing_state("ON") # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER time.sleep(self._wait_btwn_cmd) self._messaging_api.send_sms(self._destination_number, self._sms_text) sms_sent = SmsMessage(self._sms_text, self._destination_number, "PSD") # Check SMS delivery status OK before timeout using # SMS_TRANSFER_TIMEOUT value and number of SMS to be received (result_verdict, result_message) = \ self._ns_messaging_3g.check_sms_delivery_state(sms_sent, nb_segments, self._sms_transfer_timeout) return result_verdict, result_message
def __send_sms(self): """ Sends a SMS with this test's parameters. :raise DeviceException: if the SMS sending was not successful. """ # Clear old SMS (Non blocking for this test if function isn't # implemented on CDK) time.sleep(self._wait_btwn_cmd) self._messaging_api.delete_all_sms() # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER time.sleep(self._wait_btwn_cmd) sms_sent = SmsMessage(self._message, self._destination_number) # register on intent to receive incoming sms self._messaging_api.register_for_sms_reception() self._messaging_api.send_sms(self._destination_number, self._message) # Get received sms sms_received = self._messaging_api.wait_for_incoming_sms( self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (_result_verdict, result_message) = compute_sms_equals(sms_sent, sms_received) self._logger.info(result_message)
def __send_a_sms(self): """ test all UECmd linked to send SMS feature """ # Calculate how many SMS will be sent to equipment time.sleep(self._wait_btwn_cmd) nb_segments = compute_sms_segments( self._sms_text, self._nb_bits_per_char) if nb_segments > 1: # Enable message queuing self._ns_messaging_3g.set_sms_message_queuing_state("ON") # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER time.sleep(self._wait_btwn_cmd) self._mess.send_sms(self._destination_number, self._sms_text) sms_sent = SmsMessage(self._sms_text, self._destination_number, "CSD") time.sleep(self._wait_btwn_cmd) # Check SMS delivery status OK before timeout using # SMS_TRANSFER_TIMEOUT value and number of SMS to be received (result_verdict, result_message) = \ self._ns_messaging_3g.check_sms_delivery_state(sms_sent, nb_segments, self._sms_transfer_timeout) self._logger.info(result_message) return result_verdict
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 run_test(self): """ Runs the test. """ # Call inherited run_test method which will ensure IMS registration # Ugly temporary solution before implementing something # better using test steps. if self._perform_ims_registration: LiveLteImsReg.run_test(self) else: UseCaseBase.run_test(self) # Clear old SMS (Non blocking for this test if function isn't # implemented on CDK) time.sleep(self._wait_btwn_cmd) self._sms_api.delete_all_sms() time.sleep(self._wait_btwn_cmd) sms_sent = SmsMessage(self._message, self._destination_number) # register on intent to receive incoming sms self._sms_api.register_for_sms_reception() # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER self._sms_api.send_sms(self._destination_number, self._message) # Get received sms sms_received = self._sms_api.wait_for_incoming_sms(self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received) self._logger.info(result_message) # Because in case of failure the IMS stack may have crashed # we need to double-check the IMS registration status. in_service_status = ImsRegistrationStatus.in_service() registration_status = self._get_registration_status() self._logger.info("Registation status: %s (%d)" % ( str(registration_status), registration_status.as_int())) # Compute the verdict if str(registration_status) != str(in_service_status): result_message = "IMS stack has crashed or IMS registration is lost." self._logger.error(result_message) result_verdict = Global.FAILURE # Return the test result return (result_verdict, result_message)
def set_up(self): """ Set up the test configuration """ # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) if self._ns_3gsm_cell_service == "GSM": # Enable message queuing self._ns_3gsm_messaging.set_sms_message_queuing_state("ON") # MO SMS instance self.sms = SmsMessage(self._sms_text, self._phone_number, "GSM") # Set LTE cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set entries in the equivalent PLMN list self._ns_3gsm_cell.set_equivalent_plmn_list_points( self._ns_lte_mcc, self._ns_lte_mnc) # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) # 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) return Global.SUCCESS, "No errors"
def set_up(self): """ Set up the test configuration """ # Call LabMobilityLte3gsmBase set_up function LabMobilityLte3gsmBase.set_up(self) if self._ns_3gsm_cell_service == "GSM": # Enable message queuing self._ns_3gsm_messaging.set_sms_message_queuing_state("ON") # MO SMS instance self.sms = SmsMessage(self._sms_text, self._phone_number, "GSM") # Flight mode deactivation self._networking_api.set_flight_mode("off") # Set LTE cell on self._ns_lte_cell.set_cell_on(self._ns_lte_mimo) # Set Network Simulator 3GSM cell on self._ns_3gsm_cell.set_cell_on() # Set entries in the equivalent PLMN list self._ns_3gsm_cell.set_equivalent_plmn_list_points( self._ns_lte_mcc, self._ns_lte_mnc) # Set External EPC connection self._ns_3gsm_cell.set_external_epc_connection(self._ns_lte_ip_lan1, self._ns_lte_dl_earfcn) # Set parameters to go from cell 1 to cell 2 self._1_to_2_cell_parms = (self._ns_lte_cell, self._ns_3gsm_cell, self._ns_3gsm_data, self._ns_3gsm_cell_service, self._cresel_power, self._ns2_model, self._cresel_timeout, self._cresel_nocoverage_time) # Set parameters to go from cell 2 to cell 1 self._2_to_1_cell_parms = (self._ns_3gsm_cell, self._ns_lte_cell, self._ns_lte_data, self._ns_lte_cell_service, self._cresel_power, self._ns1_model, self._cresel_timeout, self._cresel_nocoverage_time) return Global.SUCCESS, "No errors"
def wait_for_incoming_sms(self, timeout=0): """ Register on SMS_Received intent to wait for incoming SMS and retrieve the received sms before timeout. :type timeout: int :param timeout: the time to wait until retrieving sms in second. :rtype: list of SmsMessage Object :return: sms array """ self._logger.info("wait for incoming sms") function = "SmsWaitForIncoming" args = " time_out=%s" % (timeout * 1000) # Get the method and class name of the UEcommand on the embedded side module_name, class_name = self._get_module_and_class_names() try: # Launch the UEcmd on the embedded side output = self._internal_uecmd_exec(module_name, class_name, function, args, timeout / 1000) except AcsBaseException as ex: error_msg = ex.get_error_message() if error_msg.find("OK") != -1 or\ error_msg.find("OK") != -1: self._logger.debug("%s" % error_msg) else: self._logger.error("%s" % error_msg) raise ex sms_list = output["values"]["list_sms"] count = output["values"]["count"] if count >= 1: # Fill SmsMessage object to perform comparison sender = "" # TBD: retrieve from UE cmd the originated number from where the SMS was received text = str(sms_list) sms = SmsMessage(text, sender) else: exception_message = "SMS not retrieved" self._logger.error("%s" % exception_message) raise DeviceException(DeviceException.SMS_EXCEPTION, exception_message) return sms
def run_test(self): """ Execute the test """ # Call the LabLteBase run_test function LabLteBase.run_test(self) self._messaging_api.delete_all_sms() if self._sms_direction == "MT": sms_sent = SmsMessage(self._sms_text, self._incoming_number, "PSD") # register on intent to receive incoming sms self._messaging_api.register_for_sms_reception() # set custom sms text to equipment time.sleep(self._wait_btwn_cmd) self._messaging_4g.set_custom_sms_text(self._sms_text) # Send sms over sgs self._messaging_4g.send_sms_over_sgs() # get sms received sms_received = self._messaging_api.wait_for_incoming_sms( self._sms_transfer_timeout) elif self._sms_direction == "MO": # TODO: SMS MO PS is not yet supported by the platform # BZ:112539 raise DeviceException( DeviceException.FEATURE_NOT_AVAILABLE, "SMS MO PS is not yet supported by the platform") else: raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, "SMS_DIRECTION should be Only MO or MT") # Compare sent and received SMS (Text, Destination number) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received) self._logger.info(result_message) return result_verdict, result_message
def assemble_received_sms(self): """ Gets all SMS received from the DUT, and re-form the original message. :rtype: (str, str) :return: couple of message and destination number of all SMS received. """ sms_message = "" sms_destination = "" # Get SMS from Equipment nb_sms = self.get_nb_received_sms() while nb_sms > 0: message_tmp = self.get_last_sms() sms_destination = self.get_sms_destination() sms_transportation = self.get_sms_transportation() sms_message += message_tmp self.move_next_sms() nb_sms -= 1 return SmsMessage(sms_message, sms_destination, sms_transportation)
def wait_for_incoming_sms(self, timeout=0): """ Register on SMS_Received intent to wait for incoming SMS and retrieve the received sms before timeout. :type timeout: int :param timeout: the time to wait until retrieving sms in second. :raise: Raise an error if the intent timed out :rtype: SmsMessage Object :return: sms """ self._logger.info("Wait for incoming SMS") start_time = time.time() # While timeout not reach, retrieve SMS data while (time.time() - start_time) < int(timeout): try: # Retrieve SMS data output = self._internal_exec_multiple_v2(self._sms_module, "assembleReceivedSms", is_system=True) self._logger.info("wait_for_incoming_sms output : %s" % output) # If not empty, then break while loop if len(output) >= 1: break except AcsBaseException as ex: error_msg = ex.get_error_message() if error_msg.find(self.UECMD_TIMEOUT_INTENT_MSG) != -1 or\ error_msg.find(self.UECMD_TIMEOUT_RESULT_MSG) != -1: self._logger.debug("%s" % error_msg) else: self._logger.error("%s" % error_msg) raise ex text = "" sender = "" # Rearrange last data received to match SMS object for sms_data in output: sender = sms_data["address"] text += sms_data["text"] sms = SmsMessage(text, sender) # Return last SMS received return sms
def run_test(self): """ Execute the test """ # Call UseCase base Run function LiveMessagingBase.run_test(self) # Clear old SMS (Non blocking for this test if function isn't # implemented on CDK) time.sleep(self._wait_btwn_cmd) self._sms_api.delete_all_sms() time.sleep(self._wait_btwn_cmd) sms_sent = SmsMessage(self._message, self._destination_number) # register on intent to receive incoming sms self._sms_api.register_for_sms_reception() # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER self._sms_api.send_sms(self._destination_number, self._message) # Get received sms sms_received = self._sms_api.wait_for_incoming_sms( self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received) self._logger.info(result_message) # Check the DUT is camped on a compatible network with the selected # preferred network. if self._network_pref is not None: self._modem_api.check_rat_with_pref_network( self._network_pref, self._registration_timeout) return result_verdict, result_message
def _sendsms(self,queue): lock = threading.Lock() lock.acquire() try: result_verdict=Global.FAILURE self._logger.info("inside the lock of msg") #thread no self._logger.info(current_thread()) #to delete all sms self._sms_api.delete_all_sms() self._sms_api2.delete_all_sms() time.sleep(5) sms_sent = SmsMessage(self._message, self._destination_number) # register on intent to receive incoming sms self._sms_api.register_for_sms_reception() # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER self._sms_api2.send_sms(self._destination_number,self._message) # Get received sms sms_received = self._sms_api.wait_for_incoming_sms(self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) self._logger.info(sms_received) (result_verdict, result_message) = \ compute_sms_equals_dual_phone(sms_sent, sms_received) self._logger.info(result_message) queue.put(result_verdict) except Exception as inst: self._logger.info(inst) raise AcsConfigException(AcsConfigException.OPERATION_FAILED, "Exception: %s" % inst) finally: #release of the lock lock.release() print(self.awake) if self.awake==True: result_verdict=Global.FAILURE #giving the return value into queue queue.put(result_verdict)
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ DeviceTestStepBase.run(self, context) # Get access to the EquipmentManager instance self._equipment_manager = self._factory.create_equipment_manager() net_sim = self._equipment_manager.get_cellular_network_simulator( self._pars.eqt, visa=True) ns_messaging = net_sim.get_cell().get_messaging() sms = SmsMessage(self._pars.sms_text, self._pars.phone_number, self._pars.transportation, ns_messaging, self._messaging_api, self._pars.coding_scheme, self._pars.nb_bits_per_char, self._pars.sms_transfer_timeout, self._pars.content_type, self._pars.sms_direction) context.set_info(self._pars.sms, sms)
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
def run_test(self): """ Execute the test """ # Call UseCase base Run function LiveMessagingBase.run_test(self) # Clear old SMS (Non blocking for this test if function isn't # implemented on CDK) time.sleep(self._wait_btwn_cmd) self._sms_api.delete_all_sms() # Enable cellular data self._logger.info("Activate PDP Context") self._networking_api.activate_pdp_context() time.sleep(self._wait_btwn_cmd) sms_sent = SmsMessage(self._message, self._destination_number) # Start the FTP data transfer self._dl_id = self._launch_ftp_data_transfer() # Check the status of the FTP connection status = self._ftp_api.get_ftp_status(self._dl_id) # If the transfer is not working some exceptions if str(status) <> "transferring": # If the transfer is not established raised an exception if str(status) in ("notrunning", "transfer failed"): message = "FTP transfer failed / not started: %s" % str(status) raise DeviceException(DeviceException.CONNECTION_LOST, message) # If the transfer status is 'connecting' # additionally wait for the connection to be established elif str(status) == "connecting": self._logger.info( "FTP transfer not started yet. STATUS is CONNECTING") time.sleep(self._wait_btwn_cmd) if str(status) == "connecting": message = "FTP transfer status is CONNECTING for a too long time" raise DeviceException(DeviceException.CONNECTION_LOST, message) # If the FTP data transfer is finished already # the transferred file length chosen is too short else: message = "FTP transfer finished before SMS has been sent" self._logger.error(message) raise AcsConfigException( AcsConfigException.INVALID_TEST_CASE_FILE, message) # If the FTP data transfer is on going start the SMS sending procedures # If the FTP data transfer status is "transferring" else: # register on intent to receive incoming sms self._sms_api.register_for_sms_reception() # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER self._sms_api.send_sms(self._destination_number, self._message) # Get received sms sms_received = self._sms_api.wait_for_incoming_sms( self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received) self._logger.info(result_message) final_transfer_status = str( self._ftp_api.get_ftp_status(self._dl_id)) while final_transfer_status <> "transfer successful": if str(final_transfer_status) in ("transfer successful", "transferring"): time.sleep(self._wait_btwn_cmd) else: message = "FTP transfer failed after SMS sent: %s" % str( final_transfer_status) raise DeviceException(DeviceException.CONNECTION_LOST, message) final_transfer_status = str( self._ftp_api.get_ftp_status(self._dl_id)) if final_transfer_status == "transfer successful": message = "FTP transfer finished successfully" self._logger.info(message) result_message = result_message + ". " + message 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 LabGsmSmsMtOnSim(LabGsmSmsCsBase): """ GSM Mobile Terminated SMS over CS on network simulator class. """ def __init__(self, tc_name, global_config): """ Constructor """ LabGsmSmsCsBase.__init__(self, tc_name, global_config) # Set an artificial phone number self._destination_number = "123456789" # Read the test case params from test case xml # Get the max sms we can stored in sim card self._sms_amount_to_send = \ int(self._tc_parameters.get_param_value("SMS_AMOUNT_TO_SEND")) # Retrieve testcase parameters for AT proxy usage self._launch_mode = 2 self._command = "AT+CPMS?" self._index = 0 self._expected_result = "" self._command_timeout = 20 # Instantiate the PhoneSystem UE Command category self._phone_system = self._device.get_uecmd("PhoneSystem") # Instantiate the modem UE commands self._modem_flashing_api = self._device.get_uecmd("ModemFlashing") # Get Serial Handler instance self._serial_handler = SerialHandler() # Read SMS_TRANSFER_TIMEOUT from xml UseCase parameter file self._sms_transfer_timeout = \ int(self._tc_parameters.get_param_value("SMS_TRANSFER_TIMEOUT")) #------------------------------------------------------------------------------ def set_up(self): """ Set up the test configuration """ # Call the LAB_GSM_SMS_CS_BASE Setup function LabGsmSmsCsBase.set_up(self) #Start up the proxy for sending AT commands self.at_proxy_com_port = self._modem_flashing_api.start_at_proxy_from_mos( int(self._launch_mode)) #check serial connection self._serial_handler.set_data_analyser( ATCommandAnalyser(self._expected_result)) self._serial_handler.set_default_timeout(self._command_timeout) self._logger.info("Connecting to the port " + str(self.at_proxy_com_port)) # Connect to the at proxy self._serial_handler.connect(self.at_proxy_com_port) # Check that the modem is available modem_status = self._modem_flashing_api.ping_modem_from_serial( self._serial_handler.get_serial()) if modem_status: self._logger.info("AT Proxy correctly respond to ping command") self.modem_available = True else: raise DeviceException(DeviceException.CONNECTION_LOST, "Connection to AT proxy failed") #Send AT+CPMS to get storage SIM information interrogate_at_command = "AT+CPMS?" self._logger.info("Send AT command: %s" % interrogate_at_command) self._at_inter_nvm_em_verdict, response =\ self._serial_handler.send_at_command_and_get_result(interrogate_at_command, self._command_timeout) try: sm_index = response.split(",").index('"SM"') except ValueError: self._error.Msg = "Storage SIM information error" raise DeviceException(DeviceException.PHONE_OUTPUT_ERROR, self._error.Msg) self.max_storage = response.split(",")[sm_index + 2] # Clear NS and Phone side sms self._ns_messaging_2g.clear_message_data() self._messaging_api.delete_all_sms() self._nb_segments = \ compute_sms_segments(self._sms_text, self._nb_bits_per_char) self.sms_sent = SmsMessage(self._sms_text, self._destination_number, "GSM", self._ns_messaging_2g, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, "MT") return Global.SUCCESS, "No errors" #------------------------------------------------------------------------------ def run_test(self): """ Execute the test """ # Call the LAB_GSM_SMS_CS_BASE run_test function LabGsmSmsCsBase.run_test(self) # Send sms_amount_to_send SMS to sim card. for i in xrange(1, self._sms_amount_to_send): if(self._nb_segments > 1): # [SEND MO SMS PROCESS] # Activate loopback on equipment self._ns_messaging_2g.set_sms_mo_loopback_state("ON") # Enable message queuing self._ns_messaging_2g.set_sms_message_queuing_state("ON") # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER # Also ask the UE Command to use synchronization self._messaging_api.send_sms( self._destination_number, self._sms_text, True) # Wait all incoming sms from DUT to Network Simulator self._ns_messaging_2g.\ check_sms_delivery_state(self.sms_sent, self._nb_segments, self._sms_transfer_timeout) # Read all messages in the queue self._ns_messaging_2g.read_all_received_sms() else: # retrieve instance in order to get sent messages self._ns_messaging_2g.\ select_sms_content(self._content_type) if(self._content_type == "CTEX"): self._ns_messaging_2g.\ set_custom_sms_text(self._sms_text) elif (self._content_type == "CDAT"): self._ns_messaging_2g.\ set_custom_sms_data(self._sms_text) # Send SMS to CDK using SMS parameters : # - SMS_TEXT self.sms_sent.send_sms() # Check sms acknowledged by network simulator self._ns_messaging_2g.check_sms_state( 'ACK', self._sms_transfer_timeout) # get sms received sms_received = self._messaging_api.wait_for_incoming_sms(self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (result_verdict, result_message) = \ compute_sms_equals(self.sms_sent, sms_received) if result_verdict == Global.FAILURE: self._logger.error(result_message) # Exit loop break return result_verdict, result_message def tear_down(self): """ End and dispose the test """ #Stop AT Proxy self._logger.info("Stop AT Proxy") self._modem_flashing_api.stop_at_proxy_from_mos() #Close the serial connection self._logger.info("Close the serial connection") self._logger.info("Disconnecting from the port " + str(self._serial_handler.get_port())) self._serial_handler.disconnect() return Global.SUCCESS, "No errors"
def set_up(self): """ Set up the test configuration """ # Call the LAB_GSM_SMS_CS_BASE Setup function LabGsmSmsCsBase.set_up(self) #Start up the proxy for sending AT commands self.at_proxy_com_port = self._modem_flashing_api.start_at_proxy_from_mos( int(self._launch_mode)) #check serial connection self._serial_handler.set_data_analyser( ATCommandAnalyser(self._expected_result)) self._serial_handler.set_default_timeout(self._command_timeout) self._logger.info("Connecting to the port " + str(self.at_proxy_com_port)) # Connect to the at proxy self._serial_handler.connect(self.at_proxy_com_port) # Check that the modem is available modem_status = self._modem_flashing_api.ping_modem_from_serial( self._serial_handler.get_serial()) if modem_status: self._logger.info("AT Proxy correctly respond to ping command") self.modem_available = True else: raise DeviceException(DeviceException.CONNECTION_LOST, "Connection to AT proxy failed") #Send AT+CPMS to get storage SIM information interrogate_at_command = "AT+CPMS?" self._logger.info("Send AT command: %s" % interrogate_at_command) self._at_inter_nvm_em_verdict, response =\ self._serial_handler.send_at_command_and_get_result(interrogate_at_command, self._command_timeout) try: sm_index = response.split(",").index('"SM"') except ValueError: self._error.Msg = "Storage SIM information error" raise DeviceException(DeviceException.PHONE_OUTPUT_ERROR, self._error.Msg) self.max_storage = response.split(",")[sm_index + 2] # Clear NS and Phone side sms self._ns_messaging_2g.clear_message_data() self._messaging_api.delete_all_sms() self._nb_segments = \ compute_sms_segments(self._sms_text, self._nb_bits_per_char) self.sms_sent = SmsMessage(self._sms_text, self._destination_number, "GSM", self._ns_messaging_2g, self._messaging_api, self._data_coding_sheme, self._nb_bits_per_char, self._sms_transfer_timeout, self._content_type, "MT") return Global.SUCCESS, "No errors"
def check_sms_delivery_state(self, sms_sent, nb_sms, timeout_per_sms=0): """ Check if all SMS sent have been received before timeout_per_sms * nb_sms seconds. :type sms_sent: SmsMessage object :param sms_sent: sent SMS to be checked :type nb_sms: integer :param nb_sms: number of SMS to be delivered :type timeout_per_sms: integer :param timeout_per_sms: timeout per SMS. If timeout is 0, only one test is performed :raise TestEquipmentException: if one or more expected SMS have not been received before timeout*nb_sms seconds. """ log = True all_received = False timeout = timeout_per_sms * nb_sms # Check if the expected number of SMS is reached while timeout > 0: if int( self._visa.query( "CALL:SMService:PTPoint:MORiginated:COUNt?", log)) == int(nb_sms): all_received = True break time.sleep(1) timeout -= 1 if not all_received: error_msg = "SMS not received : waited %d seconds for %d SMS." % \ (timeout, nb_sms) self._logger.error(error_msg) raise TestEquipmentException(TestEquipmentException.SMS_EXCEPTION, error_msg) # Check if the content of the received SMS sms_message = "" sms_destination = "" sms_transportation = "" # Get SMS from Equipment nb_sms = int( self._visa.query("CALL:SMService:PTPoint:MORiginated:COUNt?", log)) for _ in range(nb_sms): message_tmp = str( self._visa.query("CALL:SMService:PTPoint:MORiginated:TEXT?", log)).replace("\"", "") sms_destination = str( self._visa.query( "CALL:SMService:PTPoint:MORiginated:DESTination?", log)).replace("\"", "") sms_transportation = self._visa.query( "CALL:SMService:PTPoint:MORiginated:TRANsport?", log) sms_message += message_tmp self._visa.write("CALL:SMService:PTPoint:MORiginated:QUEue:NEXT") sms_received = SmsMessage(sms_message, sms_destination, sms_transportation) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received, check_transportation=True) self._logger.info(result_message) if result_verdict == Global.FAILURE: raise TestEquipmentException(TestEquipmentException.SMS_EXCEPTION, result_message) 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"
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
def run_test(self): """ Execute the test """ # Call the LAB_WCDMA_SMS_PS_BASE run_test function LabWcdmaSmsPsBase.run_test(self) # Calculate how many SMS will be sent to equipment time.sleep(self._wait_btwn_cmd) nb_segments = compute_sms_segments( self._sms_text, self._nb_bits_per_char) sms_sent = SmsMessage(self._sms_text, self._destination_number, "PSD") # register on intent to receive incoming sms self._messaging_api.register_for_sms_reception() if nb_segments > 1: # [SEND MO SMS PROCESS] # Activate loopback on equipment self._ns_messaging_3g.set_sms_mo_loopback_state("ON") # Enable message queuing self._ns_messaging_3g.set_sms_message_queuing_state("ON") # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER # Also ask the UE Command to use synchronization time.sleep(self._wait_btwn_cmd) self._messaging_api.send_sms( self._destination_number, self._sms_text, True) # Wait all incoming sms from DUT to Network Simulator self._ns_messaging_3g.check_sms_delivery_state(sms_sent, nb_segments, self._sms_transfer_timeout) # Read all messages in the queue self._ns_messaging_3g.read_all_received_sms() else: # [SEND SMS DIRECTLY BY EQUIPMENT] # Configure the type of the message to send CUSTOM TEXT. self._ns_messaging_3g.select_sms_content(self._content_type) # Set the custom text message to send, using SMS_TEXT parameter if self._content_type == "CTEX": self._ns_messaging_3g.set_custom_sms_text(self._sms_text) elif self._content_type == "CDAT": self._ns_messaging_3g.set_custom_sms_data(self._sms_text) # Send SMS to CDK using SMS parameters : # - SMS_TEXT self._ns_messaging_3g.send_sms() # Check sms acknowledged by network simulator self._ns_messaging_3g.check_sms_state( 'ACK', self._sms_transfer_timeout) # get sms received sms_received = self._messaging_api.wait_for_incoming_sms(self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received) self._logger.info(result_message) return result_verdict, result_message
def run_test(self): """ Runs the test. """ # Call inherited run_test method which will ensure IMS registration # Ugly temporary solution before implementing something # better using test steps. if self._perform_ims_registration: LiveLteImsReg.run_test(self) else: UseCaseBase.run_test(self) # Clear old SMS (Non blocking for this test if function isn't # implemented on CDK) time.sleep(self._wait_btwn_cmd) self._sms_api.delete_all_sms() time.sleep(self._wait_btwn_cmd) sms_sent = SmsMessage(self._message, self._destination_number) # Start the FTP data transfer self._dl_id = self._launch_ftp_data_transfer() # Check the status of the FTP connection status = self._ftp_api.get_ftp_status(self._dl_id) # If the transfer is not working some exceptions if str(status) <> "transferring": # If the transfer is not established raised an exception if str(status) in ("notrunning", "transfer failed"): message = "FTP transfer failed / not started: %s" % str(status) raise DeviceException(DeviceException.CONNECTION_LOST, message) # If the transfer status is 'connecting' # additionally wait for the connection to be established elif str(status) == "connecting": self._logger.info( "FTP transfer not started yet. STATUS is CONNECTING") time.sleep(self._wait_btwn_cmd) if str(status) == "connecting": message = "FTP transfer status is CONNECTING for a too long time" raise DeviceException(DeviceException.CONNECTION_LOST, message) # If the FTP data transfer is finished already # the transferred file length chosen is too short else: message = "FTP transfer finished before SMS has been sent" self._logger.error(message) raise AcsConfigException( AcsConfigException.INVALID_TEST_CASE_FILE, message) # If the FTP data transfer is on going start the SMS sending procedures # If the FTP data transfer status is "transferring" else: # register on intent to receive incoming sms self._sms_api.register_for_sms_reception() # Send SMS to equipment using SMS parameters : # - SMS_TEXT # - DESTINATION_NUMBER self._sms_api.send_sms(self._destination_number, self._message) # Get received sms sms_received = self._sms_api.wait_for_incoming_sms( self._sms_transfer_timeout) # Compare sent and received SMS (Text, # Destination number) (result_verdict, result_message) = \ compute_sms_equals(sms_sent, sms_received) self._logger.info(result_message) final_transfer_status = str( self._ftp_api.get_ftp_status(self._dl_id)) while final_transfer_status <> "transfer successful": if str(final_transfer_status) in ("transfer successful", "transferring"): time.sleep(self._wait_btwn_cmd) else: message = "FTP transfer failed after SMS sent: %s" % str( final_transfer_status) raise DeviceException(DeviceException.CONNECTION_LOST, message) final_transfer_status = str( self._ftp_api.get_ftp_status(self._dl_id)) if final_transfer_status == "transfer successful": message = "FTP transfer finished successfully" self._logger.info(message) result_message = result_message + ". " + message # Because in case of failure the IMS stack may have crashed # we need to double-check the IMS registration status. in_service_status = ImsRegistrationStatus.in_service() registration_status = self._get_registration_status() self._logger.info( "Registation status: %s (%d)" % (str(registration_status), registration_status.as_int())) # Compute the verdict if str(registration_status) != str(in_service_status): result_message = "IMS stack has crashed or IMS registration is lost." self._logger.error(result_message) result_verdict = Global.FAILURE # Return the test result return (result_verdict, result_message)