示例#1
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LAB_HSPA_BASE Run function
        LabHspaBase.run_test(self)

        # Run FTP transfer using FTP parameters :
        # - LAB_SERVER parameters (ip, username, password)
        # - DIRECTION
        # - DL_FILE or UL_FILE
        # - XFER_TIMEOUT
        time.sleep(self._wait_btwn_cmd)
        return perform_ftp_transfer(self._direction,
                                    self._server_ip_address,
                                    self._username,
                                    self._password,
                                    self._filename,
                                    self._xfer_timeout,
                                    self._device.multimedia_path,
                                    self._ns_DUT_IP_Address,
                                    self._ftp_api,
                                    self._throughput_targets.ul_failure.value,
                                    self._logger,
                                    self._dlfilename,
                                    self._throughput_targets.dl_failure.value,
                                    self._device.binaries_path)
示例#2
0
    def run_test(self):
        """
        Execute the test
        """
        test_result = Global.FAILURE
        # Call LAB_HSPA_BASE Run function
        LabHspaBase.run_test(self)

        time.sleep(self._wait_btwn_cmd)

        self._networking_api.ftp_xfer(self._direction,
                                      self._server_ip_address,
                                      self._username,
                                      self._password,
                                      self._ftp_filename,
                                      self._xfer_timeout,
                                      self._device.get_ftpdir_path())

        # TODO: For the moment, we can't stop all the google data services
        # and ntp service, we have to wait the service stop itself
        time.sleep(60)

        timer = 0
        # PDP should always stay activate and RRC should pass to IDLE state before timeout
        while timer < self._rrc_idle_timeout:
            data_connection_status = self._ns_data_3g.get_data_connection_status()
            rrc_states = self._ns_data_3g.get_rrc_states()
            states_msg = "data_connection_status: %s rrc_states: %s after %d " % \
                (data_connection_status,
                 rrc_states,
                 timer)
            self._logger.info(states_msg)
            if data_connection_status != "PDP_ACTIVE":
                self._error.Msg = "Failed to reach PDP_ACTIVE data state"
                raise DeviceException(DeviceException.OPERATION_FAILED, self._error.Msg)
            if rrc_states == "IDLE":
                self._error.Msg = states_msg
                test_result = Global.SUCCESS
                break
            time.sleep(1)
            timer += 1

        return test_result, self._error.Msg
示例#3
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LAB_HSPA_BASE run_test function
        LabHspaBase.run_test(self)

        # Run FTP transfer using FTP parameters :
        # - LAB_SERVER parameters (ip, username, password)
        # - DIRECTION
        # - DL_FILE or UL_FILE
        # - XFER_TIMEOUT
        # Start an ftp tranfer
        transfer_established_timeout = 20

        if self._cpc_state == "OFF":

            # Start FTP transfer if CPC is deactivated
            # Use private method __start_ftp_xfer
            self.__start_ftp_xfer()

        # CPC deactivation failed
        else:
            self._error.Msg = "CPC deactivation failed. CPC state is still active"
            raise TestEquipmentException(
                TestEquipmentException.OPERATION_FAILED, self._error.Msg)

        # wait 20 seconds for ensure that transfer is established
        self._logger.info(
            "Wait %i seconds for ensure that transfer is established",
            transfer_established_timeout)
        time.sleep(transfer_established_timeout)

        # Check that data transfer in on-going on DUT before CPC activation
        data_connection_state = self._ftp_api.get_ftp_status(self._ftp_task_id)
        self._logger.info("FTP transfer is %s !" % data_connection_state)

        if data_connection_state != "transferring":

            msg = self._logger.error("FTP connection lost on DUT !")
            raise DeviceException(DeviceException.CONNECTION_LOST, msg)

        # Activate CPC feature
        self._logger.info(
            "CPC activation on the equipment by setting CPC to On")
        self._ns_data_3g.set_cpc_state("ON")
        time.sleep(self._timeout_between_commands)

        # Check CPC activated state is On
        cpc_state = self._ns_data_3g.get_cpc_state()

        if cpc_state == "ON":
            # Check that CPC is active and wait for FTP transfer to finish
            # Use private method __activate_cpc
            self.__activate_cpc()

        # CPC activation failed
        else:
            self._error.Msg = "CPC activation failed. CPC state is still inactive"
            raise TestEquipmentException(
                TestEquipmentException.OPERATION_FAILED, self._error.Msg)

        # Deactivate CPC feature
        self._logger.info(
            "For BTB testing : CPC deactivation on the equipment by setting CPC to Off"
        )
        self._ns_data_3g.set_cpc_state("OFF")

        return Global.SUCCESS, "No errors"
