Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Unified Diff: server/site_linux_router.py

Issue 6030011: Rearrange EAP setup so that it is more parameterizable for other EAP types (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: No more site_eap Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: server/site_linux_router.py
diff --git a/server/site_linux_router.py b/server/site_linux_router.py
index 70707fc2e3fd86684d16d83bfe18b2f38c48fc58..96a0ef46f22b2bb1b1104be8bd4a7b2c5d23c1a3 100644
--- a/server/site_linux_router.py
+++ b/server/site_linux_router.py
@@ -4,7 +4,6 @@
import logging, re, time
from autotest_lib.client.common_lib import error
-from autotest_lib.server import site_eap_tls
def isLinuxRouter(router):
router_uname = router.run('uname').stdout
@@ -146,6 +145,27 @@ class LinuxRouter(object):
self.deconfig(params)
+ def insert_file(self, host, filename, contents):
+ """
+ If config files are too big, the "host.run()" never returns.
+ As a workaround, break the file up into lines and append the
+ file piece by piece
+ """
+ host.run('rm -f %s >/dev/null 2>&1' % filename, ignore_status=True)
+ content_lines = contents.splitlines()
+ while content_lines:
+ buflist = []
+ buflen = 0
+ while content_lines and buflen + len(content_lines[0]) < 200:
+ line = content_lines.pop(0)
+ buflen += len(line) + 1
+ buflist.append(line)
+
+ if not buflist:
+ raise error.TestFail('Cert profile: line too long: %s' %
+ content_lines[0])
+ host.run('cat <<EOF >>%s\n%s\nEOF\n' %
+ (filename, '\n'.join(buflist)))
def config(self, params):
""" Configure the AP per test requirements """
@@ -165,7 +185,19 @@ class LinuxRouter(object):
self.hostapd['driver'])
for k, v in params.iteritems():
- if k == 'ssid':
+ # For some parameters, the hostapd.conf value is a filename;
+ # here, we create a file to contain the actual value and then
+ # put the filename in hostapd.conf.
+ if k.endswith('_file') or k in ['ca_cert',
+ 'server_cert',
+ 'private_key',
+ 'radius_server_clients',
+ 'wps_pin_requests',
+ 'ap_settings']:
+ filename = "/tmp/hostap_%s" % k
+ self.insert_file(self.router, filename, v)
+ conf[k] = filename
+ elif k == 'ssid':
conf['ssid'] = v
elif k == 'ssid_suffix':
conf['ssid'] = self.defssid + v
@@ -258,8 +290,8 @@ class LinuxRouter(object):
pass # NB: meaningless for hostapd; ignore
elif k == '-ampdu':
pass # TODO(sleffler) need hostapd support
- elif k == 'eap-tls':
- conf.update(site_eap_tls.router_config(self.router, v))
+ elif k == 'eap':
+ conf.update(site_eap.router_config(self.router, v))
else:
conf[k] = v

Powered by Google App Engine
This is Rietveld 408576698