]> git.ipfire.org Git - thirdparty/hostap.git/blame - tests/hwsim/test_fst_config.py
tests: Fix ap_ft_reassoc_replay for case where wlantest has the PSK
[thirdparty/hostap.git] / tests / hwsim / test_fst_config.py
CommitLineData
41a256ec
AN
1# FST configuration tests
2# Copyright (c) 2015, Qualcomm Atheros, Inc.
3#
4# This software may be distributed under the terms of the BSD license.
5# See README for more details.
6
7import logging
8logger = logging.getLogger()
9import subprocess
10import time
11import os
12import signal
13import hostapd
14import wpasupplicant
15import utils
16
17import fst_test_common
18
19class FstLauncherConfig:
20 """FstLauncherConfig class represents configuration to be used for
21 FST config tests related hostapd/wpa_supplicant instances"""
22 def __init__(self, iface, fst_group, fst_pri, fst_llt=None):
23 self.iface = iface
24 self.fst_group = fst_group
25 self.fst_pri = fst_pri
26 self.fst_llt = fst_llt # None llt means no llt parameter will be set
27
28 def ifname(self):
29 return self.iface
30
31 def is_ap(self):
32 """Returns True if the configuration is for AP, otherwise - False"""
33 raise Exception("Virtual is_ap() called!")
34
35 def to_file(self, pathname):
36 """Creates configuration file to be used by FST config tests related
37 hostapd/wpa_supplicant instances"""
38 raise Exception("Virtual to_file() called!")
39
40class FstLauncherConfigAP(FstLauncherConfig):
41 """FstLauncherConfigAP class represents configuration to be used for
42 FST config tests related hostapd instance"""
43 def __init__(self, iface, ssid, mode, chan, fst_group, fst_pri,
44 fst_llt=None):
45 self.ssid = ssid
46 self.mode = mode
47 self.chan = chan
48 FstLauncherConfig.__init__(self, iface, fst_group, fst_pri, fst_llt)
49
50 def is_ap(self):
51 return True
52
53 def get_channel(self):
54 return self.chan
55
56 def to_file(self, pathname):
57 """Creates configuration file to be used by FST config tests related
58 hostapd instance"""
59 with open(pathname, "w") as f:
60 f.write("country_code=US\n"
61 "interface=%s\n"
62 "ctrl_interface=/var/run/hostapd\n"
63 "ssid=%s\n"
64 "channel=%s\n"
65 "hw_mode=%s\n"
66 "ieee80211n=1\n" % (self.iface, self.ssid, self.chan,
67 self.mode))
68 if len(self.fst_group) != 0:
69 f.write("fst_group_id=%s\n"
70 "fst_priority=%s\n" % (self.fst_group, self.fst_pri))
71 if self.fst_llt is not None:
72 f.write("fst_llt=%s\n" % self.fst_llt)
73 with open(pathname, "r") as f:
74 logger.debug("wrote hostapd config file %s:\n%s" % (pathname,
75 f.read()))
76
77class FstLauncherConfigSTA(FstLauncherConfig):
78 """FstLauncherConfig class represents configuration to be used for
79 FST config tests related wpa_supplicant instance"""
80 def __init__(self, iface, fst_group, fst_pri, fst_llt=None):
81 FstLauncherConfig.__init__(self, iface, fst_group, fst_pri, fst_llt)
82
83 def is_ap(self):
84 return False
85
86 def to_file(self, pathname):
87 """Creates configuration file to be used by FST config tests related
88 wpa_supplicant instance"""
89 with open(pathname, "w") as f:
90 f.write("ctrl_interface=DIR=/var/run/wpa_supplicant\n"
91 "p2p_no_group_iface=1\n")
92 if len(self.fst_group) != 0:
93 f.write("fst_group_id=%s\n"
94 "fst_priority=%s\n" % (self.fst_group, self.fst_pri))
95 if self.fst_llt is not None:
96 f.write("fst_llt=%s\n" % self.fst_llt)
97 with open(pathname, "r") as f:
98 logger.debug("wrote wpa_supplicant config file %s:\n%s" % (pathname, f.read()))
99
100class FstLauncher:
101 """FstLauncher class is responsible for launching and cleaning up of FST
102 config tests related hostapd/wpa_supplicant instances"""
103 def __init__(self, logpath):
104 self.logger = logging.getLogger()
105 self.fst_logpath = logpath
106 self.cfgs_to_run = []
107 self.hapd_fst_global = '/var/run/hostapd-fst-global'
108 self.wsup_fst_global = '/tmp/fststa'
109 self.nof_aps = 0
110 self.nof_stas = 0
111 self.reg_ctrl = fst_test_common.HapdRegCtrl()
112 self.test_is_supported()
113
114 def __del__(self):
115 self.cleanup()
116
117 @staticmethod
118 def test_is_supported():
119 h = hostapd.HostapdGlobal()
120 resp = h.request("FST-MANAGER TEST_REQUEST IS_SUPPORTED")
121 if not resp.startswith("OK"):
122 raise utils.HwsimSkip("FST not supported")
123 w = wpasupplicant.WpaSupplicant(global_iface='/tmp/wpas-wlan5')
124 resp = w.global_request("FST-MANAGER TEST_REQUEST IS_SUPPORTED")
125 if not resp.startswith("OK"):
126 raise utils.HwsimSkip("FST not supported")
127
128 def get_cfg_pathname(self, cfg):
129 """Returns pathname of ifname based configuration file"""
130 return self.fst_logpath +'/'+ cfg.ifname() + '.conf'
131
132 def add_cfg(self, cfg):
133 """Adds configuration to be used for launching hostapd/wpa_supplicant
134 instances"""
135 if cfg not in self.cfgs_to_run:
136 self.cfgs_to_run.append(cfg)
137 if cfg.is_ap() == True:
138 self.nof_aps += 1
139 else:
140 self.nof_stas += 1
141
142 def remove_cfg(self, cfg):
143 """Removes configuration previously added with add_cfg"""
144 if cfg in self.cfgs_to_run:
145 self.cfgs_to_run.remove(cfg)
146 if cfg.is_ap() == True:
147 self.nof_aps -= 1
148 else:
149 self.nof_stas -= 1
bc6e3288 150 config_file = self.get_cfg_pathname(cfg)
41a256ec
AN
151 if os.path.exists(config_file):
152 os.remove(config_file)
153
154 def run_hostapd(self):
155 """Lauches hostapd with interfaces configured according to
156 FstLauncherConfigAP configurations added"""
157 if self.nof_aps == 0:
158 raise Exception("No FST APs to start")
159 pidfile = self.fst_logpath + '/' + 'myhostapd.pid'
160 mylogfile = self.fst_logpath + '/' + 'fst-hostapd'
7b7e8a2e
JM
161 prg = os.path.join(self.fst_logpath,
162 'alt-hostapd/hostapd/hostapd')
163 if not os.path.exists(prg):
164 prg = '../../hostapd/hostapd'
fab49f61
JM
165 cmd = [prg, '-B', '-dddt',
166 '-P', pidfile, '-f', mylogfile, '-g', self.hapd_fst_global]
41a256ec
AN
167 for i in range(0, len(self.cfgs_to_run)):
168 cfg = self.cfgs_to_run[i]
169 if cfg.is_ap() == True:
170 cfgfile = self.get_cfg_pathname(cfg)
171 cfg.to_file(cfgfile)
172 cmd.append(cfgfile)
173 self.reg_ctrl.add_ap(cfg.ifname(), cfg.get_channel())
174 self.logger.debug("Starting fst hostapd: " + ' '.join(cmd))
175 res = subprocess.call(cmd)
176 self.logger.debug("fst hostapd start result: %d" % res)
177 if res == 0:
178 self.reg_ctrl.start()
179 return res
180
181 def run_wpa_supplicant(self):
182 """Lauches wpa_supplicant with interfaces configured according to
183 FstLauncherConfigSTA configurations added"""
184 if self.nof_stas == 0:
185 raise Exception("No FST STAs to start")
186 pidfile = self.fst_logpath + '/' + 'mywpa_supplicant.pid'
187 mylogfile = self.fst_logpath + '/' + 'fst-wpa_supplicant'
7b7e8a2e
JM
188 prg = os.path.join(self.fst_logpath,
189 'alt-wpa_supplicant/wpa_supplicant/wpa_supplicant')
190 if not os.path.exists(prg):
191 prg = '../../wpa_supplicant/wpa_supplicant'
fab49f61
JM
192 cmd = [prg, '-B', '-dddt',
193 '-P' + pidfile, '-f', mylogfile, '-g', self.wsup_fst_global]
41a256ec
AN
194 sta_no = 0
195 for i in range(0, len(self.cfgs_to_run)):
196 cfg = self.cfgs_to_run[i]
197 if cfg.is_ap() == False:
198 cfgfile = self.get_cfg_pathname(cfg)
199 cfg.to_file(cfgfile)
200 cmd.append('-c' + cfgfile)
201 cmd.append('-i' + cfg.ifname())
202 cmd.append('-Dnl80211')
203 if sta_no != self.nof_stas -1:
204 cmd.append('-N') # Next station configuration
205 sta_no += 1
206 self.logger.debug("Starting fst supplicant: " + ' '.join(cmd))
207 res = subprocess.call(cmd)
208 self.logger.debug("fst supplicant start result: %d" % res)
209 return res
210
211 def cleanup(self):
212 """Terminates hostapd/wpa_supplicant processes previously launched with
213 run_hostapd/run_wpa_supplicant"""
214 pidfile = self.fst_logpath + '/' + 'myhostapd.pid'
f27b9277 215 self.kill_pid(pidfile, self.nof_aps > 0)
41a256ec 216 pidfile = self.fst_logpath + '/' + 'mywpa_supplicant.pid'
f27b9277 217 self.kill_pid(pidfile, self.nof_stas > 0)
41a256ec
AN
218 self.reg_ctrl.stop()
219 while len(self.cfgs_to_run) != 0:
220 cfg = self.cfgs_to_run[0]
221 self.remove_cfg(cfg)
003716ec 222 fst_test_common.fst_clear_regdom()
41a256ec 223
f27b9277 224 def kill_pid(self, pidfile, try_again=False):
41a256ec
AN
225 """Kills process by PID file"""
226 if not os.path.exists(pidfile):
f27b9277
JM
227 if not try_again:
228 return
229 # It might take some time for the process to write the PID file,
230 # so wait a bit longer before giving up.
231 self.logger.info("kill_pid: pidfile %s does not exist - try again after a second" % pidfile)
232 time.sleep(1)
233 if not os.path.exists(pidfile):
234 self.logger.info("kill_pid: pidfile %s does not exist - could not kill the process" % pidfile)
235 return
41a256ec
AN
236 pid = -1
237 try:
d952f021 238 for i in range(3):
e50c58e5 239 pf = open(pidfile, 'r')
d952f021
JM
240 pidtxt = pf.read().strip()
241 self.logger.debug("kill_pid: %s: '%s'" % (pidfile, pidtxt))
242 pf.close()
243 try:
244 pid = int(pidtxt)
245 break
bab493b9 246 except Exception as e:
d952f021
JM
247 self.logger.debug("kill_pid: No valid PID found: %s" % str(e))
248 time.sleep(1)
41a256ec
AN
249 self.logger.debug("kill_pid %s --> pid %d" % (pidfile, pid))
250 os.kill(pid, signal.SIGTERM)
251 for i in range(10):
252 try:
253 # Poll the pid (Is the process still existing?)
254 os.kill(pid, 0)
255 except OSError:
256 # No, already done
257 break
258 # Wait and check again
259 time.sleep(1)
bab493b9 260 except Exception as e:
41a256ec
AN
261 self.logger.debug("Didn't stop the pid=%d. Was it stopped already? (%s)" % (pid, str(e)))
262
263
264def parse_ies(iehex, el=-1):
265 """Parses the information elements hex string 'iehex' in format
266 "0a0b0c0d0e0f". If no 'el' defined just checks the IE string for integrity.
267 If 'el' is defined returns the list of hex values of the specific IE (or
268 empty list if the element is not in the string."""
269 iel = [iehex[i:i + 2] for i in range(0, len(iehex), 2)]
270 for i in range(0, len(iel)):
271 iel[i] = int(iel[i], 16)
272 # Sanity check
273 i = 0
274 res = []
275 while i < len(iel):
276 logger.debug("IE found: %x" % iel[i])
277 if el != -1 and el == iel[i]:
278 res = iel[i + 2:i + 2 + iel[i + 1]]
279 i += 2 + iel[i + 1]
280 if i != len(iel):
281 logger.error("Bad IE string: " + iehex)
282 res = []
283 return res
284
285def scan_and_get_bss(dev, frq):
286 """Issues a scan on given device on given frequency, returns the bss info
287 dictionary ('ssid','ie','flags', etc.) or None. Note, the function
288 implies there is only one AP on the given channel. If not a case,
289 the function must be changed to call dev.get_bss() till the AP with the
290 [b]ssid that we need is found"""
291 dev.scan(freq=frq)
292 return dev.get_bss('0')
293
294
295# AP configuration tests
296
297def run_test_ap_configuration(apdev, test_params,
fab49f61
JM
298 fst_group=fst_test_common.fst_test_def_group,
299 fst_pri=fst_test_common.fst_test_def_prio_high,
300 fst_llt=fst_test_common.fst_test_def_llt):
41a256ec
AN
301 """Runs FST hostapd where the 1st AP configuration is fixed, the 2nd fst
302 configuration is provided by the parameters. Returns the result of the run:
303 0 - no errors discovered, an error otherwise. The function is used for
304 simplek "bad configuration" tests."""
305 logdir = test_params['logdir']
306 fst_launcher = FstLauncher(logdir)
307 ap1 = FstLauncherConfigAP(apdev[0]['ifname'], 'fst_goodconf', 'a',
308 fst_test_common.fst_test_def_chan_a,
309 fst_test_common.fst_test_def_group,
310 fst_test_common.fst_test_def_prio_low,
311 fst_test_common.fst_test_def_llt)
312 ap2 = FstLauncherConfigAP(apdev[1]['ifname'], 'fst_badconf', 'b',
313 fst_test_common.fst_test_def_chan_g, fst_group,
314 fst_pri, fst_llt)
315 fst_launcher.add_cfg(ap1)
316 fst_launcher.add_cfg(ap2)
317 res = fst_launcher.run_hostapd()
318 return res
319
320def run_test_sta_configuration(test_params,
fab49f61
JM
321 fst_group=fst_test_common.fst_test_def_group,
322 fst_pri=fst_test_common.fst_test_def_prio_high,
323 fst_llt=fst_test_common.fst_test_def_llt):
41a256ec
AN
324 """Runs FST wpa_supplicant where the 1st STA configuration is fixed, the
325 2nd fst configuration is provided by the parameters. Returns the result of
326 the run: 0 - no errors discovered, an error otherwise. The function is used
327 for simple "bad configuration" tests."""
328 logdir = test_params['logdir']
329 fst_launcher = FstLauncher(logdir)
330 sta1 = FstLauncherConfigSTA('wlan5',
331 fst_test_common.fst_test_def_group,
332 fst_test_common.fst_test_def_prio_low,
333 fst_test_common.fst_test_def_llt)
334 sta2 = FstLauncherConfigSTA('wlan6', fst_group, fst_pri, fst_llt)
335 fst_launcher.add_cfg(sta1)
336 fst_launcher.add_cfg(sta2)
337 res = fst_launcher.run_wpa_supplicant()
338 return res
339
340def test_fst_ap_config_llt_neg(dev, apdev, test_params):
341 """FST AP configuration negative LLT"""
fab49f61 342 res = run_test_ap_configuration(apdev, test_params, fst_llt='-1')
41a256ec
AN
343 if res == 0:
344 raise Exception("hostapd started with a negative llt")
345
346def test_fst_ap_config_llt_zero(dev, apdev, test_params):
347 """FST AP configuration zero LLT"""
fab49f61 348 res = run_test_ap_configuration(apdev, test_params, fst_llt='0')
41a256ec
AN
349 if res == 0:
350 raise Exception("hostapd started with a zero llt")
351
352def test_fst_ap_config_llt_too_big(dev, apdev, test_params):
353 """FST AP configuration LLT is too big"""
354 res = run_test_ap_configuration(apdev, test_params,
fab49f61 355 fst_llt='4294967296') #0x100000000
41a256ec
AN
356 if res == 0:
357 raise Exception("hostapd started with llt that is too big")
358
359def test_fst_ap_config_llt_nan(dev, apdev, test_params):
360 """FST AP configuration LLT is not a number"""
fab49f61 361 res = run_test_ap_configuration(apdev, test_params, fst_llt='nan')
41a256ec
AN
362 if res == 0:
363 raise Exception("hostapd started with llt not a number")
364
365def test_fst_ap_config_pri_neg(dev, apdev, test_params):
366 """FST AP configuration Priority negative"""
fab49f61 367 res = run_test_ap_configuration(apdev, test_params, fst_pri='-1')
41a256ec
AN
368 if res == 0:
369 raise Exception("hostapd started with a negative fst priority")
370
371def test_fst_ap_config_pri_zero(dev, apdev, test_params):
372 """FST AP configuration Priority zero"""
fab49f61 373 res = run_test_ap_configuration(apdev, test_params, fst_pri='0')
41a256ec
AN
374 if res == 0:
375 raise Exception("hostapd started with a zero fst priority")
376
377def test_fst_ap_config_pri_large(dev, apdev, test_params):
378 """FST AP configuration Priority too large"""
fab49f61 379 res = run_test_ap_configuration(apdev, test_params, fst_pri='256')
41a256ec
AN
380 if res == 0:
381 raise Exception("hostapd started with too large fst priority")
382
383def test_fst_ap_config_pri_nan(dev, apdev, test_params):
384 """FST AP configuration Priority not a number"""
fab49f61 385 res = run_test_ap_configuration(apdev, test_params, fst_pri='nan')
41a256ec
AN
386 if res == 0:
387 raise Exception("hostapd started with fst priority not a number")
388
389def test_fst_ap_config_group_len(dev, apdev, test_params):
390 """FST AP configuration Group max length"""
391 res = run_test_ap_configuration(apdev, test_params,
fab49f61 392 fst_group='fstg5678abcd34567')
41a256ec
AN
393 if res == 0:
394 raise Exception("hostapd started with fst_group length too big")
395
396def test_fst_ap_config_good(dev, apdev, test_params):
397 """FST AP configuration good parameters"""
398 res = run_test_ap_configuration(apdev, test_params)
399 if res != 0:
400 raise Exception("hostapd didn't start with valid config parameters")
401
402def test_fst_ap_config_default(dev, apdev, test_params):
403 """FST AP configuration default parameters"""
fab49f61 404 res = run_test_ap_configuration(apdev, test_params, fst_llt=None)
41a256ec
AN
405 if res != 0:
406 raise Exception("hostapd didn't start with valid config parameters")
407
408
409# STA configuration tests
410
411def test_fst_sta_config_llt_neg(dev, apdev, test_params):
412 """FST STA configuration negative LLT"""
fab49f61 413 res = run_test_sta_configuration(test_params, fst_llt='-1')
41a256ec
AN
414 if res == 0:
415 raise Exception("wpa_supplicant started with a negative llt")
416
417def test_fst_sta_config_llt_zero(dev, apdev, test_params):
418 """FST STA configuration zero LLT"""
fab49f61 419 res = run_test_sta_configuration(test_params, fst_llt='0')
41a256ec
AN
420 if res == 0:
421 raise Exception("wpa_supplicant started with a zero llt")
422
423def test_fst_sta_config_llt_large(dev, apdev, test_params):
424 """FST STA configuration LLT is too large"""
425 res = run_test_sta_configuration(test_params,
fab49f61 426 fst_llt='4294967296') #0x100000000
41a256ec
AN
427 if res == 0:
428 raise Exception("wpa_supplicant started with llt that is too large")
429
430def test_fst_sta_config_llt_nan(dev, apdev, test_params):
431 """FST STA configuration LLT is not a number"""
fab49f61 432 res = run_test_sta_configuration(test_params, fst_llt='nan')
41a256ec
AN
433 if res == 0:
434 raise Exception("wpa_supplicant started with llt not a number")
435
436def test_fst_sta_config_pri_neg(dev, apdev, test_params):
437 """FST STA configuration Priority negative"""
fab49f61 438 res = run_test_sta_configuration(test_params, fst_pri='-1')
41a256ec
AN
439 if res == 0:
440 raise Exception("wpa_supplicant started with a negative fst priority")
441
442def test_fst_sta_config_pri_zero(dev, apdev, test_params):
443 """FST STA configuration Priority zero"""
fab49f61 444 res = run_test_sta_configuration(test_params, fst_pri='0')
41a256ec
AN
445 if res == 0:
446 raise Exception("wpa_supplicant started with a zero fst priority")
447
448def test_fst_sta_config_pri_big(dev, apdev, test_params):
449 """FST STA configuration Priority too large"""
fab49f61 450 res = run_test_sta_configuration(test_params, fst_pri='256')
41a256ec
AN
451 if res == 0:
452 raise Exception("wpa_supplicant started with too large fst priority")
453
454def test_fst_sta_config_pri_nan(dev, apdev, test_params):
455 """FST STA configuration Priority not a number"""
fab49f61 456 res = run_test_sta_configuration(test_params, fst_pri='nan')
41a256ec
AN
457 if res == 0:
458 raise Exception("wpa_supplicant started with fst priority not a number")
459
460def test_fst_sta_config_group_len(dev, apdev, test_params):
461 """FST STA configuration Group max length"""
462 res = run_test_sta_configuration(test_params,
fab49f61 463 fst_group='fstg5678abcd34567')
41a256ec
AN
464 if res == 0:
465 raise Exception("wpa_supplicant started with fst_group length too big")
466
467def test_fst_sta_config_good(dev, apdev, test_params):
468 """FST STA configuration good parameters"""
469 res = run_test_sta_configuration(test_params)
470 if res != 0:
471 raise Exception("wpa_supplicant didn't start with valid config parameters")
472
473def test_fst_sta_config_default(dev, apdev, test_params):
474 """FST STA configuration default parameters"""
fab49f61 475 res = run_test_sta_configuration(test_params, fst_llt=None)
41a256ec
AN
476 if res != 0:
477 raise Exception("wpa_supplicant didn't start with valid config parameters")
478
479def test_fst_scan_mb(dev, apdev, test_params):
480 """FST scan valid MB IE presence with normal start"""
481 logdir = test_params['logdir']
482
483 # Test valid MB IE in scan results
484 fst_launcher = FstLauncher(logdir)
485 ap1 = FstLauncherConfigAP(apdev[0]['ifname'], 'fst_11a', 'a',
486 fst_test_common.fst_test_def_chan_a,
487 fst_test_common.fst_test_def_group,
488 fst_test_common.fst_test_def_prio_high)
489 ap2 = FstLauncherConfigAP(apdev[1]['ifname'], 'fst_11g', 'b',
490 fst_test_common.fst_test_def_chan_g,
491 fst_test_common.fst_test_def_group,
492 fst_test_common.fst_test_def_prio_low)
493 fst_launcher.add_cfg(ap1)
494 fst_launcher.add_cfg(ap2)
495 res = fst_launcher.run_hostapd()
496 if res != 0:
497 raise Exception("hostapd didn't start properly")
498 try:
fab49f61 499 mbie1 = []
41a256ec 500 flags1 = ''
fab49f61 501 mbie2 = []
41a256ec
AN
502 flags2 = ''
503 # Scan 1st AP
504 vals1 = scan_and_get_bss(dev[0], fst_test_common.fst_test_def_freq_a)
505 if vals1 != None:
506 if 'ie' in vals1:
507 mbie1 = parse_ies(vals1['ie'], 0x9e)
508 if 'flags' in vals1:
509 flags1 = vals1['flags']
510 # Scan 2nd AP
511 vals2 = scan_and_get_bss(dev[2], fst_test_common.fst_test_def_freq_g)
512 if vals2 != None:
513 if 'ie' in vals2:
fab49f61 514 mbie2 = parse_ies(vals2['ie'], 0x9e)
41a256ec
AN
515 if 'flags' in vals2:
516 flags2 = vals2['flags']
517 finally:
518 fst_launcher.cleanup()
519
520 if len(mbie1) == 0:
521 raise Exception("No MB IE created by 1st AP")
522 if len(mbie2) == 0:
523 raise Exception("No MB IE created by 2nd AP")
524
525def test_fst_scan_nomb(dev, apdev, test_params):
526 """FST scan no MB IE presence with 1 AP start"""
527 logdir = test_params['logdir']
528
529 # Test valid MB IE in scan results
530 fst_launcher = FstLauncher(logdir)
531 ap1 = FstLauncherConfigAP(apdev[0]['ifname'], 'fst_11a', 'a',
532 fst_test_common.fst_test_def_chan_a,
533 fst_test_common.fst_test_def_group,
534 fst_test_common.fst_test_def_prio_high)
535 fst_launcher.add_cfg(ap1)
536 res = fst_launcher.run_hostapd()
537 if res != 0:
538 raise Exception("Hostapd didn't start properly")
539 try:
540 time.sleep(2)
fab49f61 541 mbie1 = []
41a256ec
AN
542 flags1 = ''
543 vals1 = scan_and_get_bss(dev[0], fst_test_common.fst_test_def_freq_a)
544 if vals1 != None:
545 if 'ie' in vals1:
546 mbie1 = parse_ies(vals1['ie'], 0x9e)
547 if 'flags' in vals1:
548 flags1 = vals1['flags']
549 finally:
550 fst_launcher.cleanup()
551
552 if len(mbie1) != 0:
553 raise Exception("MB IE exists with 1 AP")