def tear_down(self):
        """
        Disposes this test.
        """
        # Call the inherited tear_down method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            LiveLteImsReg.tear_down(self)
        else:
            UseCaseBase.tear_down(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()

        # Delete remaining FTP transfered files from DUT
        self._delete_file_if_exists(self._absolute_path_on_dut)

        # Stop the ftp transfer if was not stopped succesfully
        self._ftp_api.stop_ftp(self._dl_id)

        # End of tear_down
        return (Global.SUCCESS, "No errors")
    def __init__(self, tc_name, global_config):
        """
        Initializes this instance.
        """
        # Call inherited initializer
        LiveLteImsReg.__init__(self, tc_name, global_config)

        # Retrieve call duration parameter
        self._callduration = \
            int(self._tc_parameters.get_param_value("CALL_DURATION", 0))

        # Initialize the attribute to use as phone number
        self._phone_number = self._tc_parameters.get_param_value(
            "PHONE_NUMBER")

        if self._ims_reg_operation == "CHECK_ONLY":
            self._perform_ims_registration = False
        else:
            self._perform_ims_registration = True

        # Read the call type parameter
        self._call_type = self._tc_parameters.get_param_value("CALL_TYPE", "")

        # Read callSetupTimeout from Phone_Catalog.xml
        self._call_setup_time = \
            int(self._dut_config.get("callSetupTimeout"))

        # Instantiate UE categories for first device
        self._voice_call_api = self._device.get_uecmd("VoiceCall")
        self._networking_api = self._device.get_uecmd("Networking")
        self._file_system_api = self._device.get_uecmd("File")
        self._phone_system_api = self._device.get_uecmd("PhoneSystem")
    def set_up(self):
        """
        Initializes the test.
        """
        # Call the inherited set_up method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            # Call inherited setup method
            self._logger.info("Performing IMS registration step as requested.")
            LiveLteImsReg.set_up(self)
        else:
            # Call the base setup method in order to be
            # compliant with ACS framework
            self._logger.info(
                "Skipping IMS registration step (assumed to be done).")
            UseCaseBase.set_up(self)
            # Simply perform a IMS registration check
            self._networking_api.check_ims_registration_before_timeout(1)

        # Compute the file name on DUT
        self._absolute_path_on_dut = "".join(
            [self._device.multimedia_path, self._ftp_file_basename])

        # Delete the FTP downloaded file on the DUT
        self._delete_file_if_exists(self._absolute_path_on_dut)

        # Disable Flight Mode on the device
        self._networking_api.set_flight_mode("off")

        # Set up is done correctly
        return (Global.SUCCESS, "No errors")
    def set_up(self):
        """
        Initializes the test.
        """
        # Call the inherited set_up method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            # Call inherited setup method
            self._logger.info("Performing IMS registration step as requested.")
            LiveLteImsReg.set_up(self)
        else:
            # Call the base setup method in order to be
            # compliant with ACS framework
            self._logger.info(
                "Skipping IMS registration step (assumed to be done).")
            UseCaseBase.set_up(self)
            if self._perform_ims_registration is None:
                # But raise an exception
                message = "Invalid parameter value for IMS_REGISTRATION_OPERATION"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         message)
            # Simply perform a IMS registration check
            self._networking_api.check_ims_registration_before_timeout(1)

        # Check the call duration parameter
        if not self._callduration:
            message = "%s '%s' %s '%s'" % (
                "Invalid parameter value (or missing parameter)",
                str(self._callduration), "for parameter", "CALL_DURATION")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)
        # We arbitrarily set a minimum allowed value for call duration
        if self._callduration < 15:
            message = "%s '%s' %s '%s'. %s." % (
                "Invalid parameter value ", str(
                    self._callduration), "for parameter", "CALL_DURATION",
                "The value should be set to 15 at the minimum")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)

        # Check the call type parameter
        if self._call_type not in ("IR92", "IR94_AUDIO", "IR94_RX", "IR94_TX",
                                   "IR94_BIDIRECTIONAL"):
            message = "%s '%s' %s '%s'" % (
                "Invalid parameter value (or missing parameter)",
                str(self._call_type), "for parameter", "CALL_TYPE")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)

        # Disable Flight Mode on both devices
        self._networking_api.set_flight_mode("off")

        # Set up is done correctly
        return (Global.SUCCESS, "No errors")
