1 # hostapd control interface
2 # Copyright (c) 2014, Qualcomm Atheros, Inc.
4 # This software may be distributed under the terms of the BSD license.
5 # See README for more details.
9 def test_hapd_ctrl_status(dev, apdev):
10 """hostapd ctrl_iface STATUS commands"""
12 bssid = apdev[0]['bssid']
13 params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
14 hapd = hostapd.add_ap(apdev[0]['ifname'], params)
15 status = hapd.get_status()
16 driver = hapd.get_driver_status()
18 if status['bss[0]'] != apdev[0]['ifname']:
19 raise Exception("Unexpected bss[0]")
20 if status['ssid[0]'] != ssid:
21 raise Exception("Unexpected ssid[0]")
22 if status['bssid[0]'] != bssid:
23 raise Exception("Unexpected bssid[0]")
24 if status['freq'] != "2412":
25 raise Exception("Unexpected freq")
27 if driver['beacon_set'] != "1":
28 raise Exception("Unexpected beacon_set")
29 if driver['addr'] != bssid:
30 raise Exception("Unexpected addr")
32 def test_hapd_ctrl_p2p_manager(dev, apdev):
33 """hostapd as P2P Device manager"""
35 passphrase = "12345678"
36 params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
37 params['manage_p2p'] = '1'
38 params['allow_cross_connection'] = '0'
39 hapd = hostapd.add_ap(apdev[0]['ifname'], params)
40 dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
41 addr = dev[0].p2p_dev_addr()
42 if "OK" not in hapd.request("DEAUTHENTICATE " + addr + " p2p=2"):
43 raise Exception("DEAUTHENTICATE command failed")
44 ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=5)
46 raise Exception("Disconnection event timed out")