예제 #1
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        UseCaseBase.__init__(self, tc_name, global_config)

        self._ftp_task_id = 0
        self._ftp_filename = None
        self._ftp_direction = None

        # Read registrationTimeout from DeviceCatalog.xml
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

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

        # Read the LAB_SERVER parameters from BenchConfig.xml
        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 = ""

        # Read ftp DIRECTION from testcase xml parameters
        self._direction = self._tc_parameters.get_param_value("DIRECTION")

        # Read the DL_FILE value from UseCase xml Parameter
        self._dlfilename = os.path.join(
            self._ftp_path,
            self._tc_parameters.get_param_value("DL_FILENAME"))
        # Read the UL_FILE value from UseCase xml Parameter
        self._ulfilename = os.path.join(
            self._ftp_path,
            self._tc_parameters.get_param_value("UL_FILENAME"))

        # Read CELLULAR_NETWORK parameters from BenchConfig.xml
        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")

        # Retrieve valid bench name for 2G capability
        self._bench_name = get_nw_sim_bench_name("2G", global_config, self._logger)

        # Read NETWORK_SIMULATOR from BenchConfig.xml
        self._ns_node = \
            global_config.benchConfig.get_parameters(self._bench_name)
        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_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")

        # Read the xml Template
        self._band_name = self._tc_parameters.get_param_value("CELL_BAND")
        self._bch_arfcn = int(self._tc_parameters.get_param_value("BCH_ARFCN"))
        self._pdtch_arfcn = \
            int(self._tc_parameters.get_param_value("PDTCH_ARFCN"))
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))
        self._multislot = \
            self._tc_parameters.get_param_value("MULTISLOT_CONFIG")
        self._ul_mcs = self._tc_parameters.get_param_value("UL_MCS")
        self._dl_mcs = self._tc_parameters.get_param_value("DL_MCS")
        self._ps_mcs = self._tc_parameters.get_param_value("PS_MCS")

        # Get UECmdLayer for Data and Voice call Use Cases
        self._networking_api = self._device.get_uecmd("Networking")
        self._modem_api = self._device.get_uecmd("Modem")
        self._voicecall_api = self._device.get_uecmd("VoiceCall")

        # set VOICE CODER RATE to FR_AMR_NB_1220
        self._voice_coder_rate = "FR_AMR_NB_1220"

        # Read CALL_DURATION from test case xml file
        self._call_duration = \
            int(self._tc_parameters.get_param_value("CALL_DURATION"))

        # Create cellular network simulator and retrieve 2G data interface
        self._ns = self._em.get_cellular_network_simulator(self._bench_name)

        # Shortcut to get Cell 2G parameters
        self._ns_cell_2g = self._ns.get_cell_2g()
        self._ns_data_2g = self._ns_cell_2g.get_data()
        self._ns_voice_call_2g = self._ns_cell_2g.get_voice_call()
예제 #2
0
    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 maxDlMultislotConfig from DeviceCatalog.xml
        max_dl_multislot_config = \
            str(self._dut_config.get("maxDlMultislotConfig"))

        # Read maxUlMultislotConfig from DeviceCatalog.xml
        max_ul_multislot_config = \
            str(self._dut_config.get("maxUlMultislotConfig"))

        # Get Lab 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 = ""

        # Read Cellular 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")

        # Cell Tech is 2G
        self.ns_cell_tech = "2G"

        # Retrieve valid bench name for 2G capability
        self._bench_name = get_nw_sim_bench_name(self.ns_cell_tech,
                                                 global_config, self._logger)
        # bench_name should be either NETWORK_SIMULATOR1 or NETWORK_SIMULATOR2
        # In both cases, we need to retrieve the NS number (position in the bench config, either 1 or 2)
        self._ns_number = int(self._bench_name[-1])

        # Read NETWORK_SIMULATOR from BenchConfig.xml
        self._ns_node = \
            global_config.benchConfig.get_parameters(self._bench_name)

        # Read the Model of the NETWORK_SIMULATOR
        self._ns_model = self._ns_node.get_param_value("Model")
        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")

        # Read the xml Template
        self._band_name = self._tc_parameters.get_param_value("CELL_BAND")

        # NS_CELL_REL
        self._ns_cell_rel = 7

        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))

        # Read the DIRECTION value from UseCase xml Parameter
        self._direction = self._tc_parameters.get_param_value("DIRECTION")

        # Read the Multislot Configuration value from UseCase xml Parameter
        # Check if this value is set to MAX or not
        multislot_config = \
            str(self._tc_parameters.get_param_value("MULTISLOT_CONFIG", "MAX"))
        if multislot_config != "" or multislot_config != "None":
            if multislot_config == "MAX" and self._direction == "DL":
                self._multislot = max_dl_multislot_config

            elif multislot_config == "MAX" and self._direction == "UL":
                self._multislot = max_ul_multislot_config

            elif multislot_config == "MAX" and (self._direction == ""
                                                or self._direction is None):
                self._multislot = "D3U2"

            elif multislot_config != "MAX":
                self._multislot = multislot_config
        else:
            self._logger.info(
                "Unknown Multislot Configuration %s has been chosen" %
                multislot_config)

        self._dl_coding_scheme = self._tc_parameters.get_param_value("DL_CS")
        self._ul_coding_scheme = self._tc_parameters.get_param_value("UL_CS")

        # 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 2G data API
        self._ns = self._em.get_cellular_network_simulator(self._bench_name)
        self._ns_cell_2g = self._ns.get_cell_2g()
        self._ns_data_2g = self._ns_cell_2g.get_data()

        # Read the throughput targets
        self._throughput_targets = TelephonyConfigsParser("Throughput_Targets").\
            parse_gprs_egprs_theoretical_targets("GPRS", self._multislot, self._dl_coding_scheme, self._ul_coding_scheme)
예제 #3
0
    def __init__(self, tc_name, global_config):
        """
        Initializes this instance.
        """
        # Call inherited initializer
        UseCaseBase.__init__(self, tc_name, global_config)

        # Read registrationTimeout from Device_Catalog.xml
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

        # Read IMS registration parameter
        self._ims_registration_timeout = self._tc_parameters.get_param_value(
            "IMS_REGISTRATION_TIMEOUT",
            default_cast_type=int)

        # Read the IMS password parameter
        self._digest_password = \
            self._tc_parameters.get_param_value("IMS_DIGEST_PASSWORD", "")
        # Device phone number
        self._dut_phone_number = str(self._device.get_phone_number())
        # If not valid, retrieve it from bench configuration file
        if self._dut_phone_number is None or self._dut_phone_number =="":
            self._dut_phone_number = \
                self._retrive_parameter_bench_config(global_config, "PhoneNumberDut1")

        # Read the IMS configuration file path parameter
        self._ims_parameter_file = \
            self._tc_parameters.get_param_value("IMS_PARAMETER_FILE")

        # Read the parameter for deregistration method
        self._deregistration_method = \
            self._tc_parameters.get_param_value("DEREGISTRATION_METHOD", None)

        # Retrieve the IMS modem configuration procedure from bench configuration file
        # if defined
        try:
            self._ims_configure_modem_procedure = \
                str(self._retrive_parameter_bench_config(global_config, "ImsModemConfiguration"))
        except AcsConfigException:
            self._ims_configure_modem_procedure = "AT-COMMANDS"

        # Read the IMS IP version parameter
        self._ip_version = \
            self._tc_parameters.get_param_value("IP_VERSION",
                                                "IPV4")
        self.__xicfg_ip_version = None

        # Initialize an IMS Configurator instance
        self._generator = None

        # Read the authentication mode
        self.__authentication_mode = None
        authentication_mode = \
            self._tc_parameters.get_param_value("IMS_AUTHENTICATION")
        if authentication_mode:
            authentication_mode = authentication_mode.lower()
        if authentication_mode in ("aka", "digest"):
            self.__authentication_mode = authentication_mode

        # Read the precondition parameter
        self.__preconditions = None
        preconditions = \
            self._tc_parameters.get_param_value("IMS_PRECONDITIONS")
        if preconditions:
            preconditions = preconditions.lower()
        if preconditions in ("ietf", "3gpp"):
            self.__preconditions = preconditions

        # Create an attribute that keeps the list of configurations
        # to be applied.
        if self._ims_configure_modem_procedure == "IMS_ANDROID":
            self.__configurations = \
                    (self._ip_version,
                     self.__preconditions,
                     self.__authentication_mode)
        else:
            self.__configurations = \
                    (self.__authentication_mode + "-at_cmd",
                     self.__preconditions + "-at_cmd",
                     "flush" + "-at_cmd")

        # Read the IMS registration operation
        try:
            self._ims_reg_operation = \
                self._retrive_parameter_bench_config(global_config, "ImsRegistrationOperation")
        except AcsConfigException:
            self._ims_reg_operation = \
                str(self._tc_parameters.get_param_value("IMS_REGISTRATION_OPERATION",
                                                        "REGISTER"))
        if "CHECK_ONLY" == self._ims_reg_operation:
            self._logger.info("IMS registration will only be checked")
        elif "SKIP_DEREGISTER" == self._ims_reg_operation:
            self._logger.info("IMS registration will be performed but de-registration will be skipped.")

        # Retrieve appropriate UE Cmd categories
        self._phone_system_api = self._device.get_uecmd("PhoneSystem")
        self._networking_api = self._device.get_uecmd("Networking")
        self._file_system_api = self._device.get_uecmd("File")
        self._modem_flashing_api = self._device.get_uecmd("ModemFlashing")
        self._modem_api = self._device.get_uecmd("Modem")
    def set_up(self):
        """
        Set up the test configuration
        """

        # Call UseCaseBase Setup function
        UseCaseBase.set_up(self)

        # Check if we have the second phone available
        if self._phone2 is not None:
            if not self._phone2.is_available():
                self._phone2.switch_on(simple_switch_mode=True)
            self._system_api2 = self._phone2.get_uecmd("System")
        else:
            # We are using this multi UC with only one phone
            error_msg = \
                "This test case requires two phones to be executed !"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.INVALID_BENCH_CONFIG,
                                     error_msg)

        # Swap 2G 3G or 4G.
        if self._call_type == "2G":
            self._networking_api.set_preferred_network_type(
                PreferredNetwork.GSM_ONLY)
        elif self._call_type == "3G":
            self._networking_api.set_preferred_network_type(
                PreferredNetwork.WCDMA_ONLY)
        elif self._call_type == "4G":
            self._networking_api.set_preferred_network_type(
                PreferredNetwork.LTE_ONLY)
        else:
            if self._call_type not in "VOIP":
                msg = "wrong value of parameter CALL TYPE"
                self._logger.error(msg)
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         msg)

        # Audio Analyzer Initialization
        if self._audio_analyzer.initialization(self._device.get_phone_model(),
                                               self._test_type) != 0:
            error_msg = \
                "Audio Analyzer Initialization Failed !"
            self._logger.error(error_msg)
            raise TestEquipmentException(
                TestEquipmentException.OPERATION_FAILED, error_msg)

        if self._acc_list.count("BLUETOOTH") > 0:
            # Get dut bt address
            self._dut_bt_address = self._bt_api.get_bt_adapter_address()

            # Push the first Bluetooth accessories in first
            l_bluetooth_acc_position = 0
            for i in self._acc_list_split:
                if i.find("BLUETOOTH") != -1:
                    # Initialization of _acc_type with the bluetooth accessories
                    self._acc_type = i
                    self._acc_list_split.insert(len(self._acc_list_split), i)
                    self._acc_active_list_split.insert(
                        len(self._acc_active_list_split),
                        self._acc_active_list_split[l_bluetooth_acc_position])
                    self._call_volume_ref_list_split.insert(
                        len(self._call_volume_ref_list_split), self.
                        _call_volume_ref_list_split[l_bluetooth_acc_position])
                    self._call_volume_dut_list_split.insert(
                        len(self._call_volume_dut_list_split), self.
                        _call_volume_dut_list_split[l_bluetooth_acc_position])
                    break
                l_bluetooth_acc_position += 1

            # Connect Bluetooth device
            if self._audio_analyzer.connect_bt(self._acc_type,
                                               self._dut_bt_address) != 0:
                error_msg = \
                    "Connect Bluetooth failed !"
                self._logger.error(error_msg)
                raise DeviceException(DeviceException.OPERATION_FAILED,
                                      error_msg)

        return Global.SUCCESS, "No errors"
