def _check_tethering(self, ad, ad_reference):
     self.log.info("Check tethering")
     if not ad.droid.carrierConfigIsTetheringModeAllowed(
         TETHERING_MODE_WIFI, MAX_WAIT_TIME_TETHERING_ENTITLEMENT_CHECK):
         self.log.error("Tethering Entitlement check failed.")
         return False
     if not wifi_tethering_setup_teardown(self.log, ad, [ad_reference],
         check_interval = 5, check_iteration = 1):
         self.log.error("Tethering Failed.")
         return False
     return True
Пример #2
0
    def test_smoke_data_airplane_mode_network_switch_tethering(self):
        try:
            ads = self.android_devices
            apm_result = False
            nw_switch_result = False
            tethering_result = False

            self.log.info("--------start test_smoke_data_airplane_mode_network"
                          "_switch_tethering--------")
            ensure_phones_default_state(self.log, ads)
            self.log.info("1. Verify toggle airplane mode.")
            apm_result = airplane_mode_test(self.log, ads[0])
            self.log.info("2. Verify LTE-WiFi network switch.")
            nw_switch_result = wifi_cell_switching(self.log, ads[0],
                                                   self.wifi_network_ssid,
                                                   self.wifi_network_pass,
                                                   GEN_4G)
            if ads[0].droid.carrierConfigIsTetheringModeAllowed(
                    TETHERING_MODE_WIFI,
                    MAX_WAIT_TIME_TETHERING_ENTITLEMENT_CHECK):
                self.log.info("3. Verify WiFi Tethering.")
                if ads[0].droid.wifiIsApEnabled():
                    WifiUtils.stop_wifi_tethering(self.log, ads[0])
                tethering_result = wifi_tethering_setup_teardown(
                    self.log,
                    ads[0], [ads[1]],
                    ap_band=WifiUtils.WIFI_CONFIG_APBAND_2G,
                    check_interval=10,
                    check_iteration=4)
                # check_interval=10, check_iteration=4: in this Smoke test,
                # check tethering connection for 4 times, each time delay 10s,
                # to provide a reasonable check_time (10*4=40s) and also reduce test
                # execution time. In regular test, check_iteration is set to 10.
            else:
                self.log.info("3. Skip WiFi Tethering."
                              "Tethering not allowed on SIM.")
                tethering_result = SKIP

            return (apm_result and nw_switch_result and
                    ((tethering_result is True) or (tethering_result == SKIP)))
        finally:
            self.log.info(
                "Summary for test run. Testbed:<{}>. <Data> Airplane Mode: {}, "
                "WiFi-Cell Network Switch: {}, Tethering: {}".format(
                    getattr(self, Config.ikey_testbed_name.value), apm_result,
                    nw_switch_result, tethering_result))
Пример #3
0
 def _check_tethering(self):
     self.log.info("Check tethering")
     for retries in range(3):
         try:
             if not self.dut.droid.carrierConfigIsTetheringModeAllowed(
                     TETHERING_MODE_WIFI,
                     MAX_WAIT_TIME_TETHERING_ENTITLEMENT_CHECK):
                 self.log.error("Tethering Entitlement check failed.")
                 if retries == 2: return False
                 time.sleep(10)
         except Exception as e:
             if retries == 2:
                 self.dut.log.error(e)
                 return False
             time.sleep(10)
     if not wifi_tethering_setup_teardown(self.log,
                                          self.dut, [self.ad_reference],
                                          check_interval=5,
                                          check_iteration=1):
         self.log.error("Tethering check failed.")
         return False
     return True