Merge "wifiblaster: add onassociation parameter."
diff --git a/waveguide/waveguide.py b/waveguide/waveguide.py
index db2f9ed..cbc9fe8 100755
--- a/waveguide/waveguide.py
+++ b/waveguide/waveguide.py
@@ -783,7 +783,7 @@
a = wgdata.Assoc(mac=mac, rssi=rssi, last_seen=last_seen, can5G=can5G)
if mac not in self.assoc_list:
self.Debug('Added: %r', a)
- self.wifiblaster_controller.Measure(self.vdevname, mac)
+ self.wifiblaster_controller.MeasureOnAssociation(self.vdevname, mac)
assoc_list[mac] = a
for line in stdout.split('\n'):
@@ -904,16 +904,18 @@
- Scheduling parameters
- wifiblaster.enable Enable WiFi performance measurement.
- wifiblaster.interval Average time between automated measurements in
- seconds, or 0 to disable automated measurements.
- wifiblaster.measureall Unix time at which to measure all clients.
+ wifiblaster.enable Enable WiFi performance measurement.
+ wifiblaster.interval Average time between automated measurements in
+ seconds, or 0 to disable automated measurements.
+ wifiblaster.measureall Unix time at which to measure all clients.
+ wifiblaster.onassociation Enable WiFi performance measurement after clients
+ associate.
- Measurement parameters
- wifiblaster.duration Measurement duration in seconds.
- wifiblaster.fraction Number of samples per measurement.
- wifiblaster.size Packet size in bytes.
+ wifiblaster.duration Measurement duration in seconds.
+ wifiblaster.fraction Number of samples per measurement.
+ wifiblaster.size Packet size in bytes.
"""
def __init__(self, managers, basedir):
@@ -985,6 +987,12 @@
'-f', str(fraction), '-s', str(size),
helpers.DecodeMAC(client)])
+ def MeasureOnAssociation(self, interface, client):
+ """Measures the performance of a client after association."""
+ onassociation = self._ReadParameter('onassociation', self._StrToBool)
+ if onassociation:
+ self.Measure(interface, client)
+
def Poll(self, now):
"""Polls the state machine."""
diff --git a/waveguide/wifiblaster_controller_test.py b/waveguide/wifiblaster_controller_test.py
index 04e71f8..6b562b1 100755
--- a/waveguide/wifiblaster_controller_test.py
+++ b/waveguide/wifiblaster_controller_test.py
@@ -208,6 +208,15 @@
wvtest.WVPASSEQ(CountRuns(), 1)
wc.Poll(501)
wvtest.WVPASSEQ(CountRuns(), 0)
+
+ # Measure on association only if enabled.
+ wc.MeasureOnAssociation(manager.vdevname,
+ manager.GetState().assoc[0].mac)
+ wvtest.WVPASSEQ(CountRuns(), 0)
+ WriteConfig('onassociation', 'True')
+ wc.MeasureOnAssociation(manager.vdevname,
+ manager.GetState().assoc[0].mac)
+ wvtest.WVPASSEQ(CountRuns(), 1)
finally:
time.time = oldtime
shutil.rmtree(d)