Add a test case that creates a new interface in AP mode. Signed-off-by: Ilan Peer <ilan.peer@xxxxxxxxx> --- tests/hwsim/test_wpas_ctrl.py | 32 ++++++++++++++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 4 +++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py index 1f2daae..a699d8f 100644 --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py @@ -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""" @@ -1478,6 +1479,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") + + 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: diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index ea9894b..abc0ae5 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -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' -- 1.9.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap