test_ap_vht.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. # Test cases for VHT operations with hostapd
  2. # Copyright (c) 2014, Qualcomm Atheros, Inc.
  3. # Copyright (c) 2013, Intel Corporation
  4. #
  5. # This software may be distributed under the terms of the BSD license.
  6. # See README for more details.
  7. import logging
  8. logger = logging.getLogger()
  9. import os
  10. import subprocess, time
  11. import hwsim_utils
  12. import hostapd
  13. from utils import HwsimSkip
  14. from test_dfs import wait_dfs_event
  15. from test_ap_csa import csa_supported
  16. def vht_supported():
  17. cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE)
  18. reg = cmd.stdout.read()
  19. if "@ 80)" in reg or "@ 160)" in reg:
  20. return True
  21. return False
  22. def test_ap_vht80(dev, apdev):
  23. """VHT with 80 MHz channel width"""
  24. try:
  25. hapd = None
  26. params = { "ssid": "vht",
  27. "country_code": "FI",
  28. "hw_mode": "a",
  29. "channel": "36",
  30. "ht_capab": "[HT40+]",
  31. "ieee80211n": "1",
  32. "ieee80211ac": "1",
  33. "vht_oper_chwidth": "1",
  34. "vht_oper_centr_freq_seg0_idx": "42" }
  35. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  36. bssid = apdev[0]['bssid']
  37. dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
  38. hwsim_utils.test_connectivity(dev[0], hapd)
  39. est = dev[0].get_bss(bssid)['est_throughput']
  40. if est != "390001":
  41. raise Exception("Unexpected BSS est_throughput: " + est)
  42. except Exception, e:
  43. if isinstance(e, Exception) and str(e) == "AP startup failed":
  44. if not vht_supported():
  45. raise HwsimSkip("80 MHz channel not supported in regulatory information")
  46. raise
  47. finally:
  48. dev[0].request("DISCONNECT")
  49. if hapd:
  50. hapd.request("DISABLE")
  51. subprocess.call(['iw', 'reg', 'set', '00'])
  52. dev[0].flush_scan_cache()
  53. def vht80_test(apdev, dev, channel, ht_capab):
  54. try:
  55. hapd = None
  56. params = { "ssid": "vht",
  57. "country_code": "FI",
  58. "hw_mode": "a",
  59. "channel": str(channel),
  60. "ht_capab": ht_capab,
  61. "ieee80211n": "1",
  62. "ieee80211ac": "1",
  63. "vht_oper_chwidth": "1",
  64. "vht_oper_centr_freq_seg0_idx": "42" }
  65. hapd = hostapd.add_ap(apdev['ifname'], params)
  66. bssid = apdev['bssid']
  67. dev.connect("vht", key_mgmt="NONE", scan_freq=str(5000 + 5 * channel))
  68. hwsim_utils.test_connectivity(dev, hapd)
  69. except Exception, e:
  70. if isinstance(e, Exception) and str(e) == "AP startup failed":
  71. if not vht_supported():
  72. raise HwsimSkip("80 MHz channel not supported in regulatory information")
  73. raise
  74. finally:
  75. dev.request("DISCONNECT")
  76. if hapd:
  77. hapd.request("DISABLE")
  78. subprocess.call(['iw', 'reg', 'set', '00'])
  79. dev.flush_scan_cache()
  80. def test_ap_vht80b(dev, apdev):
  81. """VHT with 80 MHz channel width (HT40- channel 40)"""
  82. vht80_test(apdev[0], dev[0], 40, "[HT40-]")
  83. def test_ap_vht80c(dev, apdev):
  84. """VHT with 80 MHz channel width (HT40+ channel 44)"""
  85. vht80_test(apdev[0], dev[0], 44, "[HT40+]")
  86. def test_ap_vht80d(dev, apdev):
  87. """VHT with 80 MHz channel width (HT40- channel 48)"""
  88. vht80_test(apdev[0], dev[0], 48, "[HT40-]")
  89. def test_ap_vht80_params(dev, apdev):
  90. """VHT with 80 MHz channel width and number of optional features enabled"""
  91. try:
  92. hapd = None
  93. params = { "ssid": "vht",
  94. "country_code": "FI",
  95. "hw_mode": "a",
  96. "channel": "36",
  97. "ht_capab": "[HT40+][SHORT-GI-40][DSS_CCK-40]",
  98. "ieee80211n": "1",
  99. "ieee80211ac": "1",
  100. "vht_oper_chwidth": "1",
  101. "vht_capab": "[MAX-MPDU-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP0]",
  102. "vht_oper_centr_freq_seg0_idx": "42",
  103. "require_vht": "1" }
  104. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  105. dev[1].connect("vht", key_mgmt="NONE", scan_freq="5180",
  106. disable_vht="1", wait_connect=False)
  107. dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
  108. ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"])
  109. if ev is None:
  110. raise Exception("Association rejection timed out")
  111. if "status_code=104" not in ev:
  112. raise Exception("Unexpected rejection status code")
  113. dev[1].request("DISCONNECT")
  114. hwsim_utils.test_connectivity(dev[0], hapd)
  115. except Exception, e:
  116. if isinstance(e, Exception) and str(e) == "AP startup failed":
  117. if not vht_supported():
  118. raise HwsimSkip("80 MHz channel not supported in regulatory information")
  119. raise
  120. finally:
  121. dev[0].request("DISCONNECT")
  122. dev[1].request("DISCONNECT")
  123. if hapd:
  124. hapd.request("DISABLE")
  125. subprocess.call(['iw', 'reg', 'set', '00'])
  126. dev[0].flush_scan_cache()
  127. dev[1].flush_scan_cache()
  128. def test_ap_vht_20(devs, apdevs):
  129. """VHT and 20 MHz channel"""
  130. dev = devs[0]
  131. ap = apdevs[0]
  132. try:
  133. hapd = None
  134. params = { "ssid": "test-vht20",
  135. "country_code": "DE",
  136. "hw_mode": "a",
  137. "channel": "36",
  138. "ieee80211n": "1",
  139. "ieee80211ac": "1",
  140. "ht_capab": "",
  141. "vht_capab": "",
  142. "vht_oper_chwidth": "0",
  143. "vht_oper_centr_freq_seg0_idx": "0",
  144. "supported_rates": "60 120 240 360 480 540",
  145. "require_vht": "1",
  146. }
  147. hapd = hostapd.add_ap(ap['ifname'], params)
  148. dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
  149. hwsim_utils.test_connectivity(dev, hapd)
  150. finally:
  151. dev.request("DISCONNECT")
  152. if hapd:
  153. hapd.request("DISABLE")
  154. subprocess.call(['iw', 'reg', 'set', '00'])
  155. dev.flush_scan_cache()
  156. def test_ap_vht_40(devs, apdevs):
  157. """VHT and 40 MHz channel"""
  158. dev = devs[0]
  159. ap = apdevs[0]
  160. try:
  161. hapd = None
  162. params = { "ssid": "test-vht40",
  163. "country_code": "DE",
  164. "hw_mode": "a",
  165. "channel": "36",
  166. "ieee80211n": "1",
  167. "ieee80211ac": "1",
  168. "ht_capab": "[HT40+]",
  169. "vht_capab": "",
  170. "vht_oper_chwidth": "0",
  171. "vht_oper_centr_freq_seg0_idx": "0",
  172. }
  173. hapd = hostapd.add_ap(ap['ifname'], params)
  174. dev.connect("test-vht40", scan_freq="5180", key_mgmt="NONE")
  175. hwsim_utils.test_connectivity(dev, hapd)
  176. finally:
  177. dev.request("DISCONNECT")
  178. if hapd:
  179. hapd.request("DISABLE")
  180. subprocess.call(['iw', 'reg', 'set', '00'])
  181. dev.flush_scan_cache()
  182. def test_ap_vht_capab_not_supported(dev, apdev):
  183. """VHT configuration with driver not supporting all vht_capab entries"""
  184. try:
  185. params = { "ssid": "vht",
  186. "country_code": "FI",
  187. "hw_mode": "a",
  188. "channel": "36",
  189. "ht_capab": "[HT40+][SHORT-GI-40][DSS_CCK-40]",
  190. "ieee80211n": "1",
  191. "ieee80211ac": "1",
  192. "vht_oper_chwidth": "1",
  193. "vht_capab": "[MAX-MPDU-7991][MAX-MPDU-11454][VHT160][VHT160-80PLUS80][RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][RX-STBC-1][RX-STBC-12][RX-STBC-123][RX-STBC-1234][SU-BEAMFORMER][SU-BEAMFORMEE][BF-ANTENNA-2][BF-ANTENNA-3][BF-ANTENNA-4][SOUNDING-DIMENSION-2][SOUNDING-DIMENSION-3][SOUNDING-DIMENSION-4][MU-BEAMFORMER][VHT-TXOP-PS][HTC-VHT][MAX-A-MPDU-LEN-EXP0][MAX-A-MPDU-LEN-EXP7][VHT-LINK-ADAPT2][VHT-LINK-ADAPT3][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN]",
  194. "vht_oper_centr_freq_seg0_idx": "42",
  195. "require_vht": "1" }
  196. hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False)
  197. ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
  198. if ev is None:
  199. raise Exception("Startup failure not reported")
  200. for i in range(1, 7):
  201. if "OK" not in hapd.request("SET vht_capab [MAX-A-MPDU-LEN-EXP%d]" % i):
  202. raise Exception("Unexpected SET failure")
  203. finally:
  204. subprocess.call(['iw', 'reg', 'set', '00'])
  205. def test_ap_vht160(dev, apdev):
  206. """VHT with 160 MHz channel width"""
  207. try:
  208. hapd = None
  209. hapd2 = None
  210. params = { "ssid": "vht",
  211. "country_code": "FI",
  212. "hw_mode": "a",
  213. "channel": "36",
  214. "ht_capab": "[HT40+]",
  215. "ieee80211n": "1",
  216. "ieee80211ac": "1",
  217. "vht_oper_chwidth": "2",
  218. "vht_oper_centr_freq_seg0_idx": "50",
  219. 'ieee80211d': '1',
  220. 'ieee80211h': '1' }
  221. hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False)
  222. ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
  223. if "DFS-CAC-START" not in ev:
  224. raise Exception("Unexpected DFS event")
  225. state = hapd.get_status_field("state")
  226. if state != "DFS":
  227. if state == "DISABLED" and not os.path.exists("dfs"):
  228. # Not all systems have recent enough CRDA version and
  229. # wireless-regdb changes to support 160 MHz and DFS. For now,
  230. # do not report failures for this test case.
  231. raise HwsimSkip("CRDA or wireless-regdb did not support 160 MHz")
  232. raise Exception("Unexpected interface state: " + state)
  233. params = { "ssid": "vht2",
  234. "country_code": "FI",
  235. "hw_mode": "a",
  236. "channel": "104",
  237. "ht_capab": "[HT40-]",
  238. "ieee80211n": "1",
  239. "ieee80211ac": "1",
  240. "vht_oper_chwidth": "2",
  241. "vht_oper_centr_freq_seg0_idx": "114",
  242. 'ieee80211d': '1',
  243. 'ieee80211h': '1' }
  244. hapd2 = hostapd.add_ap(apdev[1]['ifname'], params, wait_enabled=False)
  245. ev = wait_dfs_event(hapd2, "DFS-CAC-START", 5)
  246. if "DFS-CAC-START" not in ev:
  247. raise Exception("Unexpected DFS event(2)")
  248. state = hapd2.get_status_field("state")
  249. if state != "DFS":
  250. raise Exception("Unexpected interface state(2): " + state)
  251. logger.info("Waiting for CAC to complete")
  252. ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70)
  253. if "success=1" not in ev:
  254. raise Exception("CAC failed")
  255. if "freq=5180" not in ev:
  256. raise Exception("Unexpected DFS freq result")
  257. ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
  258. if not ev:
  259. raise Exception("AP setup timed out")
  260. state = hapd.get_status_field("state")
  261. if state != "ENABLED":
  262. raise Exception("Unexpected interface state")
  263. ev = wait_dfs_event(hapd2, "DFS-CAC-COMPLETED", 70)
  264. if "success=1" not in ev:
  265. raise Exception("CAC failed(2)")
  266. if "freq=5520" not in ev:
  267. raise Exception("Unexpected DFS freq result(2)")
  268. ev = hapd2.wait_event(["AP-ENABLED"], timeout=5)
  269. if not ev:
  270. raise Exception("AP setup timed out(2)")
  271. state = hapd2.get_status_field("state")
  272. if state != "ENABLED":
  273. raise Exception("Unexpected interface state(2)")
  274. freq = hapd2.get_status_field("freq")
  275. if freq != "5520":
  276. raise Exception("Unexpected frequency(2)")
  277. dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
  278. hwsim_utils.test_connectivity(dev[0], hapd)
  279. sig = dev[0].request("SIGNAL_POLL").splitlines()
  280. if "FREQUENCY=5180" not in sig:
  281. raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
  282. if "WIDTH=160 MHz" not in sig:
  283. raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
  284. dev[1].connect("vht2", key_mgmt="NONE", scan_freq="5520")
  285. hwsim_utils.test_connectivity(dev[1], hapd2)
  286. sig = dev[1].request("SIGNAL_POLL").splitlines()
  287. if "FREQUENCY=5520" not in sig:
  288. raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
  289. if "WIDTH=160 MHz" not in sig:
  290. raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
  291. except Exception, e:
  292. if isinstance(e, Exception) and str(e) == "AP startup failed":
  293. if not vht_supported():
  294. raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
  295. raise
  296. finally:
  297. dev[0].request("DISCONNECT")
  298. dev[1].request("DISCONNECT")
  299. if hapd:
  300. hapd.request("DISABLE")
  301. if hapd2:
  302. hapd2.request("DISABLE")
  303. subprocess.call(['iw', 'reg', 'set', '00'])
  304. dev[0].flush_scan_cache()
  305. dev[1].flush_scan_cache()
  306. def test_ap_vht80plus80(dev, apdev):
  307. """VHT with 80+80 MHz channel width"""
  308. try:
  309. hapd = None
  310. hapd2 = None
  311. params = { "ssid": "vht",
  312. "country_code": "US",
  313. "hw_mode": "a",
  314. "channel": "52",
  315. "ht_capab": "[HT40+]",
  316. "ieee80211n": "1",
  317. "ieee80211ac": "1",
  318. "vht_oper_chwidth": "3",
  319. "vht_oper_centr_freq_seg0_idx": "58",
  320. "vht_oper_centr_freq_seg1_idx": "155",
  321. 'ieee80211d': '1',
  322. 'ieee80211h': '1' }
  323. hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False)
  324. # This will actually fail since DFS on 80+80 is not yet supported
  325. ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
  326. # ignore result to avoid breaking the test once 80+80 DFS gets enabled
  327. params = { "ssid": "vht2",
  328. "country_code": "US",
  329. "hw_mode": "a",
  330. "channel": "36",
  331. "ht_capab": "[HT40+]",
  332. "ieee80211n": "1",
  333. "ieee80211ac": "1",
  334. "vht_oper_chwidth": "3",
  335. "vht_oper_centr_freq_seg0_idx": "42",
  336. "vht_oper_centr_freq_seg1_idx": "155" }
  337. hapd2 = hostapd.add_ap(apdev[1]['ifname'], params, wait_enabled=False)
  338. ev = hapd2.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=5)
  339. if not ev:
  340. raise Exception("AP setup timed out(2)")
  341. if "AP-DISABLED" in ev:
  342. # Assume this failed due to missing regulatory update for now
  343. raise HwsimSkip("80+80 MHz channel not supported in regulatory information")
  344. state = hapd2.get_status_field("state")
  345. if state != "ENABLED":
  346. raise Exception("Unexpected interface state(2)")
  347. dev[1].connect("vht2", key_mgmt="NONE", scan_freq="5180")
  348. hwsim_utils.test_connectivity(dev[1], hapd2)
  349. sig = dev[1].request("SIGNAL_POLL").splitlines()
  350. if "FREQUENCY=5180" not in sig:
  351. raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
  352. if "WIDTH=80+80 MHz" not in sig:
  353. raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
  354. if "CENTER_FRQ1=5210" not in sig:
  355. raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig))
  356. if "CENTER_FRQ2=5775" not in sig:
  357. raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig))
  358. except Exception, e:
  359. if isinstance(e, Exception) and str(e) == "AP startup failed":
  360. if not vht_supported():
  361. raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
  362. raise
  363. finally:
  364. dev[0].request("DISCONNECT")
  365. dev[1].request("DISCONNECT")
  366. if hapd:
  367. hapd.request("DISABLE")
  368. if hapd2:
  369. hapd2.request("DISABLE")
  370. subprocess.call(['iw', 'reg', 'set', '00'])
  371. dev[0].flush_scan_cache()
  372. dev[1].flush_scan_cache()
  373. def test_ap_vht80_csa(dev, apdev):
  374. """VHT with 80 MHz channel width and CSA"""
  375. csa_supported(dev[0])
  376. try:
  377. hapd = None
  378. params = { "ssid": "vht",
  379. "country_code": "US",
  380. "hw_mode": "a",
  381. "channel": "149",
  382. "ht_capab": "[HT40+]",
  383. "ieee80211n": "1",
  384. "ieee80211ac": "1",
  385. "vht_oper_chwidth": "1",
  386. "vht_oper_centr_freq_seg0_idx": "155" }
  387. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  388. dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745")
  389. hwsim_utils.test_connectivity(dev[0], hapd)
  390. hapd.request("CHAN_SWITCH 5 5180 ht vht blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80")
  391. ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10)
  392. if ev is None:
  393. raise Exception("CSA finished event timed out")
  394. if "freq=5180" not in ev:
  395. raise Exception("Unexpected channel in CSA finished event")
  396. time.sleep(0.5)
  397. hwsim_utils.test_connectivity(dev[0], hapd)
  398. hapd.request("CHAN_SWITCH 5 5745")
  399. ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10)
  400. if ev is None:
  401. raise Exception("CSA finished event timed out")
  402. if "freq=5745" not in ev:
  403. raise Exception("Unexpected channel in CSA finished event")
  404. time.sleep(0.5)
  405. hwsim_utils.test_connectivity(dev[0], hapd)
  406. # This CSA to same channel will fail in kernel, so use this only for
  407. # extra code coverage.
  408. hapd.request("CHAN_SWITCH 5 5745")
  409. hapd.wait_event(["AP-CSA-FINISHED"], timeout=1)
  410. except Exception, e:
  411. if isinstance(e, Exception) and str(e) == "AP startup failed":
  412. if not vht_supported():
  413. raise HwsimSkip("80 MHz channel not supported in regulatory information")
  414. raise
  415. finally:
  416. dev[0].request("DISCONNECT")
  417. if hapd:
  418. hapd.request("DISABLE")
  419. subprocess.call(['iw', 'reg', 'set', '00'])
  420. dev[0].flush_scan_cache()
  421. def test_ap_vht_on_24ghz(dev, apdev):
  422. """Subset of VHT features on 2.4 GHz"""
  423. hapd = None
  424. params = { "ssid": "test-vht-2g",
  425. "hw_mode": "g",
  426. "channel": "1",
  427. "ieee80211n": "1",
  428. "vendor_vht": "1",
  429. "vht_capab": "[MAX-MPDU-11454]",
  430. "vht_oper_chwidth": "0",
  431. "vht_oper_centr_freq_seg0_idx": "1"
  432. }
  433. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  434. try:
  435. if "OK" not in dev[0].request("VENDOR_ELEM_ADD 13 dd1300904c0400bf0c3240820feaff0000eaff0000"):
  436. raise Exception("Failed to add vendor element")
  437. dev[0].connect("test-vht-2g", scan_freq="2412", key_mgmt="NONE")
  438. hwsim_utils.test_connectivity(dev[0], hapd)
  439. sta = hapd.get_sta(dev[0].own_addr())
  440. if '[VENDOR_VHT]' not in sta['flags']:
  441. raise Exception("No VENDOR_VHT STA flag")
  442. dev[1].connect("test-vht-2g", scan_freq="2412", key_mgmt="NONE")
  443. sta = hapd.get_sta(dev[1].own_addr())
  444. if '[VENDOR_VHT]' in sta['flags']:
  445. raise Exception("Unexpected VENDOR_VHT STA flag")
  446. finally:
  447. dev[0].request("VENDOR_ELEM_REMOVE 13 *")
  448. def test_prefer_vht40(dev, apdev):
  449. """Preference on VHT40 over HT40"""
  450. try:
  451. hapd2 = None
  452. params = { "ssid": "test",
  453. "country_code": "FI",
  454. "hw_mode": "a",
  455. "channel": "36",
  456. "ieee80211n": "1",
  457. "ht_capab": "[HT40+]" }
  458. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  459. bssid = apdev[0]['bssid']
  460. params = { "ssid": "test",
  461. "country_code": "FI",
  462. "hw_mode": "a",
  463. "channel": "36",
  464. "ieee80211n": "1",
  465. "ieee80211ac": "1",
  466. "ht_capab": "[HT40+]",
  467. "vht_capab": "",
  468. "vht_oper_chwidth": "0",
  469. "vht_oper_centr_freq_seg0_idx": "0",
  470. }
  471. hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
  472. bssid2 = apdev[1]['bssid']
  473. dev[0].scan_for_bss(bssid, freq=5180)
  474. dev[0].scan_for_bss(bssid2, freq=5180)
  475. dev[0].connect("test", scan_freq="5180", key_mgmt="NONE")
  476. if dev[0].get_status_field('bssid') != bssid2:
  477. raise Exception("Unexpected BSS selected")
  478. est = dev[0].get_bss(bssid)['est_throughput']
  479. if est != "135000":
  480. raise Exception("Unexpected BSS0 est_throughput: " + est)
  481. est = dev[0].get_bss(bssid2)['est_throughput']
  482. if est != "135001":
  483. raise Exception("Unexpected BSS1 est_throughput: " + est)
  484. finally:
  485. dev[0].request("DISCONNECT")
  486. if hapd2:
  487. hapd2.request("DISABLE")
  488. subprocess.call(['iw', 'reg', 'set', '00'])
  489. dev[0].flush_scan_cache()