示例#4
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LAB_HSPA_BASE Run function
        LabHspaBase.run_test(self)

        # init values
        self._error.Code = Global.FAILURE
        self._error.Msg = "ping failed"

        time.sleep(self._wait_btwn_cmd)

        if self._ip_version == "IPV6":
            # If IPV6 is chosen, use ping6 function
            packet_loss = self._networking_api.\
                ping6(self._server_ip_v6_address,
                      self._packet_size,
                      self._nb_pings)

            # Compute verdict depending on % of packet loss
            if packet_loss.value > self._target_ping_packet_loss_rate:
                self._error.Code = Global.FAILURE
            else:
                self._error.Code = Global.SUCCESS

            self._error.Msg = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\
                % (packet_loss.value,
                   packet_loss.units,
                   self._target_ping_packet_loss_rate,
                   packet_loss.units)

        elif self._ip_version == "IPV4V6":
            # If IPV4V6 is chosen, use also ping function
            packet_loss_ping = self._networking_api.\
                ping(self._server_ip_address,
                     self._packet_size,
                     self._nb_pings)
            # If IPV4V6 is chosen, use ping6 function
            packet_loss_ping6 = self._networking_api.\
                ping6(self._server_ip_v6_address,
                      self._packet_size,
                      self._nb_pings)

            # Compute verdict depending on % of packet loss
            if (packet_loss_ping.value > self._target_ping_packet_loss_rate) or \
                    (packet_loss_ping6.value > self._target_ping_packet_loss_rate):
                self._error.Code = Global.FAILURE
            else:
                self._error.Code = Global.SUCCESS

            self._error.Msg = "Measured IPV4 Packet Loss: %.0f%s (Target: %.0f%s) and Measured IPV6 Packet Loss: %.0f%s (Target: %.0f%s)"\
                % (packet_loss_ping.value,
                   packet_loss_ping.units,
                   self._target_ping_packet_loss_rate,
                   packet_loss_ping.units,
                   packet_loss_ping6.value,
                   packet_loss_ping6.units,
                   self._target_ping_packet_loss_rate,
                   packet_loss_ping6.units)

        else:
            # If IPV4 is chosen, use ping function
            packet_loss = self._networking_api.\
                ping(self._server_ip_address,
                     self._packet_size,
                     self._nb_pings)

            # Compute verdict depending on % of packet loss
            if packet_loss.value > self._target_ping_packet_loss_rate:
                self._error.Code = Global.FAILURE
            else:
                self._error.Code = Global.SUCCESS

            self._error.Msg = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\
                % (packet_loss.value,
                   packet_loss.units,
                   self._target_ping_packet_loss_rate,
                   packet_loss.units)

        self._logger.info("Test result : " + self._error.Msg)

        return self._error.Code, self._error.Msg