예제 #5
0
    def run_test(self):
        """
        Execute the test
        """
        UseCaseBase.run_test(self)

        # Setup embedded for all defined devices
        for device in DeviceManager().get_all_devices():

            # get the signing keys from the device's BENCHCFG
            signing_key = device.get_config("appSigningKey", "")
            if not signing_key:
                error_msg = "appSigningKey parameter is not present in Device Catalog nor in Bench Config"
                raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                         error_msg)

            system_api = device.get_uecmd("System")
            app_api = device.get_uecmd("AppMgmt")
            phone_system_api = device.get_uecmd("PhoneSystem")

            device_name = device.whoami().get("device", "")
            if not device_name:
                error_msg = "Device name cannot be found from device instance!"
                raise AcsConfigException(
                    AcsConfigException.INSTANTIATION_ERROR, error_msg)

            # Boot the device if not booted and connect it
            if not device.is_available():
                DeviceManager().boot_device(device_name)

            signing_key_name = None
            signing_key_folder = None

            # Get key to sign apps if necessary
            if not device.has_intel_os():
                signing_key = None
            if signing_key:
                artifact_manager = self._em.get_artifact_manager(
                    "ARTIFACT_MANAGER")
                artifact_manager.get_artifact(artifact_name=signing_key +
                                              ".pk8",
                                              transfer_timeout=10)
                local_artifact = artifact_manager.get_artifact(
                    artifact_name=signing_key + ".x509.pem",
                    transfer_timeout=10)
                signing_key_folder = os.path.dirname(local_artifact)
                signing_key_name = os.path.basename(signing_key)

            for agent_path in self._agent_paths:
                agent_path = agent_path.strip()
                if not agent_path:
                    error_msg = "Split parameter error. An application path is empty. Did you forget a \";\" ?"
                    raise AcsConfigException(
                        AcsConfigException.INVALID_PARAMETER, error_msg)

                # check if path to ACS_AGENT exists
                if not os.path.exists(agent_path):
                    error_msg = "Application not found {0} !".format(
                        agent_path)
                    raise AcsConfigException(
                        AcsConfigException.INVALID_PARAMETER, error_msg)

                # if app signing is needed, do it now
                if signing_key_folder and signing_key_name:
                    app_path = self.__sign_app(app_api, agent_path,
                                               signing_key_folder,
                                               signing_key_name)

                # actually install the app
                status, status_msg = app_api.install_device_app(app_path)
                if status != Global.SUCCESS:
                    error_msg = "Unable to install application from {0} : {1}".format(
                        app_path, status_msg)
                    raise DeviceException(DeviceException.OPERATION_FAILED,
                                          error_msg)

                # disable app verification
                if device.is_rooted():
                    phone_system_api.set_verify_application(False)

            # Reboot device in order to "clean" the system after install
            device.reboot()

            # Initialize UI api
            self._ui_api.init()

            #disable SetupWizard
            verdict, msg = self._disable_wizard()
            if verdict != Global.SUCCESS:
                error_msg = "Unable to disable SetupWizard. Error Message: {0}".format(
                    msg)
                raise DeviceException(DeviceException.OPERATION_FAILED,
                                      error_msg)
        return Global.SUCCESS, ""
예제 #6
0
    def set_up(self):
        """
        Set up the test configuration
        """

        # Call use case base Setup function
        UseCaseBase.set_up(self)

        # Clear all data connections
        self._networking_api.clean_all_data_connections()
        time.sleep(self._wait_btwn_cmd)

        # Connect to equipment
        self._ns.init()

        # Set the equipment Application Format = "WCDMA"
        self._ns.switch_app_format("WCDMA")

        # Perform full preset
        self._ns.perform_full_preset()

        # Deactivate HSUPA and HSDPA capabilities
        self._ns_data_3g.set_edch_cell_capability("OFF")
        self._ns_data_3g.set_hsdpa_cell_capability("OFF")

        # Set cell off
        self._ns_cell_3g.set_cell_off()

        # 3G default cell setup
        RegUtil.setup_cell(self._ns_number,
                           self._ns_model,
                           "3G",
                           self._band,
                           self._ns_cell_rel,
                           self._logger)

        # Set Frequency points using frequency list
        self._ns.configure_amplitude_offset_table()

        # Set cell power using CELL_POWER value
        self._ns_cell_3g.set_cell_power(self._cell_power)

        # Set serving cell to PACKET
        self._ns_cell_3g.set_cell_service("PACKET")

        # Set downlink UARFCN using DL_UARFCN value
        self._ns_cell_3g.set_band_and_dl_arfcn(
            "BAND" + str(self._band), self._dl_uarfcn)

        # Set cell on
        self._ns_cell_3g.set_cell_on()

        # Check Data Connection State => ATTACHED before timeout
        RegUtil.check_dut_data_connection_state_before_timeout("ATTACHED",
                                                               self._ns_cell_3g,
                                                               self._networking_api,
                                                               self._logger,
                                                               self._registration_timeout,
                                                               flightmode_cycle=True,
                                                               blocking=False)
        # Check registration state is connected using
        # registrationTimeout from Device_Catalog.xml
        self._modem_api.check_cdk_registration_bfor_timeout(
            self._registration_timeout)

        # Set the APN
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn) + "...")
        self._networking_api.set_apn(self._ssid, self._apn)

        # 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)

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

        self._oglconform = OGLConform(self._device)

        self._report_pathname = self._device.get_report_tree().get_report_path(
        )
        self._output_filename = "%s/%s.csv" % (
            self._report_pathname, os.path.basename(self.get_name()))
        self._output_filename_khronos = "%s/khronos_%s.csv" % (
            self._report_pathname, os.path.basename(self.get_name()))

        # get TestCase parameters
        self._feature_name = str(
            self._tc_parameters.get_param_value("FEATURE_NAME", ""))
        self._diag_parameter = str(
            self._tc_parameters.get_param_value("DIAG_PARAMETER",
                                                "")).split(";")
        self._test_parameter = str(
            self._tc_parameters.get_param_value("TEST_PARAMETER",
                                                "")).replace("\n",
                                                             "").split(";")
        self._khronos_parameter = str(
            self._tc_parameters.get_param_value("KHRONOS_PARAMETER",
                                                "")).split(";")
        self._remove_parameter = str(
            self._tc_parameters.get_param_value("REMOVE_PARAMS",
                                                "")).replace("\n",
                                                             "").split(";")

        self._device_logdir = self._tc_parameters.get_param_value(
            "DEVICE_LOGDIR")

        self._cert_mode = self._tc_parameters.get_param_value("CERT_MODE")

        self._run_type = 'DRY'

        self.__tc_report = SecondaryTestReport(
            self._device.get_report_tree().get_report_path())
        self._adb_remove = "adb shell rm -rf /data/app/"
        self._proc_name = "org.khronos.gl_cts"

        self._report_path = self._device.get_report_tree().get_report_path()

        self._khronos_object = KhronosApk(self._device, self._device_logdir,
                                          self._report_path, None)

        self.original_results_gfx_location = os.path.join(
            os.path.expanduser("~"), "test_output")

        self.acs_gfx_results = os.path.join(
            self._device.get_report_tree().get_report_path(),
            "gfx_results.zip")

        self._helper_scripts_path = 'OTC/TC/ACS/Graphics/Graphics/scripts'
        self._scripts_path = PathManager.absjoin(KhronosApk.TEST_SUITES_PATH,
                                                 self._helper_scripts_path)
        self._activity_name = self._tc_parameters.get_param_value(
            "ACTIVITY_NAME")
        self._default_logging_dir = "/sdcard/"
        name_list = self.get_name().split("/")
        tcs_name = name_list[len(name_list) - 1]
        self._logs_folder_name = "gles_%s_logs" % tcs_name
        self._pull_logs_path = PathManager.absjoin(self._report_path,
                                                   self._logs_folder_name)

        self._output_filename = "%s/%s.csv" % (
            self._report_pathname, os.path.basename(self.get_name()))
        self._output_filename_khronos = "%s/khronos_%s.csv" % (
            self._report_pathname, os.path.basename(self.get_name()))

        self._khronos = KhronosBin(self._device, self._report_pathname,
                                   self._logs_folder_name)
        # self._khronos_object = KhronosApk(self._device, self._device_logdir, self._report_path, self._activity_name)
        self._khronos_object = KhronosApk(self._device, self._device_logdir,
                                          self._pull_logs_path,
                                          self._activity_name)
    def __init__(self, tc_name, global_config):

        # Call UseCaseBase init function.
        UseCaseBase.__init__(self, tc_name, global_config)

        # Get TC parameters
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

        # Read NS_CELL_TECH from test case xml file
        self._ns_cell_tech = \
            str(self._tc_parameters.get_param_value("CELL_TECH"))

        self._ns_cell_generation = self._ns_cell_tech
        if self._ns_cell_tech in ["3G", "HSPA"]:
            self._ns_cell_generation = "3G"

        # Read CELL_BAND from xml UseCase parameter file
        self._ns_cell_band = self._tc_parameters.get_param_value("CELL_BAND")

        # NS_CELL_REL
        self._ns_cell_rel = 7

        # Read CELL_SERVICE from test case xml file
        self._ns_cell_service = \
            str(self._tc_parameters.get_param_value("CELL_SERVICE"))

        # Read CELL_POWER from xml UseCase parameter file
        self._ns_cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))

        # Read the DARFCN value from UseCase xml Parameter
        self._ns_arfcn = \
            int(self._tc_parameters.get_param_value("ARFCN"))

        self._cpc_tti_value = str(
            self._tc_parameters.get_param_value("CPC", ""))
        # Get the CPC parameters (only if user wants to use CPC feature) .
        if self._cpc_tti_value.strip().isdigit():
            self._cpc_tti_value = int(self._cpc_tti_value)
            if self._cpc_tti_value != 2 and self._cpc_tti_value != 10:
                self._cpc_tti_value = None
                self._logger.warning(
                    "Wrong CPC parameter : %s ; Value should be 2 or 10 " %
                    self._cpc_tti_value)
        else:
            self._cpc_tti_value = None

        # Get Network configuration
        self._network = \
            global_config.benchConfig.get_parameters("CELLULAR_NETWORK")
        self._apn_name = self._network.get_param_value("APN")
        self._apn_ssid = self._network.get_param_value("SSID")

        # Retrieve valid bench name for 3G capability
        self._bench_name = get_nw_sim_bench_name(self._ns_cell_generation,
                                                 global_config, self._logger)
        # bench_name should be either NETWORK_SIMULATOR1 or NETWORK_SIMULATOR2
        # In both cases, we need to retrieve the NS number (position in the bench config, either 1 or 2)
        self._ns_number = int(self._bench_name[-1])

        # Read NETWORK_SIMULATOR from BenchConfig.xml
        self._ns_node = \
            global_config.benchConfig.get_parameters(self._bench_name)

        # Retrieve the model of the equipment
        self._ns_model = self._ns_node.get_param_value("Model")

        # Retrieve the model IP addresses
        ns_ips = NetworkSimulatorIP(self._logger)
        ns_ips.setup_config(global_config, self._ns_number)
        (self._ns_ip_lan1, self._ns_ip_lan2, self._ns_ip_dut, self._ns_ip_dut2,
         self._ns_ip_dns1, self._ns_ip_dns2, self._ns_ip_subnet_mask,
         self._ns_ip_default_gateway) = ns_ips.get_config()

        # Get UECmdLayer for Data Use Cases
        self._modem_api = self._device.get_uecmd("Modem")
        self._phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self._networking_api = self._device.get_uecmd("Networking")

        # Create cellular network simulator and retrieve 3G data API
        self._ns = self._em.get_cellular_network_simulator(self._bench_name)

        # Get server parameters
        self._server = \
            global_config.benchConfig.get_parameters("LAB_SERVER")
        self._server_ip_address = self._server.get_param_value("IP")

        # Set the default duration of waiting after changing pdp context
        self._sleep_duration = 2

        # Set the default duration of ping checking
        self._ping_check_duration = 10
