Beispiel #1
0
    def set_up(self):
        """
        Set up the test configuration
        """
        # Call the LAB_GSM_SMS_CS_BASE Setup function
        LabGsmSmsCsBase.set_up(self)

        # Set sender address using DESTINATION_NUMBER on Network simulator
        self._ns_messaging_2g.set_sms_sender_address(self._destination_number)

        self._ns_messaging_2g.set_cell_broadcast_message_identifier(
            self._cell_broadcast_message_identifier,
            self._cell_broadcast_message)

        self._ns_messaging_2g.set_cell_broadcast_message_repetition_period(
            self._repetition_period)

        self._ns_messaging_2g.select_cell_broadcast_message_content(
            self._content_type, self._cell_broadcast_message)

        self._ns_messaging_2g.set_cell_broadcast_message_update_number(
            self._update_number, self._cell_broadcast_message)

        if self._content_type == "CTEX":
            self._ns_messaging_2g.set_custom_cell_broadcast_text_message(
                self._custom_cell_broadcast_text_message,
                self._cell_broadcast_message)
        elif self._content_type == "CDAT":
            self._ns_messaging_2g.set_custom_cell_broadcast_data_string(
                self._custom_cell_broadcast_text_message,
                self._cell_broadcast_message)

        return Global.SUCCESS, "No errors"
Beispiel #2
0
    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"))
Beispiel #3
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        LabGsmSmsCsBase.__init__(self, tc_name, global_config)
        # Set dummy phoneNumber
        self._destination_number = "123456789"

        # Set cell broadcast message 1 as the sms cb which will be used
        self._cell_broadcast_message = 1
        #
        self._cell_broadcast_message_identifier = int(
            self._tc_parameters.get_param_value(
                "CELL_BROADCAST_MESSAGE_IDENTIFIER"))

        self._repetition_period = int(
            self._tc_parameters.get_param_value("REPETITION_PERIOD"))

        self._update_number = int(
            self._tc_parameters.get_param_value("UPDATE_NUMBER"))

        self._custom_cell_broadcast_text_message = self._sms_text

        self._cb_messaging_api = self._device.get_uecmd(
            "CellBroadcastMessaging")
Beispiel #4
0
    def tear_down(self):
        """
        End and dispose the test
        """

        # Release the call
        self._vc_2g.voice_call_network_release()

        try:
            # Check call is released (NS)
            self._vc_2g.check_call_idle(self._registration_timeout,
                                        blocking=False)

            # Check call is released (CDK)
            self._voicecall_api.wait_for_state(
                self._uecmd_types.VOICE_CALL_STATE.NOCALL,  # pylint: disable=E1101
                self._call_setup_time)

        except AcsBaseException as acs_exception:
            self._logger.warning("Call release fail:" + str(acs_exception))

        # Call use case base tear_down function
        LabGsmSmsCsBase.tear_down(self)

        # Clear just received cell broadcast sms
        self._cb_messaging_api.clear_all_cell_broadcast_sms()

        return Global.SUCCESS, "No errors"
Beispiel #5
0
    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
        LabGsmSmsCsBase.set_up(self)

        return Global.SUCCESS, "No errors"
Beispiel #6
0
    def tear_down(self):
        """
        End and dispose the test
        """

        # Call use case base tear_down function
        LabGsmSmsCsBase.tear_down(self)

        # Clear just received cell broadcast sms
        time.sleep(self._wait_btwn_cmd)
        self._cb_messaging_api.clear_all_cell_broadcast_sms()

        return Global.SUCCESS, "No errors"
Beispiel #7
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        LabGsmSmsCsBase.__init__(self, tc_name, global_config)
        # Set dummy phoneNumber
        self._sms_cb_destination_number = "123456789"

        # Set remote party phoneNumber
        self._distant_number = self._tc_parameters.get_param_value(
            "PHONE_NUMBER")

        # Set cell broadcast message 1 as the sms cb which will be used
        self._cell_broadcast_message = 1
        #
        self._cell_broadcast_message_identifier = int(
            self._tc_parameters.get_param_value(
                "CELL_BROADCAST_MESSAGE_IDENTIFIER"))

        self._repetition_period = int(
            self._tc_parameters.get_param_value("REPETITION_PERIOD"))

        self._update_number = int(
            self._tc_parameters.get_param_value("UPDATE_NUMBER"))

        self._custom_cell_broadcast_text_message = self._sms_text

        self._cb_messaging_api = self._device.get_uecmd(
            "CellBroadcastMessaging")

        self._vc_2g = self._ns_cell_2g.get_voice_call()

        self._voicecall_api = self._device.get_uecmd("VoiceCall")

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

        # Read VC_TYPE from test case xml file
        self._vc_type = str(self._tc_parameters.get_param_value("VC_TYPE"))
