def configure_amplitude_offset_table(self, frequency_list=None, offset_list=None, second_antenna_offset_list=None): """ Configures the amplitude offset table to compensate cable loss. :type frequency_list: str :param frequency_list: the frequency list. :type offset_list: str :param offset_list: the offset list corresponding to the frequency :type second_antenna_offset_list: str :param second_antenna_offset_list: the offset list corresponding to the frequency listed above for the diverse antenna. """ # Retrieve from bench configuration the frequency and offset table if not given if frequency_list is None or offset_list is None: available_params = self.__bench_params.get_dict().keys() # AmplitudeOffsetTable if "AmplitudeOffsetTable" in available_params: amplitude_file = ConfigsParser(self.__bench_params.get_param_value("AmplitudeOffsetTable")) amplitude_table = amplitude_file.parse_amplitude_offset_table() frequency_list = amplitude_table.get("FrequencyList") offset_list = amplitude_table.get("OffsetList") elif "AmplFrequencyList" in available_params and \ "AmplOffsetList" in available_params: frequency_list = self.__bench_params.get_dict()["AmplFrequencyList"]["value"] offset_list = self.__bench_params.get_dict()["AmplOffsetList"]["value"] # Set Frequency points using FrequencyList (from Amplitude offset table) (err, msg) = W.SetCorrectionFrequency(self, frequency_list) self.__error_check(err, msg) # Set Amplitude Offset correction using offset list (err, msg) = W.SetCorrectionGain(self, offset_list) self.__error_check(err, msg) # Turning amplitude offset state to ON (err, msg) = W.SetCorrectionState(self, "ON") self.__error_check(err, msg)
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ TestStepBase.run(self, context) protocol = self._pars.bt_protocol device = DeviceManager().get_device(self._pars.device) # Read the throughput targets throughput_targets = ConfigsParser("BT_Throughput_Targets").parse_bt_targets(device.get_phone_model(), protocol) if self._pars.direction in "up": throughput_target = throughput_targets.ul_target throughput_failure = throughput_targets.ul_failure else: throughput_target = throughput_targets.dl_target throughput_failure = throughput_targets.dl_failure context.set_info(self._pars.target_throughput+":TARGET_VALUE", throughput_target.value) context.set_info(self._pars.target_throughput+":TARGET_UNIT", str(throughput_target.unit)) context.set_info(self._pars.target_throughput+":FAILURE_VALUE", throughput_failure.value) context.set_info(self._pars.target_throughput+":FAILURE_UNIT", str(throughput_failure.unit))
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ TestStepBase.run(self, context) device = DeviceManager().get_device(self._pars.device) throughput_target_unit = ThroughputMeasure.KBPS_UNIT throughput_failure_unit = ThroughputMeasure.KBPS_UNIT # Read the throughput targets throughput_targets = ConfigsParser("Wifi_Direct_Throughput_Targets").\ parse_wifi_direct_targets(device.get_phone_model(), self._pars.iperf_protocol, self._pars.bandwidth) if self._pars.direction in "up": throughput_target_value = throughput_targets.ul_target_value throughput_failure_value = throughput_targets.ul_failure_value else: throughput_target_value = throughput_targets.dl_target_value throughput_failure_value = throughput_targets.dl_failure_value context.set_info(self._pars.target_throughput + ":TARGET_VALUE", throughput_target_value) context.set_info(self._pars.target_throughput + ":TARGET_UNIT", throughput_target_unit) context.set_info(self._pars.target_throughput + ":FAILURE_VALUE", throughput_failure_value) context.set_info(self._pars.target_throughput + ":FAILURE_UNIT", throughput_failure_unit)
def __init__(self, tc_name, global_config): """ Constructor """ # Call IMS Audio base Init function LabAudioImsVcBase.__init__(self, tc_name, global_config) self._polqa_result_dl = None self._polqa_result_ul = None # Read POLQA Targets from Audio_Quality_Targets.xml self._polqa_target = ConfigsParser( "Audio_Quality_Targets").parse_audio_quality_target( "Polqa", self._codec_type, "VoLTE") # Read the number of pings to do self._nb_pings = self._tc_parameters.get_param_value("PACKET_COUNT") # Read the data size of a packet self._packet_size = self._tc_parameters.get_param_value("PACKET_SIZE") # Get target % of received packet for ping self._target_ping_packet_loss_rate = \ float(self._tc_parameters.get_param_value("TARGET_PACKET_LOSS_RATE")) self._result_verdict = Global.SUCCESS
def __init__(self, tc_name, global_config): """ Constructor """ # Call LabAudioVcBase Init function LabAudioGsmVcBase.__init__(self, tc_name, global_config) # Read PESQ Targets from Audio_Quality_Targets.xml self._pesq_target = ConfigsParser( "Audio_Quality_Targets").parse_audio_quality_target( "Pesq", self._codec_type, "CSV") # Read SECONDARY_CODEC from test case xml file self.__secondary_codec = str( self._tc_parameters.get_param_value("SECONDARY_CODEC")) # Read CODEC_SWITCH_TIME from test case xml file self.__codec_switch_time = int( self._tc_parameters.get_param_value("CODEC_SWITCH_TIME")) # Read DURATION from test case xml file self.__duration = int(self._tc_parameters.get_param_value("DURATION")) # Read PESQ_CODEC_SWITCH_FACTOR from test case xml file self.__pesq_cswitch_factor = str( self._tc_parameters.get_param_value("PESQ_CODEC_SWITCH_FACTOR")) # Calculation of the time sleep duration self.__time_sleep = self.__duration - self.__codec_switch_time # Calculation of the PESQ target score for codec switch self.__pesq_target_cswitch = float(self._pesq_target) - float( self.__pesq_cswitch_factor)
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ TestStepBase.run(self, context) device = DeviceManager().get_device(self._pars.device) # Read the throughput targets throughput_targets = ConfigsParser("Wifi_Throughput_Targets").\ parse_wifi_targets(device.get_phone_model(), self._pars.standard, self._pars.wifi_security, self._pars.iperf_protocol, self._pars.bandwidth) if self._pars.direction in "up": throughput_target = throughput_targets.ul_target throughput_failure = throughput_targets.ul_failure else: throughput_target = throughput_targets.dl_target throughput_failure = throughput_targets.dl_failure context.set_info(self._pars.target_throughput + ":TARGET_VALUE", throughput_target.value) context.set_info(self._pars.target_throughput + ":TARGET_UNITS", str(throughput_target.unit)) context.set_info(self._pars.target_throughput + ":FAILURE_VALUE", throughput_failure.value) context.set_info(self._pars.target_throughput + ":FAILURE_UNITS", str(throughput_failure.unit))
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ DeviceTestStepBase.run(self, context) throughput = DuplexThroughputMeasure() throughput.ul_throughput.set( self._pars.ul_value, ThroughputMeasure.parse_unit(self._pars.ul_units)) throughput.dl_throughput.set( self._pars.dl_value, ThroughputMeasure.parse_unit(self._pars.dl_units)) try: throughput_targets = ConfigsParser("BT_Throughput_Targets").\ parse_bt_targets(self._device.get_phone_model(), self._pars.bt_protocol) except IndexError: raise AcsConfigException( AcsConfigException.INVALID_BENCH_CONFIG, "BT_Throughput_Targets does not have targets for %s model and %s protocol" % (self._device.get_phone_model(), self._pars.protocol)) if throughput_targets is None: raise AcsConfigException(AcsConfigException.INVALID_BENCH_CONFIG, "Could not obtain throughput targets") if self._pars.strict_target: throughput_targets.dl_failure = throughput_targets.dl_target throughput_targets.ul_failure = throughput_targets.ul_target verdict, msg = compute_iperf_verdict(throughput, throughput_targets, self._pars.direction) if verdict == Global.FAILURE: self._logger.error("CheckBTIperfResults FAILED!") else: self._logger.info("CheckBTIperfResults PASSED!") self._logger.info("Bluetooth Throughput Measurement Results") self._logger.info(msg) if verdict == Global.FAILURE: raise DeviceException(DeviceException.OPERATION_FAILED, "CheckBTIperfResults failed")
def __init__(self, tc_name, global_config): """ Constructor """ LabAudioGsmVcBase.__init__(self, tc_name, global_config) # Read PESQ Targets from Audio_Quality_Targets.xml self._pesq_target = ConfigsParser( "Audio_Quality_Targets").parse_audio_quality_target( "Pesq", self._codec_type, "CSV")
def configure_amplitude_offset_table(self, frequency_list=None, offset_list=None, second_antenna_offset_list=None): """ Configures the amplitude offset table to compensate cable loss. :type frequency_list: str :param frequency_list: the frequency list. :type offset_list: str :param offset_list: the offset list corresponding to the frequency :type second_antenna_offset_list: str :param second_antenna_offset_list: the offset list corresponding to the frequency listed above for the diverse antenna. """ # Retrieve from bench configuration the frequency and offset table if not given if frequency_list is None or offset_list is None: if "AmplitudeOffsetTable" in self._bench_params.get_dict(): amplitude_file = ConfigsParser(self._bench_params.get_param_value("AmplitudeOffsetTable")) amplitude_table = amplitude_file.parse_amplitude_offset_table() frequency_list = amplitude_table.get("FrequencyList") offset_list = amplitude_table.get("OffsetList") if "SecondAntennaOffsetList" in amplitude_table: second_antenna_offset_list = amplitude_table.get("SecondAntennaOffsetList") if offset_list is not None: # The argument format for the CMW GPIB is freq1, attenuation1, freq2, attenuation2 ... main_antenna_list = zip(str(frequency_list).split(","), str(offset_list).split(",")) main_antenna_str = ", ".join([item for sublist in main_antenna_list for item in sublist]) # Load in CMW the compensation table self._visa.send_command("CONFigure:BASE:FDCorrection:CTABle:CREate 'ACS_main_antenna', %s" % main_antenna_str) # Activate the compensation table self._visa.send_command("CONFigure:FDCorrection:ACTivate RF1C, 'ACS_main_antenna'") try: if second_antenna_offset_list is not None: # The argument format for the CMW GPIB is freq1, attenuation1, freq2, attenuation2 ... div_antenna_list = zip(str(frequency_list).split(","), str(second_antenna_offset_list).split(",")) div_antenna_str = ", ".join([item for sublist in div_antenna_list for item in sublist]) # Load in CMW the compensation table self._visa.send_command("CONFigure:BASE:FDCorrection:CTABle:CREate 'ACS_div_antenna', %s" % div_antenna_str) # Activate the compensation table self._visa.send_command("CONFigure:FDCorrection:ACTivate RF3C, 'ACS_div_antenna'") except TestEquipmentException as e: self._logger.warning("Cannot activate compensation table for RF3C: %s" % e)
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ TestStepBase.run(self, context) device = DeviceManager().get_device(self._pars.device) sta_throughput_target_unit = ThroughputMeasure.UNITS.KPS_UNIT sta_throughput_failure_unit = ThroughputMeasure.UNITS.KPS_UNIT p2p_throughput_target_unit = ThroughputMeasure.UNITS.KPS_UNIT p2p_throughput_failure_unit = ThroughputMeasure.UNITS.KPS_UNIT # Read the throughput targets sta_throughput_targets, p2p_throughput_targets = ConfigsParser("Wifi_MR_Throughput_Targets").\ parse_wifi_mr_targets(device.get_phone_model(), self._pars.standard_frequency, self._pars.bandwidth, self._pars.sta_direction, self._pars.sta_iperf_protocol, self._pars.p2p_direction, self._pars.p2p_iperf_protocol) if self._pars.sta_direction in "up": sta_throughput_target_value = sta_throughput_targets.ul_target sta_throughput_failure_value = sta_throughput_targets.ul_failure else: sta_throughput_target_value = sta_throughput_targets.dl_target sta_throughput_failure_value = sta_throughput_targets.dl_failure if self._pars.p2p_direction in "up": p2p_throughput_target_value = p2p_throughput_targets.ul_target p2p_throughput_failure_value = p2p_throughput_targets.ul_failure else: p2p_throughput_target_value = p2p_throughput_targets.dl_target p2p_throughput_failure_value = p2p_throughput_targets.dl_failure context.set_info(self._pars.target_throughput + ":STA_TARGET_VALUE", sta_throughput_target_value.value) context.set_info(self._pars.target_throughput + ":STA_TARGET_UNIT", sta_throughput_target_unit) context.set_info(self._pars.target_throughput + ":STA_FAILURE_VALUE", sta_throughput_failure_value.value) context.set_info(self._pars.target_throughput + ":STA_FAILURE_UNIT", sta_throughput_failure_unit) context.set_info(self._pars.target_throughput + ":P2P_TARGET_VALUE", p2p_throughput_target_value.value) context.set_info(self._pars.target_throughput + ":P2P_TARGET_UNIT", p2p_throughput_target_unit) context.set_info(self._pars.target_throughput + ":P2P_FAILURE_VALUE", p2p_throughput_failure_value.value) context.set_info(self._pars.target_throughput + ":P2P_FAILURE_UNIT", p2p_throughput_failure_unit)
def configure_amplitude_offset_table(self, frequency_list=None, offset_list=None, second_antenna_offset_list=None): """ Configures the amplitude offset table to compensate cable loss. :type frequency_list: str :param frequency_list: the frequency list. :type offset_list: str :param offset_list: the offset list corresponding to the frequency :type second_antenna_offset_list: str :param second_antenna_offset_list: the offset list corresponding to the frequency listed above for the diverse antenna. """ # Retrieve from bench configuration the frequency and offset table if not given if frequency_list is None or offset_list is None: available_params = self._bench_params.get_dict().keys() # AmplitudeOffsetTable if "AmplitudeOffsetTable" in available_params: amplitude_file = ConfigsParser( self._bench_params.get_param_value("AmplitudeOffsetTable")) amplitude_table = amplitude_file.parse_amplitude_offset_table() frequency_list = amplitude_table.get("FrequencyList") offset_list = amplitude_table.get("OffsetList") elif "AmplFrequencyList" in available_params and \ "AmplOffsetList" in available_params: frequency_list = self._bench_params.get_dict( )["AmplFrequencyList"]["value"] offset_list = self._bench_params.get_dict( )["AmplOffsetList"]["value"] # Set Frequency points using FrequencyList (from Amplitude offset table) self._visa.send_command("SYST:CORR:FREQ %s" % frequency_list) # Set Amplitude Offset correction using offset list self._visa.send_command("SYST:CORR:GAIN %s" % offset_list) # Turning amplitude offset state to ON self._visa.send_command("SYST:CORR:STAT ON")
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ try: if self._pars.throughput_margin and int( self._pars.throughput_margin) != 0: # get target if needed self._throughput_targets = ConfigsParser( "BT_Throughput_Targets").parse_bt_targets( self._device.get_phone_model(), "OPP") return self._do_run(context) finally: self._clean_up()
def run(self, context): """ Runs the test step :type context: TestStepContext :param context: test case context """ TestStepBase.run(self, context) device = DeviceManager().get_device(self._pars.device) # Read the connection targets connection_targets = ConfigsParser("Wifi_Connection_Targets").\ parse_wifi_connection_targets(device.get_phone_model()) context.set_info(self._pars.target_connection+":TARGET_VALUE", connection_targets.connection_target_value) context.set_info(self._pars.target_connection+":TARGET_UNIT", connection_targets.connection_unit) context.set_info(self._pars.target_connection+":FAILURE_VALUE", connection_targets.connection_failure_value) context.set_info(self._pars.target_connection+":FAILURE_UNIT", connection_targets.connection_unit)
def set_up(self): """ Initialize the test """ # Call LIVE_WIFI_TETHERING_BASE set_up function LiveWifiTetheringBase.set_up(self) if '-u' in self._iperf_options: protocole = "UDP" else: protocole = "TCP" # Read the throughput targets self._throughput_targets = ConfigsParser("Wifi_Throughput_Targets").\ parse_wifi_targets(self._device.get_phone_model(), self._hotspot_standard, self._hotspot_security, protocole) if self._direction == 'down': self._server_ip_address = self._networking_api. \ get_interface_ipv4_address(self._hotspot_ext_interface) else: if self._wifi_interface is not None: self._server_ip_address = self._interface_ip else: self._server_ip_address = self._networking_api2.get_wifi_ip_address() self._iperf_settings.update({"server_ip_address": self._server_ip_address}) if self._direction is not None: self._iperf_settings.update({"direction": self._direction}) if self._networking_api2 is not None: self._iperf_settings.update({"networking_api2": self._networking_api2}) elif self._computer is not None: self._iperf_settings.update({"computer": self._computer}) # Overwrite Iperf settings with iperf options read in TC parameter self._iperf_settings.update(parse_iperf_options(self._iperf_options)) # Add optional interface to poll self._iperf_settings.update({'interface': self._dut_config.get("hotspotExtInterface")}) return Global.SUCCESS, "No errors"
def set_up(self): """ Initialize the test """ UseCaseBase.set_up(self) # Save the initial flight mode state self._initial_flight_mode_state = self._networking_api.get_flight_mode() # set flight mode self._logger.info("Disable flight mode") self._networking_api.set_flight_mode(0) if self._networking_api.get_flight_mode(): msg = "Unable to disable flight mode" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) # Parse CWS_AirPlaneMode_Cycle_Effect.xml config file self._apm_cycle_effect_config = \ ConfigsParser("CWS_AirPlaneMode_Cycle_Effect").parse_cws_airplanemode_cycle_effect() return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ # Call UseCase base Init function UseCaseBase.__init__(self, tc_name, global_config) self._overmind = None # init em stamp self.em_stamp = self._name self._uc_id_logged = False # override IO CARD with a not None type but not implemented type if self._io_card is None: self._io_card = IIOCard() # get em parameter from device catalog here self.phone_info = self._device.get_em_parameters() # feed the overmind self._overmind = OverMind() self._overmind.init(device=self._device, tc_parameters=self._tc_parameters, equipment_manager=self._em, bench_config=global_config.benchConfig, dut_config=self._dut_config) # Get uecmd api self.em_api = self._device.get_uecmd("EnergyManagement") self.phonesystem_api = self._device.get_uecmd("PhoneSystem") self.modem_api = self._device.get_uecmd("Modem") self.voicecall_api = self._device.get_uecmd("VoiceCall") self.networking_api = self._device.get_uecmd("Networking") self.bt_api = self._device.get_uecmd("LocalConnectivity") # init temperature chamber self._tct = self._tc_parameters.get_param_value("TCT", default_cast_type=int) if self._tct is not None: self.tc_module = ThermalChamberModule(self._tct) else: self.tc_module = None # Each raw measurement data & xml files are # stored in a folder bearing the name # of the TC + a time stamp directory_name = self._name + "_" + time.strftime("%Y-%m-%d_%Hh%M.%S") report_tree = global_config.campaignConfig.get("campaignReportTree") self._saving_directory = report_tree.create_subfolder(directory_name) campaign_pass_rate = float( global_config.campaignConfig.get("targetB2bPassRate")) # resume file self._campaign_folder = report_tree.get_report_path() # verdict file self._em_meas_verdict = EMUtil.EMMeasurement(self._saving_directory, campaign_pass_rate) # Call ConfigsParser to parse Energy_Management external_target_path = self._device.get_config("EMExternalTarget") if external_target_path is not None and os.path.exists( external_target_path): # Call ConfigsParser to parse Energy_Management self._logger.info("[EM BASE] External EM target file found : %s" % external_target_path) self._target_file = ConfigsParser(external_target_path, config_folder="") else: # If no external target file , parse default one self._logger.info( "[EM BASE] No external target file found, use default EM target file" ) self._target_file = ConfigsParser("Energy_Management") # Enable ACS secondary reports self._secondary_report = SecondaryTestReport( self._device.get_report_tree().get_report_path()) # init variables # var for robustness self.start_time = time.time() self.__phone_date = "" self._ambient_temperature = 25 self.phone_as_reboot = False self._consecutive_meas_error = 5 # pylint: disable=W0212 # Ignore used of protected member, will be change if a getter is created later self.pwr_btn_boot = self._device._prss_pwr_btn_time_switch_on self.pwr_btn_off = self._device._prss_pw_btn_time_switch_off # INIT PARAMETERS HERE # param related to usecase self._em_cst = EMUtil.EMConstant self._em_targets = None # add usb sleep for avoiding to lost connection during usb recognition self.usb_sleep = self._device._usb_sleep_duration # pylint: disable=w0212 # param related to device self.vbatt_mos_shutdown = self.phone_info["BATTERY"][ "VBATT_MOS_SHUTDOWN"] + 0.1 self.vbatt_mos_boot = self.phone_info["BATTERY"]["VBATT_MOS_BOOT"] + 0.1 # param that are designed to be updated self.batt_capacity = -1 self.batt_voltage = -1 # measurement list where we store measurement inside self._meas_list = EMUtil.MeasurementList() # init core module at the end self.em_core_module = None bench_type = self._tc_parameters.get_param_value( "BENCH_TYPE", self.DEDICATED_BENCH).upper() if bench_type == "POWER_SUPPLY_BENCH": self.em_core_module = UcPowerSupplyModule(self) elif bench_type == "BATTERY_BENCH": self.em_core_module = UcBatteryModule(self) self._logger.info("Loaded EM TEST_SCRIPT configuration for %s" % self.DEDICATED_BENCH) # get the list of TCD to test, it can have several entries # if the parameter is missing or empty ( meaning None) the old verdict system will be used. self.tcd_to_test = self._tc_parameters.get_param_value( EMConstant.TC_PARAMETER_TO_CHECK, "") if type(self.tcd_to_test) is str: self.tcd_to_test = filter(None, self.tcd_to_test.split(";")) self.tcd_to_test = map(str.strip, self.tcd_to_test)
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 __init__(self, tc_name, global_config): """ Constructor """ UseCaseBase.__init__(self, tc_name, global_config) # Get TC parameters self._registration_timeout = \ int(self._dut_config.get("registrationTimeout")) # Read maxDlWcdmaRab from DeviceCatalog.xml max_dl_wcdma_rab = \ str(self._dut_config.get("maxDlWcdmaRab")) # Read maxUlWcdmaRab from DeviceCatalog.xml max_ul_wcdma_rab = \ str(self._dut_config.get("maxUlWcdmaRab")) # Get FTP server parameters self._server = \ global_config.benchConfig.get_parameters("LAB_SERVER") self._server_ip_address = self._server.get_param_value("IP") self._username = self._server.get_param_value("username") self._password = self._server.get_param_value("password") if self._server.has_parameter("ftp_path"): self._ftp_path = self._server.get_param_value("ftp_path") else: self._ftp_path = "" # Initialize the server ipv6 address to None. self._server_ip_v6_address = None # Get the server ipv6 address from the BenchConfig, if the key # is present in the file. if self._server.has_parameter("IPV6"): self._server_ip_v6_address = self._server.get_param_value("IPV6") # Get Network configuration self._network = \ global_config.benchConfig.get_parameters("CELLULAR_NETWORK") self._apn = self._network.get_param_value("APN") self._ssid = self._network.get_param_value("SSID") # Read NETWORK_SIMULATOR1 from BenchConfig.xml self._ns_node = \ global_config.benchConfig.get_parameters("NETWORK_SIMULATOR1") self._ns_IP_Lan1 = self._ns_node.get_param_value("IP_Lan1") self._ns_IP_Lan2 = self._ns_node.get_param_value("IP_Lan2") self._ns_DUT_IP_Address = \ self._ns_node.get_param_value("DUT_IP_Address") self._ns_DUT_IP_Address2 = \ self._ns_node.get_param_value("DUT_IP_Address2", "") self._ns_DNS1 = self._ns_node.get_param_value("DNS1") self._ns_DNS2 = self._ns_node.get_param_value("DNS2") self._ns_Subnet_Mask = \ self._ns_node.get_param_value("Subnet_Mask") self._ns_Default_Gateway = \ self._ns_node.get_param_value("Default_Gateway") self._ns_fast_dormancy = \ self._ns_node.get_param_value("Fast_Dormancy", "disable") # Read the xml Template self._band_name = self._tc_parameters.get_param_value("CELL_BAND") self._dl_uarfcn = int(self._tc_parameters.get_param_value("DL_UARFCN")) self._cell_power = \ int(self._tc_parameters.get_param_value("CELL_POWER")) self._cell_service = self._tc_parameters.get_param_value( "CELL_SERVICE") # Read the DIRECTION value from UseCase xml Parameter self._direction = self._tc_parameters.get_param_value("DIRECTION") self._protocol = self._tc_parameters.get_param_value("PROTOCOL") # Read the UL_RAB value from UseCase xml Parameter # Check if this value is set to MAX or not ul_rab_config = str(self._tc_parameters.get_param_value("UL_RAB")) if ul_rab_config != "" or ul_rab_config != "None": if ul_rab_config == "MAX": self._ul_rab = max_ul_wcdma_rab else: self._ul_rab = ul_rab_config else: self._logger.info( "Unkown UL RAB Configuration %s has been chosen" % ul_rab_config) # Read the DL_RAB value from UseCase xml Parameter # Check if this value is set to MAX or not dl_rab_config = str(self._tc_parameters.get_param_value("DL_RAB")) if dl_rab_config != "" or dl_rab_config != "None": if dl_rab_config == "MAX": self._dl_rab = max_dl_wcdma_rab else: self._dl_rab = dl_rab_config else: self._logger.info( "Unkown UL RAB Configuration %s has been chosen" % dl_rab_config) # Read Home Public Land Mobile Network (HPLMN) Coverage # from test case xml file and accept all the different # written for True and False values self._hplmn_coverage = \ self._tc_parameters.get_param_value("HPLMN_COVERAGE", "True") # Read Mobile Country Code (MCC) from test case xml file self._mcc = \ int(self._tc_parameters.get_param_value("MCC", "1")) # Read Mobile Network Code (MNC) from test case xml file self._mnc = \ int(self._tc_parameters.get_param_value("MNC", "1")) # Read Amplitude_Offset_Table file name from Amplitude_Offset_Table.xml self._amploffset_filename = \ self._ns_node.get_param_value("AmplitudeOffsetTable") amplitude_file = ConfigsParser(self._amploffset_filename) amplitude_table = amplitude_file.parse_amplitude_offset_table() # Read frequency_list and offset_list from Amplitude_Offset_Table.xml self._frequency_list = amplitude_table.get("FrequencyList") self._offset_list = amplitude_table.get("OffsetList") # Get UECmdLayer for Data Use Cases self._networking_api = self._device.get_uecmd("Networking") self._modem_api = self._device.get_uecmd("Modem") # Create cellular network simulator and retrieve 3G data API self._ns = self._em.get_cellular_network_simulator( "NETWORK_SIMULATOR1") self._ns_cell_3g = self._ns.get_cell_3g() self._data_3g = self._ns_cell_3g.get_data() # init wanted registration parameters self._wanted_reg_state = "None"
def set_up(self): """ Initialize the test """ LabWifiBase.set_up(self) # Check input testcase parameters self.__check_input_tcparameter() # Retrieve the expected wifi behavior depending on the input params self._scan, self._wifi_off, self._tduration, desc = \ ConfigsParser("Wifi_Sleep_Policies").\ parse_wifi_sleep_policies(self._device.get_phone_model(), self._connected, self._display_state, self._keep_wifi_on, self._usb_pluggedin, self._ssid_list_empty) if self._scan == 0 \ and self._wifi_off == 0 \ and self._tduration == 0: msg = "No Wifi sleep policy found in Wifi_Sleep_Policies.XML" self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) if desc: self._logger.info("TestCase to run: %s" % desc) self._logger.debug("Scan period (s): %d" % self._scan) self._logger.debug("Time to WiFi turn off (min): %d" % self._wifi_off) self._logger.debug("Recommended test duration (s): %d" % self._tduration) # Initialize the Sniffer equipment self._sp_sniffer = self._em.get_sniffer("WIFI_SNIFFER1") # Apply WIFI_CONNECTED initial condition if self._connected.lower() == "false": self._networking_api.wifi_remove_config('all') # Apply REMEMBERED_SSID_LIST_EMPTY initial condition if self._ssid_list_empty.lower() == "false": # Create non existing WiFi network in the known network list self._networking_api.set_wificonfiguration( self.FAKE_SSID, None, "OPEN") # Non consistent case elif self._ssid_list_empty.lower() == "true": self._logger.warning( "TC is requested with WiFi CONNECTED," + " whereas REMEMBERED_SSID_LIST has to be EMPTY. " + "Test will be run CONNECTED " + "and REMEMBERED_SSID_LIST_EMPTY is ignored.") # Apply KEEP_WIFI_ON_DURING_SLEEP initial condition if self._keep_wifi_on.lower() == "always": policy = self._networking_api.WIFI_SLEEP_POLICY["NEVER"] elif self._keep_wifi_on.lower() == "only_when_plugged_in": policy = \ self._networking_api.WIFI_SLEEP_POLICY["NEVER_WHILE_PLUGGED"] else: # "never" policy = self._networking_api.WIFI_SLEEP_POLICY["WHEN_SCREEN_OFF"] self._networking_api.set_wifi_sleep_policy(policy) # Retrieve WiFi MAC Address self._wifi_mac = self._networking_api.get_interface_mac_addr("wifi") # Unlock the WiFi power saving mode self._networking_api.set_wifi_power_saving_mode(1) # Apply display initial condition if self._display_state == "OFF": self._original_screen_timeout = \ self._phone_system_api.get_screen_timeout() # Set display off timeout to its minimal value self._phone_system_api.set_screen_timeout(self.SCREEN_TIMEOUT) time.sleep(self.SCREEN_TIMEOUT) # Go back to idle screen and turn screen off self._phone_system_api.display_on() self._phone_system_api.set_phone_lock(0) self._networking_api.wifi_menu_settings(False) self._phone_system_api.set_phone_lock(1) self._phone_system_api.display_off() else: # case if self._display_state == "ON_OUT_WIFI_MENU" is_in = False if self._display_state == "ON_IN_WIFI_MENU": is_in = True # Prevent screen back-light to turn off self._phone_system_api.display_on() time.sleep(self._wait_btwn_cmd) # Unlock the device self._phone_system_api.set_phone_lock(0) time.sleep(self._wait_btwn_cmd) # Open or exit WiFi settings menu self._networking_api.wifi_menu_settings(is_in) return Global.SUCCESS, "No errors"
def set_up(self): """ Initialize the test """ # Call LAB_WIFI_BASE set_up function LabWifiBase.set_up(self) if '-u' in self._iperf_options: protocole = "UDP" else: protocole = "TCP" # Read the throughput targets self._throughput_targets = ConfigsParser("Wifi_Throughput_Targets").\ parse_wifi_targets(self._device.get_phone_model(), self._standard, self._security, protocole, self._bandwidth) # Overwrite target values with those read in TC parameter if self._target_ul is not None and self._target_ul != "": self._throughput_targets.ul_target.set(float(self._target_ul), ThroughputMeasure.KBPS_UNIT) if self._failure_ul is not None and self._failure_ul != "": self._throughput_targets.ul_failure.set( float(self._failure_ul), ThroughputMeasure.KBPS_UNIT) if self._target_dl is not None and self._target_dl != "": self._throughput_targets.dl_target.set(float(self._target_dl), ThroughputMeasure.KBPS_UNIT) if self._failure_dl is not None and self._failure_dl != "": self._throughput_targets.dl_failure.set( float(self._failure_dl), ThroughputMeasure.KBPS_UNIT) if self._direction not in ("both", "up", "down"): msg = "%s is not a valid DIRECTION." self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) self._iperf_settings.update({"direction": self._direction}) if self._computer is not None: self._iperf_settings.update({"computer": self._computer}) dut_ip_address = str(self._networking_api.get_wifi_ip_address()) if self._direction == 'down': # Downlink: connect from host to DUT, get DUT IP address. self._iperf_settings.update({"server_ip_address": dut_ip_address}) elif self._computer is not None: # Uplink/both: connect from DUT to host, get computer IP address. # if computer is None or localhost, use WIFI_SERVER from Bench_Config ip = self._computer.get_host_on_test_network() if ip not in ("localhost", "127.0.0.1"): self._iperf_settings.update({"server_ip_address": ip}) # On windows DUT platform, we must set the outbound address # (because ethernet and wlan connections are connected at the same time # and to the same network) self._iperf_settings.update({"bind_host": dut_ip_address}) if self._tune_options == 1: # Set Iperf settings depending on the expected throughput self._iperf_settings.update( get_iperf_configuration(self._throughput_targets)) # Overwrite Iperf settings with iperf options read in TC parameter self._iperf_settings.update(parse_iperf_options(self._iperf_options)) return Global.SUCCESS, "No errors"
def set_up(self): """ Initialize the test """ LiveDualPhoneBTBase.set_up(self) # Check BT addresses validity if not NetworkingUtil.is_valid_mac_address(self._phone1_addr): msg = "Wrong MAC address for PHONE1 [%s]" % self._phone1_addr raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) if not NetworkingUtil.is_valid_mac_address(self._phone2_addr): msg = "Wrong MAC address for PHONE2 [%s]" % self._phone2_addr raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) # Set sender/receiver APIs and variables if self._direction == self.UPLOAD: self._sender_api = self._bt_api self._sender_add = self._phone1_addr self._sender_device = self._device self._sender_phonesys_api = self._phonesystem_api self._receiver_api = self._bt_api2 self._receiver_add = self._phone2_addr self._receiver_device = self._phone2 self._receiver_phonesys_api = self._phonesystem2_api (self._fullpath_filenames, expected_size1) = self \ ._process_files(self._multimedia_path1, self._file_list, False) (self._fp_filename_other_dir, expected_size2) = self \ ._process_files(self._multimedia_path2, self._file_list, True) elif self._direction == self.DOWNLOAD: self._sender_api = self._bt_api2 self._sender_add = self._phone2_addr self._sender_device = self._phone2 self._sender_phonesys_api = self._phonesystem2_api self._receiver_api = self._bt_api self._receiver_add = self._phone1_addr self._receiver_device = self._device self._receiver_phonesys_api = self._phonesystem_api (self._fullpath_filenames, expected_size1) = self \ ._process_files(self._multimedia_path2, self._file_list, False) (self._fp_filename_other_dir, expected_size2) = self \ ._process_files(self._multimedia_path1, self._file_list, True) else: msg = "Invalid DIRECTION parameter [%s]" % self._direction self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) if expected_size1 != expected_size2: # same files, hence must have same size!! msg = "Files size are supposed to be the same!!" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) self._timeout1 = int( expected_size1 / self.BT_OPP_SPEED_FOR_TIMEOUT) + 20 self._timeout2 = int( expected_size2 / self.BT_OPP_SPEED_FOR_TIMEOUT) + 20 # Set receiver discoverable by sender self._receiver_api.set_bt_discoverable("connectable", 0) # First Scan devices around to speed-up run_test self._sender_api.bt_scan_devices() # unlock screen and set display ON # Mandatory prior to use bt_opp_send_file UECmd self._sender_phonesys_api.display_on() self._sender_phonesys_api.set_phone_lock(0) # Process the bidirectional transfer if self._is_bidirectional: # Set sender discoverable by receiver self._sender_api.set_bt_discoverable("connectable", 0) self._receiver_api.bt_scan_devices() self._receiver_phonesys_api.display_on() self._receiver_phonesys_api.set_phone_lock(0) # Check throughput data validity if self._tp_enable: msg = "Throughput measurement is enabled" self._logger.info(msg) # Read the throughput targets self._throughput_targets = ConfigsParser("BT_Throughput_Targets").\ parse_bt_targets(self._device.get_phone_model(), "OPP") # Verify validity of margin parameter if self._tp_margin.isdigit(): self._throughtput_margin = int(self._tp_margin) else: msg = "ERROR_MARGIN parameter is not valid: <%s>" % self._tp_margin self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) # Initialize Average tp measure self._reset_tp_meas(self._file_list, self._direction, self._is_bidirectional) return Global.SUCCESS, "No errors"