tests: INTERFACE_ADD/REMOVE with vif addition/removal
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
efa232f915
commit
25f2cb618c
2 changed files with 25 additions and 2 deletions
|
@ -10,6 +10,7 @@ import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import hostapd
|
import hostapd
|
||||||
|
import hwsim_utils
|
||||||
from wpasupplicant import WpaSupplicant
|
from wpasupplicant import WpaSupplicant
|
||||||
from utils import alloc_fail
|
from utils import alloc_fail
|
||||||
|
|
||||||
|
@ -1347,3 +1348,18 @@ def test_wpas_ctrl_dump(dev, apdev):
|
||||||
raise Exception("Mismatch in config field " + field)
|
raise Exception("Mismatch in config field " + field)
|
||||||
if "beacon_int" not in vals:
|
if "beacon_int" not in vals:
|
||||||
raise Exception("Missing config field")
|
raise Exception("Missing config field")
|
||||||
|
|
||||||
|
def test_wpas_ctrl_interface_add(dev, apdev):
|
||||||
|
"""wpa_supplicant INTERFACE_ADD/REMOVE with vif creation/removal"""
|
||||||
|
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
|
||||||
|
dev[0].connect("open", key_mgmt="NONE", scan_freq="2412")
|
||||||
|
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||||
|
|
||||||
|
ifname = "test-" + dev[0].ifname
|
||||||
|
dev[0].interface_add(ifname, create=True)
|
||||||
|
wpas = WpaSupplicant(ifname=ifname)
|
||||||
|
wpas.connect("open", key_mgmt="NONE", scan_freq="2412")
|
||||||
|
hwsim_utils.test_connectivity(wpas, hapd)
|
||||||
|
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||||
|
dev[0].global_request("INTERFACE_REMOVE " + ifname)
|
||||||
|
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||||
|
|
|
@ -54,7 +54,7 @@ class WpaSupplicant:
|
||||||
self.ifname = None
|
self.ifname = None
|
||||||
|
|
||||||
def interface_add(self, ifname, config="", driver="nl80211",
|
def interface_add(self, ifname, config="", driver="nl80211",
|
||||||
drv_params=None, br_ifname=None):
|
drv_params=None, br_ifname=None, create=False):
|
||||||
try:
|
try:
|
||||||
groups = subprocess.check_output(["id"])
|
groups = subprocess.check_output(["id"])
|
||||||
group = "admin" if "(admin)" in groups else "adm"
|
group = "admin" if "(admin)" in groups else "adm"
|
||||||
|
@ -67,8 +67,15 @@ class WpaSupplicant:
|
||||||
if not drv_params:
|
if not drv_params:
|
||||||
cmd += '\t'
|
cmd += '\t'
|
||||||
cmd += '\t' + br_ifname
|
cmd += '\t' + br_ifname
|
||||||
|
if create:
|
||||||
|
if not br_ifname:
|
||||||
|
cmd += '\t'
|
||||||
|
if not drv_params:
|
||||||
|
cmd += '\t'
|
||||||
|
cmd += '\tcreate'
|
||||||
if "FAIL" in self.global_request(cmd):
|
if "FAIL" in self.global_request(cmd):
|
||||||
raise Exception("Failed to add a dynamic wpa_supplicant interface")
|
raise Exception("Failed to add a dynamic wpa_supplicant interface")
|
||||||
|
if not create:
|
||||||
self.set_ifname(ifname)
|
self.set_ifname(ifname)
|
||||||
|
|
||||||
def interface_remove(self, ifname):
|
def interface_remove(self, ifname):
|
||||||
|
|
Loading…
Reference in a new issue