• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#   Copyright 2021 - The Android Open Source Project
3#
4#   Licensed under the Apache License, Version 2.0 (the "License");
5#   you may not use this file except in compliance with the License.
6#   You may obtain a copy of the License at
7#
8#   http://www.apache.org/licenses/LICENSE-2.0
9#
10#   Unless required by applicable law or agreed to in writing, software
11#   distributed under the License is distributed on an "AS IS" BASIS,
12#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13#   See the License for the specific language governing permissions and
14#   limitations under the License.
15
16from acts.test_decorators import test_tracker_info
17from acts_contrib.test_utils.wifi import wifi_test_utils as wutils
18from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest
19
20
21class WifiRoaming6eTest(WifiBaseTest):
22  """Tests for 6e roaming tests.
23
24  Test Bed Requirement:
25    1 Android devices, 2 Asus AXE11000 Access Point.
26  """
27
28  def setup_class(self):
29    super().setup_class()
30    self.dut = self.android_devices[0]
31    self.ap1 = self.access_points[0]
32    self.ap2 = self.access_points[1]
33    req_params = ["roaming_attn_6g", "bssid_map"]
34    self.unpack_userparams(req_param_names=req_params,)
35
36  def setup_test(self):
37    super().setup_test()
38    self.dut.ed.clear_all_events()
39    self.dut.droid.wakeLockAcquireBright()
40    self.dut.droid.wakeUpNow()
41
42  def teardown_test(self):
43    super().teardown_test()
44    wutils.set_attns(self.attenuators, "default")
45    self.dut.droid.wakeLockRelease()
46    self.dut.droid.goToSleepNow()
47    self.dut.ed.clear_all_events()
48    wutils.reset_wifi(self.dut)
49
50  ### Helper methods ###
51
52  def trigger_roaming_and_validate(self, attn_val, expected_conf):
53    """Trigger roaming and validate the DUT connected to expected BSSID.
54
55    Args:
56      attn_val: Attenuator value.
57      expected_conf: expected wifi network.
58    """
59    expected_con = {
60        "SSID": expected_conf["SSID"],
61        "BSSID": expected_conf["bssid"]
62    }
63    wutils.set_attns_steps(self.attenuators, attn_val, self.roaming_attn_6g)
64    self.log.info("Wait %ss for roaming to finish.")
65    self.dut.droid.wakeLockAcquireBright()
66    self.dut.droid.wakeUpNow()
67    wutils.verify_wifi_connection_info(self.dut, expected_con)
68    expected_bssid = expected_con["BSSID"]
69    self.log.info("Roamed to %s successfully", expected_bssid)
70
71  def roaming_between_ap1_and_ap2(self, ap1_network, ap2_network, a_on_b_off,
72                                  a_off_b_on):
73    """Roaming logic between ap1 and ap2.
74
75    Args:
76      ap1_network: Wifi config for AP1.
77      ap2_network: Wifi config for AP2.
78      a_on_b_off: Attenuator value to roam from b to a.
79      a_off_b_on: Attenautor value to roam from a to b.
80    """
81    ap1 = ap1_network.copy()
82    ap1.pop("bssid")
83    wutils.set_attns_steps(self.attenuators, a_on_b_off, self.roaming_attn_6g)
84    wutils.connect_to_wifi_network(self.dut, ap1)
85    self.log.info("Roaming from %s to %s", ap1_network, ap2_network)
86    self.trigger_roaming_and_validate(a_off_b_on, ap2_network)
87    self.log.info("Roaming from %s to %s", ap2_network, ap1_network)
88    self.trigger_roaming_and_validate(a_on_b_off, ap1_network)
89
90  ### Test cases ###
91
92  @test_tracker_info(uuid="805eed41-b596-4d51-9ae5-3cf784b2969a")
93  def test_roaming_between_6g_to_6g_sae(self):
94    roam_ssid = "test_%s" % "_".join(self.test_name.split("_")[-4:-1])
95    self.ap1.configure_ap({"6g": {"security": "sae", "SSID": roam_ssid}})
96    ap1_network = self.ap1.get_wifi_network("6g")
97    ap1_network["bssid"] = self.bssid_map[0]["6g"]
98    self.ap2.configure_ap({"6g": {"security": "sae", "SSID": roam_ssid}})
99    ap2_network = self.ap2.get_wifi_network("6g")
100    ap2_network["bssid"] = self.bssid_map[1]["6g"]
101    self.roaming_between_ap1_and_ap2(ap2_network, ap1_network,
102                                     "AP1_6G_OFF_AP2_6G_ON",
103                                     "AP1_6G_ON_AP2_6G_OFF")
104
105  @test_tracker_info(uuid="25e8a30e-4bfe-4572-b877-fde48f433668")
106  def test_roaming_between_6g_to_6g_owe(self):
107    roam_ssid = "test_%s" % "_".join(self.test_name.split("_")[-4:-1])
108    self.ap1.configure_ap({"6g": {"security": "owe", "SSID": roam_ssid}})
109    ap1_network = self.ap1.get_wifi_network("6g")
110    ap1_network["bssid"] = self.bssid_map[0]["6g"]
111    self.ap2.configure_ap({"6g": {"security": "owe", "SSID": roam_ssid}})
112    ap2_network = self.ap2.get_wifi_network("6g")
113    ap2_network["bssid"] = self.bssid_map[1]["6g"]
114    self.roaming_between_ap1_and_ap2(ap2_network, ap1_network,
115                                     "AP1_6G_OFF_AP2_6G_ON",
116                                     "AP1_6G_ON_AP2_6G_OFF")
117
118  @test_tracker_info(uuid="b1aa0057-4887-47fd-b29d-af7aadcdc3ab")
119  def test_roaming_between_6g_to_2g_sae(self):
120    roam_ssid = "test_%s" % "_".join(self.test_name.split("_")[-4:-1])
121    self.ap1.configure_ap({"6g": {"security": "sae", "SSID": roam_ssid}})
122    ap1_network = self.ap1.get_wifi_network("6g")
123    ap1_network["bssid"] = self.bssid_map[0]["6g"]
124    self.ap2.configure_ap({"2g": {"security": "sae", "SSID": roam_ssid}})
125    ap2_network = self.ap2.get_wifi_network("2g")
126    ap2_network["bssid"] = self.bssid_map[1]["2g"]
127    self.roaming_between_ap1_and_ap2(ap1_network, ap2_network,
128                                     "AP1_6G_OFF_AP2_2G_ON",
129                                     "AP1_6G_ON_AP2_2G_OFF")
130
131  @test_tracker_info(uuid="78318f92-3cf5-49b8-89b0-7969cf631ad3")
132  def test_roaming_between_6g_to_5g_sae(self):
133    roam_ssid = "test_%s" % "_".join(self.test_name.split("_")[-4:-1])
134    self.ap1.configure_ap({"6g": {"security": "sae", "SSID": roam_ssid}})
135    ap1_network = self.ap1.get_wifi_network("6g")
136    ap1_network["bssid"] = self.bssid_map[0]["6g"]
137    self.ap2.configure_ap({"5g": {"security": "sae", "SSID": roam_ssid}})
138    ap2_network = self.ap2.get_wifi_network("5g")
139    ap2_network["bssid"] = self.bssid_map[1]["5g"]
140    self.roaming_between_ap1_and_ap2(ap1_network, ap2_network,
141                                     "AP1_6G_OFF_AP2_5G_ON",
142                                     "AP1_6G_ON_AP2_5G_OFF")
143