aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hwsim/test_fst_config.py
blob: 0c0107cb2cdc0e8559faa5e39da4098cbc77aad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# FST configuration tests
# Copyright (c) 2015, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.

import logging
logger = logging.getLogger()
import subprocess
import time
import os
import signal
import hostapd
import wpasupplicant
import utils

import fst_test_common

class FstLauncherConfig:
    """FstLauncherConfig class represents configuration to be used for
    FST config tests related hostapd/wpa_supplicant instances"""
    def __init__(self, iface, fst_group, fst_pri, fst_llt=None):
        self.iface = iface
        self.fst_group = fst_group
        self.fst_pri = fst_pri
        self.fst_llt = fst_llt # None llt means no llt parameter will be set

    def ifname(self):
        return self.iface

    def is_ap(self):
        """Returns True if the configuration is for AP, otherwise - False"""
        raise Exception("Virtual is_ap() called!")

    def to_file(self, pathname):
        """Creates configuration file to be used by FST config tests related
        hostapd/wpa_supplicant instances"""
        raise Exception("Virtual to_file() called!")

class FstLauncherConfigAP(FstLauncherConfig):
    """FstLauncherConfigAP class represents configuration to be used for
    FST config tests related hostapd instance"""
    def __init__(self, iface, ssid, mode, chan, fst_group, fst_pri,
                 fst_llt=None):
        self.ssid = ssid
        self.mode = mode
        self.chan = chan
        FstLauncherConfig.__init__(self, iface, fst_group, fst_pri, fst_llt)

    def is_ap(self):
        return True

    def get_channel(self):
        return self.chan

    def to_file(self, pathname):
        """Creates configuration file to be used by FST config tests related
        hostapd instance"""
        with open(pathname, "w") as f:
            f.write("country_code=US\n"
                    "interface=%s\n"
                    "ctrl_interface=/var/run/hostapd\n"
                    "ssid=%s\n"
                    "channel=%s\n"
                    "hw_mode=%s\n"
                    "ieee80211n=1\n" % (self.iface, self.ssid, self.chan,
                                        self.mode))
            if len(self.fst_group) != 0:
                f.write("fst_group_id=%s\n"
                        "fst_priority=%s\n" % (self.fst_group, self.fst_pri))
                if self.fst_llt is not None:
                    f.write("fst_llt=%s\n" % self.fst_llt)
        with open(pathname, "r") as f:
            logger.debug("wrote hostapd config file %s:\n%s" % (pathname,
                                                                f.read()))

class FstLauncherConfigSTA(FstLauncherConfig):
    """FstLauncherConfig class represents configuration to be used for
    FST config tests related wpa_supplicant instance"""
    def __init__(self, iface, fst_group, fst_pri, fst_llt=None):
        FstLauncherConfig.__init__(self, iface, fst_group, fst_pri, fst_llt)

    def is_ap(self):
        return False

    def to_file(self, pathname):
        """Creates configuration file to be used by FST config tests related
        wpa_supplicant instance"""
        with open(pathname, "w") as f:
            f.write("ctrl_interface=DIR=/var/run/wpa_supplicant\n"
                "p2p_no_group_iface=1\n")
            if len(self.fst_group) != 0:
                f.write("fst_group_id=%s\n"
                    "fst_priority=%s\n" % (self.fst_group, self.fst_pri))
                if self.fst_llt is not None:
                    f.write("fst_llt=%s\n" % self.fst_llt)
        with open(pathname, "r") as f:
            logger.debug("wrote wpa_supplicant config file %s:\n%s" % (pathname, f.read()))

