コード例 #1
0
    def test_lte_only_http_dl(self):
        """Test for 1GB file download on WiFi Only

        Steps:
        1. Set WiFi atten to MIN and Cellular to MAX
        2. Start downloading 1GB file from net
        3. Verify is the download is successfull

        Expected Results:
        1. File should download over WiFi

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False
        self._atten_setup_lte_only()
        if (not wait_for_cell_data_connection(self.log, ad, True)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on LTE")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        ad.on_mobile_data = True
        if not active_file_download_test(self.log, ad, "512MB"):
            ad.log.error("HTTP file download failed on LTE")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        return True
コード例 #2
0
def phone_setup_data_for_subscription(log, ad, sub_id, network_generation):
    """Setup Phone <sub_id> Data to <network_generation>

    Args:
        log: log object
        ad: android device object
        sub_id: subscription id
        network_generation: network generation, e.g. GEN_2G, GEN_3G, GEN_4G

    Returns:
        True if success, False if fail.
    """
    toggle_airplane_mode(log, ad, False, strict_checking=False)
    set_wifi_to_default(log, ad)
    if not set_wfc_mode(log, ad, WFC_MODE_DISABLED):
        ad.log.error("Disable WFC failed.")
        return False
    if not ensure_network_generation_for_subscription(
            log,
            ad,
            sub_id,
            network_generation,
            voice_or_data=NETWORK_SERVICE_DATA):
        get_telephony_signal_strength(ad)
        return False
    return True
コード例 #3
0
    def test_wifi_cell_irat_stress_ping(self):
        """Test for data switch between WiFi and Cell. DUT go in and out WiFi
        coverage for multiple times.

        Steps:
        1. Set WiFi and Cellular signal to good (attenuation value to MIN).
        2. Make sure DUT get Cell data coverage (LTE) and WiFi connected.
        3. Set WiFi RSSI to MAX (WiFi attenuator value to MIN).
        4. Verify DUT report WiFi connected and Internet access OK.
        5. Set WiFi RSSI to MIN (WiFi attenuator value to MAX).
        6. Verify DUT report Cellular Data connected and Internet access OK.
        7. Repeat Step 3~6 for stress number.

        Expected Results:
        4. DUT report WiFi connected and Internet access OK.
        6. DUT report Cellular Data connected and Internet access OK.
        7. Stress test should pass.

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False

        total_iteration = self.stress_test_number
        self.log.info("Stress test. Total iteration = %d.", total_iteration)
        current_iteration = 1
        while (current_iteration <= total_iteration):
            self.log.info(">----Current iteration = %d/%d----<",
                          current_iteration, total_iteration)

            self._atten_setup_wifi_cell()
            if (not wait_for_wifi_data_connection(self.log, ad, True)
                    or not verify_internet_connection(self.log, ad)):
                ad.log.error("Data not on WiFi")
                get_telephony_signal_strength(ad)
                get_wifi_signal_strength(ad)
                break

            self._atten_setup_cell_only()
            if (not wait_for_cell_data_connection(self.log, ad, True)
                    or not verify_internet_connection(self.log, ad)):
                ad.log.error("Data not on Cell")
                get_telephony_signal_strength(ad)
                get_wifi_signal_strength(ad)
                break

            self.log.info(">----Iteration : %d/%d succeed.----<",
                          current_iteration, total_iteration)
            current_iteration += 1
        if current_iteration <= total_iteration:
            self.log.info(">----Iteration : %d/%d failed.----<",
                          current_iteration, total_iteration)
            return False
        else:
            return True
    def test_lte_oos_lte_camping(self):
        """Test for Out Of Service Scenarios

        Steps:
        1. Set WiFi and Cell available
        2. Setup Attenuator as No Service Scenario
        3. Verify there is no LTE or WiFi Signal
        4. Wait for 2 mins
        5. Setup Attenuator as Cellular only service
        6. Verify Data Connection

        Expected Results:
        1. Device should camp back on LTE after OOS
        2. Data should be in working state

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False
        self._atten_setup_no_service()
        ad.log.info("Waiting for 1 min")
        time.sleep(60)
        if (wait_for_cell_data_connection(self.log, ad, True) or
                wait_for_wifi_data_connection(self.log, ad, True)):
            ad.log.error("Data is available, Expecting no Cellular/WiFi Signal")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        ad.log.info("Waiting for 2 mins")
        time.sleep(120)
        self._atten_setup_lte_only()
        ad.on_mobile_data = True
        if (not wait_for_cell_data_connection(self.log, ad, True)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on LTE")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        return True
コード例 #5
0
    def _wifi_cell_irat_task(self, ad, irat_wait_time=60):
        """
        Atten only WiFi to MIN and MAX
        WiFi --> Cellular
        """
        self._atten_setup_wifi_cell()
        if (not wait_for_wifi_data_connection(self.log, ad, True,
                                              irat_wait_time)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on WiFi")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False

        ad.log.info("Triggering WiFi to Cellular IRAT")
        self._atten_setup_cell_only()
        if (not wait_for_cell_data_connection(self.log, ad, True,
                                              irat_wait_time)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on Cell")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        return True
コード例 #6
0
    def downlink_calibration(self, rat=None, power_units_conversion_func=None):
        """ Computes downlink path loss and returns the calibration value

        The DUT needs to be attached to the base station before calling this
        method.

        Args:
            rat: desired RAT to calibrate (matching the label reported by
                the phone)
            power_units_conversion_func: a function to convert the units
                reported by the phone to dBm. needs to take two arguments: the
                reported signal level and bts. use None if no conversion is
                needed.
        Returns:
            Dowlink calibration value and measured DL power.
        """

        # Check if this parameter was set. Child classes may need to override
        # this class passing the necessary parameters.
        if not rat:
            raise ValueError(
                "The parameter 'rat' has to indicate the RAT being used as "
                "reported by the phone.")

        # Save initial output level to restore it after calibration
        restoration_config = self.BtsConfig()
        restoration_config.output_power = self.primary_config.output_power

        # Set BTS to a good output level to minimize measurement error
        initial_screen_timeout = self.dut.droid.getScreenTimeout()
        new_config = self.BtsConfig()
        new_config.output_power = self.simulator.MAX_DL_POWER - 5
        self.simulator.configure_bts(new_config)

        # Set phone sleep time out
        self.dut.droid.setScreenTimeout(1800)
        self.dut.droid.goToSleepNow()
        time.sleep(2)

        # Starting IP traffic
        self.start_traffic_for_calibration()

        down_power_measured = []
        for i in range(0, self.NUM_DL_CAL_READS):
            # For some reason, the RSRP gets updated on Screen ON event
            self.dut.droid.wakeUpNow()
            time.sleep(4)
            signal_strength = get_telephony_signal_strength(self.dut)
            down_power_measured.append(signal_strength[rat])
            self.dut.droid.goToSleepNow()
            time.sleep(5)

        # Stop IP traffic
        self.stop_traffic_for_calibration()

        # Reset phone and bts to original settings
        self.dut.droid.goToSleepNow()
        self.dut.droid.setScreenTimeout(initial_screen_timeout)
        self.simulator.configure_bts(restoration_config)
        time.sleep(2)

        # Calculate the mean of the measurements
        reported_asu_power = np.nanmean(down_power_measured)

        # Convert from RSRP to signal power
        if power_units_conversion_func:
            avg_down_power = power_units_conversion_func(
                reported_asu_power, self.primary_config)
        else:
            avg_down_power = reported_asu_power

        # Calculate Path Loss
        dl_target_power = self.simulator.MAX_DL_POWER - 5
        down_call_path_loss = dl_target_power - avg_down_power

        # Validate the result
        if not 0 < down_call_path_loss < 100:
            raise RuntimeError(
                "Downlink calibration failed. The calculated path loss value "
                "was {} dBm.".format(down_call_path_loss))

        self.log.info(
            "Measured downlink path loss: {} dB".format(down_call_path_loss))

        return down_call_path_loss
コード例 #7
0
    def test_modem_power_poor_coverage(self):
        """Connectivity Monitor reports Poor Coverage to User

        Steps:
        1. Set WiFi, Cellular atten to MAX
        2. Wait for X amount of time
        3. Verify if the user gets a notification on UI

        Expected Results:
        1. User gets notification "Cellular battery issue: Poor coverage"

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        # Ensure apk is installed
        monitor_apk = None
        for apk in ("com.google.telephonymonitor",
                    "com.google.android.connectivitymonitor"):
            if ad.is_apk_installed(apk):
                ad.log.info("apk %s is installed", apk)
                monitor_apk = apk
                break
        if not monitor_apk:
            ad.log.info(
                "ConnectivityMonitor|TelephonyMonitor is not installed")
            return False

        # Ensure apk is running
        ad.adb.shell("am start -n com.android.settings/.DevelopmentSettings",
                     ignore_status=True)
        for cmd in ("setprop persist.radio.enable_tel_mon user_enabled",
                    "setprop persist.radio.con_mon_hbeat 15000"):
            ad.log.info(cmd)
            ad.adb.shell(cmd)
        ad.log.info("reboot to bring up %s", monitor_apk)
        reboot_device(ad)
        for i in range(30):
            if ad.is_apk_running(monitor_apk):
                ad.log.info("%s is running after reboot", monitor_apk)
                break
            elif i == 19:
                ad.log.error("%s is not running after reboot", monitor_apk)
                return False
            else:
                ad.log.info(
                    "%s is not running after reboot. Wait and check again",
                    monitor_apk)
                time.sleep(30)

        # Setup all Notify Poor Coverage params
        for cmd in (
                "am broadcast -a "
                "com.google.gservices.intent.action.GSERVICES_OVERRIDE "
                "-e \"ce.cm.bi.c.notify_poor_coverage\" \"true\"",
                "am broadcast -a "
                "com.google.gservices.intent.action.GSERVICES_OVERRIDE "
                "-e \"ce.cm.bi.c.max_time_lowest_signal_strength_level_ms\" \"1\"",
                "am broadcast -a "
                "com.google.gservices.intent.action.GSERVICES_OVERRIDE "
                "-e \"ce.cm.bi.c.max_temperature_c\" \"1\"",
                "dumpsys battery set usb 0"):
            time.sleep(1)
            ad.log.info(cmd)
            ad.adb.shell(cmd)

        # Make Chamber ready for test
        self._atten_setup_no_service()
        ad.log.info("Waiting 1 min for attens to settle")
        time.sleep(60)
        if (wait_for_cell_data_connection(self.log, ad, True)
                or wait_for_wifi_data_connection(self.log, ad, True)):
            ad.log.error(
                "Data is available, Expecting no Cellular/WiFi Signal")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        ad.log.info("Wait time for 2 CM Heart Beats")
        time.sleep(60)
        ad.log.info("dumpsys battery set usb 1")
        ad.adb.shell("dumpsys battery set usb 1")
        if ad.search_logcat(
                "Bugreport notification title Cellular battery drain"):
            ad.log.info("User got Poor coverage notification")
        else:
            ad.log.error("User didn't get Poor coverage notification")
            result = False
        return True