Пример #1
0
    def __init__(self, tc_name, global_config):
        LiveCellularBase.__init__(self, tc_name, global_config)

        # Get TC Parameters
        self._port = int(self._tc_parameters.get_param_value("PORT"))
        self._duration = \
            int(self._tc_parameters.get_param_value("DURATION"))
        self._iperf_protocol = \
            str(self._tc_parameters.get_param_value("IPERF_PROTOCOL","TCP"))
        # Read the throughput targets
        self._throughput_targets = TelephonyConfigsParser("Throughput_Targets").\
            parse_live_wcdma_targets()
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """
        # Call LAB_LTE_IPERF Init function
        LabLteIperf.__init__(self, tc_name, global_config)

        # SWAP CARRIER
        self._swap_carrier = \
            self._tc_parameters.get_param_value("SWAP_CARRIER", False, "str_to_bool")

        # Save PCC throughput targets
        self._pcc_throughput_targets, _ = TelephonyConfigsParser("Throughput_Targets").\
            parse_lte_theoretical_targets(self._lte_category, self._bandwidth, self._antennas_number)

        # Save SCC throughput targets
        self._scc_throughput_targets, _ = TelephonyConfigsParser("Throughput_Targets").\
            parse_lte_theoretical_targets(self._lte_category, self._scc_bandwidth, self._antennas_number)

        # Iperf duration
        self._iperf_duration = 120
Пример #3
0
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        UseCaseBase.__init__(self, tc_name, global_config)

        # Read registrationTimeout from DeviceCatalog.xml
        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"))

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

        # 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._ul_mcs = self._tc_parameters.get_param_value("UL_MCS", "MCS9")
        self._dl_mcs = self._tc_parameters.get_param_value("DL_MCS", "MCS9")
        self._ps_mcs = self._tc_parameters.get_param_value("PS_MCS", "PS1")

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

        # 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 interface
        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("EGPRS", self._multislot,
                                               self._dl_mcs, self._ul_mcs)
Пример #4
0
    def _set_lte_throughput_settings(self):
        """
        Compute and sets lte parameters depending of the throughput wanted.
        """
        # Getting the LTE category.
        self._lte_category = \
            str(self._tc_parameters.get_param_value("LTE_CATEGORY", None))
        if self._lte_category in [None, "None"]:
            # Read max lteCategory supported from DeviceCatalog.xml
            self._lte_category = str(
                self._dut_config.get("maxSupportedLteCategory", "3"))

        # Get antennas number and bandwidth for maximum throughput available
        bandwidth, antennas_number = self._get_lte_max_tput_params(
            self._lte_category)

        if self._antennas_number in (None, ""):
            self._antennas_number = antennas_number
        if self._mimo in (None, ""):
            if antennas_number > 1:
                self._mimo = "True"
            else:
                self._mimo = "False"
        if self._bandwidth in (None, ""):
            self._bandwidth = bandwidth

        self._logger.info(
            "Set Throughput target for LTE %s Category: %s, Bandwidth: %s MHz, %s and %s antenna(s)"
            % (self._duplex_type, self._lte_category, self._bandwidth,
               self._direction, self._antennas_number))

        # Get customized failure Targets
        self._failure_targets = \
            str(self._tc_parameters.get_param_value("FAILURE_TARGETS", ""))

        if self._duplex_type == "FDD":
            # Read the throughput targets for FDD mode
            self._throughput_targets, self._lte_parameters = TelephonyConfigsParser("Throughput_Targets").\
                parse_lte_theoretical_targets(self._lte_category, self._bandwidth, self._antennas_number)

            # Set LTE parameters from _Config/Throughput_Targets.xml, only if they aren't define in Test Case...
            if self._dl_nb_rb in (None, ""):
                self._dl_nb_rb = str(self._lte_parameters.dl_nb_rb)
                self._logger.info("Set dl_rb_size to %s" % self._dl_nb_rb)

            if self._ul_nb_rb in (None, ""):
                self._ul_nb_rb = str(self._lte_parameters.ul_nb_rb)
                self._logger.info("Set ul_rb_size to %s" % self._ul_nb_rb)

            if self._dl_i_mcs in (None, ""):
                self._dl_i_mcs = str(self._lte_parameters.dl_i_mcs)
                self._logger.info("Set dl_i_mcs to %s" % self._dl_i_mcs)

            if self._ul_i_mcs in (None, ""):
                self._ul_i_mcs = str(self._lte_parameters.ul_i_mcs)
                self._logger.info("Set ul_i_mcs to %s" % self._ul_i_mcs)

            # Add Secondary Component Carrier throughput if Carrier Aggregation is activated
            if self._carrier_aggregation:
                self._scc_throughput_targets, self._scc_parameters = TelephonyConfigsParser("Throughput_Targets").\
                    parse_lte_theoretical_targets(self._lte_category, self._scc_bandwidth, self._antennas_number)
                self._throughput_targets.add_secondary_carrier_throughput_targets(
                    self._scc_throughput_targets)

                if self._scc_dl_nb_rb in (None, ""):
                    self._scc_dl_nb_rb = str(self._scc_parameters.dl_nb_rb)
                    self._logger.info("Set scc_dl_rb_size to %s" %
                                      self._scc_dl_nb_rb)
                if self._scc_dl_i_mcs in (None, ""):
                    self._scc_dl_i_mcs = str(self._scc_parameters.dl_i_mcs)
                    self._logger.info("Set scc_dl_i_mcs to %s" %
                                      self._scc_dl_i_mcs)

            if self._transmission_mode in (None, ""):
                if self._mimo:
                    self._lte_parameters.transmission_mode = "TM3"
                self._transmission_mode = self._lte_parameters.transmission_mode
                self._logger.info("Set transmission_mode to %s" %
                                  self._transmission_mode)
        elif self._duplex_type == "TDD":
            # Read the throughput targets for TDD mode
            self._throughput_targets, self._lte_tdd_config = TelephonyConfigsParser("Throughput_Targets").\
                parse_lte_tdd_targets(self._lte_category, self._direction)
Пример #5
0
class LabLteBase(UseCaseBase):
    """
    Lab Lte Data Transfer base class.
    """
    def __init__(self, tc_name, global_config):
        """
        Constructor
        """

        UseCaseBase.__init__(self, tc_name, global_config)

        # Boot mode selected is MOS
        self._boot_mode_selected = "MOS"

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

        # Wait 15 seconds before UE detach
        self._wait_before_ue_detach = 15

        # Get FTP server parameters
        self._server = \
            global_config.benchConfig.get_parameters("LAB_LTE_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 the ip_version file name from UseCase xml Parameter
        self._ip_version = self._tc_parameters.get_param_value(
            "IP_VERSION", "IPV4")

        # Get the server ipv6 address from the BenchConfig, if the key
        # is present in the file.
        if self._server.has_parameter("IPV6"):
            self._server_ip_v6_address = self._server.get_param_value("IPV6")

        # Get the apn_ip_version from UseCase xml Parameter
        self._apn_ip_version = self._tc_parameters.get_param_value(
            "APN_IP_VERSION")
        if self._apn_ip_version is None:
            self._apn_ip_version = self._ip_version

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

        # Retrieve valid bench name for 4G capability
        self._bench_name = get_nw_sim_bench_name("4G", 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)
        self._ns_dut_ip_Address = \
            self._ns_node.get_param_value("DUT_IP_Address")
        # It is not mandatory to have a IPV6 address for a LTE test
        if self._ns_node.has_parameter("DUT_IPV6_Address"):
            self._ns_dut_ipv6_Address = \
                self._ns_node.get_param_value("DUT_IPV6_Address")
        else:
            self._ns_dut_ipv6_Address = None

        self._ns_model = self._ns_node.get_param_value("Model")

        # Read the xml Template
        # Read MIMO from test case xml file
        self._mimo_temp = self._tc_parameters.get_param_value("MIMO", '')
        if self._mimo_temp not in (None, ''):
            self._mimo = (str(self._mimo_temp).lower() == "true")
        else:
            self._mimo = self._mimo_temp
        # Read CARRIER_AGGREGATION
        self._carrier_aggregation = self._tc_parameters.get_param_value(
            'CARRIER_AGGREGATION', 'False', 'str_to_bool')
        # Read SIGNAL_MODE from test case xml file
        self._signal_mode = \
            str(self._tc_parameters.get_param_value("SIGNAL_MODE"))

        # Read PHYSICAL_CELL_ID from test case xml file
        self._physical_cell_id = \
            str(self._tc_parameters.get_param_value("PHYSICAL_CELL_ID"))
        # Read CELL_ID from test case xml file
        self._cell_id = \
            str(self._tc_parameters.get_param_value("CELL_ID", "A"))
        # Read CELL_POWER_RFO1 from test case xml file
        self._cell_power_rf1 = \
            str(self._tc_parameters.get_param_value("CELL_POWER_RFO1", "-40"))
        # Read CELL_POWER_RFO2 from test case xml file
        self._cell_power_rf2 = \
            str(self._tc_parameters.get_param_value("CELL_POWER_RFO2"))

        # Read ANTENNAS NUMBER from test case xml file
        self._antennas_number = \
            self._tc_parameters.get_param_value("ANTENNAS_NUMBER", '')
        # Read CH_BANDWIDTH from test case xml file
        self._bandwidth = \
            self._tc_parameters.get_param_value("CELL_CHANNEL_BANDWIDTH", '')
        # Read TRANSMISSION_MODE from test case xml file
        self._transmission_mode = \
            self._tc_parameters.get_param_value("TRANSMISSION_MODE")
        # Read BANDWIDTH from test case xml file
        self._type0_bitmap = \
            str(self._tc_parameters.get_param_value("TYPE0_BITMAP", "63"))
        # Read DL_RB_SIZE from test case xml file
        self._dl_nb_rb = \
            self._tc_parameters.get_param_value("DL_RB_SIZE")
        # Read UL_RB_SIZE from test case xml file
        self._ul_nb_rb = \
            self._tc_parameters.get_param_value("UL_RB_SIZE")
        # Read I_MCS from test case xml file
        self._dl_i_mcs = \
            self._tc_parameters.get_param_value("DL_I_MCS")
        # Read I_MCS from test case xml file
        self._ul_i_mcs = \
            self._tc_parameters.get_param_value("UL_I_MCS")
        # Read UL Grant Mode from test case xml file
        self._ul_grant_mode = \
            self._tc_parameters.get_param_value("UL_GRANT_MODE", "FIXEDMAC")

        # Read Home Public Land Mobile Network (HPLMN) Coverage
        # from test case xml file and accept all the different
        # written for True and False values
        self._hplmn_coverage = \
            self._tc_parameters.get_param_value("HPLMN_COVERAGE")

        # Read Mobile Country Code (MCC) from test case xml file
        self._mcc = \
            int(self._tc_parameters.get_param_value("MCC", 1))

        # Read Mobile Network Code (MNC) from test case xml file
        self._mnc = \
            int(self._tc_parameters.get_param_value("MNC", 1))

        # Read Duplex type (Frequency Division Duplex (FDD) or Time Division Duplex (TDD)) from test case xml file
        self._duplex_type = \
            self._tc_parameters.get_param_value("DUPLEX_TYPE", "FDD")

        if self._duplex_type == "FDD":
            # Read CELL_BAND from test case xml file
            self._cell_band = \
                int(self._tc_parameters.get_param_value("CELL_BAND", 1))
        else:
            # Read CELL_BAND from test case xml file
            self._cell_band = \
                self._tc_parameters.get_param_value("CELL_BAND", None)
            if self._cell_band in [None, "None"]:
                self._cell_band = None
            else:
                self._cell_band = int(self._cell_band)
        # Read DL_EARFCN from test case xml file
        self._dl_earfcn = \
            int(self._tc_parameters.get_param_value("DL_EARFCN", 300))

        if self._carrier_aggregation:
            # Read SCC_BAND from test case xml file
            self._scc_band = int(
                self._tc_parameters.get_param_value("SCC_BAND"))
            # Read SCC_EARFCN from test case xml file
            self._scc_earfcn = int(
                self._tc_parameters.get_param_value("SCC_EARFCN"))
            # Read SCC_BANDWIDTH from test case xml file
            self._scc_bandwidth = self._tc_parameters.get_param_value(
                "SCC_BANDWIDTH")
            # Read SCC_DL_RB_SIZE from test case xml file
            self._scc_dl_nb_rb = \
                self._tc_parameters.get_param_value("SCC_DL_RB_SIZE")
            # Read SCC_I_MCS from test case xml file
            self._scc_dl_i_mcs = \
                self._tc_parameters.get_param_value("SCC_DL_I_MCS")

        # Read SCENARIO_PATH from test case xml file
        self._scenario_path = \
            str(self._tc_parameters.get_param_value("SCENARIO_PATH"))
        # Read IMS from test case xml file to know if IMS service should be enabled or not
        self._ims = \
            str(self._tc_parameters.get_param_value("IMS", "off")).lower()

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

        # Read if we need to switch configuration between TDD/FDD at the end of an iteration
        self._switch_tdd_fdd = self._tc_parameters.get_param_value(
            "SWITCH_TDD_FDD", "False", "str_to_bool")

        # Create cellular network simulator
        self._ns = self._em.get_cellular_network_simulator(self._bench_name)
        self._ns_cell_4g = self._ns.get_cell_4g()
        self._ns_data_4g = self._ns.get_cell_4g().get_data()

        # init wanted registration parameters to a value that
        # will make the uecmd that used it to raise an error
        self._wanted_reg_state = "None"

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

    def set_up(self):
        """
        Initialize the test
        """
        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)

        # Flight mode activation
        self._networking_api.set_flight_mode("on")

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

        # Connect to equipment
        self._ns.init()

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

        # Wait a while for the full preset
        time.sleep(self._wait_btwn_cmd)

        # Set EPC off, not for CMW500 because DAU starting is a long lasting time operation
        if self._ns_model == "AGILENT_E6621A":
            self._ns_data_4g.set_epc_off()

        # Set cell off
        self._ns_cell_4g.set_cell_off()

        self._ns.configure_amplitude_offset_table()

        self._check_ip_version()

        if self._ip_version in ["IPV4V6", "IPV6"]:
            self._ns_dut_ip_Address = self._ns_dut_ipv6_Address

        # Perform setup for a FDD cell
        if self._duplex_type == "FDD":
            # Load Cell Configuration
            self._ns.load_cell_config("COMMON_LTE", self._ns_number)
            self._ns.load_cell_config(self._cell_band, self._ns_number)
            if self._carrier_aggregation:
                self._ns.load_cell_config("CAT6", self._ns_number)
            if self._ims == "on":
                self._ns.load_cell_config("COMMON_IMS", self._ns_number)
                if self._ip_version != "IPV4":
                    self._ns_data_4g.set_ims_ip_version(self._ip_version)

            # Call specific configuration functions
            RegUtil.setup_cell_lte(self._ns, self._mcc, self._mnc,
                                   self._ns_dut_ip_Address, self._signal_mode,
                                   self._cell_id, self._physical_cell_id,
                                   self._mimo, self._cell_power_rf1,
                                   self._cell_power_rf2, self._scenario_path,
                                   self._cell_band, self._dl_earfcn, self._apn)

            # Set EPC on for Agilent PXT or DAU for RCW500
            self._ns_data_4g.set_epc_on()

            if self._ims == "on":
                self._ns_cell_4g.set_ims_on()

            time.sleep(self._wait_btwn_cmd)

            # stop scenario to set cell parameters
            self._ns.stop_scenario()
            # set configuration for LTE
            self._ns_cell_4g.set_lte_configuration(
                self._antennas_number, self._bandwidth,
                self._transmission_mode, self._type0_bitmap,
                self._ul_grant_mode, self._dl_nb_rb, self._dl_i_mcs,
                self._ul_nb_rb, self._ul_i_mcs, self._mimo,
                self._carrier_aggregation)

            # Set configugation on Secondary Component Carrier
            if self._carrier_aggregation:
                self._ns_cell_4g.set_secondary_carrier_configuration(
                    self._scc_band, self._scc_earfcn, self._scc_bandwidth,
                    self._cell_power_rf1, self._scc_dl_nb_rb,
                    self._scc_dl_i_mcs)
            # Start the scenario
            self._ns.start_scenario()
        elif self._duplex_type == "TDD":
            if self._ip_version in ["IPV4V6", "IPV6"]:
                # Setting the IPv6 Prefix and IID on the CallBox
                self._ns_data_4g.set_ip6_network_parameters(
                    self._server_ip_v6_address)
            # Set the DUT IP address
            self._ns_data_4g.set_dut_ip_address(self._ns_dut_ip_Address)
            # Load LTE TDD optimal configuration
            self._ns.load_cell_config("TDD_COMMON", self._ns_number)
            if hasattr(self, "_lte_tdd_config"):
                self._ns.load_cell_config(self._lte_tdd_config,
                                          self._ns_number)
            if self._cell_band is not None and not self._switch_tdd_fdd:
                self._ns_cell_4g.set_cell_band(self._cell_band)
                self._ns_cell_4g.set_downlink_earfcn(self._dl_earfcn)

            # Set MIMO mode
            self._ns_cell_4g.set_lte_tdd_configuration(self._antennas_number,
                                                       self._mimo)
        else:
            return Global.FAILURE, "Wrong duplex type for LTE: %s it must be FDD or TDD" % self._duplex_type

        return Global.SUCCESS, "No errors"

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

    def tear_down(self):
        """
        End and dispose the test
        """

        # Call UseCaseBase Tear down
        UseCaseBase.tear_down(self)

        try:
            # Avoid exception during tear down
            # For instance on windows platforms set_flight_mode
            # use UI code, it can throw an exception if we are on the wrong window
            # Reset roaming flag
            if self._wanted_reg_state == "roaming":
                self._networking_api.set_roaming_mode("OFF")

            # Set Flight Mode On
            self._networking_api.set_flight_mode("on")
        except:
            pass

        # Disable IMS service if it was activated in the set_up
        if self._ims == "on":
            self._ns_cell_4g.set_ims_off()

        # Set cell off
        self._ns_cell_4g.set_cell_off()

        # Disconnect Equipment
        self._ns.release()

        return Global.SUCCESS, "No errors"

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

    def _check_ip_version(self):
        """
        Check ip protocol version for phone and callbox
        """
        # Check the type of IP address assigned by the NW
        self._nw_ip_version = str(self._ns_data_4g.get_ip_address_type())
        # Check if IP version needed is already set
        if self._nw_ip_version == self._ip_version:
            self._logger.info("IP version is already set to: " +
                              self._nw_ip_version)

        else:
            # Set the NW IP version to the version in XML file
            self._nw_ip_version = self._ip_version
            # Check if the version value is valid
            if self._nw_ip_version in ("IPV4", "IPV6", "IPV4V6"):
                # stop scenario in order to change version
                self._ns.stop_scenario()
                # Set the new IP version assigned by the NW
                self._ns_data_4g.set_ip_address_type(self._nw_ip_version)
                # Start scenario
                self._ns.start_scenario()

            else:
                msg = "IP_VERSION possible values are only IPV4, IPV6, or IPV4V6"
                self._logger.error(msg)
                return Global.FAILURE, msg

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

    def _check_data_connection_state(self, state, timeout=None):
        """
        Check Data Connection State

        :type state: str
        :param state: IDLE|CON

        :type timeout: int
        :param timeout: Optional (default is None) timeout in second to reach the state.

        """

        if timeout is None:
            timeout = self._registration_timeout

        if state == "CON":
            self._ns_data_4g.check_data_connection_state("CON",
                                                         timeout,
                                                         blocking=False,
                                                         cell_id=self._cell_id)
        else:  # IDLE case
            if self._ns_model == "RS_CMW500":
                # Check Data Connection State => OFF before timeout
                self._ns_data_4g.check_data_connection_state(
                    "OFF", timeout, blocking=False, cell_id=self._cell_id)
            else:  # case AGILENT_E6621A
                # Check Data Connection State => IDLE before timeout
                self._ns_data_4g.check_data_connection_state(
                    "IDLE", timeout, blocking=False, cell_id=self._cell_id)
        # Increase cell power if needed
        check_and_set_minimal_cell_power(self._ns_cell_4g, self._modem_api,
                                         self._dut_config,
                                         self._cell_power_rf1)

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

    def _set_lte_throughput_settings(self):
        """
        Compute and sets lte parameters depending of the throughput wanted.
        """
        # Getting the LTE category.
        self._lte_category = \
            str(self._tc_parameters.get_param_value("LTE_CATEGORY", None))
        if self._lte_category in [None, "None"]:
            # Read max lteCategory supported from DeviceCatalog.xml
            self._lte_category = str(
                self._dut_config.get("maxSupportedLteCategory", "3"))

        # Get antennas number and bandwidth for maximum throughput available
        bandwidth, antennas_number = self._get_lte_max_tput_params(
            self._lte_category)

        if self._antennas_number in (None, ""):
            self._antennas_number = antennas_number
        if self._mimo in (None, ""):
            if antennas_number > 1:
                self._mimo = "True"
            else:
                self._mimo = "False"
        if self._bandwidth in (None, ""):
            self._bandwidth = bandwidth

        self._logger.info(
            "Set Throughput target for LTE %s Category: %s, Bandwidth: %s MHz, %s and %s antenna(s)"
            % (self._duplex_type, self._lte_category, self._bandwidth,
               self._direction, self._antennas_number))

        # Get customized failure Targets
        self._failure_targets = \
            str(self._tc_parameters.get_param_value("FAILURE_TARGETS", ""))

        if self._duplex_type == "FDD":
            # Read the throughput targets for FDD mode
            self._throughput_targets, self._lte_parameters = TelephonyConfigsParser("Throughput_Targets").\
                parse_lte_theoretical_targets(self._lte_category, self._bandwidth, self._antennas_number)

            # Set LTE parameters from _Config/Throughput_Targets.xml, only if they aren't define in Test Case...
            if self._dl_nb_rb in (None, ""):
                self._dl_nb_rb = str(self._lte_parameters.dl_nb_rb)
                self._logger.info("Set dl_rb_size to %s" % self._dl_nb_rb)

            if self._ul_nb_rb in (None, ""):
                self._ul_nb_rb = str(self._lte_parameters.ul_nb_rb)
                self._logger.info("Set ul_rb_size to %s" % self._ul_nb_rb)

            if self._dl_i_mcs in (None, ""):
                self._dl_i_mcs = str(self._lte_parameters.dl_i_mcs)
                self._logger.info("Set dl_i_mcs to %s" % self._dl_i_mcs)

            if self._ul_i_mcs in (None, ""):
                self._ul_i_mcs = str(self._lte_parameters.ul_i_mcs)
                self._logger.info("Set ul_i_mcs to %s" % self._ul_i_mcs)

            # Add Secondary Component Carrier throughput if Carrier Aggregation is activated
            if self._carrier_aggregation:
                self._scc_throughput_targets, self._scc_parameters = TelephonyConfigsParser("Throughput_Targets").\
                    parse_lte_theoretical_targets(self._lte_category, self._scc_bandwidth, self._antennas_number)
                self._throughput_targets.add_secondary_carrier_throughput_targets(
                    self._scc_throughput_targets)

                if self._scc_dl_nb_rb in (None, ""):
                    self._scc_dl_nb_rb = str(self._scc_parameters.dl_nb_rb)
                    self._logger.info("Set scc_dl_rb_size to %s" %
                                      self._scc_dl_nb_rb)
                if self._scc_dl_i_mcs in (None, ""):
                    self._scc_dl_i_mcs = str(self._scc_parameters.dl_i_mcs)
                    self._logger.info("Set scc_dl_i_mcs to %s" %
                                      self._scc_dl_i_mcs)

            if self._transmission_mode in (None, ""):
                if self._mimo:
                    self._lte_parameters.transmission_mode = "TM3"
                self._transmission_mode = self._lte_parameters.transmission_mode
                self._logger.info("Set transmission_mode to %s" %
                                  self._transmission_mode)
        elif self._duplex_type == "TDD":
            # Read the throughput targets for TDD mode
            self._throughput_targets, self._lte_tdd_config = TelephonyConfigsParser("Throughput_Targets").\
                parse_lte_tdd_targets(self._lte_category, self._direction)

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

    def _get_lte_max_tput_params(self, lte_category):
        """
        Compute and return lte parameters to reach the phone maximum throughput.
        Read max lteCategory supported from DeviceCatalog.xml
        get antennas number and bandwidth for maximum throughput available for this category

        :type lte_category: str
        :param lte_category: the lte category of the test
        :rtype: str
        :return: bw, the maximum bandwidth supported by phone
        :rtype: str
        :return: antennas_number, the maximum number of antenna supported by phone
        """
        antennas_number = "1"
        bw = "10"
        if int(lte_category) > 1:
            antennas_number = "2"
        if int(lte_category) > 2:
            bw = "20"

        return bw, antennas_number

    def _set_apn_for_lte_and_ims(self):
        # Set the APN
        time.sleep(self._wait_btwn_cmd)
        self._logger.info("Setting APN " + str(self._apn) + "...")

        # Check whether an APN is already set on the phone, and that
        # this APN corresponds to the one defined in BenchConfig.xml
        # For IMS, set an additional APN depending on IP version without removing previous one
        if self._ims == "on":
            if self._apn_ip_version == "IPV4":
                self._logger.info("Setting APN for IMS " + str(self._apn) +
                                  " on protocol IPV4 ")
                # APN for AP centric
                self._networking_api.set_apn(self._ssid, self._apn, None, None,
                                             "IP", None, "default,supl,ims")
                # APN for BP centric
                self._networking_api.set_apn("ims", "ims", None, None, "IP",
                                             None, None, False, False)
                # APN for IMS Emergency call
                self._networking_api.set_apn("emi", "emergency", None, None,
                                             "IP", None, "emergency", False,
                                             False)
            else:
                self._logger.info("Setting APN for IMS " + str(self._apn) +
                                  " on protocol " + str(self._apn_ip_version))
                # APN for AP centric
                self._networking_api.set_apn(self._ssid, self._apn, None, None,
                                             self._apn_ip_version, None,
                                             "default,supl,ims")
                # APN for BP centric
                self._networking_api.set_apn("ims", "ims", None, None,
                                             self._apn_ip_version, None, None,
                                             False, False)
                # APN for IMS Emergency call
                self._networking_api.set_apn("emi", "emergency", None, None,
                                             self._apn_ip_version, None,
                                             "emergency", False, False)
        else:
            if self._apn_ip_version == "IPV4":
                self._logger.info("Setting APN " + str(self._apn) +
                                  " on protocol IPV4 ")
                self._networking_api.set_apn(self._ssid, self._apn)
            else:
                self._logger.info("Setting APN " + str(self._apn) +
                                  " on protocol " + str(self._apn_ip_version))
                self._networking_api.set_apn(self._ssid, self._apn, None, None,
                                             self._apn_ip_version)

    def _setup_ftp_for_lte(self):
        """
        Setup FTP for LTE use cases (used in LabLteFtp and LabLteUsbTether classes).

        :rtype: integer
        :return: function execution status

        :rtype: str
        :return: function execution comment
        """
        # configure RRC state after cell attach process (will be used on LabLteBase set_up)
        if "IDLE" in str(self._rrc_state):
            self._ns_cell_4g.keep_rrc_connection(False)
        else:
            self._ns_cell_4g.keep_rrc_connection(True)

        (code, message) = LabLteBase.set_up(self)

        if code == Global.SUCCESS:
            # Set Cell on
            self._ns_cell_4g.set_cell_on(self._mimo)

            # Flight mode deactivation
            self._networking_api.set_flight_mode("off")

            # Check registration state is connected using
            # registrationTimeout from Device_Catalog.xml
            self._logger.info(
                "Check network registration status is %s on DUT" %
                self._wanted_reg_state)

            self._modem_api.check_cdk_state_bfor_timeout(
                self._wanted_reg_state, self._registration_timeout)

            # Set APN for LTE and/or IMS depending on protocol IPv4 or IPv6
            self._set_apn_for_lte_and_ims()

            # Enable Data Usage
            time.sleep(self._wait_btwn_cmd)
            self._networking_api.activate_pdp_context(check=False)

            # Check data connection state is "CON"
            self._check_data_connection_state("CON")

            # Get RAT from Equipment
            network_type = self._ns_data_4g.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)
            # Get on DUT its IP address
            if self._ip_version == "IPV4":
                self._ns_dut_ip_Address = wait_for_dut_ipv4_address(
                    self._registration_timeout, self._networking_api,
                    self._device.get_cellular_network_interface())

            current_rrc_state = self._ns_cell_4g.get_rrc_state()
            if self._rrc_state == "RRC_IDLE":
                self._networking_api.disable_output_traffic()
                # Force detaching on PXT
                if self._ns_model == "AGILENT_E6621A":
                    self._ns_data_4g.ue_detach()
                self._ns_cell_4g.check_rrc_state_before_timeout("IDLE", 60)
                current_rrc_state = self._ns_cell_4g.get_rrc_state()
                self._networking_api.enable_output_traffic()
                # self._data_4g.release_rrc_connection()
                self._logger.info("The FTP will start from %s state" %
                                  current_rrc_state)
            elif self._rrc_state == "RRC_CONNECTED":
                self._logger.info("The FTP will start from %s state" %
                                  current_rrc_state)
            # Start FTP service on equipment side
            self._ns_data_4g.start_ftp_service()

            # Selecting the  IPV6 address of the FTP server, according to
            # the TC parameter value.
            if self._ip_version == "IPV6":
                if self._server_ip_v6_address is not None:
                    # If Protocol is IPV6 use IPV6 address.
                    log_msg = "Using IPV6 address to connect to the FTP server."
                    self._logger.info(log_msg)
                    self._ip_address = self._server_ip_v6_address
                else:
                    # If IPV6 address is not present in the BenchConfig.
                    msg = "The IPV6 parameter is missing from the Bench Config!"
                    raise AcsConfigException(
                        AcsConfigException.INVALID_BENCH_CONFIG, msg)
            else:
                self._ip_address = self._server_ip_address

        return (code, message)
Пример #6
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 maxDlHspaRab from DeviceCatalog.xml
        max_dl_hspa_rab = \
            str(self._dut_config.get("maxDlHspaRab"))

        # Read maxUlHspaRab from DeviceCatalog.xml
        max_ul_hspa_rab = \
            str(self._dut_config.get("maxUlHspaRab"))

        # Get FTP server parameters
        self._server = \
            global_config.benchConfig.get_parameters("LAB_SERVER")
        self._server_ip_address = self._server.get_param_value("IP")
        self._username = self._server.get_param_value("username")
        self._password = self._server.get_param_value("password")
        if self._server.has_parameter("ftp_path"):
            self._ftp_path = self._server.get_param_value("ftp_path")
        else:
            self._ftp_path = ""

        # Initialize the server ipv6 address to None.
        self._server_ip_v6_address = None

        # Get the server ipv6 address from the BenchConfig, if the key
        # is present in the file.
        if self._server.has_parameter("IPV6"):
            self._server_ip_v6_address = self._server.get_param_value("IPV6")

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

        # 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")
        self._ns_IP_Lan1 = self._ns_node.get_param_value("IP_Lan1")
        self._ns_IP_Lan2 = self._ns_node.get_param_value("IP_Lan2")
        self._ns_DUT_IP_Address = \
            self._ns_node.get_param_value("DUT_IP_Address")
        self._ns_DUT_IP_Address2 = \
            self._ns_node.get_param_value("DUT_IP_Address2", "")
        self._ns_DNS1 = self._ns_node.get_param_value("DNS1")
        self._ns_DNS2 = self._ns_node.get_param_value("DNS2")
        self._ns_Subnet_Mask = \
            self._ns_node.get_param_value("Subnet_Mask")
        self._ns_Default_Gateway = \
            self._ns_node.get_param_value("Default_Gateway")
        self._ns_fast_dormancy = \
            self._ns_node.get_param_value("Fast_Dormancy", "disable")

        # Read the xml Template
        self._band = str(self._tc_parameters.get_param_value("CELL_BAND"))
        self._dl_uarfcn = int(self._tc_parameters.get_param_value("DL_UARFCN"))
        # NS_CELL_REL
        self._ns_cell_rel = 7
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))
        self._cell_service = \
            str(self._tc_parameters.get_param_value("CELL_SERVICE"))

        # Read the PDP_ACTIVATION value from UseCase xml Parameter (True or False)
        self._pdp_activation = \
            self._tc_parameters.get_param_value("PDP_ACTIVATION", "TRUE")

        self._cqi_scheme = \
            str(self._tc_parameters.get_param_value("CQI_SCHEME"))
        self._mac_d_pdu_size = \
            str(self._tc_parameters.get_param_value("MAC_D_PDU_SIZE"))

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

        self._kpi_test = self._tc_parameters.get_param_value(
            "KPI_TEST", False, "str_to_bool")

        # Read the UL_RAB value from UseCase xml Parameter
        # Check if this value is set to MAX or not
        ul_rab_config = str(self._tc_parameters.get_param_value("UL_RAB"))

        if ul_rab_config != "" or ul_rab_config != "None":
            if ul_rab_config == "MAX":
                self._ul_rab = max_ul_hspa_rab
            else:
                self._ul_rab = ul_rab_config
        else:
            self._logger.info(
                "Unknown UL RAB Configuration %s has been chosen" %
                ul_rab_config)

        # Read the DL_RAB value from UseCase xml Parameter
        # Check if this value is set to MAX or not
        dl_rab_config = str(self._tc_parameters.get_param_value("DL_RAB"))

        if dl_rab_config != "" or dl_rab_config != "None":
            if dl_rab_config == "MAX":
                self._dl_rab = max_dl_hspa_rab
            else:
                self._dl_rab = dl_rab_config
        else:
            self._logger.info(
                "Unkown UL RAB Configuration %s has been chosen" %
                dl_rab_config)

        # Get the HSDPA category (only if user
        # wants to use HSDPA.
        if self._dl_rab is not None:
            # Retrieve all after "HSDPA_CAT"
            self._hsdpa_cat = self._dl_rab[9:]
        else:
            self._logger.debug("HSDPA Cat parameter not found "
                               "on TC parameters, retrieve from DeviceModel")
            self._hsdpa_cat = \
                int(self._dut_config.get("maxDlHspaRab"))

        self._logger.debug("HSDPA CAT: " + str(self._hsdpa_cat))
        # Get the HSUPA category (only if user
        # wants to use HSUPA.
        if self._ul_rab.find("HSUPA_CAT") != -1:
            # Retrieve all after "HSUPA_CAT"
            self._hsupa_cat = int(self._ul_rab[9:])
            self._logger.debug("HSUPA CAT: " + str(self._hsupa_cat))
        else:
            self._hsupa_cat = None

        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

        # Initialize further parameters
        self._rbt_channel_type = "HSPA"
        self._ps_data_ergch_information_state = None
        self._cqi = None
        self._tti = None
        self._throughput_targets = None
        self._rrc_inactivity_timer = None

        # Get the HSUPA MS reported category (only if user
        # wants to use HSUPA.
        if self._ul_rab.find("HSUPA_CAT") != -1:
            ul_rab = None
        else:
            ul_rab = self._ul_rab

        # Read the throughput targets
        hsupa_cat = self._hsupa_cat
        # If TC use CPC with a TTI of 10ms and UL category is CAT6
        # Max throughput is 2Mbps in this case so get category 5 max throughput
        # CAT5 has a TTI=10ms
        if self._cpc_tti_value is not None:
            if self._cpc_tti_value == 10 and hsupa_cat == 6:
                hsupa_cat = 5
        (self._throughput_targets, self._cqi, self._tti) = \
            TelephonyConfigsParser("Throughput_Targets").\
            parse_hspa_theoretical_targets(self._hsdpa_cat, hsupa_cat, ul_rab)

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

        # Create cellular network simulator and retrieve 3G data API
        self._ns = self._em.get_cellular_network_simulator(self._bench_name)
        self._ns_cell_3g = self._ns.get_cell_3g()
        self._ns_data_3g = self._ns_cell_3g.get_data()
Пример #7
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 maxDlWcdmaRab from DeviceCatalog.xml
        max_dl_wcdma_rab = \
            str(self._dut_config.get("maxDlWcdmaRab"))

        # Read maxUlWcdmaRab from DeviceCatalog.xml
        max_ul_wcdma_rab = \
            str(self._dut_config.get("maxUlWcdmaRab"))

        # Get FTP server parameters
        self._server = \
            global_config.benchConfig.get_parameters("LAB_SERVER")
        self._server_ip_address = self._server.get_param_value("IP")
        self._username = self._server.get_param_value("username")
        self._password = self._server.get_param_value("password")
        if self._server.has_parameter("ftp_path"):
            self._ftp_path = self._server.get_param_value("ftp_path")
        else:
            self._ftp_path = ""

        # Initialize the server ipv6 address to None.
        self._server_ip_v6_address = None

        # Get the server ipv6 address from the BenchConfig, if the key
        # is present in the file.
        if self._server.has_parameter("IPV6"):
            self._server_ip_v6_address = self._server.get_param_value("IPV6")

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

        # 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")
        self._ns_IP_Lan1 = self._ns_node.get_param_value("IP_Lan1")
        self._ns_IP_Lan2 = self._ns_node.get_param_value("IP_Lan2")
        self._ns_DUT_IP_Address = \
            self._ns_node.get_param_value("DUT_IP_Address")
        self._ns_DUT_IP_Address2 = \
            self._ns_node.get_param_value("DUT_IP_Address2", "")
        self._ns_DNS1 = self._ns_node.get_param_value("DNS1")
        self._ns_DNS2 = self._ns_node.get_param_value("DNS2")
        self._ns_Subnet_Mask = \
            self._ns_node.get_param_value("Subnet_Mask")
        self._ns_Default_Gateway = \
            self._ns_node.get_param_value("Default_Gateway")
        self._ns_fast_dormancy = \
            self._ns_node.get_param_value("Fast_Dormancy", "disable")

        # Read the xml Template
        self._band = self._tc_parameters.get_param_value("CELL_BAND")
        self._dl_uarfcn = int(self._tc_parameters.get_param_value("DL_UARFCN"))
        # NS_CELL_REL
        self._ns_cell_rel = 7
        self._cell_power = \
            int(self._tc_parameters.get_param_value("CELL_POWER"))
        self._cell_service = self._tc_parameters.get_param_value(
            "CELL_SERVICE")

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

        # Read the UL_RAB value from UseCase xml Parameter
        # Check if this value is set to MAX or not
        ul_rab_config = str(self._tc_parameters.get_param_value("UL_RAB"))

        if ul_rab_config != "" or ul_rab_config != "None":
            if ul_rab_config == "MAX":
                self._ul_rab = max_ul_wcdma_rab
            else:
                self._ul_rab = ul_rab_config
        else:
            self._logger.info(
                "Unkown UL RAB Configuration %s has been chosen" %
                ul_rab_config)

        # Read the DL_RAB value from UseCase xml Parameter
        # Check if this value is set to MAX or not
        dl_rab_config = str(self._tc_parameters.get_param_value("DL_RAB"))

        if dl_rab_config != "" or dl_rab_config != "None":
            if dl_rab_config == "MAX":
                self._dl_rab = max_dl_wcdma_rab
            else:
                self._dl_rab = dl_rab_config
        else:
            self._logger.info(
                "Unkown UL RAB Configuration %s has been chosen" %
                dl_rab_config)

        # Read Home Public Land Mobile Network (HPLMN) Coverage
        # from test case xml file and accept all the different
        # written for True and False values
        self._hplmn_coverage = \
            self._tc_parameters.get_param_value("HPLMN_COVERAGE", "True")

        # Read Mobile Country Code (MCC) from test case xml file
        self._mcc = \
            int(self._tc_parameters.get_param_value("MCC", "1"))

        # Read Mobile Network Code (MNC) from test case xml file
        self._mnc = \
            int(self._tc_parameters.get_param_value("MNC", "1"))

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

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

        # Read the throughput targets
        self._throughput_targets = TelephonyConfigsParser("Throughput_Targets").\
            parse_wcdma_theoretical_targets(self._dl_rab, self._ul_rab)

        # init wanted registration parameters
        self._wanted_reg_state = "None"
Пример #8
0
    def run(self, context):
        """
        Runs the test step

        :type context: TestStepContext
        :param context: test case context
        """
        TestStepBase.run(self, context)

        if self._pars.ul_conf.lower() == "none":
            self._pars.ul_conf = None
        if self._pars.dl_conf.lower() == "none":
            self._pars.dl_conf = None
        parser = TelephonyConfigsParser("Throughput_Targets")
        sections = self._pars.section.upper().split(";")
        # there is at least 1 section
        if sections[0] in ("GPRS", "EGPRS"):
            throughput_targets = parser.parse_gprs_egprs_theoretical_targets(
                self._pars.section, self._pars.multislot, self._pars.dl_conf,
                self._pars.ul_conf)
        elif sections[0] == "WCDMA":
            throughput_targets = parser.parse_wcdma_theoretical_targets(
                self._pars.dl_conf, self._pars.ul_conf)
        elif sections[0] in ("HSPA", "HSDPA"):
            # when HSDPA, the uplink need to be given. so expecting 2 sections
            if len(sections) > 1:
                hsupa_cat = None
                ul_rab = None
                if sections[1] == "HSUPA":
                    hsupa_cat = self._pars.ul_conf
                elif sections[1] == "WCDMA":
                    ul_rab = self._pars.ul_conf
                else:
                    raise AcsBaseException(
                        AcsBaseException.INVALID_PARAMETER,
                        "expected HSUPA or WCDMA for uplink throughput targets determination"
                    )
                throughput_targets = parser.parse_hspa_theoretical_targets(
                    self._pars.dl_conf, hsupa_cat, ul_rab)
            else:
                raise AcsBaseException(
                    AcsBaseException.INVALID_PARAMETER,
                    "with %s" % sections[0] +
                    ", a second section name for uplink targets determination is expected"
                    "(HSUPA or WCDMA).")
        elif sections[0] == "TD-SCDMA":
            throughput_targets = parser.parse_tdscdma_theoretical_targets()
        elif sections[0] == "LIVE_WCDMA":
            throughput_targets = parser.parse_live_wcdma_targets()
        elif sections[0] == "LTE":
            if self._pars.dl_conf is not None:
                lte_cat = self._pars.dl_conf
            elif self._pars.ul_conf is not None:
                lte_cat = self._pars.ul_conf
            else:
                raise AcsBaseException(
                    AcsBaseException.INVALID_PARAMETER,
                    "either DL_CONF or UL_CONF should be set.")
            throughput_targets = parser.parse_lte_theoretical_targets(lte_cat)
        elif sections[0] == "LTE_TDD":
            if self._pars.dl_conf is not None:
                lte_cat = self._pars.dl_conf
                direction = "DL"
            elif self._pars.ul_conf is not None:
                lte_cat = self._pars.ul_conf
                direction = "UL"
            else:
                raise AcsBaseException(
                    AcsBaseException.INVALID_PARAMETER,
                    "either DL_CONF or UL_CONF should be set.")
            throughput_targets = parser.parse_lte_tdd_targets(
                lte_cat, direction)
        else:
            raise AcsBaseException(AcsBaseException.INVALID_PARAMETER,
                                   "invalid section name.")

        # Get DUT configuration
        dut_config = DeviceManager().get_device_config("PHONE1")
        # Get customized failure Targets
        failure_targets = \
            str(self._tc_parameters.get_param_value("FAILURE_TARGETS", "FUTE"))
        # Detect if it is a KPI test or not
        kpi_test = self._tc_parameters.get_param_value("KPI_TEST", False,
                                                       "str_to_bool")

        # Update the failure targets
        throughput_targets.set_failure_throughput_from_config(
            dut_config, failure_targets, kpi_test, self._name)

        context.set_info(self._pars.save_throughput_as + ":DL_TARGET",
                         throughput_targets.dl_target.value)
        context.set_info(self._pars.save_throughput_as + ":DL_FAILURE",
                         throughput_targets.dl_failure.value)
        context.set_info(self._pars.save_throughput_as + ":UL_TARGET",
                         throughput_targets.ul_target.value)
        context.set_info(self._pars.save_throughput_as + ":UL_FAILURE",
                         throughput_targets.ul_failure.value)
        context.set_info(self._pars.save_throughput_as + ":DL_UNIT",
                         throughput_targets.dl_target.unit)
        context.set_info(self._pars.save_throughput_as + ":UL_UNIT",
                         throughput_targets.ul_target.unit)
Пример #9
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()