class FstLauncher:
    """FstLauncher class is responsible for launching and cleaning up of FST
    config tests related hostapd/wpa_supplicant instances"""
    def __init__(self, logpath):
        self.logger = logging.getLogger()
        self.fst_logpath = logpath
        self.cfgs_to_run = []
        self.hapd_fst_global = '/var/run/hostapd-fst-global'
        self.wsup_fst_global = '/tmp/fststa'
        self.nof_aps = 0
        self.nof_stas = 0
        self.reg_ctrl = fst_test_common.HapdRegCtrl()
        self.test_is_supported()

    def __del__(self):
        self.cleanup()

    @staticmethod
    def test_is_supported():
        h = hostapd.HostapdGlobal()
        resp = h.request("FST-MANAGER TEST_REQUEST IS_SUPPORTED")
        if not resp.startswith("OK"):
            raise utils.HwsimSkip("FST not supported")
        w = wpasupplicant.WpaSupplicant(global_iface='/tmp/wpas-wlan5')
        resp = w.global_request("FST-MANAGER TEST_REQUEST IS_SUPPORTED")
        if not resp.startswith("OK"):
            raise utils.HwsimSkip("FST not supported")

    def get_cfg_pathname(self, cfg):
        """Returns pathname of ifname based configuration file"""
        return self.fst_logpath +'/'+ cfg.ifname() + '.conf'

    def add_cfg(self, cfg):
        """Adds configuration to be used for launching hostapd/wpa_supplicant
        instances"""
        if cfg not in self.cfgs_to_run:
            self.cfgs_to_run.append(cfg)
        if cfg.is_ap() == True:
            self.nof_aps += 1
        else:
            self.nof_stas += 1

    def remove_cfg(self, cfg):
        """Removes configuration previously added with add_cfg"""
        if cfg in self.cfgs_to_run:
            self.cfgs_to_run.remove(cfg)
        if cfg.is_ap() == True:
            self.nof_aps -= 1
        else:
            self.nof_stas -= 1
        config_file = self.get_cfg_pathname(cfg)
        if os.path.exists(config_file):
            os.remove(config_file)

    def run_hostapd(self):
        """Lauches hostapd with interfaces configured according to
        FstLauncherConfigAP configurations added"""
        if self.nof_aps == 0:
            raise Exception("No FST APs to start")
        pidfile = self.fst_logpath + '/' + 'myhostapd.pid'
        mylogfile = self.fst_logpath + '/' + 'fst-hostapd'
        prg = os.path.join(self.fst_logpath,
                           'alt-hostapd/hostapd/hostapd')
        if not os.path.exists(prg):
            prg = '../../hostapd/hostapd'
        cmd = [ prg, '-B', '-dddt',
                '-P', pidfile, '-f', mylogfile, '-g', self.hapd_fst_global]
        for i in range(0, len(self.cfgs_to_run)):
            cfg = self.cfgs_to_run[i]
            if cfg.is_ap() == True:
                cfgfile = self.get_cfg_pathname(cfg)
                cfg.to_file(cfgfile)
                cmd.append(cfgfile)
                self.reg_ctrl.add_ap(cfg.ifname(), cfg.get_channel())
        self.logger.debug("Starting fst hostapd: " + ' '.join(cmd))
        res = subprocess.call(cmd)
        self.logger.debug("fst hostapd start result: %d" % res)
        if res == 0:
            self.reg_ctrl.start()
        return res

    def run_wpa_supplicant(self):
        """Lauches wpa_supplicant with interfaces configured according to
        FstLauncherConfigSTA configurations added"""
        if self.nof_stas == 0:
            raise Exception("No FST STAs to start")
        pidfile = self.fst_logpath + '/' + 'mywpa_supplicant.pid'
        mylogfile = self.fst_logpath + '/' + 'fst-wpa_supplicant'
        prg = os.path.join(self.fst_logpath,
                           'alt-wpa_supplicant/wpa_supplicant/wpa_supplicant')
        if not os.path.exists(prg):
            prg = '../../wpa_supplicant/wpa_supplicant'
        cmd = [ prg, '-B', '-dddt',
                '-P' + pidfile, '-f', mylogfile, '-g', self.wsup_fst_global ]
        sta_no = 0
        for i in range(0, len(self.cfgs_to_run)):
            cfg = self.cfgs_to_run[i]
            if cfg.is_ap() == False:
                cfgfile = self.get_cfg_pathname(cfg)
                cfg.to_file(cfgfile)
                cmd.append('-c' + cfgfile)
                cmd.append('-i' + cfg.ifname())
                cmd.append('-Dnl80211')
                if sta_no != self.nof_stas -1:
                    cmd.append('-N')    # Next station configuration
                sta_no += 1
        self.logger.debug("Starting fst supplicant: " + ' '.join(cmd))
        res = subprocess.call(cmd)
        self.logger.debug("fst supplicant start result: %d" % res)
        return res

    def cleanup(self):
        """Terminates hostapd/wpa_supplicant processes previously launched with
        run_hostapd/run_wpa_supplicant"""
        pidfile = self.fst_logpath + '/' + 'myhostapd.pid'
        self.kill_pid(pidfile, self.nof_aps > 0)
        pidfile = self.fst_logpath + '/' + 'mywpa_supplicant.pid'
        self.kill_pid(pidfile, self.nof_stas > 0)
        self.reg_ctrl.stop()
        while len(self.cfgs_to_run) != 0:
            cfg = self.cfgs_to_run[0]
            self.remove_cfg(cfg)
        fst_test_common.fst_clear_regdom()

    def kill_pid(self, pidfile, try_again=False):
        """Kills process by PID file"""
        if not os.path.exists(pidfile):
            if not try_again:
                return
            # It might take some time for the process to write the PID file,
            # so wait a bit longer before giving up.
            self.logger.info("kill_pid: pidfile %s does not exist - try again after a second" % pidfile)
            time.sleep(1)
            if not os.path.exists(pidfile):
                self.logger.info("kill_pid: pidfile %s does not exist - could not kill the process" % pidfile)
                return
        pid = -1
        try:
            for i in range(3):
                pf = file(pidfile, 'r')
                pidtxt = pf.read().strip()
                self.logger.debug("kill_pid: %s: '%s'" % (pidfile, pidtxt))
                pf.close()
                try:
                    pid = int(pidtxt)
                    break
                except Exception as e:
                    self.logger.debug("kill_pid: No valid PID found: %s" % str(e))
                    time.sleep(1)
            self.logger.debug("kill_pid %s --> pid %d" % (pidfile, pid))
            os.kill(pid, signal.SIGTERM)
            for i in range(10):
                try:
                    # Poll the pid (Is the process still existing?)
                    os.kill(pid, 0)
                except OSError:
                    # No, already done
                    break
                # Wait and check again
                time.sleep(1)
        except Exception as e:
            self.logger.debug("Didn't stop the pid=%d. Was it stopped already? (%s)" % (pid, str(e)))


