tests: FST with RSN
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
86ba832cf2
commit
85eb89fe56
2 changed files with 35 additions and 18 deletions
|
@ -69,30 +69,30 @@ def parse_fst_session_event(ev):
|
||||||
event['reason'] = f.group(1)
|
event['reason'] = f.group(1)
|
||||||
return event
|
return event
|
||||||
|
|
||||||
def start_two_ap_sta_pairs(apdev):
|
def start_two_ap_sta_pairs(apdev, rsn=False):
|
||||||
"""auxiliary function that creates two pairs of APs and STAs"""
|
"""auxiliary function that creates two pairs of APs and STAs"""
|
||||||
ap1 = FstAP(apdev[0]['ifname'], 'fst_11a', 'a',
|
ap1 = FstAP(apdev[0]['ifname'], 'fst_11a', 'a',
|
||||||
fst_test_common.fst_test_def_chan_a,
|
fst_test_common.fst_test_def_chan_a,
|
||||||
fst_test_common.fst_test_def_group,
|
fst_test_common.fst_test_def_group,
|
||||||
fst_test_common.fst_test_def_prio_low,
|
fst_test_common.fst_test_def_prio_low,
|
||||||
fst_test_common.fst_test_def_llt)
|
fst_test_common.fst_test_def_llt, rsn=rsn)
|
||||||
ap1.start()
|
ap1.start()
|
||||||
ap2 = FstAP(apdev[1]['ifname'], 'fst_11g', 'g',
|
ap2 = FstAP(apdev[1]['ifname'], 'fst_11g', 'g',
|
||||||
fst_test_common.fst_test_def_chan_g,
|
fst_test_common.fst_test_def_chan_g,
|
||||||
fst_test_common.fst_test_def_group,
|
fst_test_common.fst_test_def_group,
|
||||||
fst_test_common.fst_test_def_prio_high,
|
fst_test_common.fst_test_def_prio_high,
|
||||||
fst_test_common.fst_test_def_llt)
|
fst_test_common.fst_test_def_llt, rsn=rsn)
|
||||||
ap2.start()
|
ap2.start()
|
||||||
|
|
||||||
sta1 = FstSTA('wlan5',
|
sta1 = FstSTA('wlan5',
|
||||||
fst_test_common.fst_test_def_group,
|
fst_test_common.fst_test_def_group,
|
||||||
fst_test_common.fst_test_def_prio_low,
|
fst_test_common.fst_test_def_prio_low,
|
||||||
fst_test_common.fst_test_def_llt)
|
fst_test_common.fst_test_def_llt, rsn=rsn)
|
||||||
sta1.start()
|
sta1.start()
|
||||||
sta2 = FstSTA('wlan6',
|
sta2 = FstSTA('wlan6',
|
||||||
fst_test_common.fst_test_def_group,
|
fst_test_common.fst_test_def_group,
|
||||||
fst_test_common.fst_test_def_prio_high,
|
fst_test_common.fst_test_def_prio_high,
|
||||||
fst_test_common.fst_test_def_llt)
|
fst_test_common.fst_test_def_llt, rsn=rsn)
|
||||||
sta2.start()
|
sta2.start()
|
||||||
|
|
||||||
return ap1, ap2, sta1, sta2
|
return ap1, ap2, sta1, sta2
|
||||||
|
@ -103,11 +103,17 @@ def stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2):
|
||||||
ap1.stop()
|
ap1.stop()
|
||||||
ap2.stop()
|
ap2.stop()
|
||||||
|
|
||||||
def connect_two_ap_sta_pairs(ap1, ap2, dev1, dev2):
|
def connect_two_ap_sta_pairs(ap1, ap2, dev1, dev2, rsn=False):
|
||||||
"""Connects a pair of stations, each one to a separate AP"""
|
"""Connects a pair of stations, each one to a separate AP"""
|
||||||
dev1.scan(freq=fst_test_common.fst_test_def_freq_a)
|
dev1.scan(freq=fst_test_common.fst_test_def_freq_a)
|
||||||
dev2.scan(freq=fst_test_common.fst_test_def_freq_g)
|
dev2.scan(freq=fst_test_common.fst_test_def_freq_g)
|
||||||
|
|
||||||
|
if rsn:
|
||||||
|
dev1.connect(ap1, psk="12345678",
|
||||||
|
scan_freq=fst_test_common.fst_test_def_freq_a)
|
||||||
|
dev2.connect(ap2, psk="12345678",
|
||||||
|
scan_freq=fst_test_common.fst_test_def_freq_g)
|
||||||
|
else:
|
||||||
dev1.connect(ap1, key_mgmt="NONE",
|
dev1.connect(ap1, key_mgmt="NONE",
|
||||||
scan_freq=fst_test_common.fst_test_def_freq_a)
|
scan_freq=fst_test_common.fst_test_def_freq_a)
|
||||||
dev2.connect(ap2, key_mgmt="NONE",
|
dev2.connect(ap2, key_mgmt="NONE",
|
||||||
|
@ -145,7 +151,7 @@ def disconnect_external_sta(sta, ap, check_disconnect=True):
|
||||||
# FST functionality.
|
# FST functionality.
|
||||||
#
|
#
|
||||||
class FstDevice:
|
class FstDevice:
|
||||||
def __init__(self, iface, fst_group, fst_pri, fst_llt=None):
|
def __init__(self, iface, fst_group, fst_pri, fst_llt=None, rsn=False):
|
||||||
self.iface = iface
|
self.iface = iface
|
||||||
self.fst_group = fst_group
|
self.fst_group = fst_group
|
||||||
self.fst_pri = fst_pri
|
self.fst_pri = fst_pri
|
||||||
|
@ -158,6 +164,7 @@ class FstDevice:
|
||||||
s = self.grequest("FST-MANAGER TEST_REQUEST IS_SUPPORTED")
|
s = self.grequest("FST-MANAGER TEST_REQUEST IS_SUPPORTED")
|
||||||
if not s.startswith('OK'):
|
if not s.startswith('OK'):
|
||||||
raise utils.HwsimSkip("FST not supported")
|
raise utils.HwsimSkip("FST not supported")
|
||||||
|
self.rsn = rsn
|
||||||
|
|
||||||
def ifname(self):
|
def ifname(self):
|
||||||
return self.iface
|
return self.iface
|
||||||
|
@ -571,7 +578,7 @@ class FstDevice:
|
||||||
#
|
#
|
||||||
class FstAP (FstDevice):
|
class FstAP (FstDevice):
|
||||||
def __init__(self, iface, ssid, mode, chan, fst_group, fst_pri,
|
def __init__(self, iface, ssid, mode, chan, fst_group, fst_pri,
|
||||||
fst_llt=None):
|
fst_llt=None, rsn=False):
|
||||||
"""If fst_group is empty, then FST parameters will not be set
|
"""If fst_group is empty, then FST parameters will not be set
|
||||||
If fst_llt is empty, the parameter will not be set and the default value
|
If fst_llt is empty, the parameter will not be set and the default value
|
||||||
is expected to be configured."""
|
is expected to be configured."""
|
||||||
|
@ -581,7 +588,7 @@ class FstAP (FstDevice):
|
||||||
self.reg_ctrl = fst_test_common.HapdRegCtrl()
|
self.reg_ctrl = fst_test_common.HapdRegCtrl()
|
||||||
self.reg_ctrl.add_ap(iface, self.chan)
|
self.reg_ctrl.add_ap(iface, self.chan)
|
||||||
self.global_instance = hostapd.HostapdGlobal()
|
self.global_instance = hostapd.HostapdGlobal()
|
||||||
FstDevice.__init__(self, iface, fst_group, fst_pri, fst_llt)
|
FstDevice.__init__(self, iface, fst_group, fst_pri, fst_llt, rsn)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Starts AP the "standard" way as it was intended by hostapd tests.
|
"""Starts AP the "standard" way as it was intended by hostapd tests.
|
||||||
|
@ -592,6 +599,11 @@ class FstAP (FstDevice):
|
||||||
params['hw_mode'] = self.mode
|
params['hw_mode'] = self.mode
|
||||||
params['channel'] = self.chan
|
params['channel'] = self.chan
|
||||||
params['country_code'] = 'US'
|
params['country_code'] = 'US'
|
||||||
|
if self.rsn:
|
||||||
|
params['wpa'] = '2'
|
||||||
|
params['wpa_key_mgmt'] = 'WPA-PSK'
|
||||||
|
params['rsn_pairwise'] = 'CCMP'
|
||||||
|
params['wpa_passphrase'] = '12345678'
|
||||||
self.hapd=hostapd.add_ap(self.iface, params)
|
self.hapd=hostapd.add_ap(self.iface, params)
|
||||||
if not self.hapd.ping():
|
if not self.hapd.ping():
|
||||||
raise Exception("Could not ping FST hostapd")
|
raise Exception("Could not ping FST hostapd")
|
||||||
|
@ -661,11 +673,11 @@ class FstAP (FstDevice):
|
||||||
# FstSTA class
|
# FstSTA class
|
||||||
#
|
#
|
||||||
class FstSTA (FstDevice):
|
class FstSTA (FstDevice):
|
||||||
def __init__(self, iface, fst_group, fst_pri, fst_llt=None):
|
def __init__(self, iface, fst_group, fst_pri, fst_llt=None, rsn=False):
|
||||||
"""If fst_group is empty, then FST parameters will not be set
|
"""If fst_group is empty, then FST parameters will not be set
|
||||||
If fst_llt is empty, the parameter will not be set and the default value
|
If fst_llt is empty, the parameter will not be set and the default value
|
||||||
is expected to be configured."""
|
is expected to be configured."""
|
||||||
FstDevice.__init__(self, iface, fst_group, fst_pri, fst_llt)
|
FstDevice.__init__(self, iface, fst_group, fst_pri, fst_llt, rsn)
|
||||||
self.connected = None # FstAP object the station is connected to
|
self.connected = None # FstAP object the station is connected to
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
|
@ -325,17 +325,18 @@ def fst_initiate_session(apdev, test_params, bad_param_type, init_on_ap):
|
||||||
else:
|
else:
|
||||||
print "Failure. Unexpected exception"
|
print "Failure. Unexpected exception"
|
||||||
|
|
||||||
def fst_transfer_session(apdev, test_params, bad_param_type, init_on_ap):
|
def fst_transfer_session(apdev, test_params, bad_param_type, init_on_ap,
|
||||||
|
rsn=False):
|
||||||
"""This function makes the necessary preparations and then adds, sets,
|
"""This function makes the necessary preparations and then adds, sets,
|
||||||
initiates and attempts to transfer a session using either correct or
|
initiates and attempts to transfer a session using either correct or
|
||||||
incorrect parameters at each stage depending on the value of bad_param_type.
|
incorrect parameters at each stage depending on the value of bad_param_type.
|
||||||
If the call ends as expected the function silently exits. Otherwise, it
|
If the call ends as expected the function silently exits. Otherwise, it
|
||||||
throws an exception thus failing the test."""
|
throws an exception thus failing the test."""
|
||||||
ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
|
ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev, rsn=rsn)
|
||||||
bad_parameter_detected = False
|
bad_parameter_detected = False
|
||||||
exception_already_raised = False
|
exception_already_raised = False
|
||||||
try:
|
try:
|
||||||
fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
|
fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2, rsn=rsn)
|
||||||
# This call makes sure FstHostapd singleton object is created and, as a
|
# This call makes sure FstHostapd singleton object is created and, as a
|
||||||
# result, the global control interface is registered (this is done from
|
# result, the global control interface is registered (this is done from
|
||||||
# the constructor).
|
# the constructor).
|
||||||
|
@ -1770,3 +1771,7 @@ def test_fst_sta_remove_session_bad_session_id(dev, apdev, test_params):
|
||||||
"""FST STA remove session - bad session id"""
|
"""FST STA remove session - bad session id"""
|
||||||
fst_remove_session(apdev, test_params, remove_scenario_bad_session_id,
|
fst_remove_session(apdev, test_params, remove_scenario_bad_session_id,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
|
def test_fst_rsn_ap_transfer_session(dev, apdev, test_params):
|
||||||
|
"""FST RSN AP transfer session"""
|
||||||
|
fst_transfer_session(apdev, test_params, bad_param_none, True, rsn=True)
|
||||||
|
|
Loading…
Reference in a new issue