Updated to hostap_2_6
[mech_eap.git] / libeap / tests / hwsim / test_offchannel_tx.py
1 # cfg80211 offchannel TX using remain-on-channel
2 # Copyright (c) 2014, Jouni Malinen <j@w1.fi>
3 #
4 # This software may be distributed under the terms of the BSD license.
5 # See README for more details.
6
7 import logging
8 logger = logging.getLogger()
9
10 import hostapd
11 from wpasupplicant import WpaSupplicant
12 from test_gas import start_ap
13 from test_gas import anqp_get
14 from p2p_utils import *
15
16 def test_offchannel_tx_roc_gas(dev, apdev):
17     """GAS using cfg80211 remain-on-channel for offchannel TX"""
18     start_ap(apdev[0])
19     bssid = apdev[0]['bssid']
20
21     wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
22     wpas.interface_add("wlan5", drv_params="no_offchannel_tx=1")
23     wpas.flush_scan_cache()
24     wpas.scan_for_bss(bssid, freq=2412)
25     anqp_get(wpas, bssid, 263)
26     ev = wpas.wait_event(["GAS-QUERY-DONE"], timeout=10)
27     if ev is None:
28         raise Exception("GAS query timed out")
29     if "result=SUCCESS" not in ev:
30         raise Exception("Unexpected GAS query result")
31
32 def test_offchannel_tx_roc_grpform(dev, apdev):
33     """P2P group formation using cfg80211 remain-on-channel for offchannel TX"""
34     wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
35     wpas.interface_add("wlan5", drv_params="no_offchannel_tx=1")
36
37     [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_freq=2412,
38                                            r_dev=wpas, r_freq=2412)
39     check_grpform_results(i_res, r_res)
40     remove_group(dev[0], wpas)
41
42 def test_offchannel_tx_roc_grpform2(dev, apdev):
43     """P2P group formation(2) using cfg80211 remain-on-channel for offchannel TX"""
44     wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
45     wpas.interface_add("wlan5", drv_params="no_offchannel_tx=1")
46
47     [i_res, r_res] = go_neg_pin_authorized(i_dev=wpas, i_freq=2412,
48                                            r_dev=dev[0], r_freq=2412)
49     check_grpform_results(i_res, r_res)
50     remove_group(dev[0], wpas)