def parse_ies(iehex, el=-1):
    """Parses the information elements hex string 'iehex' in format
    "0a0b0c0d0e0f". If no 'el' defined just checks the IE string for integrity.
    If 'el' is defined returns the list of hex values of the specific IE (or
    empty list if the element is not in the string."""
    iel = [iehex[i:i + 2] for i in range(0, len(iehex), 2)]
    for i in range(0, len(iel)):
         iel[i] = int(iel[i], 16)
    # Sanity check
    i = 0
    res = []
    while i < len(iel):
        logger.debug("IE found: %x" % iel[i])
        if el != -1 and el == iel[i]:
            res = iel[i + 2:i + 2 + iel[i + 1]]
        i += 2 + iel[i + 1]
    if i != len(iel):
        logger.error("Bad IE string: " + iehex)
        res = []
    return res

def scan_and_get_bss(dev, frq):
    """Issues a scan on given device on given frequency, returns the bss info
    dictionary ('ssid','ie','flags', etc.) or None. Note, the function
    implies there is only one AP on the given channel. If not a case,
    the function must be changed to call dev.get_bss() till the AP with the
    [b]ssid that we need is found"""
    dev.scan(freq=frq)
    return dev.get_bss('0')


# AP configuration tests

def run_test_ap_configuration(apdev, test_params,
                              fst_group = fst_test_common.fst_test_def_group,
                              fst_pri = fst_test_common.fst_test_def_prio_high,
                              fst_llt = fst_test_common.fst_test_def_llt):
    """Runs FST hostapd where the 1st AP configuration is fixed, the 2nd fst
    configuration is provided by the parameters. Returns the result of the run:
    0 - no errors discovered, an error otherwise. The function is used for
    simplek "bad configuration" tests."""
    logdir = test_params['logdir']
    fst_launcher = FstLauncher(logdir)
    ap1 = FstLauncherConfigAP(apdev[0]['ifname'], 'fst_goodconf', 'a',
                              fst_test_common.fst_test_def_chan_a,
                              fst_test_common.fst_test_def_group,
                              fst_test_common.fst_test_def_prio_low,
                              fst_test_common.fst_test_def_llt)
    ap2 = FstLauncherConfigAP(apdev[1]['ifname'], 'fst_badconf', 'b',
                              fst_test_common.fst_test_def_chan_g, fst_group,
                              fst_pri, fst_llt)
    fst_launcher.add_cfg(ap1)
    fst_launcher.add_cfg(ap2)
    res = fst_launcher.run_hostapd()
    return res