示例#5
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LAB_HSPA_BASE Run function
        LabHspaBase.run_test(self)

        # Activate PDP context
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Active PDP Context...")
        self._networking_api.activate_pdp_context(self._ssid)

        # Check Data Connection State => PDP Active before timeout
        self._ns_data_3g.check_data_connection_state(
            "PDP_ACTIVE", self._registration_timeout, blocking=False)

        # Get RAT from Equipment
        network_type = self._ns_data_3g.get_network_type()

        # Check that DUT is registered on the good RAT
        self._modem_api.check_network_type_before_timeout(
            network_type, self._registration_timeout)

        # Check IP protocol
        self._msg = self._networking_api.check_ip_protocol(self._ip_version)
        self._logger.info(self._msg)

        if self._rrc_state == "FACH":
            # If the RRC_STATE was set to FACH, set the RRC transition to
            # FACH
            self._logger.info("Setting the rrc_state transition to FACH")
            self._ns_cell_3g.set_rrc_state_transition("FACH")
            time.sleep(5)

        if self._do_ping:
            # Ping FTP server to verify PDP context activated.
            # Ping should be successful
            packet_loss = self._networking_api.ping(self._server_ip_address,
                                                    self._packet_size,
                                                    self._nb_pings)

            self._error.Msg = "Measured Packet Loss: %.0f%s (Target: %.0f%s)"\
                    % (packet_loss.value, packet_loss.units,
                       self._target_ping_packet_loss_rate,
                       packet_loss.units)

            # Compute verdict depending on % of packet loss
            # PDP Context active, ping should be successful
            if packet_loss.value > self._target_ping_packet_loss_rate:
                raise DeviceException(DeviceException.OPERATION_FAILED,
                                      self._error.Msg)
            else:
                self._logger.info("Ping successful:  %s" % self._error.Msg)

        # Deactivate PDP context
        self._logger.info("Deactivation of the PDP Context")
        self._networking_api.deactivate_pdp_context(self._ssid)

        # Check ATTACHED Data Connection State
        # We can't use check_data_connection_state function, because the UE
        # should switch from PDP_ACTIVE state to ATTACHED state, but in this function
        # "PDP_ACTIVE" means already "ATTACHED" in telephony context.
        timer = self._registration_timeout
        while (timer > 0) and (self._ns_data_3g.get_data_connection_status() !=
                               "ATTACHED"):
            timer -= 1
            time.sleep(1)

        # Check that DUT does not have any IP address
        self._networking_api.check_no_ip_address()

        if self._do_ping:
            # Ping FTP server to verify PDP context deactivated.
            # The test should be failed
            try:
                packet_loss = self._networking_api.ping(
                    self._server_ip_address, self._packet_size, self._nb_pings)
            except AcsBaseException as error:
                self._logger.info(error.get_error_message())
            else:
                raise DeviceException(
                    DeviceException.OPERATION_FAILED,
                    "PDP context isn't correctly "
                    "deactivated, ping packets reach the"
                    " server.")
        # Reactivate PDP context
        self._networking_api.activate_pdp_context(self._ssid)

        self._ns_data_3g.check_data_connection_state(
            "PDP_ACTIVE", self._registration_timeout, blocking=False)

        if self._do_ping:
            packet_loss = self._networking_api.ping(self._server_ip_address,
                                                    self._packet_size,
                                                    self._nb_pings)
            # Compute verdict depending on % of packet loss
            # PDP Context active, ping should be successful
            if packet_loss.value > self._target_ping_packet_loss_rate:
                raise DeviceException(DeviceException.OPERATION_FAILED,
                                      self._error.Msg)
            else:
                self._logger.info("Ping successful:  %s" % self._error.Msg)
        return Global.SUCCESS, "no errors"