예제 #9
0
    def set_up(self):
        """
        Set up the test configuration
        """

        # Call use case base Setup function
        UseCaseBase.set_up(self)

        # Ensure flight mode off so that GSM sim operator info can be retrieved
        self._networking_api.set_flight_mode("off")
        time.sleep(self._wait_btwn_cmd)

        # Determinates the kind of registration state to wait
        # by comparing test case MCC/MNC parameters to sim MCC/MNC
        sim_info = self._modem_api.get_sim_operator_info()
        if sim_info["MCC"] != self._mcc or\
                sim_info["MNC"] != self._mnc:
            self._wanted_reg_state = "roaming"
            self._networking_api.set_roaming_mode("ON")
        else:
            self._wanted_reg_state = "registered"

        # Clear all data connections
        self._networking_api.clean_all_data_connections()
        time.sleep(self._wait_btwn_cmd)

        # Enable flight mode
        self._networking_api.set_flight_mode("on")

        hpmln_message = "Expected network registration state to be %s while " \
                        % self._wanted_reg_state

        self._logger.info(hpmln_message)

        # Connect to equipment
        self._ns.init()

        # Set the equipment Application Format = "WCDMA"
        self._ns.switch_app_format("WCDMA")

        # Perform full preset
        self._ns.perform_full_preset()

        # Deactivate HSUPA and HSDPA capabilities
        self._ns_data_3g.set_edch_cell_capability("OFF")
        self._ns_data_3g.set_hsdpa_cell_capability("OFF")

        # Set cell off
        self._ns_cell_3g.set_cell_off()

        # Set Mobile Country Code (MCC)
        self._ns_cell_3g.set_mcc(self._mcc)
        # Set Mobile Network Code (MNC)
        self._ns_cell_3g.set_mnc(self._mnc)

        hpmln_message = "Expected network registration state to be %s while " \
            "HPMLN coverage is %s, MCCODE is %s and MNCODE is %s" % (
                str(self._wanted_reg_state),
                str(self._hplmn_coverage),
                str(self._mcc),
                str(self._mnc))

        self._logger.info(hpmln_message)

        # 3G default cell setup
        RegUtil.setup_cell(self._ns_number, self._ns_model, "3G",
                           self._band_name, self._ns_cell_rel, self._logger)

        # Set cell power using CELL_POWER value
        self._ns_cell_3g.set_cell_power(self._cell_power)

        # Set cell on
        self._ns_cell_3g.set_cell_on()

        # Disable airplane mode
        self._networking_api.set_flight_mode("off")

        # Check registration status before time out using
        # registrationTimeout value from Device_Catalog.xml
        time.sleep(self._wait_btwn_cmd)
        dut_imsi = self._modem_api.get_imsi(self._registration_timeout)

        RegUtil.check_dut_registration_before_timeout(
            self._ns_cell_3g, self._networking_api, self._logger, dut_imsi,
            self._registration_timeout)

        # Check registration state is connected using
        # registrationTimeout from Device_Catalog.xml (Non blocking
        # for this test if function isn't implemented on CDK)
        time.sleep(self._wait_btwn_cmd)
        self._modem_api.check_cdk_state_bfor_timeout(
            self._wanted_reg_state, self._registration_timeout)

        # Set the APN
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn) + "...")
        self._networking_api.set_apn(self._ssid, self._apn)

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

        time.sleep(self._wait_btwn_cmd)
        # 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)

        return Global.SUCCESS, "No errors"
    def set_up(self):
        # Call UseCaseBase set_up function.
        UseCaseBase.set_up(self)

        # Disable data and PDP context
        self._networking_api.deactivate_pdp_context()

        # Enable flight mode
        self._networking_api.set_flight_mode("on")

        # Set the Network Simulators APIs instances
        self._set_ns_apis_instances()

        # Perform full preset
        self._ns.perform_full_preset()

        # Set cell off
        self._ns_cell.set_cell_off()

        # Set IP addresses
        self._ns.set_ip_addresses(self._ns_ip_lan1, self._ns_ip_lan2,
                                  self._ns_ip_subnet_mask,
                                  self._ns_ip_default_gateway, self._ns_ip_dut,
                                  self._ns_ip_dns1, self._ns_ip_dns2)

        # Call specific configuration functions
        # Some parameters are defined by function
        RegUtil.setup_cell(self._ns_number, self._ns_model,
                           self._ns_cell_generation, self._ns_cell_band,
                           self._ns_cell_rel, self._logger)

        # Set Cell Band and ARFCN using 3GSM_CELL_BAND
        # and 3GSM_ARFCN parameters
        # Set cell service using 3GSM_CELL_SERVICE parameter
        # Set Cell Power using 3GSM_CELL_POWER parameter
        # Set Cell LAC using 3GSM_LAC_VALUE parameter
        # Set Cell RAC using 3GSM_RAC_VALUE parameter
        self._ns_cell.configure_basic_cell_parameters(self._ns_cell_service,
                                                      self._ns_cell_band,
                                                      self._ns_arfcn,
                                                      self._ns_cell_power)

        # Set CPC Feature
        if self._cpc_tti_value is not None:
            self._em.configure_equipments("CPCFeature%d" % self._ns_number,
                                          {"type": self._cpc_tti_value})
            self._logger.info(
                "CPC Feature has been set on the equipment with TII equal to %s ms."
                % self._cpc_tti_value)

        if self._ns_cell_tech == "HSPA":
            hsdpa_cat = str(self._dut_config.get("maxDlHspaRab"))[9:]
            self._em.configure_equipments(
                "HSDPACategories%d" % self._ns_number, {"category": hsdpa_cat})
            hsupa_cat = str(self._dut_config.get("maxUlHspaRab"))[9:]
            self._em.configure_equipments(
                "HSDPACategories%d" % self._ns_number, {"category": hsupa_cat})

        # Set cell on
        self._ns_cell.set_cell_on()

        # Disable flight mode
        self._networking_api.set_flight_mode("off")

        # Set the APN in the DUT
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn_name) + "...")
        self._networking_api.set_apn(self._apn_ssid, self._apn_name)

        # Activate PDP context
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Active PDP Context...")
        self._networking_api.activate_pdp_context(self._apn_ssid, check=False)

        # Get RAT from Equipment
        network_type = self._ns_data.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)
        # Force screen on to avoid end of PDP context due to fast dormancy
        self._phonesystem_api.wake_screen()
        self._phonesystem_api.set_phone_screen_lock_on(1)
        if self._ns_data.get_data_connection_status() != "PDP_ACTIVE":
            self._ns_data.check_data_connection_state(
                "PDP_ACTIVE", self._registration_timeout, blocking=False)

        self._logger.info("Start continuous ping to " +
                          self._server_ip_address)
        self._networking_api.start_continuous_ping(self._server_ip_address)

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

        # Call UseCaseBase run_test function.
        UseCaseBase.run_test(self)

        self._logger.info("Check that the ping session still success")
        (ping_success, average_rtt) = \
            self._networking_api.check_continuous_ping_success(self._ping_check_duration)
        if not ping_success:
            return Global.FAILURE, "Ping failed when it should not"
        else:
            self._logger.info(
                "Ping succeeded during %.0fs with average rtt of %.3f ms" %
                (self._ping_check_duration, average_rtt))

        # De-activate pdp context
        self._networking_api.deactivate_pdp_context(self._apn_ssid)
        time.sleep(self._sleep_duration)

        self._logger.info("Check that the ping session fails")
        (ping_result, rtt) = self._networking_api.get_current_continuous_ping()
        if ping_result:
            return Global.FAILURE, "Ping succeeded when it should not"
        else:
            self._logger.info("Ping failed")

        # Check pdp is attached
        self._ns_data.check_data_connection_state("ATTACHED")

        self._logger.info("Check that the ping session still fails")
        ping_failed = self._networking_api.check_continuous_ping_failure(
            self._ping_check_duration)
        if not ping_failed:
            return Global.FAILURE, "Ping succeed when it should npt"
        else:
            self._logger.info("Ping failed during %.0fs" %
                              self._ping_check_duration)

        # Re-activate pdp context
        self._networking_api.activate_pdp_context(self._apn_ssid)
        time.sleep(self._sleep_duration)

        self._logger.info("Check that the ping session success")
        (ping_result, rtt) = self._networking_api.get_current_continuous_ping()
        if not ping_result:
            return Global.FAILURE, "Ping failed when it should npt"
        else:
            self._logger.info("Ping succeeded")

        # Check pdp is transfering
        self._ns_data.check_data_connection_state(self._active_state)

        self._logger.info("Check that the ping session still success")
        (ping_success, average_rtt) = \
            self._networking_api.check_continuous_ping_success(self._ping_check_duration)
        if not ping_success:
            return Global.FAILURE, "Ping succeeded when it should not"
        else:
            self._logger.info(
                "Ping succeeded during %.0fs with average rtt of %.3f ms" %
                (self._ping_check_duration, average_rtt))

        return Global.SUCCESS, "No errors"