def run_test_sta_configuration(test_params,
                               fst_group = fst_test_common.fst_test_def_group,
                               fst_pri = fst_test_common.fst_test_def_prio_high,
                               fst_llt = fst_test_common.fst_test_def_llt):
    """Runs FST wpa_supplicant where the 1st STA configuration is fixed, the
    2nd fst configuration is provided by the parameters. Returns the result of
    the run: 0 - no errors discovered, an error otherwise. The function is used
    for simple "bad configuration" tests."""
    logdir = test_params['logdir']
    fst_launcher = FstLauncher(logdir)
    sta1 = FstLauncherConfigSTA('wlan5',
                                fst_test_common.fst_test_def_group,
                                fst_test_common.fst_test_def_prio_low,
                                fst_test_common.fst_test_def_llt)
    sta2 = FstLauncherConfigSTA('wlan6', fst_group, fst_pri, fst_llt)
    fst_launcher.add_cfg(sta1)
    fst_launcher.add_cfg(sta2)
    res = fst_launcher.run_wpa_supplicant()
    return res

def test_fst_ap_config_llt_neg(dev, apdev, test_params):
    """FST AP configuration negative LLT"""
    res = run_test_ap_configuration(apdev, test_params, fst_llt = '-1')
    if res == 0:
        raise Exception("hostapd started with a negative llt")

def test_fst_ap_config_llt_zero(dev, apdev, test_params):
    """FST AP configuration zero LLT"""
    res = run_test_ap_configuration(apdev, test_params, fst_llt = '0')
    if res == 0:
        raise Exception("hostapd started with a zero llt")

def test_fst_ap_config_llt_too_big(dev, apdev, test_params):
    """FST AP configuration LLT is too big"""
    res = run_test_ap_configuration(apdev, test_params,
                                    fst_llt = '4294967296') #0x100000000
    if res == 0:
        raise Exception("hostapd started with llt that is too big")

def test_fst_ap_config_llt_nan(dev, apdev, test_params):
    """FST AP configuration LLT is not a number"""
    res = run_test_ap_configuration(apdev, test_params, fst_llt = 'nan')
    if res == 0:
        raise Exception("hostapd started with llt not a number")

def test_fst_ap_config_pri_neg(dev, apdev, test_params):
    """FST AP configuration Priority negative"""
    res = run_test_ap_configuration(apdev, test_params, fst_pri = '-1')
    if res == 0:
        raise Exception("hostapd started with a negative fst priority")

