def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.__init__(self, tc_name, global_config)

        # Instantiate generic UECmd for voiceCall Ucs
        self._voice_call_api = self._device.get_uecmd("VoiceCall")
        self._phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self._networking_api = self._device.get_uecmd("Networking")

        self._voice_call_api2 = None

        # Read Audio Analyzer parameters from bench config xml file (str)
        # self._audio_analyzer_node = global_config.benchConfig.\
        #    get_parameters("AudioAnalyzer")

        if self._audio_analyzer_node.get_param_value("Model") in "APx585":
            self._test_type = "audioactivity"

        # Instantiate the instances for phone caller, receiver and releaser
        self._phone_calling = None
        self._phone_receiving = None
        self._phone_releasing = None
        # Initialization of phone_number to call
        self._calling_phone_number = None
    def set_up(self):
        """
        Set up the test configuration
        """
        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.set_up(self)

        if self._phone2 is not None:
            self._voice_call_api2 = self._phone2.get_uecmd("VoiceCall")
        else:
            error_msg = \
                "This test case requires two phones to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_BENCH_CONFIG,
                                     error_msg)

        # Setup phone type for this test Mobile terminated is mandatory
        self._phone_calling = self._voice_call_api2
        self._phone_receiving = self._voice_call_api
        self._calling_phone_number = self._device.get_phone_number()
        self._phone_releasing = self._voice_call_api2

        # Release any previous call (Robustness)
        self._voice_call_api.release()
        self._voice_call_api2.release()

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

        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.tear_down(self)

        # Stop Sip Service
        if self._sip_call_api is not None:
            self._sip_call_api.clean_sipcall_module()
        if self._sip_call_api2 is not None:
            self._sip_call_api2.clean_sipcall_module()

        # Disable Wifi connections
        if self._result_verdict != Global.SUCCESS:
            if self._networking_api is not None:
                self._networking_api.clean_all_data_connections()
                time.sleep(self._wait_btwn_cmd)
                self._networking_api.set_wifi_power("off")
            if self._networking_api2 is not None:
                self._networking_api2.clean_all_data_connections()
                time.sleep(self._wait_btwn_cmd)
                self._networking_api2.set_wifi_power("off")

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

        # Call LabAudioQualityBase tear_down function
        LabAudioQualityBase.tear_down(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()

        # Release any previous call (Robustness)
        if self._voice_call_api is not None:
            self._voice_call_api.release()
        if self._voice_call_api2 is not None:
            self._voice_call_api2.release()

        if self._is_network_simulator_used:

            # Stop IMS service if needed
            if self._call_type in "4G":
                self._ns_cell.set_ims_off()

            # Set cell off
            self._ns_cell.set_cell_off()

            # Disconnect Equipment
            self._ns.release()

        return Global.SUCCESS, "No errors"
    def tear_down(self):
        """
        End and dispose the test
        """
        try:
            # RELEASE THE CALL
            # Phone1 & 2 : Check call is still active
            self._phone_calling.wait_for_state(
                self._uecmd_types.SIP_CALL_STATE.IN_CALL,
                self._call_setup_time)

            if self._phone_receiving:
                self._phone_receiving.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.IN_CALL,
                    self._call_setup_time)

            self._phone_releasing.release()

            self._phone_releasing.wait_for_state(
                self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
                self._call_setup_time)

            if self._phone_receiving:
                self._phone_receiving.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
                    self._call_setup_time)

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

        # Call LabAudioQualityBase tear_down function
        LabAudioQualityBase.tear_down(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()

        # Stop Sip Service
        if self._sip_call_api is not None:
            self._sip_call_api.clean_sipcall_module()
        if self._sip_call_api2 is not None:
            self._sip_call_api2.clean_sipcall_module()

        # Disable Wifi connections
        if self._result_verdict != Global.SUCCESS:
            if self._networking_api is not None:
                self._networking_api.clean_all_data_connections()
                time.sleep(self._wait_btwn_cmd)
                self._networking_api.set_wifi_power("off")
            if self._networking_api2 is not None:
                self._networking_api2.clean_all_data_connections()
                time.sleep(self._wait_btwn_cmd)
                self._networking_api2.set_wifi_power("off")

        return Global.SUCCESS, "No errors"
    def run_test(self):
        """
        Execute the test
        """
        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.run_test(self)

        if self._hold_mute == "MUTE":
            self._sip_call_api.toogle_mute()

            # Check no audio on uplink after mute call
            audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL")
            audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL")

            #unmute call
            self._sip_call_api.toogle_mute()

            if audio_analyzer_result_ul == 2 and audio_analyzer_result_dl == 0:
                # Check audio on uplink is back after unmute
                audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL")
                audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL")
                if audio_analyzer_result_dl == 0 and audio_analyzer_result_ul == 0:
                    audio_analyzer_result = 0
                else:
                    audio_analyzer_result = 4
            else:
                audio_analyzer_result = 4

        elif self._hold_mute == "HOLD":
            self._sip_call_api.hold_call()

            # Check no audio on uplink after mute call
            audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL")
            audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL")

            #unhold call
            self._sip_call_api.unhold_call()

            if audio_analyzer_result_ul == 2 and audio_analyzer_result_dl == 2:
                # Check audio on uplink is back after unmute
                audio_analyzer_result_ul = self._audio_analyzer.run(self._call_type, self._acc_type, "UL")
                audio_analyzer_result_dl = self._audio_analyzer.run(self._call_type, self._acc_type, "DL")
                if audio_analyzer_result_dl == 0 and audio_analyzer_result_ul == 0:
                    audio_analyzer_result = 0
                else:
                    audio_analyzer_result = 4
            else:
                audio_analyzer_result = 4
        else:
            self._logger.error("Unknown hold/mute argument")
            audio_analyzer_result = 4

        # Compute test verdict and comment verdict
        self.__compute_test_verdict__(audio_analyzer_result)

        return self._result_verdict, self._verdict_comment
Beispiel #7
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.run_test(self)

        # WAIT FOR CALL DURATION
        self._logger.info("Wait for call duration: %s s..." %
                          str(self._call_duration))

        # Set Voice Call Volume 0%
        self._system_api.adjust_specified_stream_volume("VoiceCall", 0)
        # Launch audio_quality test
        audio_analyzer_result, l_volume_zero_percent = self._audio_analyzer.get_volume(
            self._call_type, self._acc_type)
        self._logger.info("Volume at 0 percent: %s " %
                          str(l_volume_zero_percent))

        # Set Voice Call Volume 100%
        self._system_api.adjust_specified_stream_volume("VoiceCall", 100)
        # Launch audio_quality test
        audio_analyzer_result2, l_volume_hundred_percent = self._audio_analyzer.get_volume(
            self._call_type, self._acc_type)
        self._logger.info("Volume at 100 percent: %s " %
                          str(l_volume_hundred_percent))

        self._keyevent_api.scenario(["POWER_BUTTON"])
        # Set Voice Call Volume 0%
        self._system_api.adjust_specified_stream_volume("VoiceCall", 0)
        # Launch audio_quality test
        audio_analyzer_result3, l_volume_zero_percent2 = self._audio_analyzer.get_volume(
            self._call_type, self._acc_type)
        self._logger.info(
            "Volume at 0 percent after press power down button: %s " %
            str(l_volume_zero_percent2))

        if audio_analyzer_result == 0 and audio_analyzer_result2 == 0 and audio_analyzer_result3 == 0:
            l_delta1 = int(l_volume_hundred_percent) - int(
                l_volume_zero_percent)
            l_delta2 = int(l_volume_hundred_percent) - int(
                l_volume_zero_percent2)
            self._delta_volume = abs(l_delta1 - l_delta2)

            if self._delta_volume < 10:
                self._result_verdict = 0
            else:
                self._result_verdict = 1
        else:
            self._result_verdict = 3
        # Compute test verdict and comment verdict
        self.__compute_test_verdict__(self._result_verdict)

        return self._result_verdict, self._verdict_comment
Beispiel #8
0
    def set_up(self):
        """
        Set up the test configuration
        """
        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.set_up(self)

        if self._phone2 is not None:
            self._voice_call_api2 = self._phone2.get_uecmd("VoiceCall")
        elif self._is_network_simulator_used:
            self._voice_call_api2 = self._vc
        else:
            error_msg = \
                "This test case requires two phones to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_BENCH_CONFIG,
                                     error_msg)

        # Setup phone type ( calling, receiving, releasing phone)
        if self._call_origin_type == "MO":
            self._phone_calling = self._voice_call_api
            self._phone_receiving = self._voice_call_api2
            if not self._is_network_simulator_used:
                self._calling_phone_number = self._phone2.get_phone_number()
            else:
                self._calling_phone_number = "1234"
        elif self._call_origin_type == "MT":
            self._phone_calling = self._voice_call_api2
            self._phone_receiving = self._voice_call_api
            self._calling_phone_number = self._device.get_phone_number()
        else:
            error_msg = \
                "This test case requires call originated type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     error_msg)

        if self._call_end_type == "NR":
            self._phone_releasing = self._voice_call_api2
        elif self._call_end_type == "MR":
            self._phone_releasing = self._voice_call_api
        else:
            error_msg = \
                "This test case requires call end type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     error_msg)

        # Release any previous call (Robustness)
        self._voice_call_api.release()
        self._voice_call_api2.release()

        return Global.SUCCESS, "No errors"
    def tear_down(self):
        """
        End and dispose the test
        """
        try:
            # RELEASE THE CALL
            # Phone1 & 2 : Check call is still active
            self._phone_calling.check_state(
                self._uecmd_types.VOICE_CALL_STATE.ACTIVE)
            self._phone_receiving.check_state(
                self._uecmd_types.VOICE_CALL_STATE.ACTIVE)

            # Hang up call
            self._phone_releasing.release()

            # Phone1 & 2 : Check call is idle
            self._phone_calling.wait_for_state(
                self._uecmd_types.VOICE_CALL_STATE.NOCALL,
                self._call_setup_time)
            self._phone_receiving.wait_for_state(
                self._uecmd_types.VOICE_CALL_STATE.NOCALL,
                self._call_setup_time)

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

        # Call LabAudioQualityBase tear_down function
        LabAudioQualityBase.tear_down(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()

        # Release any previous call (Robustness)
        if self._voice_call_api is not None:
            self._voice_call_api.release()
        if self._voice_call_api2 is not None:
            self._voice_call_api2.release()

        return Global.SUCCESS, "No errors"
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.__init__(self, tc_name, global_config)

        # Read wifi parameters from bench config xml file (int)
        self._wifirouter = global_config.benchConfig. \
            get_parameters("WIFI_ACCESS_POINT")
        self._wifi_security = self._wifirouter.get_param_value("WIFI_SECURITY")
        self._wifi_passphrase = self._wifirouter.get_param_value("passphrase")
        self._ssid = self._wifirouter.get_param_value("SSID")

        # Read dut sip address from test case xml file (str)
        self._dut_sip_address = \
            str(self._tc_parameters.get_param_value("DUT_SIP_ADDRESS"))

        # Read ref phone sip address from test case xml file (str)
        self._peer_sip_address = \
            str(self._tc_parameters.get_param_value("PEER_SIP_ADDRESS"))

        # Read hold or mute parameter (str)
        self._hold_mute = \
            str(self._tc_parameters.get_param_value("HOLD_MUTE"))

        self._dut_sip_passphrase = None
        self._peer_sip_passphrase = None
        # Instantiate generic UECmd for voiceCall Ucs
        self._networking_api = self._device.get_uecmd("Networking")
        self._sip_call_api = self._device.get_uecmd("SipCall")

        # Instantiate the instances of member class variables
        self._sip_call_api2 = None
        self._networking_api2 = None
        self._phone_calling = None
        self._phone_receiving = None
        self._phone_releasing = None
        # Initialization of phone_number to call
        self._calling_phone_number = None
Beispiel #11
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.__init__(self, tc_name, global_config)

        # Instantiate generic UECmd for voiceCall Ucs
        self._voice_call_api = self._device.get_uecmd("VoiceCall")
        self._phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self._networking_api = self._device.get_uecmd("Networking")

        self._voice_call_api2 = None

        # Instantiate the instances for phone caller, receiver and releaser
        self._phone_calling = None
        self._phone_receiving = None
        self._phone_releasing = None
        # Initialization of phone_number to call
        self._calling_phone_number = None
Beispiel #12
0
    def tear_down(self):
        """
        End and dispose the test
        """

        # Call LabAudioQualityBase tear_down function
        LabAudioQualityBase.tear_down(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()

        # Release any previous call (Robustness)
        if self._voice_call_api is not None:
            self._voice_call_api.release()
        if self._voice_call_api2 is not None:
            self._voice_call_api2.release()

        return Global.SUCCESS, "No errors"
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.__init__(self, tc_name, global_config)

        # Instantiate generic UECmd for voiceCall Ucs
        self._phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self._keyevent_api = self._device.get_uecmd("KeyEvent")
        self._networking_api = self._device.get_uecmd("Networking")

        self._voice_call_api2 = None

        # Read wifi parameters from bench config xml file (int)
        self._wifirouter = global_config.benchConfig.\
            get_parameters("WIFI_ACCESS_POINT")
        self._ssid = self._wifirouter.get_param_value("SSID")

        # Read dut sip address from test case xml file (string)
        self._dut_sip_address = \
            str(self._tc_parameters.get_param_value("DUT_SIP_ADDRESS"))

        # Read ref phone sip address from test case xml file (string)
        self._peer_sip_address = \
            str(self._tc_parameters.get_param_value("PEER_SIP_ADDRESS"))
        # Instantiate generic UECmd for voiceCall Ucs
        self._networking_api = self._device.get_uecmd("Networking")
        self._sip_call_api = self._device.get_uecmd("SipCall")

        # Instantiate the instances of member class variables
        self._sip_call_api2 = None
        self._networking_api2 = None
        self._phone_calling = None
        self._phone_receiving = None
        self._phone_releasing = None
        self._calling_phone_number = None
        self._delta_volume = 0
    def run_test(self):
        """
        Execute the test
        """
        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.run_test(self)

        self._voice_call_api.set_mute(1)

        # Check no audio on uplink after mute call. Check audio routing in downlink still after mute call
        audio_analyzer_result_ul = self._audio_analyzer.run(
            self._call_type, self._acc_type, "UL")
        audio_analyzer_result_dl = self._audio_analyzer.run(
            self._call_type, self._acc_type, "DL")

        # unmute call
        self._voice_call_api.set_mute(0)

        if audio_analyzer_result_ul == 2 and audio_analyzer_result_dl == 0:
            # Check audio on uplink is back after unmute
            audio_analyzer_result_ul = self._audio_analyzer.run(
                self._call_type, self._acc_type, "UL")
            audio_analyzer_result_dl = self._audio_analyzer.run(
                self._call_type, self._acc_type, "DL")

            if audio_analyzer_result_dl == 0 and audio_analyzer_result_ul == 0:
                audio_analyzer_result = 0
            else:
                audio_analyzer_result = 4
        else:
            audio_analyzer_result = 4

        # Compute test verdict and comment verdict
        self.__compute_test_verdict__(audio_analyzer_result)

        return self._result_verdict, self._verdict_comment
Beispiel #15
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.run_test(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()
                self._wired_headset.plug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
                self._wired_headset.plug_headphone()

        # Dial using PHONE_NUMBER parameter
        self._phone_calling.dial(self._calling_phone_number)
        time.sleep(self._wait_btwn_cmd)

        # Wait for state "active" before callSetupTimeout seconds
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.INCOMING, self._call_setup_time)

        # Answer call
        self._phone_receiving.answer()

        # Phone1 & 2 : Check voice call is active
        self._phone_calling.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)

        call_start_time = time.localtime()

        # Configure Audio output to acc_type given with the test_case
        if self._acc_type == "EARPIECE":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
                self._wired_headset.unplug_headphone()
        elif self._acc_type == "SPEAKER":
            # Switch to Speaker, nothing to do in Earpiece
            # Bluetooth already done with connect Bluetooth function above
            self._phonesystem_api.switch_audio_output(self._acc_type.lower())
            time.sleep(self._wait_btwn_cmd)

        if self._acc_type.find("BLUETOOTH") == -1:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume(
                "VoiceCall", self._call_stream_volume_dut)
        else:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume(
                "Bluetooth", self._call_stream_volume_dut)

        if self._system_api2:
            self._system_api2.adjust_specified_stream_volume(
                "VoiceCall", self._call_stream_volume_ref)

        self._logger.info("Begin audio checks - Call duration = %d s" %
                          self._call_duration)

        while self._elapsed_time < self._call_duration and self._result_verdict is not Global.FAILURE:

            # Launch audio_quality test
            if self._signal_tested_direction in ["UL", "DL"]:
                audio_analyzer_result = self._audio_analyzer.run(
                    self._call_type, self._acc_type,
                    self._signal_tested_direction)

                # Compute test verdict and comment verdict
                LabAudioQualityBase.__compute_test_verdict__(
                    self, audio_analyzer_result)

            else:
                # Test both UL and DL audio output
                audio_analyzer_result_ul = self._audio_analyzer.run(
                    self._call_type, self._acc_type, "ul")

                audio_analyzer_result_dl = self._audio_analyzer.run(
                    self._call_type, self._acc_type, "dl")

                # Compute test verdict and comment verdict for UL
                LabAudioQualityBase.__compute_test_verdict__(
                    self, audio_analyzer_result_ul)

                if self._result_verdict is Global.SUCCESS:
                    tmp = self._verdict_comment

                    # Compute test verdict and comment verdict for DL
                    LabAudioQualityBase.__compute_test_verdict__(
                        self, audio_analyzer_result_dl)

                    if self._result_verdict is Global.SUCCESS:
                        self._verdict_comment += tmp

            # Wait for the next measurement to be made while checking the CSV call is still active
            if self._is_network_simulator_used:
                if self._call_origin_type in "MO":
                    self._phone_receiving.is_voice_call_connected(
                        self._wait_between_measure)
                elif self._call_origin_type in "MT":
                    self._phone_calling.is_voice_call_connected(
                        self._wait_between_measure)

            # Get elapsed time since call establishment in s
            self._elapsed_time = self._get_elapsed_time(
                call_start_time, time.localtime())
            self._logger.info(
                "Time elapsed since the beginning of the call: %d s" %
                self._elapsed_time)

        # RELEASE THE CALL
        # Phone1 & 2 : Check call is still active
        self._phone_calling.check_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE)
        self._phone_receiving.check_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE)

        # Hang up call
        self._phone_releasing.release()

        # Phone1 & 2 : Check call is idle
        self._phone_calling.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time)
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time)

        return self._result_verdict, self._verdict_comment
