Made config options optional and added configurable AP

Added the ability to configure an AP instead of specifying
many options inside of the config file for this test.  This
test is still backwards compatible with the old config files
but can now be used with a whirlwind instead of individual
APs.

Bug: 34624546
Change-Id: Ib643392d7f28e6c7e7fcf3bf719a09da4e08ce0f
Fixes: 34624546
Fixes: 37680623
Test: act.py -c /android/nonets.json -tc WiFiManagerTest
diff --git a/acts/framework/acts/controllers/access_point.py b/acts/framework/acts/controllers/access_point.py
index d517b10..c91275a 100755
--- a/acts/framework/acts/controllers/access_point.py
+++ b/acts/framework/acts/controllers/access_point.py
@@ -168,10 +168,11 @@
         # one radio to have up to 8 APs on the interface.  The check ensures
         # backwards compatibility since if someone has set the bssid on purpose
         # the bssid will not be changed from what the user set.
+        interface_mac_orig = None
         if not hostapd_config.bssid:
             cmd = "ifconfig %s|grep ether|awk -F' ' '{print $2}'" % interface
-            interface_mac = self.ssh.run(cmd)
-            interface_mac = interface_mac.stdout[:-1] + '0'
+            interface_mac_orig = self.ssh.run(cmd)
+            interface_mac = interface_mac_orig.stdout[:-1] + '0'
             hostapd_config.bssid = interface_mac
 
         if interface in self._aps:
@@ -199,6 +200,11 @@
             dhcp_bss = {}
             counter = 1
             for bss in hostapd_config.bss_lookup:
+                if not hostapd_config.bss_lookup[bss].bssid:
+                    if interface_mac_orig:
+                        hostapd_config.bss_lookup[
+                            bss].bssid = interface_mac_orig.stdout[:-1] + str(
+                                counter)
                 self._route_cmd.clear_routes(net_interface=str(bss))
                 if interface is _AP_2GHZ_INTERFACE:
                     starting_ip_range = _AP_2GHZ_SUBNET_STR
@@ -238,6 +244,21 @@
 
         return interface
 
+    def get_bssid_from_ssid(self, ssid):
+        """Gets the BSSID from a provided SSID
+
+        Args:
+            ssid: An SSID string
+        Returns: The BSSID if on the AP or None is 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
+
     def stop_ap(self, identifier):
         """Stops a running ap on this controller.