def test_fst_ap_config_pri_zero(dev, apdev, test_params):
    """FST AP configuration Priority zero"""
    res = run_test_ap_configuration(apdev, test_params, fst_pri = '0')
    if res == 0:
        raise Exception("hostapd started with a zero fst priority")

def test_fst_ap_config_pri_large(dev, apdev, test_params):
    """FST AP configuration Priority too large"""
    res = run_test_ap_configuration(apdev, test_params, fst_pri = '256')
    if res == 0:
        raise Exception("hostapd started with too large fst priority")

def test_fst_ap_config_pri_nan(dev, apdev, test_params):
    """FST AP configuration Priority not a number"""
    res = run_test_ap_configuration(apdev, test_params, fst_pri = 'nan')
    if res == 0:
        raise Exception("hostapd started with fst priority not a number")

def test_fst_ap_config_group_len(dev, apdev, test_params):
    """FST AP configuration Group max length"""
    res = run_test_ap_configuration(apdev, test_params,
                                    fst_group = 'fstg5678abcd34567')
    if res == 0:
        raise Exception("hostapd started with fst_group length too big")

def test_fst_ap_config_good(dev, apdev, test_params):
    """FST AP configuration good parameters"""
    res = run_test_ap_configuration(apdev, test_params)
    if res != 0:
        raise Exception("hostapd didn't start with valid config parameters")

def test_fst_ap_config_default(dev, apdev, test_params):
    """FST AP configuration default parameters"""
    res = run_test_ap_configuration(apdev, test_params, fst_llt = None)
    if res != 0:
        raise Exception("hostapd didn't start with valid config parameters")


# STA configuration tests

def test_fst_sta_config_llt_neg(dev, apdev, test_params):
    """FST STA configuration negative LLT"""
    res = run_test_sta_configuration(test_params, fst_llt = '-1')
    if res == 0:
        raise Exception("wpa_supplicant started with a negative llt")

def test_fst_sta_config_llt_zero(dev, apdev, test_params):
    """FST STA configuration zero LLT"""
    res = run_test_sta_configuration(test_params, fst_llt = '0')
    if res == 0:
        raise Exception("wpa_supplicant started with a zero llt")

def test_fst_sta_config_llt_large(dev, apdev, test_params):
    """FST STA configuration LLT is too large"""
    res = run_test_sta_configuration(test_params,
                                     fst_llt = '4294967296') #0x100000000
    if res == 0:
        raise Exception("wpa_supplicant started with llt that is too large")

def test_fst_sta_config_llt_nan(dev, apdev, test_params):
    """FST STA configuration LLT is not a number"""
    res = run_test_sta_configuration(test_params, fst_llt = 'nan')
    if res == 0:
        raise Exception("wpa_supplicant started with llt not a number")

def test_fst_sta_config_pri_neg(dev, apdev, test_params):
    """FST STA configuration Priority negative"""
    res = run_test_sta_configuration(test_params, fst_pri = '-1')
    if res == 0:
        raise Exception("wpa_supplicant started with a negative fst priority")

def test_fst_sta_config_pri_zero(dev, apdev, test_params):
    """FST STA configuration Priority zero"""
    res = run_test_sta_configuration(test_params, fst_pri = '0')
    if res == 0:
        raise Exception("wpa_supplicant started with a zero fst priority")

def test_fst_sta_config_pri_big(dev, apdev, test_params):
    """FST STA configuration Priority too large"""
    res = run_test_sta_configuration(test_params, fst_pri = '256')
    if res == 0:
        raise Exception("wpa_supplicant started with too large fst priority")

def test_fst_sta_config_pri_nan(dev, apdev, test_params):
    """FST STA configuration Priority not a number"""
    res = run_test_sta_configuration(test_params, fst_pri = 'nan')
    if res == 0:
        raise Exception("wpa_supplicant started with fst priority not a number")