Beispiel #16
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.run_test(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()
                self._wired_headset.plug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
                self._wired_headset.plug_headphone()

        # Flight mode activation
        self._logger.info("Airplane mode switch on")
        self._networking_api.set_flight_mode("on")
        time.sleep(self._wait_btwn_cmd)
        # Flight mode desactivation
        self._logger.info("Airplane mode switch off")
        self._networking_api.set_flight_mode("off")
        # Wait networking go back
        self._logger.info("Wait networking go back")
        time.sleep(20)

        # Dial using PHONE_NUMBER parameter
        self._phone_calling.dial(self._calling_phone_number)
        time.sleep(self._wait_btwn_cmd)

        # Wait for state "active" before callSetupTimeout seconds
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.INCOMING, self._call_setup_time)

        # Answer call
        self._phone_receiving.answer()

        # Phone1 & 2 : Check voice call is active
        self._phone_calling.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)

        # Configure Audio output to acc_type given with the test_case
        if self._acc_type == "EARPIECE":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()
                self._wired_headset.unplug_whs()
        elif self._acc_type == "SPEAKER":
            # Switch to Speaker, nothing to do in Earpiece
            # Bluetooth already done with connect Bluetooth function above
            self._phonesystem_api.switch_audio_output(self._acc_type.lower())
            time.sleep(self._wait_btwn_cmd)

        if self._acc_type.find("BLUETOOTH") == -1:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume(
                "VoiceCall", self._call_stream_volume_dut)
        else:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume(
                "Bluetooth", self._call_stream_volume_dut)

        self._system_api2.adjust_specified_stream_volume(
            "VoiceCall", self._call_stream_volume_ref)

        # WAIT FOR CALL DURATION
        self._logger.info("Wait for call duration: %s s..." %
                          str(self._call_duration))

        # Launch audio_quality test
        audio_analyzer_result = self._audio_analyzer.run(
            self._call_type, self._acc_type, self._signal_tested_direction)

        # Compute test verdict and comment verdict
        LabAudioQualityBase.__compute_test_verdict__(self,
                                                     audio_analyzer_result)

        # RELEASE THE CALL
        # Phone1 & 2 : Check call is still active
        self._phone_calling.check_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE)
        self._phone_receiving.check_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE)

        # Hang up call
        self._phone_releasing.release()

        # Phone1 & 2 : Check call is idle
        self._phone_calling.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time)
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time)

        return self._result_verdict, self._verdict_comment