예제 #12
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call LiveBTBase init function
        UseCaseBase.__init__(self, tc_name, global_config)

        # Get UECmdLayer
        self._bt_api = self._device.get_uecmd("LocalConnectivity")
        self._networking_api = self._device.get_uecmd("Networking")

        # Get TestCase parameters
        self._wifi_init_mode = self._tc_parameters.get_param_value("WIFI_INIT_MODE")
        self._bt_init_mode = self._tc_parameters.get_param_value("BT_INIT_MODE")
        self._nfc_init_mode = self._tc_parameters.get_param_value("NFC_INIT_MODE")
        self._nfc_beam_init_mode = self._tc_parameters.get_param_value("NFC_BEAM_INIT_MODE")
        self._hotspot_wifi_init_mode = self._tc_parameters.get_param_value("HOTSPOT_WIFI_INIT_MODE")
        self._hotspot_bt_init_mode = self._tc_parameters.get_param_value("HOTSPOT_BT_INIT_MODE")

        #  Format TC parameter in order to have defined boolean or None values
        self._wifi_init_mode = str_to_bool_ex(self._wifi_init_mode)
        self._bt_init_mode = str_to_bool_ex(self._bt_init_mode)
        self._nfc_init_mode = str_to_bool_ex(self._nfc_init_mode)
        self._nfc_beam_init_mode = str_to_bool_ex(self._nfc_beam_init_mode)
        self._hotspot_wifi_init_mode = str_to_bool_ex(self._hotspot_wifi_init_mode)
        self._hotspot_bt_init_mode = str_to_bool_ex(self._hotspot_bt_init_mode)

        # Database of all functions to control and check features states
        self._DB = [{self._FEATURE_NAME: "WIFI",
                     self._INIT_VALUE: self._wifi_init_mode,
                     self._SET_ON: self._networking_api.set_wifi_power,
                     self._SET_ON_PARAM: ['1'],
                     self._SET_OFF: self._networking_api.set_wifi_power,
                     self._SET_OFF_PARAM: ['0'],
                     self._GET_STATE: self._networking_api.get_wifi_power_status,
                     self._EXPECTED_ON: 1,
                     self._EXPECTED_OFF: 0},
                    {self._FEATURE_NAME: "BT",
                     self._INIT_VALUE: self._bt_init_mode,
                     self._SET_ON: self._bt_api.set_bt_power,
                     self._SET_ON_PARAM: ['1'],
                     self._SET_OFF: self._bt_api.set_bt_power,
                     self._SET_OFF_PARAM: ['0'],
                     self._GET_STATE: self._bt_api.get_bt_power_status,
                     self._EXPECTED_ON: str(BT_STATE.STATE_ON),  # pylint: disable=E1101
                     self._EXPECTED_OFF: str(BT_STATE.STATE_OFF)},  # pylint: disable=E1101
                    {self._FEATURE_NAME: "NFC",
                     self._INIT_VALUE: self._nfc_init_mode,
                     self._SET_ON: self._bt_api.nfc_enable,
                     self._SET_ON_PARAM: [],
                     self._SET_OFF: self._bt_api.nfc_disable,
                     self._SET_OFF_PARAM: [],
                     self._GET_STATE: self._bt_api.get_nfc_status,
                     self._EXPECTED_ON: "ON",
                     self._EXPECTED_OFF: "OFF"},
                    {self._FEATURE_NAME: "NFC_BEAM",
                     self._INIT_VALUE: self._nfc_beam_init_mode,
                     self._SET_ON: self._bt_api.enable_nfc_beam,
                     self._SET_ON_PARAM: [],
                     self._SET_OFF: self._bt_api.disable_nfc_beam,
                     self._SET_OFF_PARAM: [],
                     self._GET_STATE: self._bt_api.get_nfc_beam_status,
                     self._EXPECTED_ON: True,
                     self._EXPECTED_OFF: False},
                    {self._FEATURE_NAME: "HOTSPOT_WIFI",
                     self._INIT_VALUE: self._hotspot_wifi_init_mode,
                     self._SET_ON: self._networking_api.set_wifi_hotspot,
                     self._SET_ON_PARAM: ["on", self._WIFI_TETHERING_SSID,
                                          self._WIFI_TETHERING_SECURITY,
                                          self._WIFI_TETHERING_PASSPHRASE],
                     self._SET_OFF: self._networking_api.set_wifi_hotspot,
                     self._SET_OFF_PARAM: ['off'],
                     self._GET_STATE: self._networking_api.get_wifi_hotspot_status,
                     self._EXPECTED_ON: 1,
                     self._EXPECTED_OFF: 0},
                    {self._FEATURE_NAME: "HOTSPOT_BT",
                     self._INIT_VALUE: self._hotspot_bt_init_mode,
                     self._SET_ON: self._bt_api.set_bt_tethering_power,
                     self._SET_ON_PARAM: ['1'],
                     self._SET_OFF: self._bt_api.set_bt_tethering_power,
                     self._SET_OFF_PARAM: ['0'],
                     self._GET_STATE: self._bt_api.get_bt_tethering_power,
                     self._EXPECTED_ON: True,
                     self._EXPECTED_OFF: False}
                    ]

        self._apm_cycle_effect_config = dict()
        self._features_on = list()

        # Instantiate the Secondary Report object
        self._secondary_report = SecondaryTestReport(self._device.get_report_tree().get_report_path())

        self._initial_flight_mode_state = 0
예제 #13
0
    def run_test(self):
        """
        Executes the test
        """
        UseCaseBase.run_test(self)

        # Perform a first Voice Call to check that
        # the operation succeeds in nominal conditions
        self.__perform_voice_call()

        # Enable flight mode and wait
        # for the phone to settle down
        self._logger.info("Enabling Flight Mode.")  # pylint: disable-msg=E1101
        self._networking_api.set_flight_mode("on")
        time.sleep(self._settledown_duration)

        # Perform a new Voice Call which is expected to fail
        try:
            self.__perform_voice_call()
        except AcsBaseException as the_exception:
            # Handle expected failure
            self.__check_failure(the_exception, DeviceException,
                                 DeviceException.TIMEOUT_REACHED)
        except:
            # Handle non-exception failures
            exception_message = "Unexpected error: %s" % (str(
                sys.exc_info()[0]))
            raise DeviceException(DeviceException.INTERNAL_EXEC_ERROR,
                                  exception_message)

        # Remove annoying possible popups
        self.__remove_popups()

        # Perform a SMS send which is also expected to fail
        try:
            self.__send_sms()
        except BaseException as the_exception:
            # We may have to go back on the home screen
            # to remove pop up message
            # We give the UE Command 5 seconds to do its job.
            self._device.run_cmd(
                "adb shell input keyevent %s" %
                LiveSmsVcFlightMode.KEYCODE_HOME, 5)
            # Handle expected failure
            self.__check_failure(the_exception, DeviceException,
                                 DeviceException.PHONE_OUTPUT_ERROR)
        except:
            # Handle non-exception failures
            exception_message = "Unexpected error: %s" % \
                (str(sys.exc_info()[0]))
            raise DeviceException(DeviceException.INTERNAL_EXEC_ERROR,
                                  exception_message)

        # Remove annoying possible popups
        self.__remove_popups()

        # Disable flight mode and wait
        # for the phone to settle down
        self._logger.info(
            "Disabling Flight Mode.")  # pylint: disable-msg=E1101
        self._networking_api.set_flight_mode("off")
        time.sleep(self._settledown_duration)

        # Remove annoying possible popups
        self.__remove_popups()

        # We wait a little longer for the DUT to camp
        time.sleep(self._settledown_duration)

        # Perform another Voice Call to check that
        # the Flight Mode has actually been disabled
        self.__perform_voice_call()

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

        # Run UC base run_test
        UseCaseBase.run_test(self)

        # Open the configuration file in read-only mode
        config_file = open(self._nvm_config_file_path, 'r')

        # Initialize global verdict and return message
        return_code = None
        return_message = None

        # Read NVM configuration file line by line
        for line in config_file:
            # Check whether this line shall be tested or not
            if line.startswith(self._prefixes) and line.find("=") != -1:
                self._logger.debug("Checking line: %s." % line)
                # Retrieve both the property and its value
                (config_element, element_value) = line.split("=")
                # Store the expected result for later use
                element_value = element_value.translate(None, "\r\n")
                # Build the corresponding AT command to send to the modem
                at_command = "at@%s?" % config_element
                self._logger.debug("Preparing AT command: %s" % at_command)
                self._logger.debug("Value to check: '%s'" % element_value)

                # Issue an AT command to the modem
                self._at_proxy_serial.write("%s\r\n" % at_command)

                # Initialize loop interation values
                answer_complete = False
                answer_line = None
                full_answer = ""
                # Read maximum tries
                maximum_tries = 10
                # Read current try
                current_try = 0

                while not answer_complete and current_try <= maximum_tries:
                    # Update current try
                    current_try += 1
                    # Read a line
                    answer_line = self._at_proxy_serial.readline()
                    # Remove unwanted characters
                    answer_line = answer_line.translate(None, "\r\n")
                    # Ignore the line if empty or None
                    if answer_line is None or answer_line == "":
                        continue
                    else:
                        if answer_line in ("ERROR", "OK"):
                            answer_complete = True
                        else:
                            self._logger.debug("Got modem response: '%s'" %
                                               answer_line)
                            full_answer += answer_line

                # Compare with the expected result
                if element_value not in full_answer:
                    # If the values do not match
                    message = "Modem value for '%s' is: '%s' (expected '%s')" % \
                        (config_element, str(full_answer), element_value)
                    # Log an error
                    self._logger.error(message)
                    # Update the global verdict if required
                    return_code = Global.FAILURE

            else:
                self._logger.debug("Ignoring line: %s" % line)

        # Update the verdict if no error occured
        if return_code is None:
            return_code = Global.SUCCESS
            return_message = "No error."
        else:
            # If return code is not None
            # then it means that an error occured.
            # We will return the last error message
            return_message = "Last error was: %s" % message

        # In any case close the file opened in read-only mode
        config_file.close()

        # Return the verdict of the flash
        return return_code, return_message
예제 #15
0
    def __init__(self, tc_name, global_config):

        # Call UseCaseBase init function.
        UseCaseBase.__init__(self, tc_name, global_config)

        # init following variable with it's default value:
        self._wanted_reg_state = "registered"

        # Read the configuration from test case
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

        # Read MMS APN parameters from BenchConfig.xml to use NowSMS Server
        self._mms_apn = \
            global_config.benchConfig.get_parameters("NOWSMS_SERVER")
        self._apn_ssid = self._mms_apn.get_param_value("SSID")
        self._apn_name = self._mms_apn.get_param_value("APN")
        self._apn_user = self._mms_apn.get_param_value("username")
        self._apn_password = self._mms_apn.get_param_value("password")
        self._apn_ip_address = self._mms_apn.get_param_value("IP")
        self._apn_port = self._mms_apn.get_param_value("APN_PORT")
        self._destination_number = self._mms_apn.get_param_value(
            "MMS_DESTINATION_NUMBER", "")

        # Compose the mmsc value using Now Sms Server URL, APN_PORT, APN_USER, APN_PASSWORD
        self._apn_mmsc = self._apn_ip_address + ":" + self._apn_port + "/" + self._apn_user + "=" + self._apn_password

        # Set apn type to "default,mms" according to UC definition (test of MO / MT MMS)
        self._apn_type = "default,mms"

        # Get NowSMS Server port
        self._nowsms_port = self._mms_apn.get_param_value("PORT")
        # Compose the complete NowSms Server URL with the connection port
        self._nowsms_url = self._apn_ip_address + ":" + self._nowsms_port

        # Get NOWSMS user name
        self._user_name = self._tc_parameters.get_param_value(
            "NOWSMS_USER_NAME")
        # Get NOWSMS user password
        self._user_password = self._tc_parameters.get_param_value(
            "NOWSMS_USER_PASSWORD")

        # Read NS_CELL_TECH from test case xml file
        self._cell_tech = \
            str(self._tc_parameters.get_param_value("CELL_TECH", "3G"))

        # Read CELL_BAND from xml UseCase parameter file
        self._cell_band = self._tc_parameters.get_param_value("CELL_BAND")

        # NS_CELL_REL
        self._ns_cell_rel = 7

        # Read CELL_SERVICE from test case xml file
        self._cell_service = \
            str(self._tc_parameters.get_param_value("CELL_SERVICE"))

        # Read CELL_POWER from xml UseCase parameter file
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))

        # Read the DL_ARFCN value from UseCase xml Parameter
        self._arfcn = \
            int(self._tc_parameters.get_param_value("ARFCN"))

        # Read the CELL_LAC value from UseCase xml Parameter
        self._lac = int(self._tc_parameters.get_param_value("LAC"))
        if self._lac is None:
            self._lac = 10

        # Read the CELL_RAC value from UseCase xml Parameter
        self._rac = int(self._tc_parameters.get_param_value("RAC"))
        if self._rac is None:
            self._rac = 20

        # Read the CELL_MCC value from UseCase xml Parameter
        self._mcc = int(self._tc_parameters.get_param_value("MCC"))
        if self._mcc is None:
            self._mcc = 1

        # Read the CELL_MNC value from UseCase xml Parameter
        self._mnc = int(self._tc_parameters.get_param_value("MNC"))
        if self._mnc is None:
            self._mnc = 1

        # Read optional MOVE_OUT_OF_COVERAGE parameter from UseCase xml Parameter
        self._move_out_of_coverage = self._tc_parameters.get_param_value(
            "MOVE_OUT_OF_COVERAGE", 0, int)
        if self._move_out_of_coverage != 1 and self._move_out_of_coverage != 2:
            self._move_out_of_coverage = 0

        # Read optional OUT_OF_COVERAGE_TIMER parameter from UseCase xml Parameter
        self._out_of_coverage_timer = self._tc_parameters.get_param_value(
            "OUT_OF_COVERAGE_TIMER", 0, int)

        # Retrieve valid bench name for capability
        self._bench_name = get_nw_sim_bench_name(self._cell_tech,
                                                 global_config, self._logger)
        # bench_name should be either NETWORK_SIMULATOR1 or NETWORK_SIMULATOR2
        # In both cases, we need to retrieve the NS number (position in the bench config, either 1 or 2)
        self._ns_number = int(self._bench_name[-1])

        # Read NETWORK_SIMULATOR from BenchConfig.xml
        self._ns_node = \
            global_config.benchConfig.get_parameters(self._bench_name)

        # Create cellular network simulator
        self._em = EM()
        self._ns = self._em.get_cellular_network_simulator(self._bench_name)

        # Retrieve the model of the equipment
        self._ns_model = self._ns_node.get_param_value("Model")

        # Retrieve the model IP addresses
        ns_ips = NetworkSimulatorIP(self._logger)
        ns_ips.setup_config(global_config, self._ns_number)
        (self._ns_ip_lan1, self._ns_ip_lan2, self._ns_dut_ip_address,
         self._ns_dut_ip_address2, self._ns_dns1, self._ns_dns2,
         self._ns_subnet_mask, self._ns_default_gateway) = ns_ips.get_config()

        # Instantiate UECmd API
        self._modem_api = self._device.get_uecmd("Modem")
        self._phonesystem_api = self._device.get_uecmd("PhoneSystem")
        self._networking_api = self._device.get_uecmd("Networking")
        self._mms_messaging = self._device.get_uecmd("MmsMessaging")