def test_fst_sta_config_group_len(dev, apdev, test_params):
    """FST STA configuration Group max length"""
    res = run_test_sta_configuration(test_params,
                                     fst_group = 'fstg5678abcd34567')
    if res == 0:
        raise Exception("wpa_supplicant started with fst_group length too big")

def test_fst_sta_config_good(dev, apdev, test_params):
    """FST STA configuration good parameters"""
    res = run_test_sta_configuration(test_params)
    if res != 0:
        raise Exception("wpa_supplicant didn't start with valid config parameters")

def test_fst_sta_config_default(dev, apdev, test_params):
    """FST STA configuration default parameters"""
    res = run_test_sta_configuration(test_params, fst_llt = None)
    if res != 0:
        raise Exception("wpa_supplicant didn't start with valid config parameters")

def test_fst_scan_mb(dev, apdev, test_params):
    """FST scan valid MB IE presence with normal start"""
    logdir = test_params['logdir']

    # Test valid MB IE in scan results
    fst_launcher = FstLauncher(logdir)
    ap1 = FstLauncherConfigAP(apdev[0]['ifname'], 'fst_11a', 'a',
                              fst_test_common.fst_test_def_chan_a,
                              fst_test_common.fst_test_def_group,
                              fst_test_common.fst_test_def_prio_high)
    ap2 = FstLauncherConfigAP(apdev[1]['ifname'], 'fst_11g', 'b',
                              fst_test_common.fst_test_def_chan_g,
                              fst_test_common.fst_test_def_group,
                              fst_test_common.fst_test_def_prio_low)
    fst_launcher.add_cfg(ap1)
    fst_launcher.add_cfg(ap2)
    res = fst_launcher.run_hostapd()
    if res != 0:
        raise Exception("hostapd didn't start properly")
    try:
        mbie1=[]
        flags1 = ''
        mbie2=[]
        flags2 = ''
        # Scan 1st AP
        vals1 = scan_and_get_bss(dev[0], fst_test_common.fst_test_def_freq_a)
        if vals1 != None:
            if 'ie' in vals1:
                mbie1 = parse_ies(vals1['ie'], 0x9e)
            if 'flags' in vals1:
                flags1 = vals1['flags']
        # Scan 2nd AP
        vals2 = scan_and_get_bss(dev[2], fst_test_common.fst_test_def_freq_g)
        if vals2 != None:
            if 'ie' in vals2:
                mbie2 = parse_ies(vals2['ie'],0x9e)
            if 'flags' in vals2:
                flags2 = vals2['flags']
    finally:
         fst_launcher.cleanup()

    if len(mbie1) == 0:
        raise Exception("No MB IE created by 1st AP")
    if len(mbie2) == 0:
        raise Exception("No MB IE created by 2nd AP")

def test_fst_scan_nomb(dev, apdev, test_params):
    """FST scan no MB IE presence with 1 AP start"""
    logdir = test_params['logdir']

    # Test valid MB IE in scan results
    fst_launcher = FstLauncher(logdir)
    ap1 = FstLauncherConfigAP(apdev[0]['ifname'], 'fst_11a', 'a',
                              fst_test_common.fst_test_def_chan_a,
                              fst_test_common.fst_test_def_group,
                              fst_test_common.fst_test_def_prio_high)
    fst_launcher.add_cfg(ap1)
    res = fst_launcher.run_hostapd()
    if res != 0:
        raise Exception("Hostapd didn't start properly")
    try:
        time.sleep(2)
        mbie1=[]
        flags1 = ''
        vals1 = scan_and_get_bss(dev[0], fst_test_common.fst_test_def_freq_a)
        if vals1 != None:
            if 'ie' in vals1:
                mbie1 = parse_ies(vals1['ie'], 0x9e)
            if 'flags' in vals1:
                flags1 = vals1['flags']
    finally:
        fst_launcher.cleanup()

    if len(mbie1) != 0:
        raise Exception("MB IE exists with 1 AP")