tests: wmm_ac_status and roaming case with WMM-AC

Make sure the wmm_ac_status command reflects correctly the existing
tspecs after add_ts/del_ts commands. Add a new test to verify all tspecs
are removed on roaming (while FT is not used).

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
This commit is contained in:
Eliad Peller 2014-12-28 21:15:02 -05:00 committed by Jouni Malinen
parent 8c42b36902
commit bc32f830f4
2 changed files with 37 additions and 3 deletions

View file

@ -20,12 +20,12 @@ def add_wmm_ap(apdev, acm_list):
for ac in acm_list: for ac in acm_list:
params["wmm_ac_%s_acm" % (ac.lower())] = "1" params["wmm_ac_%s_acm" % (ac.lower())] = "1"
return hostapd.add_ap(apdev[0]['ifname'], params) return hostapd.add_ap(apdev['ifname'], params)
def test_tspec(dev, apdev): def test_tspec(dev, apdev):
"""Basic addts/delts tests""" """Basic addts/delts tests"""
# configure ap with VO and VI requiring admission-control # configure ap with VO and VI requiring admission-control
hapd = add_wmm_ap(apdev, ["VO", "VI"]) hapd = add_wmm_ap(apdev[0], ["VO", "VI"])
dev[0].connect("wmm_ac", key_mgmt="NONE", scan_freq="2462") dev[0].connect("wmm_ac", key_mgmt="NONE", scan_freq="2462")
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
status = dev[0].request("WMM_AC_STATUS") status = dev[0].request("WMM_AC_STATUS")
@ -112,7 +112,7 @@ def test_tspec(dev, apdev):
def test_tspec_protocol(dev, apdev): def test_tspec_protocol(dev, apdev):
"""Protocol tests for addts/delts""" """Protocol tests for addts/delts"""
# configure ap with VO and VI requiring admission-control # configure ap with VO and VI requiring admission-control
hapd = add_wmm_ap(apdev, ["VO", "VI"]) hapd = add_wmm_ap(apdev[0], ["VO", "VI"])
dev[0].connect("wmm_ac", key_mgmt="NONE", scan_freq="2462") dev[0].connect("wmm_ac", key_mgmt="NONE", scan_freq="2462")
dev[0].dump_monitor() dev[0].dump_monitor()
@ -245,3 +245,21 @@ def test_tspec_not_enabled(dev, apdev):
msg['bssid'] = apdev[0]['bssid'] msg['bssid'] = apdev[0]['bssid']
msg['payload'] = struct.pack('BBBB', 17, 2, 0, 0) msg['payload'] = struct.pack('BBBB', 17, 2, 0, 0)
hapd.mgmt_tx(msg) hapd.mgmt_tx(msg)
def test_tspec_ap_roam_open(dev, apdev):
"""Roam between two open APs while having tspecs"""
hapd0 = add_wmm_ap(apdev[0], ["VO", "VI"])
dev[0].connect("wmm_ac", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev[0], hapd0)
dev[0].add_ts(5, 6)
hapd1 = add_wmm_ap(apdev[1], ["VO", "VI"])
dev[0].scan_for_bss(apdev[1]['bssid'], freq=2462)
dev[0].roam(apdev[1]['bssid'])
hwsim_utils.test_connectivity(dev[0], hapd1)
if dev[0].tspecs():
raise Exception("TSPECs weren't deleted on roaming")
dev[0].scan_for_bss(apdev[0]['bssid'], freq=2462)
dev[0].roam(apdev[0]['bssid'])
hwsim_utils.test_connectivity(dev[0], hapd0)

View file

@ -723,6 +723,15 @@ class WpaSupplicant:
raise Exception("Failed to request TDLS teardown") raise Exception("Failed to request TDLS teardown")
return None return None
def tspecs(self):
"""Return (tsid, up) tuples representing current tspecs"""
res = self.request("WMM_AC_STATUS")
tspecs = re.findall(r"TSID=(\d+) UP=(\d+)", res)
tspecs = [tuple(map(int, tspec)) for tspec in tspecs]
logger.debug("tspecs: " + str(tspecs))
return tspecs
def add_ts(self, tsid, up, direction="downlink", expect_failure=False, def add_ts(self, tsid, up, direction="downlink", expect_failure=False,
extra=None): extra=None):
params = { params = {
@ -754,6 +763,9 @@ class WpaSupplicant:
if "tsid=%d" % (tsid) not in ev: if "tsid=%d" % (tsid) not in ev:
raise Exception("ADDTS failed (invalid tsid in TSPEC-ADDED)") raise Exception("ADDTS failed (invalid tsid in TSPEC-ADDED)")
if not (tsid, up) in self.tspecs():
raise Exception("ADDTS failed (tsid not in tspec list)")
def del_ts(self, tsid): def del_ts(self, tsid):
if self.request("WMM_AC_DELTS %d" % (tsid)).strip() != "OK": if self.request("WMM_AC_DELTS %d" % (tsid)).strip() != "OK":
raise Exception("DELTS failed") raise Exception("DELTS failed")
@ -764,6 +776,10 @@ class WpaSupplicant:
if "tsid=%d" % (tsid) not in ev: if "tsid=%d" % (tsid) not in ev:
raise Exception("DELTS failed (invalid tsid in TSPEC-REMOVED)") raise Exception("DELTS failed (invalid tsid in TSPEC-REMOVED)")
tspecs = [(t, u) for (t, u) in self.tspecs() if t == tsid]
if tspecs:
raise Exception("DELTS failed (still in tspec list)")
def connect(self, ssid=None, ssid2=None, **kwargs): def connect(self, ssid=None, ssid2=None, **kwargs):
logger.info("Connect STA " + self.ifname + " to AP") logger.info("Connect STA " + self.ifname + " to AP")
id = self.add_network() id = self.add_network()