예제 #16
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        UseCaseBase.__init__(self, tc_name, global_config)

        self._logger = LOGGER_TEST_SCRIPT
        logcat_cmd_line = self._device.get_config(
            "logcatCmdLine", "adb shell logcat -v threadtime")
        self._logcat_extract = os.path.join(Folders.REPORTS,
                                            "parserlogcat.log")

        self._logcat_analyzer = LogCatReaderThread(
            self._device,
            logger=self._logger,
            enable_writer=False,
            logcat_cmd_line=logcat_cmd_line)
        self._proc_name = "org.khronos.gl_cts"

        #parameter that says how you want to run the tests: dry or full
        #dry: run once, if it fails, log the result, close execution
        #full: if it fails, re-run from the last entry, log the results as you go
        self._run_type = self._tc_parameters.get_param_value("RUN_TYPE")

        #this parameter says if the run is in certification mode or not
        self._cert_mode = self._tc_parameters.get_param_value("CERT_MODE")

        #give the location on the device for the logs
        self._device_logdir = self._tc_parameters.get_param_value(
            "DEVICE_LOGDIR")

        #initializing the secondary test results
        #this is also where the intermediate and so on results must be pulled
        self._report_path = self._device.get_report_tree().get_report_path()
        self.__tc_report = SecondaryTestReport(self._report_path)

        #the sdcard is the default logging directory for the ES APK
        self._default_logging_dir = "/sdcard/"
        self._helper_scripts = 'OTC/TC/ACS/Graphics/Graphics/scripts'
        #this is also where the group and test lists must be pulled
        self._helper_scripts_gfx = PathManager.absjoin(
            KhronosApk.TEST_SUITES_PATH, self._helper_scripts)

        self._activity_name = self._tc_parameters.get_param_value(
            "ACTIVITY_NAME")

        self._group_list_filename = self._tc_parameters.get_param_value(
            "GROUPS_FILENAME")
        if self._tc_parameters.get_param_value("SINGLE_TEST_PARAM"):
            self._single_test_parameter = str(
                self._tc_parameters.get_param_value(
                    "SINGLE_TEST_PARAM")).split(";")
        else:
            self._single_test_parameter = None

        name_list = self.get_name().split("/")
        tcs_name = name_list[len(name_list) - 1]
        self._logs_folder_name = "gles_%s_logs" % tcs_name
        self._pull_logs_path = PathManager.absjoin(self._report_path,
                                                   self._logs_folder_name)

        if self._group_list_filename:
            self._group_list = PathManager.absjoin(self._helper_scripts_gfx,
                                                   self._group_list_filename)
        else:
            self._group_list = self._helper_scripts_gfx
        # self._khronos_object = KhronosApk(self._device, self._device_logdir, self._report_path, self._activity_name)
        self._khronos_object = KhronosApk(self._device, self._device_logdir,
                                          self._pull_logs_path,
                                          self._activity_name)

        self._output_filename_khronos = "%s/khronos_%s.csv" % (
            self._report_path, os.path.basename(self.get_name()))
예제 #17
0
    def set_up(self):
        """
        Set up the test configuration
        """

        # Call use case base Setup function
        UseCaseBase.set_up(self)

        # Ensure flight mode off so that GSM sim operator info can be retrieved
        self._networking_api.set_flight_mode("on")
        time.sleep(self._wait_btwn_cmd)

        # Connect to equipment
        self._ns.init()

        # Set the equipment Application Format = "GSM/GPRS"
        self._ns.switch_app_format("GSM/GPRS")

        # Perform full preset
        self._ns.perform_full_preset()

        # Set cell off
        self._ns_cell_2g.set_cell_off()

        # 2G default cell setup
        RegUtil.setup_cell(self._ns_number, self._ns_model, "2G",
                           self._band_name, self._ns_cell_rel, self._logger)

        # Set serving cell to GSM
        self._ns_cell_2g.set_cell_service("GSM")

        # Set cell power using CELL_POWER value
        self._ns_cell_2g.set_cell_power(self._cell_power)

        # Set cell on
        self._ns_cell_2g.set_cell_on()

        # Ensure flight mode off so that GSM sim operator info can be retrieved
        self._networking_api.set_flight_mode("off")

        # Check registration status before time out using
        # registrationTimeout value from Device_Catalog.xml
        time.sleep(self._wait_btwn_cmd)
        dut_imsi = self._modem_api.get_imsi(self._registration_timeout)

        # Start DUT registration
        RegUtil.check_dut_registration_before_timeout(
            self._ns_cell_2g, self._networking_api, self._logger, dut_imsi,
            self._registration_timeout)

        # Check registration state is connected using
        # registrationTimeout from Device_Catalog.xml (Non blocking
        # for this test if function isn't implemented on CDK)
        time.sleep(self._wait_btwn_cmd)
        self._modem_api.check_cdk_registration_bfor_timeout(
            self._registration_timeout)

        # Set the APN
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn) + "...")
        self._networking_api.set_apn(self._ssid, self._apn)

        # Activate PDP context but without check as in GSM, PDP can not be activated
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Active PDP Context...")
        self._networking_api.activate_pdp_context(self._ssid, check=False)

        # Get RAT from Equipment
        network_type = self._ns_data_2g.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)

        return Global.SUCCESS, "No errors"
예제 #18
0
 def __init__(self, tc_name, global_config):
     self._ftp_path = None
     UseCaseBase.__init__(self, tc_name, global_config)
     AnyUsbTether.__init__(self, tc_name, global_config)
     self._throughput_targets = TelephonyConfigsParser("Throughput_Targets").\
         parse_live_wcdma_targets()
예제 #19
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call UseCase base Init function
        UseCaseBase.__init__(self, tc_name, global_config)

        # Read registrationTimeout from Device_Catalog.xml
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

        # Read CELLULAR_NETWORK parameters from BenchConfig.xml
        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")

        # Retrieve valid bench name for 3G capability
        self._bench_name = get_nw_sim_bench_name("3G", global_config, self._logger)
        # bench_name should be either NETWORK_SIMULATOR1 or NETWORK_SIMULATOR2
        # In both cases, we need to retrieve the NS number (position in the bench config, either 1 or 2)
        self._ns_number = int(self._bench_name[-1])

        # Read NETWORK_SIMULATOR from BenchConfig.xml
        self._ns_node = \
            global_config.benchConfig.get_parameters(self._bench_name)

        # Retrieve the model of the equipment
        self._ns_model = self._ns_node.get_param_value("Model")

        # Read BAND from xml UseCase parameter file
        self._band = self._tc_parameters.get_param_value("CELL_BAND")

        # NS_CELL_REL
        self._ns_cell_rel = 7

        # Read CELL_POWER from xml UseCase parameter file
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))

        # Read DL_UARFCN from xml UseCase parameter file
        self._dl_uarfcn = \
            int(self._tc_parameters.get_param_value("DL_UARFCN"))

        # Read DATA_CODING_SCHEME from xml UseCase parameter file
        self._data_coding_sheme = \
            self._tc_parameters.get_param_value("DATA_CODING_SCHEME")

        # Read SMS_TEXT from xml UseCase parameter file
        self._sms_text = self._tc_parameters.get_param_value("SMS_TEXT")

        # Read SMS_TRANSFER_TIMEOUT from xml UseCase parameter file
        self._sms_transfer_timeout = \
            int(self._tc_parameters.get_param_value("SMS_TRANSFER_TIMEOUT"))

        dcs = DataCodingScheme(self._data_coding_sheme)
        dcs.decode()

        # Get number of bits per character setted in DCS
        self._nb_bits_per_char = dcs.compute_character_size()

        character_set = dcs.get_character_set()
        if character_set == "7BITS":
            self._content_type = "CTEX"
        else:
            self._content_type = "CDAT"

        # Instantiate Messaging UECmd for SMS UseCases
        self._messaging_api = self._device.get_uecmd("SmsMessaging")

        # Instantiate Modem UECmd for checking phone registration
        self._modem_api = self._device.get_uecmd("Modem")

        # Instantiate generic UECmd for camp
        self._networking_api = self._device.get_uecmd("Networking")

        # Create cellular network simulator and retrieve 3G mesaging
        # and 3G data interfaces
        self._ns = self._em.get_cellular_network_simulator(self._bench_name)
        self._ns_cell_3g = self._ns.get_cell_3g()
        self._ns_messaging_3g = self._ns_cell_3g.get_messaging()
        self._ns_data_3g = self._ns_cell_3g.get_data()
예제 #20
0
 def set_up(self):
     (code, message) = UseCaseBase.set_up(self)
     if code == Global.SUCCESS:
         (code, message) = AnyUsbTether.set_up(self)
     return code, message
