event['reason'] = f.group(1)
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"""
ap1 = FstAP(apdev[0]['ifname'], 'fst_11a', 'a',
fst_test_common.fst_test_def_chan_a,
fst_test_common.fst_test_def_group,
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()
ap2 = FstAP(apdev[1]['ifname'], 'fst_11g', 'g',
fst_test_common.fst_test_def_chan_g,
fst_test_common.fst_test_def_group,
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()
sta1 = FstSTA('wlan5',
fst_test_common.fst_test_def_group,
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()
sta2 = FstSTA('wlan6',
fst_test_common.fst_test_def_group,
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()
return ap1, ap2, sta1, sta2
ap1.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"""
dev1.scan(freq=fst_test_common.fst_test_def_freq_a)
dev2.scan(freq=fst_test_common.fst_test_def_freq_g)
- dev1.connect(ap1, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_a)
- dev2.connect(ap2, key_mgmt="NONE",
- 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",
+ scan_freq=fst_test_common.fst_test_def_freq_a)
+ dev2.connect(ap2, key_mgmt="NONE",
+ scan_freq=fst_test_common.fst_test_def_freq_g)
def disconnect_two_ap_sta_pairs(ap1, ap2, dev1, dev2):
dev1.disconnect()
# FST functionality.
#
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.fst_group = fst_group
self.fst_pri = fst_pri
s = self.grequest("FST-MANAGER TEST_REQUEST IS_SUPPORTED")
if not s.startswith('OK'):
raise utils.HwsimSkip("FST not supported")
+ self.rsn = rsn
def ifname(self):
return self.iface
#
class FstAP (FstDevice):
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_llt is empty, the parameter will not be set and the default value
is expected to be configured."""
self.reg_ctrl = fst_test_common.HapdRegCtrl()
self.reg_ctrl.add_ap(iface, self.chan)
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):
"""Starts AP the "standard" way as it was intended by hostapd tests.
params['hw_mode'] = self.mode
params['channel'] = self.chan
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)
if not self.hapd.ping():
raise Exception("Could not ping FST hostapd")
# FstSTA class
#
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_llt is empty, the parameter will not be set and the default value
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
def start(self):
else:
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,
initiates and attempts to transfer a session using either correct or
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
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
exception_already_raised = False
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
# result, the global control interface is registered (this is done from
# the constructor).
"""FST STA remove session - bad session id"""
fst_remove_session(apdev, test_params, remove_scenario_bad_session_id,
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)