From 46185f5bfdca1d505779e27d104907aee815c3bb Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 22 Feb 2016 19:51:36 +0200 Subject: [PATCH] tests: MBO non-preferred channel list Signed-off-by: Jouni Malinen --- tests/hwsim/test_mbo.py | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/tests/hwsim/test_mbo.py b/tests/hwsim/test_mbo.py index 274ad494c..74c6623a1 100644 --- a/tests/hwsim/test_mbo.py +++ b/tests/hwsim/test_mbo.py @@ -115,3 +115,86 @@ def test_mbo_cell_capa_update_pmf(dev, apdev): raise Exception("mbo_cell_capa missing after update") if sta['mbo_cell_capa'] != '3': raise Exception("mbo_cell_capa not updated properly") + +def test_mbo_non_pref_chan(dev, apdev): + """MBO non-preferred channel list""" + ssid = "test-wnm-mbo" + params = { 'ssid': ssid, 'mbo': '1' } + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + bssid = apdev[0]['bssid'] + if "OK" not in dev[0].request("SET non_pref_chan 81:7:200:3"): + raise Exception("Failed to set non-preferred channel list") + if "OK" not in dev[0].request("SET non_pref_chan 81:7:200:1:123 81:9:100:2"): + raise Exception("Failed to set non-preferred channel list") + + dev[0].connect(ssid, key_mgmt="NONE", scan_freq="2412") + + addr = dev[0].own_addr() + sta = hapd.get_sta(addr) + logger.debug("STA: " + str(sta)) + if 'non_pref_chan[0]' not in sta: + raise Exception("Missing non_pref_chan[0] value (assoc)") + if sta['non_pref_chan[0]'] != '81:200:1:123:7': + raise Exception("Unexpected non_pref_chan[0] value (assoc)") + if 'non_pref_chan[1]' not in sta: + raise Exception("Missing non_pref_chan[1] value (assoc)") + if sta['non_pref_chan[1]'] != '81:100:2:0:9': + raise Exception("Unexpected non_pref_chan[1] value (assoc)") + if 'non_pref_chan[2]' in sta: + raise Exception("Unexpected non_pref_chan[2] value (assoc)") + + if "OK" not in dev[0].request("SET non_pref_chan 81:9:100:2"): + raise Exception("Failed to update non-preferred channel list") + time.sleep(0.1) + sta = hapd.get_sta(addr) + logger.debug("STA: " + str(sta)) + if 'non_pref_chan[0]' not in sta: + raise Exception("Missing non_pref_chan[0] value (update 1)") + if sta['non_pref_chan[0]'] != '81:100:2:0:9': + raise Exception("Unexpected non_pref_chan[0] value (update 1)") + if 'non_pref_chan[1]' in sta: + raise Exception("Unexpected non_pref_chan[2] value (update 1)") + + if "OK" not in dev[0].request("SET non_pref_chan 81:9:100:2 81:10:100:2 81:8:100:2 81:7:100:1:123 81:5:100:1:124"): + raise Exception("Failed to update non-preferred channel list") + time.sleep(0.1) + sta = hapd.get_sta(addr) + logger.debug("STA: " + str(sta)) + if 'non_pref_chan[0]' not in sta: + raise Exception("Missing non_pref_chan[0] value (update 2)") + if sta['non_pref_chan[0]'] != '81:100:1:123:7': + raise Exception("Unexpected non_pref_chan[0] value (update 2)") + if 'non_pref_chan[1]' not in sta: + raise Exception("Missing non_pref_chan[1] value (update 2)") + if sta['non_pref_chan[1]'] != '81:100:1:124:5': + raise Exception("Unexpected non_pref_chan[1] value (update 2)") + if 'non_pref_chan[2]' not in sta: + raise Exception("Missing non_pref_chan[2] value (update 2)") + if sta['non_pref_chan[2]'] != '81:100:2:0:9,10,8': + raise Exception("Unexpected non_pref_chan[2] value (update 2)") + if 'non_pref_chan[3]' in sta: + raise Exception("Unexpected non_pref_chan[3] value (update 2)") + + if "OK" not in dev[0].request("SET non_pref_chan 81:5:90:2 82:14:91:2"): + raise Exception("Failed to update non-preferred channel list") + time.sleep(0.1) + sta = hapd.get_sta(addr) + logger.debug("STA: " + str(sta)) + if 'non_pref_chan[0]' not in sta: + raise Exception("Missing non_pref_chan[0] value (update 3)") + if sta['non_pref_chan[0]'] != '81:90:2:0:5': + raise Exception("Unexpected non_pref_chan[0] value (update 3)") + if 'non_pref_chan[1]' not in sta: + raise Exception("Missing non_pref_chan[1] value (update 3)") + if sta['non_pref_chan[1]'] != '82:91:2:0:14': + raise Exception("Unexpected non_pref_chan[1] value (update 3)") + if 'non_pref_chan[2]' in sta: + raise Exception("Unexpected non_pref_chan[2] value (update 3)") + + if "OK" not in dev[0].request("SET non_pref_chan "): + raise Exception("Failed to update non-preferred channel list") + time.sleep(0.1) + sta = hapd.get_sta(addr) + logger.debug("STA: " + str(sta)) + if 'non_pref_chan[0]' in sta: + raise Exception("Unexpected non_pref_chan[0] value (update 4)")