示例#6
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LAB_MOBILITY_3G_HHO_BASE run_test function
        LabHspaBase.run_test(self)

        time.sleep(self._wait_btwn_cmd)

        self._logger.info("FTP transfer " + str(self._direction) + " for " +
                          str(self._ftp_filename) + "...")

        self._ftp_task_id = self._ftp_api.start_ftp(
            self._direction, self._server_ip_address, self._username,
            self._password, self._ftp_filename, self._device.multimedia_path,
            self._ns_DUT_IP_Address)

        timeout = time.time() + self._xfer_timeout
        # Check data state "TRANSFERRING" before timeout
        self._ns_data_3g.check_data_connection_transferring(
            self._check_data_transfer_state_timeout)

        # perfom a hard handover from cellA to cellB
        self.perform_hard_handover(self._ns_cell_3g)

        # Check data state "TRANSFERRING" before timeout
        self._ns_data_3g.check_data_connection_transferring(
            self._check_data_transfer_state_timeout)
        # Get RAT from Equipment
        network_type = self._ns_data_3g.get_network_type()
        # Check that DUT is registered on the good RAT
        self._modem_api.check_network_type_before_timeout(
            network_type, self._registration_timeout)

        # perfom a hard handover from cellB to cellA
        self.perform_hard_handover(self._ns_cell_3g)

        # Check data state "TRANSFERRING" before timeout
        self._ns_data_3g.check_data_connection_transferring(
            self._check_data_transfer_state_timeout, blocking=False)
        # Get RAT from Equipment
        network_type = self._ns_data_3g.get_network_type()
        # Check that DUT is registered on the good RAT
        self._modem_api.check_network_type_before_timeout(
            network_type, self._registration_timeout)
        # number of Hard Handover
        hh_number = 2 * self.get_b2b_iteration()

        # Create success_msg
        self._logger.info("Ftp success and %i Hard Handover(s) done" %
                          hh_number)

        data_connection_state = self._ftp_api.get_ftp_status(self._ftp_task_id)
        self._logger.info("FTP transfer is %s !" % data_connection_state)

        # No need to keep FTP transfer on going. Stop properly FTP client on DUT side
        try:
            self._ftp_api.stop_ftp(self._ftp_task_id)
            self._ftp_api.kill_ftp()
        except:
            pass
        # if ftp transfer is finished
        if data_connection_state in ("transfer successful", "transferring"):
            self._logger.info("FTP %s of file %s finish success !" %
                              (self._direction, self._ftp_filename))
            return Global.SUCCESS, "No Errors"
        else:
            self._error.Msg = "FTP transfer failed or have been too long! FTP status: %s" % (
                data_connection_state)
            return Global.FAILURE, self._error.Msg
