Exemplo n.º 1
0
    def run_test(self):
        """
        Run test
        """

        LabWifiKPIBase.run_test(self)
        # Flush TCP records
        self._networking_api.clean_tcp_records_device()
        self._computer.clean_tcp_records_computer()

        if self._bt_play_music == "on":
            # Search duration in iperf options
            duration = 20 + int(
                (re.search("(-t[ ]*)([0-9]+)", self._iperf_options)).group(2))
            # Configure and launch check music thread
            self._thread_headset_check_music = ThreadA2DPCheckMusic(
                self._queue, BtAudioState.PLAYING, duration, self._bt_api,
                self._bt_headset_addr)
            self._thread_headset_check_music.start()

        time.sleep(self._wait_btwn_cmd)
        iperf_result, iperf_msg = LabWifiIperf.run_test(self)

        if self._bt_play_music == "on":
            self._exception_reader(self._queue,
                                   [self._thread_headset_check_music])

        complete_msg = "RSSI value : %s -- %s" % (self._rssi_value, iperf_msg)
        return iperf_result, complete_msg
Exemplo n.º 2
0
    def run_test(self):
        """
        Run test
        """

        LabWifiBase.run_test(self)
        LabWifiKPIBase.run_test(self)

        self._networking_api.set_wifi_power("off")
        time.sleep(self._wait_btwn_cmd)
        # Start log monitoring
        self._networking_api.start_wifi_connection_log()
        self._networking_api.set_wifi_power("on")

        # Get the log and trigger it !
        time_to_reconnect = self.__check_logs_and_compute_time()

        if time_to_reconnect > self._time_target:
            msg = "Reconnection time too long : %ss. Expected : %ss" % (
                time_to_reconnect, self._time_target)
            self._logger.error(msg)
            raise DeviceException(DeviceException.OPERATION_FAILED, msg)

        return_msg = "No errors - Time to connect : %ss - Target : %ss" % (
            time_to_reconnect, self._time_target)
        return Global.SUCCESS, return_msg
Exemplo n.º 3
0
    def set_up(self):
        """
        Initialize the test
        """
        LabWifiIperf.set_up(self)
        LiveBTBase.set_up(self)

        # Check values
        if self._bt_play_music is not None and self._bt_play_music not in [
                "on", "off"
        ]:
            msg = "Bad value for BT_PLAY_MUSIC : %s" % self._bt_play_music
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)

        # Setup DUT for KPI TC
        LabWifiKPIBase.set_up(self)

        if self._bt_play_music == "on":
            LiveBTBase.set_up(self)
            # Configure Headset and launch audio
            self._bt_headset = self._em.get_bluetooth_headset("BT_HEADSET")
            self._bt_headset_addr = self._bt_headset.get_bdaddress()
            a2dp_pair_connect_to_headset(self._bt_api, self._bt_headset)
            a2dp_switch_music_state(self._bt_api, self._bt_headset,
                                    BtAudioCmd.PLAY)

        return Global.SUCCESS, "No errors"
Exemplo n.º 4
0
 def __init__(self, tc_name, global_config):
     """
     Constructor
     """
     LabWifiBase.__init__(self, tc_name, global_config)
     LabWifiKPIBase.__init__(self, tc_name, global_config)
     self._time_target = float(
         self._tc_parameters.get_param_value("REF_CONNECTION_TIME"))
Exemplo n.º 5
0
    def tear_down(self):
        """
        End and dispose the test
        """
        LabWifiBase.tear_down(self)

        # Reconfigure default device state
        LabWifiKPIBase.tear_down(self)

        return Global.SUCCESS, "No errors"
Exemplo n.º 6
0
    def set_up(self):
        """
        Initialize the test
        """
        LabWifiBase.set_up(self)
        LabWifiKPIBase.set_up(self)

        # Control REF_CONNECTION_TIME value
        if self._time_target < 0:
            msg = "Wrong parameter for REF_CONNECTION_TIME: read value %f" % self._time_target
            self._logger.error(msg)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg)

        return Global.SUCCESS, "No errors"
Exemplo n.º 7
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        LabWifiIperf.__init__(self, tc_name, global_config)
        LiveBTBase.__init__(self, tc_name, global_config)
        LabWifiKPIBase.__init__(self, tc_name, global_config)

        self._bt_play_music = self._tc_parameters.get_param_value(
            "BT_PLAY_MUSIC")
        self._bt_headset = None
        self._bt_headset_addr = None
        self._thread_headset_check_music = None
        self._queue = Queue.Queue()
Exemplo n.º 8
0
    def tear_down(self):
        """
        End and dispose the test
        """
        LabWifiIperf.tear_down(self)

        # Disable BT if required
        if self._bt_play_music == "on":
            a2dp_switch_music_state(self._bt_api, self._bt_headset,
                                    BtAudioCmd.PAUSE)
            a2dp_unpair_headset(self._bt_api, self._bt_headset)
            self._bt_api.set_bt_power(0)

        # Reconfigure default device state
        LabWifiKPIBase.tear_down(self)

        return Global.SUCCESS, "No errors"