Example #5
0
    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 tear_down(self):
        """
        Disposes this test.
        """
        # Call the inherited tear_down method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            LiveLteImsReg.tear_down(self)
        else:
            UseCaseBase.tear_down(self)

        # End of tear_down
        return (Global.SUCCESS, "No errors")
Example #7
0
    def tear_down(self):
        """
        Disposes this test.
        """
        # Call the inherited tear_down method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            LiveLteImsReg.tear_down(self)
        else:
            UseCaseBase.tear_down(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()

        # End of tear_down
        return (Global.SUCCESS, "No errors")
    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)

        # Check registration for secondary DUT
        self._check_registration_second_dut()

        # Release any previous call (Robustness)
        self._logger.info("Releasing any ongoing calls")
        self._voice_call_api.release()
        self._voice_call_api2.release()

        # Return the test result
        return (Global.SUCCESS, "No error.")
    def tear_down(self):
        """
        Disposes this test.
        """

        # Call the inherited tear_down method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            LiveLteImsReg.tear_down(self)
        else:
            UseCaseBase.tear_down(self)

        # Release the call
        self._voice_call_api.release()

        # Check call is idle
        self._voice_call_api.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time)

        # End of tear_down
        return (Global.SUCCESS, "No errors")
Example #10
0
    def __init__(self, tc_name, global_config):
        """
        Initializes this instance.
        """
        # Call inherited initializer
        LiveLteImsReg.__init__(self, tc_name, global_config)

        # Retrieve the content of the message and check the parameter before going any further
        message_content = self._tc_parameters.get_param_value("MESSAGE_CONTENT")
        if message_content :
            self._message = str(message_content)
        else:
            message = "Invalid parameter value: %s for parameter '%s'." % (
                str(message_content),
                "EXECUTION_TIMEOUT")
            self._logger.error(message)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, message)

        # Initialize the attribute to use as phone number
        self._destination_number = self._tc_parameters.get_param_value("DESTINATION_NUMBER")
        # For a stand alone bench, update the phone number with the one defined in bench configuration file
        if self._destination_number == "BB:phone_number":
            # Try to retrieve the phone number from bench configuration file
            self._destination_number = \
                self._retrive_parameter_bench_config(global_config, "PhoneNumberDut1")

        # Read SMS_TRANSFER_TIMEOUT from xml UseCase parameter file
        self._sms_transfer_timeout = \
            int(self._tc_parameters.get_param_value("SMS_TRANSFER_TIMEOUT"))

        if self._ims_reg_operation == "CHECK_ONLY":
            self._perform_ims_registration = False
        else:
            self._perform_ims_registration = True

        # Instantiate UE categories for first device
        self._sms_api = self._device.get_uecmd("SmsMessaging")
        self._networking_api = self._device.get_uecmd("Networking")