예제 #21
0
    def run_test(self):
        """
        Executes the test.
        """
        UseCaseBase.run_test(self)

        # Format the command
        # The google test case result is stored inside GTEST_OUTPUT file
        cmd = "adb shell %s --gtest_output=\"xml:%s\"" % (
            self._google_test_command, GTEST_OUTPUT)

        # Run the test
        result, output = self._device.run_cmd(cmd, self._google_test_timeout)

        # In all the cases store in ACS report folder google test command stdout
        # Build a report file path is ACS report folder
        txt_result_file_path = self.__build_report_file_name(
            self._google_test_command, "txt")

        with open(txt_result_file_path, "w") as text_file:
            text_file.write(output)

        if result == Global.SUCCESS:

            # Check adb command output after running google test
            if "Segmentation fault" in output:
                # Handle Segmentation fault error case
                # No xml report file generated => no copy to do in ACS report folder
                # Inform user that test is FAILED with Segmentation fault
                result = Global.FAILURE
                comment = "Segmentation Fault detected during google test command execution: " + \
                    self._google_test_command + " - see log file " + os.path.basename(txt_result_file_path)
            else:
                # Build a report file path is ACS report folder
                xml_result_file_path = self.__build_report_file_name(
                    self._google_test_command, "xml")

                # Pull the google test result xml file on the ACS report folder
                self._device.pull(GTEST_OUTPUT, xml_result_file_path,
                                  ADB_PULL_FILE_TIMEOUT)

                # If we retrieve the google test command xml report file
                if os.path.isfile(xml_result_file_path):

                    # Put all the test case data inside a dictionnary after parsing the google xml report file
                    gtest_report_dict = {}
                    status, msg = self.__google_test_xml_report_as_dict(
                        xml_result_file_path, gtest_report_dict)

                    if status:
                        # Parse result file
                        # Add to secondary reports all sub test cases
                        result, comment = self.__parse_google_test_report_data(
                            gtest_report_dict)
                    else:
                        result = Global.FAILURE
                        comment = msg
                else:
                    result = Global.FAILURE
                    comment = "Cannot retrieve google test xml report file associated to test execution" % self._google_test_command

                if "ERROR:" in output:
                    # Handle possible case where all test case are passed but an error is detected
                    result = Global.FAILURE
                    comment = "ERROR detected during google test command execution: " + \
                        self._google_test_command + " - see log file " + os.path.basename(txt_result_file_path)
        else:
            result = Global.FAILURE
            comment = "ISSUE detected during google test command execution: " + \
                self._google_test_command + " - see log file " + os.path.basename(txt_result_file_path)

        return result, comment
예제 #22
0
 def run_test(self):
     (code, message) = UseCaseBase.run_test(self)
     if code == Global.SUCCESS:
         (code, message) = AnyUsbTether.run_test(self)
     return code, message
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

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

        # Create Audio Analyzer
        self._audio_analyzer = self._em.get_audio_analyzer("AudioAnalyzer")

        # Check if IO card is used
        self._use_io_card = str_to_bool(
            global_config.campaignConfig.get("isIoCardUsed"))

        # Create Whs
        if self._use_io_card:
            self._wired_headset = self._em.get_wired_headset("WiredHeadset")

        # Initialization of the test type
        self._test_type = "audioquality"

        # Initialization of accessories type
        self._acc_type = "None"
        self._previous_acc_type = "None"

        # Initialization of audio_analyzer_result saved
        self._audio_analyzer_result_save = 0
        self._audio_analyzer_result_ul = 0
        self._audio_analyzer_result_dl = 0

        # Initialization of failed transition saved
        self._failed_transition_audio_pb = ""
        self._failed_transition_no_audio = ""

        # Initialization of _dut_bt_address
        self._dut_bt_address = "None"

        # Initialization of test result
        self._result_verdict = Global.SUCCESS

        # Initialization of the verdict comment
        self._verdict_comment = "Audio Quality test fail"

        # Read registrationTimeout from Device_Catalog.xml
        self._registration_timeout = \
            int(self._dut_config.get("registrationTimeout"))

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

        # Read call origin type from test case xml file (str)
        self._call_origin_type = str(
            self._tc_parameters.get_param_value("CALL_ORIGIN_TYPE"))

        # Read accessories list from test case xml file (str)
        self._acc_list = str(self._tc_parameters.get_param_value("ACC_LIST"))
        # Split the accessories list, accessories separated by ','
        self._acc_list = self._acc_list.strip('[] ')
        self._acc_list_split = self._acc_list.split(',')
        self._acc_list_split.reverse()

        # Read accessories active list from test case xml file (str)
        self._acc_active_list = str(
            self._tc_parameters.get_param_value("ACC_ACTIVE_LIST"))
        # Split the accessories active list, accessories separated by ','
        self._acc_active_list = self._acc_active_list.strip('[] ')
        self._acc_active_list_split = self._acc_active_list.split(',')
        self._acc_active_list_split.reverse()

        # Call Stream Volume in percent
        self._call_stream_volume_dut_list = \
            str(self._tc_parameters.get_param_value("CALL_VOLUME_DUT_LIST"))
        # Split the accessories list, accessories separated by ','
        self._call_stream_volume_dut_list = self._call_stream_volume_dut_list.strip(
            '[] ')
        self._call_volume_dut_list_split = self._call_stream_volume_dut_list.split(
            ',')
        self._call_volume_dut_list_split.reverse()

        # Call Stream Volume in percent
        self._call_stream_volume_ref_list = \
            str(self._tc_parameters.get_param_value("CALL_VOLUME_REF_LIST"))
        # Split the accessories list, accessories separated by ','
        self._call_stream_volume_ref_list = self._call_stream_volume_ref_list.strip(
            '[] ')
        self._call_volume_ref_list_split = self._call_stream_volume_ref_list.split(
            ',')
        self._call_volume_ref_list_split.reverse()

        # Read call end type from test case xml file (str)
        self._call_end_type = str(
            self._tc_parameters.get_param_value("CALL_END_TYPE"))

        # Read call type from test case xml file (str)
        self._call_type = str(self._tc_parameters.get_param_value("CALL_TYPE"))

        # Read test call direction type from test case xml file (s tring)
        self._signal_tested_direction = \
            str(self._tc_parameters.get_param_value("SIGNAL_TESTED_DIRECTION"))

        # Read duration type from test case xml file (int)
        if self._tc_parameters.get_param_value("DURATION"):
            self._call_duration = int(
                self._tc_parameters.get_param_value("DURATION"))
        else:
            # Call duration by default
            self._call_duration = 5

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

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

        # Bluetooth present in the list accessories
        if self._acc_list.count("BLUETOOTH") > 0:
            # Get UECmdLayer
            self._bt_api = self._device.get_uecmd("LocalConnectivity")

        # Load instance of the PHONE2
        self._phone2 = DeviceManager().get_device("PHONE2")
        self._system_api2 = None

        self._acc_swap_type = self._tc_parameters.get_param_value(
            "ACC_SWAP_TYPE", 'Default')

        # Copy of accessories list
        self._temp_acc_list_split = None

        # Copy of volume list / active accessory list
        self._temp_call_volume_dut_list_split = None
        self._temp_call_volume_ref_list_split = None
        self._temp_acc_active_list_split = None
예제 #24
0
 def tear_down(self):
     AnyUsbTether.tear_down(self)
     return UseCaseBase.tear_down(self)
예제 #25
0
    def set_up(self):
        """
        Initialize the test
        """
        UseCaseBase.set_up(self)

        # Clear all data connections
        self._networking_api.clean_all_data_connections()
        time.sleep(self._wait_btwn_cmd)

        # Activate the flight mode.
        self._networking_api.set_flight_mode("on")

        # Connect to equipment
        self._ns.init()

        # Set the equipment application format GSM/GPRS
        self._ns.switch_app_format("GSM/GPRS")
        time.sleep(self._wait_btwn_cmd)

        # Perform a full preset
        self._ns.perform_full_preset()

        # Set cell off
        self._ns_cell_2g.set_cell_off()

        # Call specific configuration functions
        # Some parameters are defined by function
        RegUtil.setup_cell(self._ns_number, self._ns_model, self.ns_cell_tech,
                           self._band_name, self._ns_cell_rel, self._logger)

        # Set serving cell to GPRS
        self._ns_cell_2g.set_cell_service("GPRS")

        # Set Frequency points using frequency list
        # Set Amplitude Offset correction using offset list
        # Turning amplitude offset state to ON
        self._ns.configure_amplitude_offset_table()

        # Set the equipment IP Address 1
        self._ns.set_ip4_lan_address(self._ns_IP_Lan1)

        # Set the equipment IP_Lan2 to the equipment
        self._ns.set_ip4_lan_address2(self._ns_IP_Lan2)

        # Set the Equipment Subnet mask
        self._ns.set_ip4_subnet_mask(self._ns_Subnet_Mask)

        # Set the Equipment gateway
        self._ns.set_ip4_default_gateway(self._ns_Default_Gateway)

        # Set the DUT IP address 1
        self._ns_data_2g.set_dut_ip_address(1, self._ns_DUT_IP_Address)
        # Set the DUT IP address 2 if not empty string.
        if self._ns_DUT_IP_Address2 != "":
            self._ns_data_2g.set_dut_ip_address(2, self._ns_DUT_IP_Address2)

        # Set the DUT DNS1
        self._ns_data_2g.set_dut_primary_dns(self._ns_DNS1)

        # Set the DUT DNS2
        self._ns_data_2g.set_dut_secondary_dns(self._ns_DNS2)

        # Set Cell Power using CELL_POWER parameter
        self._ns_cell_2g.set_cell_power(self._cell_power)

        # Set connection type to auto
        self._ns_data_2g.set_connection_type("AUTO")

        # Set the multislot configuration
        self._ns_data_2g.set_multislot_config(self._multislot)

        # Set the Coding Scheme (CS)
        self._ns_data_2g.set_pdtch_coding_scheme(self._dl_coding_scheme,
                                                 self._ul_coding_scheme)

        # Set cell on
        self._ns_cell_2g.set_cell_on()

        # Phone has to see the cell off!
        self._modem_api.check_cdk_no_registration_bfor_timeout(
            self._registration_timeout)

        # Deactivate the flight mode.
        self._networking_api.set_flight_mode("off")

        # Check registration state is connected using
        # registrationTimeout from Device_Catalog.xml (Non blocking
        # for this test if function isn't implemented on CDK)
        self._modem_api.check_cdk_registration_bfor_timeout(
            self._registration_timeout)

        # Set the APN
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn) + "...")
        self._networking_api.set_apn(self._ssid, self._apn)

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

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

        # Get RAT from Equipment
        network_type = self._ns_data_2g.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)

        return Global.SUCCESS, "No errors"
예제 #26
0
 def __init__(self, tc_name, global_config):
     """
     Constructor
     """
     UseCaseBase.__init__(self, tc_name, global_config)