Beispiel #17
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.run_test(self)

        # In case of back-to-back iterations, the DUT or reference phone might have been unplugged
        if self._use_io_card:
            if self._device.get_state() == "unknown":
                self._io_card.usb_connector(plug=True)
                self._system_api.wait_for_device(timeout=60)
                self._device.connect_board()

            if self._io_card_2:
                if self._phone2.get_state() == "unknown":
                    self._io_card_2.usb_connector(plug=True)
                    self._system_api2.wait_for_device(timeout=60)
                    self._phone2.connect_board()

        if self._phone_calling:
            if self._phone_calling.get_sip_call_state() is not self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL:
                self._logger.info("Read state of calling phone: %s" % self._phone_calling.get_sip_call_state())
                self._phone_calling.release()
            self._phone_calling.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
                    self._call_setup_time)

        if self._phone_receiving:
            if self._phone_receiving.get_sip_call_state() is not self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL:
                self._logger.info("Read state of receiving phone: %s" % self._phone_receiving.get_sip_call_state())
                self._phone_receiving.release()
            self._phone_receiving.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
                    self._call_setup_time)

        # Dial using PHONE_NUMBER parameter
        if self._phone_calling:
            if self._phone2:
                self._phone_calling.dial(self._calling_phone_number)
            else:
                self._phone_calling.dial(self._calling_phone_number, check_state=False)
        else:
            self._voip_server.start_mt_call(self._dut_sip_address.split('@')[0],
                                            self._peer_sip_address.split('@')[0])

        if self._phone_receiving:
            self._phone_receiving.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.INCOMING_CALL,
                    self._call_setup_time)

            self._phone_receiving.answer()

        # Phone1 & 2 : Check voice call is active
        if self._phone_calling:
            self._phone_calling.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.IN_CALL,
                    self._call_setup_time)

        if self._phone_receiving:
            self._phone_receiving.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.IN_CALL,
                    self._call_setup_time)

        # Set Voice Call Volume
        self._system_api.adjust_specified_stream_volume("VoiceCall",
                                                        self._call_stream_volume_dut)

        if self._phone_receiving and self._phone2:
            self._system_api2.adjust_specified_stream_volume("VoiceCall",
                                                             self._call_stream_volume_ref)

        start_time = time.localtime()

        if self._elapsed_time > 0:
            self._elapsed_time = 0

        polqa_result_dl = []
        polqa_result_ul = []

        # Start audio quality measurement
        while self._elapsed_time < self._call_duration:

            # Unplug IO card(s)
            if self._use_io_card:
                self._device.disconnect_board()
                self._io_card.usb_connector(plug=False)

                if self._io_card_2:
                    self._phone2.disconnect_board()
                    self._io_card_2.usb_connector(plug=False)

            # If only 1 phone is used, the acquisition of DL and UL audio stream are done using a SIP server
            if not self._phone2:
                # For DL, switch to a playback call profile
                self._voip_server.change_call_profile(self._dut_sip_address.split('@')[0],
                                                      VoIPServerCallUtilities.sip_profiles["PLAYBACK"])

            # Start POLQA measurement in DL
            [tmp_polqa_result_dl, meas_in_range_dl] = self.__start_audio_quality_mos("POLQA",
                                                                                     "DL",
                                                                                     self._audio_analyzer_meas_retry)

            # If the current measurement result is not in the expected MOS range, do not take it into account
            if meas_in_range_dl:
                polqa_result_dl.append(float(tmp_polqa_result_dl))

                # If User does not want to keep recorded audio file, it will not be stored
                # only if test is PASS
                if self._keep_record is True or polqa_result_dl[-1] < float(self._polqa_target):
                    self._host_deg_file_path += time.strftime('%Y%m%d_%H%M%S', time.localtime()) + "_DL" ".wav"
                    self._audio_analyzer.copy_from_upv(self._aa_deg_file_path, self._host_deg_file_path)

                    self._host_deg_file_path = self._host_deg_file_path.split(str(time.localtime().tm_year))[0]

            if not self._phone2:
                # For UL, switch to a record call profile
                self._voip_server.change_call_profile(self._dut_sip_address.split('@')[0],
                                                      VoIPServerCallUtilities.sip_profiles["RECORD"])
                self._audio_analyzer.start_single_measurement(wait_for_result=False)
                self._audio_analyzer.wait_for_meas_state("measurement_terminated")

                self._voip_server_computer.copy_file_in_local_path(self._voip_server_deg_file, self._local_deg_file)
                # Copy degraded audio file to UPV for offline POLQA measurement
                self._audio_analyzer.copy_to_upv(os.path.join(self._aa_conf_path, self._degraded_audio_file),
                                                 self._aa_deg_file_path)

                # Start POLQA measurement in offline mode
                [tmp_polqa_result_ul, meas_in_range_ul] = self.__start_audio_quality_mos("POLQA",
                                                                                         "DL",
                                                                                         self._audio_analyzer_meas_retry,
                                                                                         load_setup=False,
                                                                                         offline=True)
            else:
                # Start POLQA measurement in UL
                [tmp_polqa_result_ul, meas_in_range_ul] = self.__start_audio_quality_mos("POLQA",
                                                                                         "UL",
                                                                                         self._audio_analyzer_meas_retry)

            # Plug IO card(s)
            if self._use_io_card:
                self._io_card.usb_connector(plug=True)

                self._system_api.wait_for_device(timeout=60)
                self._device.connect_board()

                if self._io_card_2:
                    self._io_card_2.usb_connector(plug=True)

                    self._system_api2.wait_for_device(timeout=60)
                    self._phone2.connect_board()

            # If the current measurement result is not in the expected MOS range, do not take it into account
            if meas_in_range_ul:
                polqa_result_ul.append(float(tmp_polqa_result_ul))

                # If User does not want to keep recorded audio file, it will not be stored
                # only if test is PASS
                if self._keep_record is True or polqa_result_ul[-1] < float(self._polqa_target):
                    self._host_deg_file_path += time.strftime('%Y%m%d_%H%M%S', time.localtime()) + "_UL" + ".wav"
                    self._audio_analyzer.copy_from_upv(self._aa_deg_file_path, self._host_deg_file_path)

                    self._host_deg_file_path = self._host_deg_file_path.split(str(time.localtime().tm_year))[0]

            if meas_in_range_dl and meas_in_range_ul:
                self._error.Msg = "Current POLQA result (DL/UL) : %f / %f, POLQA target : %s" % (polqa_result_dl[-1],
                                                                                                 polqa_result_ul[-1],
                                                                                                 self._polqa_target)
                self._logger.info(self._error.Msg)
            else:
                self._error.Msg = "POLQA result is out of range after %d retry. No usable result for this iteration." \
                                  % self._audio_analyzer_meas_retry
                self._logger.error(self._error.Msg)
                self._result_verdict = Global.BLOCKED

            # Maintain the VOIP call for wait_between_measure s before starting a new measurement
            self._logger.info(
                    "Maintain the VOIP call for %d s before starting a new measurement" % self._wait_between_measure)
            time.sleep(self._wait_between_measure)

            # Get elapsed time since call establishment in s
            self._elapsed_time = self.__get_elapsed_time(start_time, time.localtime())

            # Check if call is still connected
            if self._sip_call_api.get_sip_call_state() is not self._uecmd_types.SIP_CALL_STATE.IN_CALL:
                msg = "VOIP call interrupted after %d seconds, state is %s !" % (self._elapsed_time,
                                                                                 self._sip_call_api.get_sip_call_state())
                self.get_logger().error(msg)
                raise DeviceException(DeviceException.INVALID_DEVICE_STATE, msg)
            else:
                self.get_logger().info(
                        "VOIP call still connected after %d seconds!",
                        self._elapsed_time)

        # RELEASE THE CALL
        # Phone1 & 2 : Check call is still active
        if self._phone_calling:
            self._phone_calling.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.IN_CALL, self._call_setup_time)

        if self._phone_receiving:
            self._phone_receiving.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.IN_CALL, self._call_setup_time)

        if self._phone_releasing:
            self._phone_releasing.release()

            time.sleep(self._wait_btwn_cmd)

            self._phone_releasing.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
                    self._call_setup_time)
        else:
            self._voip_server.release_call(self._dut_sip_address.split('@')[0])

        if self._phone_receiving:
            self._phone_receiving.wait_for_state(
                    self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
                    self._call_setup_time)

        if self._result_verdict is not Global.BLOCKED:
            self._error.Msg = "Median POLQA result (DL/UL) : %f / %f, POLQA target : %s" % (
                float(numpy.median(numpy.array(polqa_result_dl))),
                float(numpy.median(numpy.array(polqa_result_ul))),
                self._polqa_target)

            # Compare the result of POLQA process with POLQA targets
            # Compute test verdict (if POLQA result > POLQA target the test pass,
            # else the test fails)
            if float(numpy.median(numpy.array(polqa_result_dl))) > float(self._polqa_target) \
                    and float(numpy.median(numpy.array(polqa_result_ul))) > float(self._polqa_target):
                self._logger.info(self._error.Msg)
                self._result_verdict = Global.SUCCESS
            else:
                self._logger.error(self._error.Msg)
                self._result_verdict = Global.FAILURE
                self._error.Msg += ""

        return self._result_verdict, self._error.Msg
