def roaming_between_a_and_b_logic(self, config): """Test roaming between two enterprise APs. Steps: 1. Make bssid_a visible, bssid_b not visible. 2. Connect to ent_roaming_ssid. Expect DUT to connect to bssid_a. 3. Make bssid_a not visible, bssid_b visible. 4. Expect DUT to roam to bssid_b. 5. Make bssid_a visible, bssid_b not visible. 6. Expect DUT to roam back to bssid_a. """ expected_con_to_a = { WifiEnums.SSID_KEY: self.ent_roaming_ssid, WifiEnums.BSSID_KEY: self.bssid_a, } expected_con_to_b = { WifiEnums.SSID_KEY: self.ent_roaming_ssid, WifiEnums.BSSID_KEY: self.bssid_b, } self.set_attns("a_on_b_off") asserts.assert_true( wutils.eap_connect(config, self.dut, validate_con=False), "Failed to connect to %s" % config) wutils.verify_wifi_connection_info(self.dut, expected_con_to_a) self.log.info("Roaming from %s to %s" % (self.bssid_a, self.bssid_b)) self.trigger_roaming_and_validate("b_on_a_off", expected_con_to_b) self.log.info("Roaming from %s to %s" % (self.bssid_b, self.bssid_a)) self.trigger_roaming_and_validate("a_on_b_off", expected_con_to_a) return True
def trigger_pno_and_assert_connect(self, attn_val_name, expected_con): """Sets attenuators to disconnect current connection to trigger PNO. Validate that the DUT connected to the new SSID as expected after PNO. Args: attn_val_name: Name of the attenuation value pair to use. expected_con: The expected info of the network to we expect the DUT to roam to. """ connection_info = self.dut.droid.wifiGetConnectionInfo() self.log.info("Triggering PNO connect from %s to %s", connection_info[WifiEnums.SSID_KEY], expected_con[WifiEnums.SSID_KEY]) self.set_attns(attn_val_name) self.log.info("Wait %ss for PNO to trigger.", self.pno_interval) time.sleep(self.pno_interval) try: self.log.info("Connected to %s network after PNO interval" % self.dut.droid.wifiGetConnectionInfo()) expected_ssid = expected_con[WifiEnums.SSID_KEY] verify_con = {WifiEnums.SSID_KEY: expected_ssid} wutils.verify_wifi_connection_info(self.dut, verify_con) self.log.info("Connected to %s successfully after PNO", expected_ssid) finally: pass
def connect_and_verify_connected_ssid(self, expected_con, is_pno=False): """Start a scan to get the DUT connected to an AP and verify the DUT is connected to the correct SSID. Args: expected_con: The expected info of the network to we expect the DUT to roam to. """ connection_info = self.dut.droid.wifiGetConnectionInfo() self.log.info("Triggering network selection from %s to %s", connection_info[WifiEnums.SSID_KEY], expected_con[WifiEnums.SSID_KEY]) self.attenuators[0].set_atten(0) if is_pno: self.log.info("Wait %ss for PNO to trigger.", self.pno_interval) time.sleep(self.pno_interval) else: # force start a single scan so we don't have to wait for the scheduled scan. wutils.start_wifi_connection_scan_and_return_status(self.dut) self.log.info("Wait 60s for network selection.") time.sleep(60) try: self.log.info("Connected to %s network after network selection" % self.dut.droid.wifiGetConnectionInfo()) expected_ssid = expected_con[WifiEnums.SSID_KEY] verify_con = {WifiEnums.SSID_KEY: expected_ssid} wutils.verify_wifi_connection_info(self.dut, verify_con) self.log.info( "Connected to %s successfully after network selection", expected_ssid) finally: pass
def trigger_roaming_and_validate(self, attn_val_name, expected_con): """Sets attenuators to trigger roaming and validate the DUT connected to the BSSID expected. Args: attn_val_name: Name of the attenuation value pair to use. expected_con: The expected info of the network to we expect the DUT to roam to. """ self.set_attns(attn_val_name) self.log.info("Wait %ss for roaming to finish." % self.roam_interval) time.sleep(self.roam_interval) try: self.dut.droid.wakeLockAcquireBright() self.dut.droid.wakeUpNow() wutils.verify_wifi_connection_info(self.dut, expected_con) expected_bssid = expected_con[WifiEnums.BSSID_KEY] self.log.info("Roamed to %s successfully" % expected_bssid) finally: self.dut.droid.wifiLockRelease() self.dut.droid.goToSleepNow()