예제 #27
0
    def set_up(self):
        """
        Initialize the test
        """
        # Call inherited set_up method
        UseCaseBase.set_up(self)

        # Check the value for the IMS operation parameter
        if self._ims_reg_operation not in ("REGISTER", "CHECK_ONLY", "SKIP_DEREGISTER"):
            raise AcsConfigException(
                AcsConfigException.INVALID_PARAMETER,
                "Invalid parameter value for '%s' (%s)" % (
                    "IMS_REGISTRATION_OPERATION",
                    str(self._ims_reg_operation)))

        # Perform operation according the the IMS operation parameter
        if self._ims_reg_operation in ("REGISTER", "SKIP_DEREGISTER"):
            # De-register for IMS services
            (verdict, message) = self._perform_ims_deregistration()
            if verdict == Global.FAILURE:
                raise AcsToolException(
                    AcsToolException.OPERATION_FAILED,
                    message)

            # Generate the configuration and flush the parameters
            # to the NVM.
            # We force the 'flush' configurations.
            self._generator = ImsConfigGenerator(
                self._ims_parameter_file,
                None,
                None,
                self._logger)

        # Check the value for the IP_VERSION parameter
        if self._ip_version not in ("IPV4", "IPV6", "IPV4V6"):
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER,
                                     "Invalid parameter value for '%s' (%s)" % ("IP_VERSION", str(self._ip_version)))

        if self._ims_reg_operation in ("REGISTER", "SKIP_DEREGISTER"):
            # Set the APN for IPV6 or IPV4V6
            if self._ip_version in ("IPV6", "IPV4V6"):
                # Modify the default values for APN configuration depending on the IP version
                ipv6_apn_values = self.C4I_DEFAULT_IPV4_APN_CONFIG.copy()
                ipv6_apn_values["apn"] = self.APN_VALUES[self._ip_version]
                ipv6_apn_values["protocol"] = self._ip_version

                # Update the APN configuration
                self._logger.info("Setting the APN configuration for %s protocol."
                                  % self._ip_version)
                self._networking_api.update_apn(ipv6_apn_values)
            # Default case - IPV4
            else:
                self._logger.info("APN configuration is the default one, for %s protocol."
                                  % self._ip_version)

            # Configure value for +XICFG command depending on the IP version
            self.__xicfg_ip_version = str(self.XICFG_IP_VERSION[self._ip_version])

            # Prior to anything let us check we are registered to LTE first
            self._modem_api.check_rat_with_pref_network(
                PreferredNetwork.LTE_ONLY,
                self._registration_timeout)

            # Apply the IMS configuration
            self._generate_configuration()

        # Set up is done correctly
        return (Global.SUCCESS, "No errors")
예제 #28
0
    def set_up(self):
        """
        Setting up the test
        """
        # Call UseCaseBase set_up function.
        UseCaseBase.set_up(self)

        # Ensure flight mode off so that GSM sim operator info can be retrieved
        self._networking_api.set_flight_mode("off")

        time.sleep(self._wait_btwn_cmd)

        # Determinate the kind of registration state to wait
        # by comparing test case MCC/MNC parameters to sim MCC/MNC
        sim_info = self._modem_api.get_sim_operator_info()
        if sim_info["MCC"] != self._mcc or\
                sim_info["MNC"] != self._mnc:
            self._wanted_reg_state = "roaming"
            self._networking_api.set_roaming_mode("ON")
        else:
            self._wanted_reg_state = "registered"

        # Clear all data connections
        self._networking_api.clean_all_data_connections()
        time.sleep(self._wait_btwn_cmd)

        # Enable flight mode
        self._networking_api.set_flight_mode("on")

        # Instantiate Network Simulator APIs and
        # Initialize the Network Simulator
        self.set_ns_apis_instances()

        # Perform full preset
        self._ns.perform_full_preset()

        # Set cell off
        self._ns_cell.set_cell_off()

        # Set the Equipment IP Address 1
        self._ns.set_ip4_lan_address(self._ns_ip_lan1)

        # Set the equipment IP_Lan2 to the equipment
        self._ns.set_ip4_lan_address2(self._ns_ip_lan2)

        # Set the Equipment Subnet mask
        self._ns.set_ip4_subnet_mask(self._ns_subnet_mask)

        # Set the Equipment gateway
        self._ns.set_ip4_default_gateway(self._ns_default_gateway)

        # Set the DUT IP address 1
        self._ns_data.set_dut_ip_address(1, self._ns_dut_ip_address)
        # Set the DUT IP address 2 if not empty str.
        if self._ns_dut_ip_address2 != "":
            self._ns_data.set_dut_ip_address(2, self._ns_dut_ip_address2)

        # Set HTTP Input ON for Nowsms
        # Set HTTP output ON for Nowsms
        self._ns.set_sms_http("ON", "ON")

        # Call specific configuration functions
        RegUtil.setup_cell(self._ns_number, self._ns_model, self._cell_tech,
                           self._cell_band, self._ns_cell_rel, self._logger)

        # Set Cell Band and ARFCN using CELL_BAND
        # and ARFCN parameters
        # Set cell service using CELL_SERVICE parameter
        # Set Cell Power using CELL_POWER parameter
        # Set Cell LAC using LAC parameter
        # Set Cell RAC using RAC parameter
        # Set Cell MCC using MCC parameter
        # Set Cell MNC using MNC parameter
        self._ns_cell.configure_basic_cell_parameters(
            self._cell_service, self._cell_band, self._arfcn, self._cell_power,
            self._lac, self._rac, self._mcc, self._mnc)

        # Set cell on
        self._ns_cell.set_cell_on()

        # Disable flight mode
        self._networking_api.set_flight_mode("off")

        # Set the MMS APN in the DUT
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn_name) + "...")
        self._networking_api.set_apn(self._apn_ssid,
                                     self._apn_name,
                                     self._apn_user,
                                     self._apn_password,
                                     protocol=None,
                                     mmsc=self._apn_mmsc,
                                     apn_type=self._apn_type)

        # Activate PDP context
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Active PDP Context...")
        self._networking_api.activate_pdp_context(self._apn_ssid, check=False)

        # Check DUT is register
        verdict, output = self._check_network_registration()
        if verdict == Global.FAILURE:
            return verdict, output

        # Set display to "on"
        self._phonesystem_api.display_on()

        return Global.SUCCESS, "No error"