Example #11
0
    def set_up(self):
        """
        Initializes the test.
        """
        # Call the inherited set_up method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            # Call inherited setup method
            self._logger.info("Performing IMS registration step as requested.")
            LiveLteImsReg.set_up(self)
            # Disable Flight Mode on the device
            self._networking_api.set_flight_mode("off")
        else:
            # Call the base setup method in order to be
            # compliant with ACS framework
            self._logger.info("Skipping IMS registration step (assumed to be done).")
            UseCaseBase.set_up(self)
            # Simply perform a IMS registration check
            self._networking_api.check_ims_registration_before_timeout(1)

        # Set up is done correctly
        return (Global.SUCCESS, "No errors")
    def __init__(self, tc_name, global_config):
        """
        Initializes this instance.
        """
        # Call inherited initializer
        LiveLteImsReg.__init__(self, tc_name, global_config)

        # Read the call direction parameter
        self._call_direction = str(
            self._tc_parameters.get_param_value("CALL_DIRECTION", "MO"))

        # Read the call release parameter
        self._call_release_direction = str(
            self._tc_parameters.get_param_value("CALL_RELEASE", "MR"))

        # Read the call type parameter
        self._call_type = self._tc_parameters.get_param_value("CALL_TYPE", "")

        # Retrieve call duration parameter
        self._callduration = \
            int(self._tc_parameters.get_param_value("CALL_DURATION", 15))

        # Read the parameter for call on hold/resume procedure
        self._check_on_hold_resume_procedure = str_to_bool(
            self._tc_parameters.get_param_value("CHECK_CALL_ON_HOLD_RESUME",
                                                "False"))

        # Read the call option parameter for remote party
        self._remote_party_action = \
            self._tc_parameters.get_param_value("REMOTE_PARTY_ACTION", "")

        # Initialize some attributes to store various phone numbers
        self._phone_no_main_dut = None
        self._phone_no_secondary_dut = None

        # Read the phone number parameter from TC's XML
        self._phone_number = self._tc_parameters.get_param_value(
            "PHONE_NUMBER")

        # If Phone number is not specified in TC XML, try to retrieve it from bench config
        if self._phone_number is None:
            # Retrieve the numbers for each phone used, from bench config file
            self._phone_no_main_dut = \
                self._retrive_parameter_bench_config(global_config, "PhoneNumberDut1")
            self._phone_no_secondary_dut = \
                self._retrive_parameter_bench_config(global_config, "PhoneNumberDut2")

        if self._ims_reg_operation == "CHECK_ONLY":
            self._perform_ims_registration = False
        else:
            self._perform_ims_registration = True

        # Read the ftp transfer parameter
        self._ftp_transfer = str_to_bool(
            self._tc_parameters.get_param_value("FTP_TRANSFER", "False"))

        if self._ftp_transfer is True:
            # Retrieve the parameters needed for FTP data transfer
            self._retrieve_ftp_parameters(global_config)
            # Instantiate the FTP UE commands for main device
            self._ftp_api = self._device.get_uecmd("Ftp")
        else:
            # Initialize the FTP parameters
            self._ftp_api = None
            self._server = None
            self._server_ip_v4_address = None
            self._server_ip_v6_address = None
            self._username = None
            self._password = None
            self._ftp_path = None
            self._ftp_direction = None
            self._ftp_filename = None
            self._dl_ftp_filename = None
            self._ftp_ip_version = None
            self._ip_address = None
            self._xfer_timeout = None

        # Read callSetupTimeout from Phone_Catalog.xml
        self._call_setup_time = \
            int(self._dut_config.get("callSetupTimeout"))

        # Instantiate UE categories for first device
        self._voice_call_api = self._device.get_uecmd("VoiceCall")
        self._networking_api = self._device.get_uecmd("Networking")
        self._file_system_api = self._device.get_uecmd("File")
        self._phone_system_api = self._device.get_uecmd("PhoneSystem")

        # Load instance of the PHONE2
        self._remote_phone = DeviceManager().get_device("PHONE2")
        self._remote_dut_config = DeviceManager().get_device_config("PHONE2")

        # Instantiate UE categories for second device
        if self._remote_phone is not None:
            self._voice_call_api2 = self._remote_phone.get_uecmd("VoiceCall")
            self._networking_api2 = self._remote_phone.get_uecmd("Networking")
            self._phone_system_api2 = self._remote_phone.get_uecmd(
                "PhoneSystem")
        else:
            self._voice_call_api2 = None
            self._networking_api2 = None
            self._phone_system_api2 = None
    def set_up(self):
        """
        Initializes the test.
        """

        # Call the inherited set_up method
        # Ugly temporary solution before implementing something
        # better using test steps.
        if self._perform_ims_registration:
            # Call inherited setup method
            self._logger.info("Performing IMS registration step as requested.")
            LiveLteImsReg.set_up(self)
        else:
            # Call the base setup method in order to be
            # compliant with ACS framework
            self._logger.info(
                "Skipping IMS registration step (assumed to be done).")
            UseCaseBase.set_up(self)
            if self._perform_ims_registration is None:
                # But raise an exception
                message = "Invalid parameter value for IMS_REGISTRATION_OPERATION"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         message)
            # Simply perform a IMS registration check
            self._networking_api.check_ims_registration_before_timeout(10)

        # Check the call duration parameter
        if not self._callduration:
            message = "%s '%s' %s '%s'" % (
                "Invalid parameter value (or missing parameter)",
                str(self._callduration), "for parameter", "CALL_DURATION")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)
        # We arbitrarily set a minimum allowed value for call duration
        if self._callduration < 15:
            message = "%s '%s' %s '%s'. %s." % (
                "Invalid parameter value ", str(
                    self._callduration), "for parameter", "CALL_DURATION",
                "The value should be set to 15 at the minimum")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)

        # Check the call type parameter
        if self._call_type not in ("IR92", "IR94_AUDIO", "IR94_RX", "IR94_TX",
                                   "IR94_BIDIRECTIONAL"):
            message = "%s '%s' %s '%s'" % (
                "Invalid parameter value (or missing parameter)",
                str(self._call_type), "for parameter", "CALL_TYPE")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)

        # Check the call type parameter
        if self._call_direction not in ("MO", "MT"):
            message = "%s '%s' %s '%s'" % (
                "Invalid parameter value (or missing parameter)",
                str(self._call_direction), "for parameter", "CALL_DIRECTION")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)

        # Check the call type parameter
        if self._call_release_direction not in ("MR", "NR"):
            message = "%s '%s' %s '%s'" % ("Invalid parameter value",
                                           str(self._call_release_direction),
                                           "for parameter", "CALL_RELEASE")
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)

        # Check if we have the second phone available
        if self._remote_phone is None:
            # We are using this multi UC with only one phone
            message = \
                "This use case requires two phones to be executed !"
            self._logger.error(message)
            raise AcsConfigException(AcsConfigException.INVALID_BENCH_CONFIG,
                                     message)

        # Boot the other phone (the DUT is already booted)
        if not self._remote_phone.is_available():
            DeviceManager().boot_device("PHONE2")

        # Disable Flight Mode for the secondary DUT (robustness)
        self._networking_api2.set_flight_mode("off")

        # Set up is done correctly
        return (Global.SUCCESS, "No errors")
