summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBindu Mahadev <bmahadev@google.com>2018-05-22 16:35:03 -0700
committerBindu Mahadev <bmahadev@google.com>2018-05-23 19:34:00 +0000
commite57533d092b77aed7007f7e3bea4b9428f949119 (patch)
tree3045c4d236f23dc38b28e3706e8919703027148d
parentca6704f6f05b64a955217ed9112a043c2c8cc05a (diff)
downloadplatform_tools_test_connectivity-e57533d092b77aed7007f7e3bea4b9428f949119.tar.gz
platform_tools_test_connectivity-e57533d092b77aed7007f7e3bea4b9428f949119.tar.bz2
platform_tools_test_connectivity-e57533d092b77aed7007f7e3bea4b9428f949119.zip
Merge "Revert "[AccessPoint]Check AP state and restart."" am: 3eea2ffc1b am: 212c337d11
am: 23406bde5b Bug: 79856986 Change-Id: Ieafda4598283e52d8bcda5be435a305abed689a8 (cherry picked from commit b2c26d20a2932e8c7bcc33604acf52b4d20b14f4)
-rwxr-xr-xacts/framework/acts/controllers/access_point.py43
1 files changed, 8 insertions, 35 deletions
diff --git a/acts/framework/acts/controllers/access_point.py b/acts/framework/acts/controllers/access_point.py
index a58c7dcb97..bf5b5f641f 100755
--- a/acts/framework/acts/controllers/access_point.py
+++ b/acts/framework/acts/controllers/access_point.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.4
+#!/usr/bin/env python3
#
# Copyright 2016 - Google, Inc.
#
@@ -16,16 +16,18 @@
import collections
import ipaddress
+import logging
import time
-from acts import logger
from acts.controllers.ap_lib import ap_get_interface
from acts.controllers.ap_lib import bridge_interface
from acts.controllers.ap_lib import dhcp_config
from acts.controllers.ap_lib import dhcp_server
from acts.controllers.ap_lib import hostapd
+from acts.controllers.ap_lib import hostapd_config
from acts.controllers.utils_lib.commands import ip
from acts.controllers.utils_lib.commands import route
+from acts.controllers.utils_lib.commands import shell
from acts.controllers.utils_lib.ssh import connection
from acts.controllers.utils_lib.ssh import settings
from acts.libs.proc import job
@@ -104,12 +106,6 @@ class AccessPoint(object):
configs: configs for the access point from config file.
"""
self.ssh_settings = settings.from_config(configs['ssh_config'])
- self.ssh = connection.SshConnection(self.ssh_settings)
- self.log = logger.create_logger(lambda msg: '[Access Point|%s] %s' % (
- self.ssh_settings.hostname, msg))
-
- self.check_state()
-
if 'ap_subnet' in configs:
self._AP_2G_SUBNET_STR = configs['ap_subnet']['2g']
self._AP_5G_SUBNET_STR = configs['ap_subnet']['5g']
@@ -134,7 +130,7 @@ class AccessPoint(object):
self.bridge = bridge_interface.BridgeInterface(self)
self.interfaces = ap_get_interface.ApInterfaces(self)
- # Get needed interface names and initialize the unnecessary ones.
+ # Get needed interface names and initialize the unneccessary ones.
self.wan = self.interfaces.get_wan_interface()
self.wlan = self.interfaces.get_wlan_interface()
self.wlan_2g = self.wlan[0]
@@ -142,30 +138,6 @@ class AccessPoint(object):
self.lan = self.interfaces.get_lan_interface()
self.__initial_ap()
- def check_state(self):
- """Check what state the AP is in and reboot if required.
-
- Check if the AP already has stale interfaces from the previous run.
- If "yes", then reboot the AP and continue AP initialization.
-
- """
- self.log.debug("Checking AP state")
- self.interfaces = ap_get_interface.ApInterfaces(self)
- # Check if the AP has any virtual interfaces created.
- interfaces = self.ssh.run('iw dev | grep -i "type ap" || true')
- self.log.debug("AP interfaces = %s" % interfaces)
- # The virtual interface will be of type "AP".
- if 'AP' in interfaces.stdout:
- self.log.debug("Found AP in stale state. Rebooting.")
- try:
- self.ssh.run('reboot')
- # Wait for AP to shut down.
- time.sleep(10)
- self.ssh.run('echo connected', timeout=300)
- except Exception as e:
- self.log.exception("Error in rebooting AP: %s", e)
- raise
-
def __initial_ap(self):
"""Initial AP interfaces.
@@ -281,8 +253,9 @@ class AccessPoint(object):
counter = 1
for bss in hostapd_config.bss_lookup:
if interface_mac_orig:
- hostapd_config.bss_lookup[bss].bssid = (
- interface_mac_orig.stdout[:-1] + str(counter))
+ 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 self.wlan_2g:
starting_ip_range = self._AP_2G_SUBNET_STR