示例#7
0
    def run_test(self):
        """
        Execute the test
        """
        result_code = Global.SUCCESS
        result_msg = ""
        result_msg_tmp = ""
        throughput = None

        # Call LAB_HSPA_BASE Run function
        LabHspaBase.run_test(self)

        # Start IPERF measurement
        time.sleep(self._wait_btwn_cmd)

        # Launch the IPERF test and get throughput
        try:
            # Force screen on to avoid end of PDP context due to fast dormancy
            self._phone_system.wake_screen()
            self._phone_system.set_phone_screen_lock_on(1)
            if self._random_port:
                # Get a randomly generated port
                self._port = get_random_iperf_port()
                self._iperf_settings["port_number"] = self._port

            self._networking_api.reactivate_pdp_context(self._ssid, False)
            if self._ns_data_3g.get_data_connection_status() != "PDP_ACTIVE":
                self._networking_api.reactivate_pdp_context(self._ssid, False)
                self._ns_data_3g.check_data_connection_state(
                    "PDP_ACTIVE", self._registration_timeout, blocking=False)

            throughput = self._networking_api.iperf(self._iperf_settings)

            (result_code, result_msg_tmp) = \
                compute_iperf_verdict(throughput,
                                      self._throughput_targets,
                                      self._iperf_direction)
            if self._kpi_test:
                # In case of KPI test, store measured throughput
                # for final verdict (it will depend of the median value of all measured values)
                self._kpi_data.append(throughput)
                result_msg = "KPI test Iteration: %d " % (
                    self._current_iteration + 1) + result_msg_tmp
            else:
                result_msg = result_msg_tmp

        except Exception as e:
            result_code = Global.FAILURE
            result_msg = "!!!! WARNING Exception occurred during iperf test !!!! "
            exception_text = format_exception_info()
            self._logger.warning(
                "!!!! WARNING Exception occurred during iperf test !!!! ")
            self._logger.debug("Exception during iperf test: %s ",
                               exception_text)
        finally:
            if self._kpi_test:
                self._current_iteration += 1
                # For KPI test verdict is computed only on median throughput computed on last iteration ,
                # other reasons(exception, iteration not run, not last iteration ...) does not alter the verdict
                result_code = Global.SUCCESS
                # If we are in the latest iteration of a KPI test
                # compute throughput median value and compute verdict on this median value
                if self._current_iteration == self.get_b2b_iteration():
                    median_throughput = self._kpi_data.get_median_throughput()
                    self._logger.info("Median Throughput : DL: %s UL %s" %
                                      (str(median_throughput.dl_throughput),
                                       str(median_throughput.ul_throughput)))
                    (result_code, result_msg_tmp) = compute_iperf_verdict(
                        median_throughput, self._throughput_targets,
                        self._iperf_direction)
                    result_msg = "KPI median throughput: " + result_msg_tmp
        # Return result
        return result_code, result_msg
    def run_test(self):
        """
        Execute the test
        """
        # Call LAB_HSPA_BASE run_test function
        LabHspaBase.run_test(self)

        # Run FTP transfer using FTP parameters :
        # - LAB_SERVER parameters (ip, username, password)
        # - DIRECTION
        # - DL_FILE or UL_FILE
        # - XFER_TIMEOUT
        # Start an ftp tranfer

        # Check CPC activated state is Off for UL DTX and DL DRX
        cpc_state = self._ns_data_3g.get_cpc_state()

        if cpc_state == "OFF":
            msg = self._logger.error("CPC has not been successfully enable on UL DTX and on DL DRX")
            raise TestEquipmentException(TestEquipmentException.OPERATION_FAILED, msg)

        else:
            self._logger.info("CPC has been successfully enable on UL DTX and on DL DRX")

        time.sleep(self._wait_btwn_cmd)

        self._logger.info("FTP transfer " + str(self._direction) +
                          " for " + str(self._ftp_filename) + "...")
        self._ftp_task_id = self._ftp_api.start_ftp(self._direction,
                                                    self._server_ip_address,
                                                    self._username,
                                                    self._password,
                                                    self._ftp_filename,
                                                    self._device.multimedia_path,
                                                    self._ns_DUT_IP_Address)

        # wait 20 seconds to ensure that transfer is established
        self._logger.info(
            "Wait 30 seconds to ensure that transfer is established")
        time.sleep(30)

        # Check data state "TRANSFERRING" before 10 seconds
        self._ns_data_3g.check_data_connection_transferring(self._check_data_transfer_state_timeout,
                                                            True,
                                                            blocking=False)

        if self._cpc_deact_type == "CPC_OFF":
            # Deactivate CPC feature
            self._logger.info(
                "CPC deactivation on the equipment by setting CPC to OFF")
            self._ns_data_3g.set_cpc_state("OFF")
            # wait 3 seconds for ensure that CPC deactivation has been made
            time.sleep(self._timeout_between_commands)

            # Check CPC activated state is OFF
            cpc_state = self._ns_data_3g.get_cpc_state()
            self._logger.info("CPC reported state is : %s", cpc_state)
            if cpc_state == "OFF":
                self._wait_end_of_ftp()
            # CPC deactivation failed
            else:
                self._error.Msg = "CPC deactivation failed. CPC state is still active"
                raise TestEquipmentException(TestEquipmentException.OPERATION_FAILED,
                                             self._error.Msg)

        elif self._cpc_deact_type == "HS_SCCH_ORDER":
            self._logger.info(
                "CPC deactivation on the equipment by sending a HS-SCCH ORDER")

            # Send the HS-SCCH ORDER
            self._ns_data_3g.send_hsscch_order()
            time.sleep(self._timeout_between_commands)

            # Check CPC activated state is ON
            cpc_state = self._ns_data_3g.get_cpc_state()
            self._logger.info("CPC reported state is : %s", cpc_state)
            if cpc_state == "ON":
                self._wait_end_of_ftp()
            # CPC deactivation failed
            else:
                self._error.Msg = "CPC deactivation failed. CPC is inactive"
                raise TestEquipmentException(TestEquipmentException.OPERATION_FAILED,
                                             self._error.Msg)

        elif self._cpc_deact_type == "PDP_DEACT":
            # deactivate PDP context
            self._logger.info(
                "CPC deactivation on the equipment by deactivating PDP context")
            self._networking_api.deactivate_pdp_context(self._ssid)

            time.sleep(self._timeout_between_commands)

            self._logger.info("Data transfer has stopped !")

            # Check CPC activated state is Off for UL DTX and DL DRX
            current_drx_activated_state = self._ns_data_3g.get_current_drx_activated_state()
            current_dtx_activated_state = self._ns_data_3g.get_current_dtx_activated_state()

            if current_drx_activated_state == "OFF" and current_dtx_activated_state == "OFF":

                self._logger.info("CPC has been successfully disable on UL DTX and on DL DRX")
                # Check Data Connection State => ATTACHED before TimeOut
                self._ns_data_3g.check_data_connection_state("ATTACHED",
                                                             self._registration_timeout,
                                                             blocking=False)
            else:
                self._error.Msg = "CPC deactivation on the equipment by deactivating PDP context has failed !"
                raise TestEquipmentException(TestEquipmentException.OPERATION_FAILED,
                                             self._error.Msg)

        else:
            self._error.Msg = "%s is not a known CPC deactivation type" % \
                self._cpc_deact_type
            raise TestEquipmentException(TestEquipmentException.INVALID_PARAMETER,
                                         self._error.Msg)

        # Activate CPC feature
        self._logger.info("For BTB testing : CPC activation on the equipment by setting CPC to On")
        self._ns_data_3g.set_cpc_state("ON")

        # deactivate PDP context
        self._logger.info(
            "For Back to Back testing : Reactivating PDP context")
        self._networking_api.activate_pdp_context(self._ssid)

        return Global.SUCCESS, "No errors"