Beispiel #18
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.__init__(self, tc_name, global_config)

        # Read wifi parameters from bench config xml file (int)
        self._wifirouter = global_config.benchConfig. \
            get_parameters("WIFI_ACCESS_POINT")
        self._wifi_security = self._wifirouter.get_param_value("WIFI_SECURITY")
        self._wifi_passphrase = self._wifirouter.get_param_value("passphrase")
        self._ssid = self._wifirouter.get_param_value("SSID")

        # Read dut sip address from test case xml file (string)
        self._dut_sip_address = \
            str(self._tc_parameters.get_param_value("DUT_SIP_ADDRESS"))

        # Read ref phone sip address from test case xml file (string)
        self._peer_sip_address = \
            str(self._tc_parameters.get_param_value("PEER_SIP_ADDRESS"))

        self._dut_sip_passphrase = self._tc_parameters.get_param_value("DUT_SIP_PASSPHRASE")
        self._peer_sip_passphrase = self._tc_parameters.get_param_value("PEER_SIP_PASSPHRASE")

        # Check if a dedicated VoIP server will be used
        if global_config.benchConfig.has_parameter("VOIP_SERVER"):
            self._voip_server_node = global_config.benchConfig.get_parameters("VOIP_SERVER")
            self._voip_server_computer = self._em.get_computer("VOIP_SERVER")
            self._voip_server_computer.init()
            self._voip_server = VoIPServerCallUtilities(self._voip_server_computer,
                                                        self._voip_server_node,
                                                        self._logger)
            self._degraded_audio_file = self._voip_server_node.get_param_value("DegradedAudioFile")
            self._voip_server_deg_file = self._voip_server_node.get_param_value(
                    "ServerRecordDir") + self._degraded_audio_file

            self._local_deg_file = self._voip_server_node.get_param_value("LocalRecordDir") + self._degraded_audio_file
            self._peer_sip_address = VoIPServerCallUtilities.sip_profiles[self._peer_sip_address.split('@')[0]] + \
                                     '@' + self._peer_sip_address.split('@')[-1]

        else:
            self._voip_server_node = None

        # Read ConfPath from AUDIO_ANALYZER BenchConfig.xml
        self._aa_conf_path = os.path.join(str(self._audio_analyzer_node.get_param_value("ConfPath")))

        # Read DestPath from AUDIO_ANALYZER BenchConfig.xml
        self._aa_dest_path = os.path.join(str(self._audio_analyzer_node.get_param_value("DestPath")))

        # Construct trace file path on audio analyzer
        self._aa_trace_file_path = os.path.join(self._aa_dest_path,
                                                "sip_sweep_trace.trc")

        self._keep_record = str_to_bool(self._tc_parameters.get_param_value("KEEP_RECORD"))

        # Number of iteration for the current test
        self._tc_iteration_count = self._tc_parameters.get_b2b_iteration()

        # Instantiate generic UECmd for voiceCall Ucs
        self._networking_api = self._device.get_uecmd("Networking")
        self._sip_call_api = self._device.get_uecmd("SipCall")

        # Instantiate the instances of member class variables
        self._sip_call_api2 = None
        self._networking_api2 = None
        self._phone_calling = None
        self._phone_receiving = None
        self._phone_releasing = None
        self._calling_phone_number = None

        # Read AUDIO_FILE from test case xml file
        self._ref_file = str(self._tc_parameters.get_param_value("AUDIO_FILE"))

        # Construct reference audio file path on bench computer
        self._host_ref_file_path = os.path.join(self._aa_conf_path,
                                                self._ref_file)

        self._host_deg_file_path = os.path.join(self._aa_conf_path,
                                                self._name.split('\\')[-1].split('-')[0] + "-" +
                                                str(self._tc_parameters.get_ucase_name()) + "_")

        # Construct degraded audio file path on UPV
        self._aa_deg_file_path = os.path.join(self._aa_dest_path,
                                              "voice_degraded_upv.wav")

        self._wait_between_measure = int(self._tc_parameters.get_param_value("WAIT_BETWEEN_MEASURE"))

        self._offline_measurement = False

        # Get the instance of the second IO_CARD
        if self._phone2:
            if DeviceManager().get_device_config("PHONE2").get("IoCard", ""):
                self._io_card_2 = self._em.get_io_card(DeviceManager().get_device_config("PHONE2").get("IoCard", ""))
            else:
                self._io_card_2 = None
        else:
            self._offline_measurement = True
            self._io_card_2 = None

        self._polqa_result_dl = None
        self._polqa_result_ul = None

        self._elapsed_time = 0

        # Read POLQA Targets from Audio_Quality_Targets.xml
        self._polqa_target = ConfigsParser("Audio_Quality_Targets").parse_audio_quality_target("Polqa",
                                                                                               "VOIP",
                                                                                               "VoIP")

        # Number of retry permitted for a single measurement on the audio analyzer
        self._audio_analyzer_meas_retry = 5

        self._audioalgocontroller_api = self._device.get_uecmd("AudioAlgoController")

        self._result_verdict = Global.SUCCESS
    def run_test(self):
        """
        Execute the test
        """
        # Call LabAudioQualityBase run_test function
        LabAudioQualityBase.run_test(self)

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()
                self._wired_headset.plug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
                self._wired_headset.plug_headphone()

        self._system_api.adjust_specified_stream_volume(
            "Ringtone", self._call_stream_volume_dut)

        # Dial using PHONE_NUMBER parameter
        self._phone_calling.dial(self._calling_phone_number)
        time.sleep(self._wait_btwn_cmd)

        # Wait for state "active" before callSetupTimeout seconds
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.INCOMING, self._call_setup_time)

        # Check ringtone
        audio_analyzer_result = self._audio_analyzer.ringtone_detection(
            self._acc_type)

        # Answer for all accessories except Bluetooth( auto answer by audio_analyzer for bt)
        if self._acc_type.find("BLUETOOTH") == -1:
            # Answer call
            self._phone_receiving.answer()

        # Phone1 & 2 : Check voice call is active
        self._phone_calling.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)

        # Compute test verdict and comment verdict
        LabAudioQualityBase.__compute_test_verdict__(self,
                                                     audio_analyzer_result)

        # RELEASE THE CALL
        # Phone1 & 2 : Check call is still active
        self._phone_calling.check_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE)
        self._phone_receiving.check_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE)

        # Hang up call
        self._phone_releasing.release()

        # Phone1 & 2 : Check call is idle
        self._phone_calling.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time)
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.NOCALL, self._call_setup_time)

        return self._result_verdict, self._verdict_comment
    def set_up(self):
        """
        Set up the test configuration
        """
        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.set_up(self)

        if self._phone2 is not None:
            self._voice_call_api2 = self._phone2.get_uecmd("VoiceCall")
        else:
            error_msg = \
                "This test case requires two phones to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_BENCH_CONFIG,
                                     error_msg)

        # Setup phone type ( calling, receiving, releasing phone)
        if self._call_origin_type == "MO":
            self._phone_calling = self._voice_call_api
            self._phone_receiving = self._voice_call_api2
            self._calling_phone_number = self._phone2.get_phone_number()
        elif self._call_origin_type == "MT":
            self._phone_calling = self._voice_call_api2
            self._phone_receiving = self._voice_call_api
            self._calling_phone_number = self._device.get_phone_number()
        else:
            error_msg = \
                "This test case requires call originated type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     error_msg)

        if self._call_end_type == "NR":
            self._phone_releasing = self._voice_call_api2
        elif self._call_end_type == "MR":
            self._phone_releasing = self._voice_call_api
        else:
            error_msg = \
                "This test case requires call end type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     error_msg)

        # Release any previous call (Robustness)
        self._voice_call_api.release()
        self._voice_call_api2.release()

        if self._acc_type == "HEADSET":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()
                self._wired_headset.plug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._wired_headset.unplug_whs()
                self._wired_headset.plug_headphone()

        # Dial using PHONE_NUMBER parameter
        self._phone_calling.dial(self._calling_phone_number)
        time.sleep(self._wait_btwn_cmd)

        # Wait for state "active" before callSetupTimeout seconds
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.INCOMING, self._call_setup_time)

        # Answer call
        self._phone_receiving.answer()

        # Phone1 & 2 : Check voice call is active
        self._phone_calling.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)
        self._phone_receiving.wait_for_state(
            self._uecmd_types.VOICE_CALL_STATE.ACTIVE, self._call_setup_time)

        # Configure Audio output to acc_type given with the test_case
        if self._acc_type == "EARPIECE":
            if self._use_io_card:
                self._wired_headset.unplug_headphone()
                self._wired_headset.unplug_whs()
        elif self._acc_type == "SPEAKER":
            # Switch to Speaker, nothing to do in Earpiece
            # Bluetooth already done with connect Bluetooth function above
            self._phonesystem_api.switch_audio_output(self._acc_type.lower())
            time.sleep(self._wait_btwn_cmd)

        if self._acc_type.find("BLUETOOTH") == -1:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume(
                "VoiceCall", self._call_stream_volume_dut)
        else:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume(
                "Bluetooth", self._call_stream_volume_dut)

        self._system_api2.adjust_specified_stream_volume(
            "VoiceCall", self._call_stream_volume_ref)

        return Global.SUCCESS, "No errors"
    def set_up(self):
        """
        Set up the test configuration
        """
        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.set_up(self)
        if self._phone2 is not None:
            self._networking_api2 = self._phone2.get_uecmd("Networking")
            self._sip_call_api2 = self._phone2.get_uecmd("SipCall")
        else:
            self._sip_call_api2 = None
            self._networking_api2 = None

        # Setup phone type ( calling, receiving, releasing phone)
        if self._call_origin_type == "MO":
            self._phone_calling = self._sip_call_api
            self._phone_receiving = self._sip_call_api2
            self._calling_phone_number = self._peer_sip_address
        elif self._call_origin_type == "MT":
            self._phone_calling = self._sip_call_api2
            self._phone_receiving = self._sip_call_api
            self._calling_phone_number = self._dut_sip_address
        else:
            error_msg = \
                "This test case requires call originated type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, error_msg)

        if self._call_end_type == "NR":
            self._phone_releasing = self._sip_call_api2
        elif self._call_end_type == "MR":
            self._phone_releasing = self._sip_call_api
        else:
            error_msg = \
                "This test case requires call end type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, error_msg)

        # Setup the wifi connection for DUT and Ref phone
        self.__setup_wifi()

        # Connect to wifi using SSID parameter value for DUT
        self._networking_api.wifi_connect(self._ssid)
        time.sleep(self._wait_btwn_cmd)

        # Connect to wifi using SSID parameter value for Ref phone
        if self._phone2 is not None:
            self._networking_api2.wifi_connect(self._ssid)
            time.sleep(self._wait_btwn_cmd)

        # Start Sip Service
        self._phone_calling.initialize_sipcall_module()

        # In case only 1 phone is used, no need to set a 2nd SIP account (assuming MO call)
        if self._phone_receiving:
            self._phone_receiving.initialize_sipcall_module()

        # Setup Sip Account
        self._sip_call_api.initialize_local_profile(self._dut_sip_address, self._dut_sip_passphrase)
        if self._phone2 is not None:
            self._sip_call_api2.initialize_local_profile(self._peer_sip_address, self._peer_sip_passphrase)

        self._phone_calling.wait_for_state(
            self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
            self._call_setup_time)

        # In case only 1 phone is used, no need to make verifications on reference phone (assuming MO call)
        if self._phone_receiving:
            self._phone_receiving.wait_for_state(
                self._uecmd_types.SIP_CALL_STATE.READY_TO_CALL,
                self._call_setup_time)

        # Dial using PHONE_NUMBER parameter
        if self._phone2 is not None:
            self._phone_calling.dial(self._calling_phone_number)
        else:
            self._phone_calling.dial(self._calling_phone_number, check_state=False)

        if self._phone_receiving:
            self._phone_receiving.wait_for_state(
                self._uecmd_types.SIP_CALL_STATE.INCOMING_CALL,
                self._call_setup_time)

            self._phone_receiving.answer()
            # Phone1 & 2 : Check voice call is active
        self._phone_calling.wait_for_state(
            self._uecmd_types.SIP_CALL_STATE.IN_CALL,
            self._call_setup_time)

        if self._phone_receiving:
            self._phone_receiving.wait_for_state(
                self._uecmd_types.SIP_CALL_STATE.IN_CALL,
                self._call_setup_time)

        # Configure Audio output to acc_type given with the test_case
        if self._acc_type == "EARPIECE":
            self._sip_call_api.switch_to_earpiece()
            if self._use_io_card:
                self._wired_headset.unplug_whs()
                self._wired_headset.unplug_headphone()
            time.sleep(self._wait_btwn_cmd)
        elif self._acc_type == "SPEAKER":
            self._sip_call_api.switch_to_speaker()
            time.sleep(self._wait_btwn_cmd)
        elif self._acc_type == "HEADSET":
            if self._use_io_card:
                self._sip_call_api.switch_to_earpiece()
                self._wired_headset.unplug_headphone()
                self._wired_headset.plug_whs()
        elif self._acc_type == "HEADPHONE":
            if self._use_io_card:
                self._sip_call_api.switch_to_earpiece()
                self._wired_headset.unplug_whs()
                self._wired_headset.plug_headphone()
        elif self._acc_type == "BLUETOOTHHSP" or self._acc_type == "BLUETOOTHHFP":
            self._sip_call_api.switch_to_bluetooth()
        elif self._acc_type == "BLUETOOTHA2DP":
            self._sip_call_api.switch_to_bluetooth_a2dp()
        else:
            self._logger.error("Unknown accessories")
            raise AcsConfigException(AcsConfigException.OPERATION_FAILED,
                                     "Unknown accessories")
        time.sleep(self._wait_btwn_cmd)

        if self._acc_type.find("BLUETOOTH") == -1:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume("VoiceCall",
                                                            self._call_stream_volume_dut)
        else:
            # Set Voice Call Volume
            self._system_api.adjust_specified_stream_volume("Bluetooth",
                                                            self._call_stream_volume_dut)

        if self._phone_receiving:
            self._system_api2.adjust_specified_stream_volume("VoiceCall",
                                                             self._call_stream_volume_ref)

        return Global.SUCCESS, "No errors"
