[AP_LIB]Populate bssid's for all dynamically created networks.
- Populate bssid's for open and reference networks
- Updated open_network for WifiManager and WifiNetworkSelection class
- Added constants for 2g and 5g.
- Added more logic to get_bssid from ssid method to account for all
possible interfaces on the AP.
Bug: 62548665
Test: Tested with wifimanager and scanner so far. Autojoin has some issues.
Change-Id: Ia6bb3a4da39c81e56a7d7411b41e2f8522bbce2f
diff --git a/acts/framework/acts/controllers/access_point.py b/acts/framework/acts/controllers/access_point.py
index c91275a..38af355 100755
--- a/acts/framework/acts/controllers/access_point.py
+++ b/acts/framework/acts/controllers/access_point.py
@@ -249,15 +249,26 @@
Args:
ssid: An SSID string
- Returns: The BSSID if on the AP or None is SSID could not be found.
+ Returns: The BSSID if on the AP or None if SSID could not be found.
"""
- cmd = "iw dev %s info|grep addr|awk -F' ' '{print $2}'" % str(ssid)
- iw_output = self.ssh.run(cmd)
- if 'command failed: No such device' in iw_output.stderr:
- return None
- else:
- return iw_output.stdout
+ interfaces = [_AP_2GHZ_INTERFACE, _AP_5GHZ_INTERFACE, ssid]
+ # Get the interface name associated with the given ssid.
+ for interface in interfaces:
+ cmd = "iw dev %s info|grep ssid|awk -F' ' '{print $2}'" %(
+ str(interface))
+ iw_output = self.ssh.run(cmd)
+ if 'command failed: No such device' in iw_output.stderr:
+ continue
+ else:
+ # If the configured ssid is equal to the given ssid, we found
+ # the right interface.
+ if iw_output.stdout == ssid:
+ cmd = "iw dev %s info|grep addr|awk -F' ' '{print $2}'" %(
+ str(interface))
+ iw_output = self.ssh.run(cmd)
+ return iw_output.stdout
+ return None
def stop_ap(self, identifier):
"""Stops a running ap on this controller.