tests: wpa_supplicant interface creation in AP mode
Add a test case that creates a new interface in AP mode. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
cadffacb3f
commit
061190308d
2 changed files with 35 additions and 1 deletions
|
@ -16,6 +16,7 @@ import hwsim_utils
|
|||
from hwsim import HWSimRadio
|
||||
from wpasupplicant import WpaSupplicant
|
||||
from utils import alloc_fail
|
||||
from test_wpas_ap import wait_ap_ready
|
||||
|
||||
def test_wpas_ctrl_network(dev):
|
||||
"""wpa_supplicant ctrl_iface network set/get"""
|
||||
|
@ -1490,6 +1491,37 @@ def test_wpas_ctrl_interface_add(dev, apdev):
|
|||
dev[0].global_request("INTERFACE_REMOVE " + ifname)
|
||||
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||
|
||||
def test_wpas_ctrl_interface_add_ap(dev, apdev):
|
||||
"""wpa_supplicant INTERFACE_ADD/REMOVE AP interface"""
|
||||
with HWSimRadio() as (radio, iface):
|
||||
wpas0 = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
wpas0.interface_add(iface)
|
||||
|
||||
ifname = "test-wpas-ap"
|
||||
wpas0.interface_add(ifname, create=True, if_type='ap')
|
||||
wpas = WpaSupplicant(ifname=ifname)
|
||||
|
||||
id = wpas.add_network()
|
||||
wpas.set_network(id, "mode", "2")
|
||||
wpas.set_network_quoted(id, "ssid", "wpas-ap-open")
|
||||
wpas.set_network(id, "key_mgmt", "NONE")
|
||||
wpas.set_network(id, "frequency", "2412")
|
||||
wpas.set_network(id, "scan_freq", "2412")
|
||||
wpas.select_network(id)
|
||||
wait_ap_ready(wpas)
|
||||
|
||||
dev[1].connect("wpas-ap-open", key_mgmt="NONE", scan_freq="2412")
|
||||
dev[2].connect("wpas-ap-open", key_mgmt="NONE", scan_freq="2412")
|
||||
|
||||
hwsim_utils.test_connectivity(wpas, dev[1])
|
||||
hwsim_utils.test_connectivity(dev[1], dev[2])
|
||||
|
||||
dev[1].request("DISCONNECT")
|
||||
dev[2].request("DISCONNECT")
|
||||
dev[1].wait_disconnected()
|
||||
dev[2].wait_disconnected()
|
||||
wpas0.global_request("INTERFACE_REMOVE " + ifname)
|
||||
|
||||
def test_wpas_ctrl_interface_add_many(dev, apdev):
|
||||
"""wpa_supplicant INTERFACE_ADD/REMOVE with vif creation/removal (many)"""
|
||||
try:
|
||||
|
|
|
@ -55,7 +55,7 @@ class WpaSupplicant:
|
|||
|
||||
def interface_add(self, ifname, config="", driver="nl80211",
|
||||
drv_params=None, br_ifname=None, create=False,
|
||||
set_ifname=True, all_params=False):
|
||||
set_ifname=True, all_params=False, if_type=None):
|
||||
try:
|
||||
groups = subprocess.check_output(["id"])
|
||||
group = "admin" if "(admin)" in groups else "adm"
|
||||
|
@ -74,6 +74,8 @@ class WpaSupplicant:
|
|||
if not drv_params:
|
||||
cmd += '\t'
|
||||
cmd += '\tcreate'
|
||||
if if_type:
|
||||
cmd += '\t' + if_type
|
||||
if all_params and not create:
|
||||
if not br_ifname:
|
||||
cmd += '\t'
|
||||
|
|
Loading…
Reference in a new issue