Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 5
0
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"
Exemplo n.º 6
0
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"