示例#9
0
    def run_test(self):
        """
        Execute the test
        """
        # Call LAB_HSPA_BASE Run function
        LabHspaBase.run_test(self)

        self._logger.info("FTP transfer " + str(self._direction) + " for " +
                          str(self._ftp_filename) + "...")

        self._ftp_task_id = self._networking_api.start_ftp_xfer(
            self._direction, self._server_ip_address, self._username,
            self._password, self._ftp_filename, self._device.get_ftpdir_path())

        # Measure the information_bit_throughput for all the cell powers in the list
        for cell_power in self._measure_cell_power_list:
            self._ns_cell_3g.set_cell_power(int(cell_power))
            # Wait for the device adjust to new cell power
            time.sleep(3)
            information_bit_throughput = 0
            measure_times = 0
            # Measure 5 times and calculate the average
            for i in xrange(5):
                # Ensure the data transfer is still ongoing before measurement
                self._data_3g.check_data_connection_transferring(
                    self._ftp_data_transfer_state_timeout, True)
                xfer_status = self._networking_api.get_ftp_xfer_status()
                # Quit from measurement,  once ftp tranfert stop
                if "transferring" != xfer_status:
                    msg = "FTP transfer is %s before measurement start " % xfer_status
                    self._logger.info(msg)
                    break

                try:
                    throughput = self._data_3g.get_information_bit_throughput()
                except TestEquipmentException:
                    self._logger.info("The %d th measurement of power %s is failed"\
                                       % (i, cell_power))
                    throughput = float("nan")

                if math.isnan(throughput):
                    self._logger.debug("throughput can't be retrieved")
                else:
                    information_bit_throughput = information_bit_throughput + throughput
                    measure_times += 1

            if 0 == measure_times:
                self._logger.info("The measurement of power %d is failed" %
                                  cell_power)
                self._cqi_result_dico.update({cell_power: "N/A"})
            else:
                average_bit_throughput = round(information_bit_throughput /
                                               measure_times)
                self._cqi_result_dico.update(
                    {cell_power: average_bit_throughput})
            self._logger.debug("cqi_results: %s " % str(self._cqi_result_dico))

        # Create the output message
        for key in self._measure_cell_power_list:
            self._error.Msg = self._error.Msg + " Power: " + str(key) + "db throughput: "\
                        + str(self._cqi_result_dico[key]) + " kbps "

        self._networking_api.stop_ftp_xfer(self._ftp_task_id)

        return Global.SUCCESS, self._error.Msg