Example #14
0
    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)

        # Initialize verdict variables
        verdict = Global.SUCCESS
        message = "No error."

        # Attempt an IMS VoiceCall
        self._phone_system_api.wake_screen()
        self._voice_call_api.dial(self._phone_number, False, False,
                                  self._call_type)

        # Check voice call is active
        # Use a protected block here because we do not want
        # the Use Case to break in case of failure, as we
        # have some additional checks to perform.
        try:
            self._voice_call_api.wait_for_state(
                self._uecmd_types.VOICE_CALL_STATE.ACTIVE,
                self._call_setup_time)

        except DeviceException as device_ex:
            # Log the error and update the verdict accordingly
            message = "Could not establish Voice Call, " \
                "exception caught: %s" % str(device_ex)
            self._logger.error(message)
            verdict = Global.FAILURE
            # Robustness: release the call
            self._voice_call_api.release()

        # Proceed with the following test steps only if the
        # previous one succeeded.
        # Use a protected block here because we do not want
        # the Use Case to break in case of failure, as we
        # have some additional checks to perform.
        if verdict != Global.FAILURE:
            # Wait for call duration
            self._logger.info("Wait for call duration: %s s..." %
                              str(self._callduration))
            time.sleep(self._callduration)

            # Check call is still active
            try:
                self._voice_call_api.check_state(
                    self._uecmd_types.VOICE_CALL_STATE.ACTIVE)

                # Release the call
                self._voice_call_api.release()

                # Check call is idle
                self._voice_call_api.wait_for_state(
                    self._uecmd_types.VOICE_CALL_STATE.NOCALL,
                    self._call_setup_time)
            except DeviceException as device_ex:
                message = "Error during Voice Call, " \
                    "exception caught: %s" % str(device_ex)
                self._logger.error(message)
                verdict = Global.FAILURE

        # 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):
            message = "IMS stack has crashed or IMS registration is lost."
            self._logger.error(message)
            verdict = Global.FAILURE

        # Return the test result
        return (verdict, message)
    def __init__(self, tc_name, global_config):
        """
        Initializes this instance.
        """
        # Call inherited initializer
        LiveLteImsReg.__init__(self, tc_name, global_config)

        # Retrieve the content of the message and check the parameter before going any further
        message_content = self._tc_parameters.get_param_value(
            "MESSAGE_CONTENT")
        if message_content:
            self._message = str(message_content)
        else:
            message = "Invalid parameter value: %s for parameter '%s'." % (
                str(message_content), "EXECUTION_TIMEOUT")
            self._logger.error(message)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     message)

        # Initialize the attribute to use as phone number
        self._destination_number = self._tc_parameters.get_param_value(
            "DESTINATION_NUMBER")
        # For a stand alone bench, update the phone number with the one defined in bench configuration file
        if self._destination_number == "BB:phone_number":
            # Try to retrieve the phone number from bench configuration file
            self._destination_number = \
                self._retrive_parameter_bench_config(global_config, "PhoneNumberDut1")

        # Read SMS_TRANSFER_TIMEOUT from xml UseCase parameter file
        self._sms_transfer_timeout = \
            int(self._tc_parameters.get_param_value("SMS_TRANSFER_TIMEOUT"))

        if self._ims_reg_operation == "CHECK_ONLY":
            self._perform_ims_registration = False
        else:
            self._perform_ims_registration = True

        # Get FTP server parameters from bench config file
        self._server = \
            global_config.benchConfig.get_parameters("LAB_LTE_IMS_SERVER")
        self._ip_address = self._server.get_param_value("IP")
        self._username = self._server.get_param_value("username")
        self._password = self._server.get_param_value("password")

        if self._server.has_parameter("ftp_path"):
            self._ftp_path = self._server.get_param_value("ftp_path")
        else:
            self._ftp_path = ""

        # The get_param_value output is casted to a str
        # None will be "None"
        if self._username in ("None", ""):
            self._logger.info("FTP user not indicated, using 'anonymous'")
            self._username = str("anonymous")

        # The get_param_value, output is casted to a str
        # None will be "None"
        if self._password in ("None", ""):
            self._logger.info(
                "FTP user's password not indicated, using 'none'")
            self._password = str("none")

        # Read the ftp DL file name from TC's xml
        self._ftp_filename = os.path.join(
            self._ftp_path,
            self._tc_parameters.get_param_value("DL_FILENAME", ""))
        self._ftp_filename = self._ftp_filename.replace('\\', '/')
        self._dl_ftp_filename = None

        # The base name of the file we download
        self._ftp_file_basename = self._tc_parameters.get_param_value(
            "BASENAME")

        # Some attributes needed to add robustness to FTP operations
        # The absolute file path on the DUT
        self._absolute_path_on_dut = None

        # Get UECmdLayer for Data Use Cases
        self._networking_api = self._device.get_uecmd("Networking")
        self._phone_system_api = self._device.get_uecmd("PhoneSystem")
        self._ftp_api = self._device.get_uecmd("Ftp")
        self._sms_api = self._device.get_uecmd("SmsMessaging")
    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)