Beispiel #22
0
    def set_up(self):
        """
        Set up the test configuration
        """
        # Call LabAudioQualityBase Init function
        LabAudioQualityBase.set_up(self)

        if self._voip_server_node:
            # Restart the SIP server
            self._voip_server.restart_asterisk()

        # Stop Sip Service
        if self._sip_call_api is not None:
            self._sip_call_api.delete_profile_sip_phone_app()

        if self._phone2 is not None:
            self._networking_api2 = self._phone2.get_uecmd("Networking")
            self._sip_call_api2 = self._phone2.get_uecmd("SipCall")
        else:
            self._sip_call_api2 = None
            self._networking_api2 = None

        if self._sip_call_api2 is not None:
            self._sip_call_api2.delete_profile_sip_phone_app()

        # Setup phone type ( calling, receiving, releasing phone)
        if self._call_origin_type == "MO":
            self._phone_calling = self._sip_call_api
            self._phone_receiving = self._sip_call_api2
            self._calling_phone_number = self._peer_sip_address
        elif self._call_origin_type == "MT":
            self._phone_calling = self._sip_call_api2
            self._phone_receiving = self._sip_call_api
            self._calling_phone_number = self._dut_sip_address
        else:
            error_msg = \
                "This test case requires call originated type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, error_msg)

        if self._call_end_type == "NR":
            self._phone_releasing = self._sip_call_api2
        elif self._call_end_type == "MR":
            self._phone_releasing = self._sip_call_api
        else:
            error_msg = \
                "This test case requires call end type to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, error_msg)

        # Setup the wifi connection for DUT and Ref phone
        self.__setup_wifi()

        # Connect to wifi using SSID parameter value for DUT
        self._networking_api.wifi_connect(self._ssid)
        time.sleep(self._wait_btwn_cmd)

        # Connect to wifi using SSID parameter value for Ref phone
        if self._phone2 is not None:
            self._networking_api2.wifi_connect(self._ssid)
            time.sleep(self._wait_btwn_cmd)

        # Start Sip Service
        if self._phone_calling:
            self._phone_calling.initialize_sipcall_module()
        if self._phone_receiving:
            self._phone_receiving.initialize_sipcall_module()

        # Setup Sip Account
        self._sip_call_api.initialize_local_profile(self._dut_sip_address, self._dut_sip_passphrase)
        if self._phone2 is not None:
            self._sip_call_api2.initialize_local_profile(self._peer_sip_address, self._peer_sip_passphrase)

        if not self._phone2:
            # Release any ongoing calls which were using the DUT SIP account
            self._logger.info("Get the status of the channels of the SIP server")
            if self._voip_server.check_call_status(self._dut_sip_address.split('@')[0]) == 'IN_CALL':
                self._voip_server.release_call(self._dut_sip_address.split('@')[0])

        return Global.SUCCESS, "No errors"