Beispiel #8
0
    def run_test(self):
        """
        Execute the test
        """

        # Call the LAB_GSM_SMS_CS_BASE run_test function
        LabGsmSmsCsBase.run_test(self)

        # Set the default SMS service center
        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()
Beispiel #9
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call LabGsmSmsCsBase init function
        LabGsmSmsCsBase.__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, "GSM",
                               self._ns_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)
Beispiel #10
0
    def run_test(self):
        """
        Execute the test
        """

        LabGsmSmsCsBase.run_test(self)

        # Start SMS cell broadcast
        self._ns_messaging_2g.start_cell_broadcast()
        self._logger.info("Start Cell Broadcast")

        received_cb_sms = self._cb_messaging_api.\
            wait_for_incoming_cell_broadcast_sms(self._sms_transfer_timeout)

        self._ns_messaging_2g.stop_cell_broadcast()

        try:
            received_cb_sms_text = received_cb_sms["sms_cb_text"]
            received_cb_sms_category = received_cb_sms["sms_cb_category"]
        except KeyError:
            self._error.Msg = "received_cb_sms doesn't have all the information" \
                "text, category and serial_number :: %s " % str(received_cb_sms)
            raise DeviceException(DeviceException.OPERATION_FAILED,
                                  self._error.Msg)

        if received_cb_sms_text != self._custom_cell_broadcast_text_message or \
                int(received_cb_sms_category) != self._cell_broadcast_message_identifier:
            test_result = Global.FAILURE
            self._error.Msg = "Sent CB SMS isn't the same as received one"\
                "sent cb sms text : %s  received_cb_sms_text : %s " \
                "sent cb sms category : %d  received_cb_sms_category: %d" \
                % (self._custom_cell_broadcast_text_message, received_cb_sms_text,
                   self._cell_broadcast_message_identifier, int(received_cb_sms_category))
        else:
            test_result = Global.SUCCESS
            self._error.Msg = "Match between sent and received SMS CB regarding text, category and serial number"

        return test_result, self._error.Msg
Beispiel #11
0
    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"
Beispiel #12
0
    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
Beispiel #13
0
    def set_up(self):
        """
        Set up the test configuration
        """
        # Call the LAB_GSM_SMS_CS_BASE Setup function
        LabGsmSmsCsBase.set_up(self)

        # Set sender address using DESTINATION_NUMBER on Network simulator
        self._ns_messaging_2g.set_sms_sender_address(
            self._sms_cb_destination_number)

        self._ns_messaging_2g.set_cell_broadcast_message_identifier(
            self._cell_broadcast_message_identifier,
            self._cell_broadcast_message)

        self._ns_messaging_2g.set_cell_broadcast_message_repetition_period(
            self._repetition_period)

        self._ns_messaging_2g.select_cell_broadcast_message_content(
            self._content_type, self._cell_broadcast_message)

        self._ns_messaging_2g.set_cell_broadcast_message_update_number(
            self._update_number, self._cell_broadcast_message)

        if self._content_type == "CTEX":
            self._ns_messaging_2g.set_custom_cell_broadcast_text_message(
                self._custom_cell_broadcast_text_message,
                self._cell_broadcast_message)
        elif self._content_type == "CDAT":
            self._ns_messaging_2g.set_custom_cell_broadcast_data_string(
                self._custom_cell_broadcast_text_message,
                self._cell_broadcast_message)

        if self._vc_type not in ("MT", "MO"):
            raise AcsConfigException(AcsConfigException.INVALID_BENCH_CONFIG,
                                     "Invalid voice call type")

        # Release any previous call (Robustness)
        self._voicecall_api.release()

        # Establish voice call
        if self._vc_type == "MO":

            # Dial using a dummy hard-coded phone number
            self._logger.info("Calling distant party...")
            self._voicecall_api.dial(self._distant_number)

        elif self._vc_type == "MT":
            # Initiate VoiceCall to CDK
            self._vc_2g.mt_originate_call()
            # pylint: disable=E1101
            # Check call status is incoming before callSetupTimeout
            self._voicecall_api.wait_for_state(
                self._uecmd_types.VOICE_CALL_STATE.INCOMING,
                self._call_setup_time)
            # Answer incoming call
            self._voicecall_api.answer()

        # Check call status before callSetupTimeout (NS)
        self._vc_2g.check_call_connected(self._call_setup_time)

        # Check call status before callSetupTimeout (CDK)
        self._voicecall_api.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE,  # pylint: disable=E1101
            self._call_setup_time)

        return Global.SUCCESS, "No errors"