예제 #29
0
    def run_test(self):
        UseCaseBase.run_test(self)

        test = self._tc_parameters.get_param_value("test")

        serial = self._device.retrieve_serial_number()

        adb_server_port = self._tc_parameters.get_param_value(
            "adb-server-port", default_value=None)
        adb_local_port = self._tc_parameters.get_param_value(
            "adb-local-port", default_value=None)
        script_args = self._tc_parameters.get_param_value("script-args",
                                                          default_value=None)

        # Set Parameters specific to PHONE1 from benchConfig to script-args
        phone_number, sim_pin, wrong_pin, puk_code, carrier_name, voicemail_number = (
            None, ) * 6

        try:
            phone_number = self._global_conf.deviceConfig['PHONE1'].phoneNumber
        except Exception:
            pass
        if phone_number:
            if not script_args:
                script_args = "number={0}".format(phone_number)
            else:
                script_args += " number={0}".format(phone_number)

        try:
            sim_pin = self._global_conf.deviceConfig['PHONE1'].simPin
        except Exception:
            pass
        if sim_pin:
            if not script_args:
                script_args = "sim_pin={0}".format(sim_pin)
            else:
                script_args += " sim_pin={0}".format(sim_pin)

        try:
            wrong_pin = self._global_conf.deviceConfig['PHONE1'].wrongPin
        except Exception:
            pass
        if wrong_pin:
            if not script_args:
                script_args = "wrong_pin={0}".format(wrong_pin)
            else:
                script_args += " wrong_pin={0}".format(wrong_pin)

        try:
            puk_code = self._global_conf.deviceConfig['PHONE1'].pukCode
        except Exception:
            pass
        if puk_code:
            if not script_args:
                script_args = "puk_code={0}".format(puk_code)
            else:
                script_args += " puk_code={0}".format(puk_code)

        try:
            carrier_name = self._global_conf.deviceConfig['PHONE1'].carrierName
        except Exception:
            pass
        if carrier_name:
            if not script_args:
                script_args = "carrier_name={0}".format(carrier_name)
            else:
                script_args += " carrier_name={0}".format(carrier_name)

        try:
            voicemail_number = self._global_conf.deviceConfig[
                'PHONE1'].voiceMailNumber
        except Exception:
            pass
        if voicemail_number:
            if not script_args:
                script_args = "voicemail_number={0}".format(voicemail_number)
            else:
                script_args += " voicemail_number={0}".format(voicemail_number)

        # ---------------------------------------------------------------------

        serial2 = None
        # save the serialNumber if it is defined
        try:
            serial2 = self._global_conf.deviceConfig['PHONE2'].serialNumber

        except Exception:
            # the parameter is not defined; it will remain set to None
            pass

        if serial2 != None and serial2 != "":
            if script_args == None:
                script_args = "serial2={0}".format(serial2)
            else:
                script_args += " serial2={0}".format(serial2)

        # ---------------------------------------------------------------------

        serial3 = None
        # save the serialNumber if it is defined
        try:
            serial3 = self._global_conf.deviceConfig['PHONE3'].serialNumber

        except Exception:
            # the parameter is not defined; it will remain set to None
            pass

        if serial3 != None and serial3 != "":
            if script_args == None:
                script_args = "serial3={0}".format(serial3)
            else:
                script_args += " serial3={0}".format(serial3)

        # ---------------------------------------------------------------------

        serial4 = None
        # save the serialNumber if it is defined
        try:
            serial4 = self._global_conf.deviceConfig['PHONE4'].serialNumber

        except Exception:
            # the parameter is not defined; it will remain set to None
            pass

        if serial4 != None and serial4 != "":
            if script_args == None:
                script_args = "serial4={0}".format(serial4)
            else:
                script_args += " serial4={0}".format(serial4)

        media_path = self._tc_parameters.get_param_value("media-path",
                                                         default_value=None)
        apks = self._tc_parameters.get_param_value("apks", default_value=None)

        timeout = self._tc_parameters.get_param_value("timeout",
                                                      default_value=1800,
                                                      default_cast_type=int)
        wifi_ap_name = self._device.get_config("WiFi_Support_Ap_Name")

        if wifi_ap_name != None:
            if script_args != None:
                # replace the given ap_name if it exists in script_args
                if "ap_name" in script_args:
                    script_args = re.sub(r"ap_name=[-\w]+",
                                         r"ap_name=" + wifi_ap_name,
                                         script_args)
                else:
                    script_args += " ap_name=" + wifi_ap_name
            #else:
            #script_args = "ap_name=" + wifi_ap_name

        # get the access point from bench config (ip and user name)
        ap_type = None
        ap_ip = None
        ap_username = None
        try:
            self._configurable_ap = self._em.get_computer("AccessPoint")
        except:
            self._logger.warning(
                "Invalid parameter for AccessPoint in Bench Config. "
                "Please update the AP Equipment name with: "
                "name='AccessPoint' and add the type of the AP "
                "'ddwrt_atheros' or 'ddwrt_broadcom'")
        try:
            ap_type = self._global_conf.benchConfig.get_parameters(
                "AccessPoint").get_dict()["type"]["value"]
        except:
            self._logger.warning(
                "'type' parameter missing for 'AccessPoint. Please update the AP Equipment with: "
                "parameter 'type' with 'value' 'ddwrt_atheros' or 'ddwrt_broadcom'"
            )

        try:
            ap_ip = self._global_conf.benchConfig.get_parameters(
                "AccessPoint").get_dict()["IP"]["value"]
            ap_username = self._global_conf.benchConfig.get_parameters(
                "AccessPoint").get_dict()["username"]["value"]
        except:
            self._logger.warning(
                "'IP' or 'username' parameter missing for 'AccessPoint. Please update the AP Equipment with: "
                "parameter 'IP' with '192.168.1.1' or something similar, parameter 'username' with the user name"
            )

        # add ap_type to script_args as ap_module
        if ap_type != None:
            if ap_type == "ddwrt_broadcom":
                ap_type = "ddwrt"
            if script_args != None:
                if "ap_module" in script_args:
                    # replace the value
                    script_args = re.sub(r"ap_module=[-\w]+",
                                         r"ap_module=" + ap_type, script_args)
                else:
                    script_args += " ap_module={0}".format(ap_type)
            else:
                script_args = "ap_module={0}".format(ap_type)

        # add ap_ip to script_args
        if ap_ip != None:
            if script_args != None:
                if "ap_ip" in script_args:
                    # replace the value
                    script_args = re.sub(r"ap_ip=[\d\.]+", r"ap_ip=" + ap_ip,
                                         script_args)
                else:
                    script_args += " ap_ip={0}".format(ap_ip)
            else:
                script_args = "ap_ip={0}".format(ap_ip)

        # add ap_username to script_args
        if ap_username != None:
            if script_args != None:
                if "ap_username" in script_args:
                    # replace the value
                    script_args = re.sub(r"ap_username=[-\w]+",
                                         r"ap_username="******" ap_username={0}".format(ap_username)
            else:
                script_args = "ap_username={0}".format(ap_username)

        # get the Internet Connected AP name & password from bench config

        net_ap_ssid = self._device.get_config("WiFi_Connection_Ap_Name")
        net_ap_password = self._device.get_config("WiFi_Connection_Passwd")
        net_ap_security = self._device.get_config(
            "WiFi_Connection_Security_Mode")
        wv_toolbox = self._device.get_config("WV_Tool_Box")
        wv_keybox = self._device.get_config("WV_Key_Box")
        android_build_top = self._device.get_config("Android_Build_Top")
        boot_img = self._device.get_config("Boot_Img")

        if net_ap_ssid:
            # replace the given ap_name if it exists in script_args
            net_ap_ssid = net_ap_ssid.replace(" ", "___")
            # by default, when the SSID contains white spaces, it is split into composing words,
            # and only the 1st one is passed to script args, which breaks the configuration
            # therefore, we temporarily replace spaces with three underscores
            if script_args:
                if "net_ap_ssid" in script_args:
                    script_args = re.sub(r"net_ap_ssid=[-\w]+",
                                         r"net_ap_ssid={}".format(net_ap_ssid),
                                         script_args)
                else:
                    script_args += " net_ap_ssid=" + net_ap_ssid + "  "
            else:
                script_args = " net_ap_ssid=" + net_ap_ssid + "  "

            if net_ap_password:
                if script_args:
                    if "net_ap_password" in script_args:
                        # replace the given passphrase if it exists in script_args
                        script_args = re.sub(
                            r"net_ap_password=[.^\s]+",
                            r"net_ap_password="******" net_ap_password="******" net_ap_password="******"net_ap_security" in script_args:
                        # replace the given security mode if it exists in script_args
                        script_args = re.sub(
                            r"net_ap_security=[-\w]+",
                            r"net_ap_security=" + net_ap_security, script_args)
                    else:
                        script_args += " net_ap_security=" + net_ap_security + " "
                else:
                    script_args = " net_ap_security=" + net_ap_security + " "

        if wv_toolbox:
            # replace the given wv_toolbox if it exists in script_args
            wv_toolbox = wv_toolbox.replace(" ", "___")
            if script_args:
                if "wv_toolbox" in script_args:
                    script_args = re.sub(r"wv_toolbox=[-\w]+",
                                         r"wv_toolbox={}".format(wv_toolbox),
                                         script_args)
                else:
                    script_args += " wv_toolbox=" + wv_toolbox + "  "
            else:
                script_args = " wv_toolbox=" + wv_toolbox + "  "

            if wv_keybox:
                if script_args:
                    if "wv_keybox" in script_args:
                        # replace the given wv_keybox if it exists in script_args
                        script_args = re.sub(r"wv_keybox=[.^\s]+",
                                             r"wv_keybox=" + wv_keybox,
                                             script_args)
                    else:
                        script_args += " wv_keybox=" + wv_keybox
                else:
                    script_args = " wv_keybox=" + wv_keybox

        if android_build_top:
            # replace the given android_build_top if it exists in script_args
            android_build_top = android_build_top.replace(" ", "___")
            if script_args:
                if "android_build_top" in script_args:
                    script_args = re.sub(
                        r"android_build_top=[-\w]+",
                        r"android_build_top={}".format(android_build_top),
                        script_args)
                else:
                    script_args += " android_build_top=" + android_build_top + "  "
            else:
                script_args = " android_build_top=" + android_build_top + "  "

        if boot_img:
            # replace the given boot_img if it exists in script_args
            boot_img = boot_img.replace(" ", "___")
            if script_args:
                if "boot_img" in script_args:
                    script_args = re.sub(r"boot_img=[-\w]+",
                                         r"boot_img={}".format(boot_img),
                                         script_args)
                else:
                    script_args += " boot_img=" + boot_img + "  "
            else:
                script_args = " boot_img=" + boot_img + "  "

        # check if there is an "Equipment" named "RELAY"
        self._relay = None
        try:
            self._relay = self._global_conf.benchConfig.get_parameters("RELAY")
        except:
            try:
                self._relay = self._global_conf.benchConfig.get_parameters(
                    "IO_CARD")
            except:
                pass

        script_args_to_add = ""
        if self._relay:
            # get all existing attributes of the relay
            relay_attributes = self._relay.get_dict()
            if "Model" in relay_attributes:
                script_args_to_add += "relay_type={} ".format(
                    relay_attributes["Model"]["value"])
            if "ComPort" in relay_attributes:
                script_args_to_add += "relay_port={} ".format(
                    relay_attributes["ComPort"]["value"])
            if "SwitchOnOff" in relay_attributes:
                script_args_to_add += "power_port={} ".format(
                    relay_attributes["SwitchOnOff"]["value"])
            if "VolumeUp" in relay_attributes:
                script_args_to_add += "v_up_port={} ".format(
                    relay_attributes["VolumeUp"]["value"])
            if "VolumeDown" in relay_attributes:
                script_args_to_add += "v_down_port={} ".format(
                    relay_attributes["VolumeDown"]["value"])
            if "USBVCCut" in relay_attributes:
                script_args_to_add += "USB_VC_cut={} ".format(
                    relay_attributes["USBVCCut"]["value"])

            script_args_to_add += "flash_files={}".format(Paths.FLASH_FILES)

            if script_args_to_add != "":
                if not script_args:
                    script_args = ""
                script_args += " " + script_args_to_add

        ui_handlers_group = self._device.get_config("UI_Handlers_Group",
                                                    default_value=None)
        if ui_handlers_group:
            os.environ['TESTLIB_UI_HANDLERS_GROUP'] = ui_handlers_group

        # create process for each test
        output, error = self._run_process(test,
                                          serial,
                                          adb_server_port=adb_server_port,
                                          adb_local_port=adb_local_port,
                                          script_args=script_args,
                                          media_path=media_path,
                                          apks=apks,
                                          timeout=timeout)
        # start the process
        result = self._parse_file_for_resolution(output, error)

        if result != Global.SUCCESS:
            self.upload_testlib_logs()

        return result, str(output) + " " + str(error)
예제 #30
0
    def set_up(self):
        """
        Initialize the test
        """
        UseCaseBase.set_up(self)

        # Clear all data connections
        self._networking_api.clean_all_data_connections()
        time.sleep(self._wait_btwn_cmd)

        # Connect to equipment
        self._ns.init()

        # Set the equipment application format GSM/GPRS
        self._ns.switch_app_format("GSM/GPRS")

        # Perform a full preset
        self._ns.perform_full_preset()

        # Set cell off
        self._ns_cell_2g.set_cell_off()

        # Set serving cell to EGPRS
        self._ns_cell_2g.set_cell_service("EGPRS")

        # Set Frequency points using frequency list
        # Set Amplitude Offset correction using offset list
        # Turning amplitude offset state to ON
        self._ns.configure_amplitude_offset_table()

        # Set the equipment IP address 1
        self._ns.set_ip4_lan_address(self._ns_IP_Lan1)

        # Set the equipment IP_Lan2 to the equipment
        self._ns.set_ip4_lan_address2(self._ns_IP_Lan2)

        # Set the equipment subnet mask
        self._ns.set_ip4_subnet_mask(self._ns_Subnet_Mask)

        # Set the equipment default gateway
        self._ns.set_ip4_default_gateway(self._ns_Default_Gateway)

        # Set the DUT IP address 1
        self._ns_data_2g.set_dut_ip_address(1, self._ns_DUT_IP_Address)

        # Set the DUT DNS1
        self._ns_data_2g.set_dut_primary_dns(self._ns_DNS1)

        # Set the DUT DNS2
        self._ns_data_2g.set_dut_secondary_dns(self._ns_DNS2)

        # Set Cell Power using CELL_POWER parameter
        self._ns_cell_2g.set_cell_power(self._cell_power)

        # Set VOICE_CODER_RATE
        self._ns_voice_call_2g.set_audio_codec(self._voice_coder_rate)

        # Set connection type to auto
        self._ns_data_2g.set_connection_type("AUTO")

        # Set Cell Band  using CELL_BAND parameter
        self._ns_cell_2g.set_band(self._band_name)

        # Set Broadcast Channel Arfcn using BCH_ARFCN parameter
        self._ns_cell_2g.set_bcch_arfcn(self._bch_arfcn)

        # Set PDTCH Arfcn using PDTCH_ARFCN parameter
        self._ns_cell_2g.set_pdtch_arfcn(self._pdtch_arfcn)

        # Set the multislot configuration
        self._ns_data_2g.set_multislot_config(self._multislot)

        # Set the downlink and uplink Modulation Coding Schema
        # (DL_MCS and UL_MCS)
        self._ns_data_2g.set_pdtch_modulation_coding_scheme(
            self._dl_mcs, self._ul_mcs)

        # Set the Puncturing Modulation Coding Schema (PS_MCS)
        self._ns_data_2g.set_pdtch_puncturing_scheme(self._ps_mcs)

        # Set DTM state to ON
        self._ns_cell_2g.set_dtm_state("ON")

        # Set cell on
        self._ns_cell_2g.set_cell_on()

        # Check Data Connection State => ATTACHED before timeout
        RegUtil.check_dut_data_connection_state_before_timeout("ATTACHED",
                                                               self._ns_cell_2g,
                                                               self._networking_api,
                                                               self._logger,
                                                               self._registration_timeout)

        # Check registration state is connected using
        # registrationTimeout from Device_Catalog.xml (Non blocking
        # for this test if function isn't implemented on CDK)
        self._modem_api.check_cdk_registration_bfor_timeout(
            self._registration_timeout)

        # Get RAT from Equipment
        network_type = self._ns_data_2g.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)

        # Set the APN
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn) + "...")
        self._networking_api.set_apn(self._ssid, self._apn)

        # 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_2g.check_data_connection_state("PDP_ACTIVE",
                                                     self._registration_timeout)

        # IF DIRECTION is UL starting upload FTP
        #    Start ftp upload of "put100M" file using  following parameters :
        #        DIRECTION, IP, username, password
        if self._direction == "UL":
            self._ftp_direction = self._uecmd_types.XFER_DIRECTIONS.UL  # pylint: disable=E1101
            self._ftp_filename = self._ulfilename

        # ELIF DIRECTION is DL starting download FTP
        #    Start ftp download of "get500M" file using  following parameters :
        #        DIRECTION, IP, username, password
        elif self._direction == "DL":
            self._ftp_direction = self._uecmd_types.XFER_DIRECTIONS.DL  # pylint: disable=E1101
            self._ftp_filename = self._dlfilename

        # ELSE raise an error
        # Raise an error in case the direction is not known
        else:
            self._logger.error("Unknown ftp direction (%s)" % self._direction)
            raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, "Unknown ftp direction.")

        return Global.SUCCESS, "No errors"