1 # FST functionality tests
2 # Copyright (c) 2015, Qualcomm Atheros, Inc.
4 # This software may be distributed under the terms of the BSD license.
5 # See README for more details.
8 logger
= logging
.getLogger()
14 from hwsim
import HWSimRadio
16 import fst_test_common
18 from utils
import alloc_fail
20 #enum - bad parameter types
22 bad_param_session_add_no_params
= 1
23 bad_param_group_id
= 2
24 bad_param_session_set_no_params
= 3
25 bad_param_session_set_unknown_param
= 4
26 bad_param_session_id
= 5
27 bad_param_old_iface
= 6
28 bad_param_new_iface
= 7
29 bad_param_negative_llt
= 8
30 bad_param_zero_llt
= 9
31 bad_param_llt_too_big
= 10
32 bad_param_llt_nan
= 11
33 bad_param_peer_addr
= 12
34 bad_param_session_initiate_no_params
= 13
35 bad_param_session_initiate_bad_session_id
= 14
36 bad_param_session_initiate_with_no_new_iface_set
= 15
37 bad_param_session_initiate_with_bad_peer_addr_set
= 16
38 bad_param_session_initiate_request_with_bad_stie
= 17
39 bad_param_session_initiate_response_with_reject
= 18
40 bad_param_session_initiate_response_with_bad_stie
= 19
41 bad_param_session_initiate_response_with_zero_llt
= 20
42 bad_param_session_initiate_stt_no_response
= 21
43 bad_param_session_initiate_concurrent_setup_request
= 22
44 bad_param_session_transfer_no_params
= 23
45 bad_param_session_transfer_bad_session_id
= 24
46 bad_param_session_transfer_setup_skipped
= 25
47 bad_param_session_teardown_no_params
= 26
48 bad_param_session_teardown_bad_session_id
= 27
49 bad_param_session_teardown_setup_skipped
= 28
50 bad_param_session_teardown_bad_fsts_id
= 29
52 bad_param_names
= ("None",
53 "No params passed to session add",
55 "No params passed to session set",
56 "Unknown param passed to session set",
63 "LLT is not a number",
65 "No params passed to session initiate",
67 "No new_iface was set",
69 "Request with bad st ie",
70 "Response with reject",
71 "Response with bad st ie",
72 "Response with zero llt",
74 "Concurrent setup request",
75 "No params passed to session transfer",
77 "Session setup skipped",
78 "No params passed to session teardown",
80 "Session setup skipped",
83 def fst_start_session(apdev
, test_params
, bad_param_type
, start_on_ap
,
85 """This function makes the necessary preparations and the adds and sets a
86 session using either correct or incorrect parameters depending on the value
87 of bad_param_type. If the call ends as expected (with session being
88 successfully added and set in case of correct parameters or with the
89 expected exception in case of incorrect parameters), the function silently
90 exits. Otherwise, it throws an exception thus failing the test."""
92 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
93 bad_parameter_detected
= False
94 exception_already_raised
= False
96 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
100 new_iface
= ap2
.ifname()
101 new_peer_addr
= ap2
.get_actual_peer_addr()
105 new_iface
= sta2
.ifname()
106 new_peer_addr
= sta2
.get_actual_peer_addr()
107 initiator
.add_peer(responder
, peer_addr
, new_peer_addr
)
109 if bad_param_type
== bad_param_group_id
:
111 elif bad_param_type
== bad_param_session_add_no_params
:
113 initiator
.set_fst_parameters(group_id
=group_id
)
114 sid
= initiator
.add_session()
115 if bad_param_type
== bad_param_session_set_no_params
:
116 res
= initiator
.set_session_param(None)
117 if not res
.startswith("OK"):
118 raise Exception("Session set operation failed")
119 elif bad_param_type
== bad_param_session_set_unknown_param
:
120 res
= initiator
.set_session_param("bad_param=1")
121 if not res
.startswith("OK"):
122 raise Exception("Session set operation failed")
124 if bad_param_type
== bad_param_session_initiate_with_no_new_iface_set
:
126 elif bad_param_type
== bad_param_new_iface
:
128 old_iface
= None if bad_param_type
!= bad_param_old_iface
else 'wlan12'
130 if bad_param_type
== bad_param_negative_llt
:
132 elif bad_param_type
== bad_param_zero_llt
:
134 elif bad_param_type
== bad_param_llt_too_big
:
135 llt
= '4294967296' #0x100000000
136 elif bad_param_type
== bad_param_llt_nan
:
138 elif bad_param_type
== bad_param_session_id
:
140 initiator
.set_fst_parameters(llt
=llt
)
141 initiator
.configure_session(sid
, new_iface
, old_iface
)
143 if e
.args
[0].startswith("Cannot add FST session with groupid"):
144 if bad_param_type
== bad_param_group_id
or bad_param_type
== bad_param_session_add_no_params
:
145 bad_parameter_detected
= True
146 elif e
.args
[0].startswith("Cannot set FST session new_ifname:"):
147 if bad_param_type
== bad_param_new_iface
:
148 bad_parameter_detected
= True
149 elif e
.args
[0].startswith("Session set operation failed"):
150 if (bad_param_type
== bad_param_session_set_no_params
or
151 bad_param_type
== bad_param_session_set_unknown_param
):
152 bad_parameter_detected
= True
153 elif e
.args
[0].startswith("Cannot set FST session old_ifname:"):
154 if (bad_param_type
== bad_param_old_iface
or
155 bad_param_type
== bad_param_session_id
or
156 bad_param_type
== bad_param_session_set_no_params
):
157 bad_parameter_detected
= True
158 elif e
.args
[0].startswith("Cannot set FST session llt:"):
159 if (bad_param_type
== bad_param_negative_llt
or
160 bad_param_type
== bad_param_llt_too_big
or
161 bad_param_type
== bad_param_llt_nan
):
162 bad_parameter_detected
= True
163 elif e
.args
[0].startswith("Cannot set FST session peer address:"):
164 if bad_param_type
== bad_param_peer_addr
:
165 bad_parameter_detected
= True
166 if not bad_parameter_detected
:
167 # The exception was unexpected
169 exception_already_raised
= True
172 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
173 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
174 if not exception_already_raised
:
175 if bad_parameter_detected
:
176 logger
.info("Success. Bad parameter was detected (%s)" % bad_param_names
[bad_param_type
])
178 if bad_param_type
== bad_param_none
or bad_param_type
== bad_param_zero_llt
:
179 logger
.info("Success. Session added and set")
182 if bad_param_type
== bad_param_peer_addr
:
183 exception_text
= "Failure. Bad parameter was not detected (Peer address == %s)" % ap1
.get_new_peer_addr()
185 exception_text
= "Failure. Bad parameter was not detected (%s)" % bad_param_names
[bad_param_type
]
186 raise Exception(exception_text
)
188 print "Failure. Unexpected exception"
190 def fst_initiate_session(apdev
, test_params
, bad_param_type
, init_on_ap
):
191 """This function makes the necessary preparations and then adds, sets and
192 initiates a session using either correct or incorrect parameters at each
193 stage depending on the value of bad_param_type. If the call ends as expected
194 (with session being successfully added, set and initiated in case of correct
195 parameters or with the expected exception in case of incorrect parameters),
196 the function silently exits. Otherwise it throws an exception thus failing
198 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
199 bad_parameter_detected
= False
200 exception_already_raised
= False
202 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
203 # This call makes sure FstHostapd singleton object is created and, as a
204 # result, the global control interface is registered (this is done from
206 ap1
.get_global_instance()
210 new_iface
= ap2
.ifname() if bad_param_type
!= bad_param_session_initiate_with_no_new_iface_set
else None
211 new_peer_addr
= ap2
.get_actual_peer_addr()
212 resp_newif
= sta2
.ifname()
216 new_iface
= sta2
.ifname() if bad_param_type
!= bad_param_session_initiate_with_no_new_iface_set
else None
217 new_peer_addr
= sta2
.get_actual_peer_addr()
218 resp_newif
= ap2
.ifname()
219 peeraddr
= None if bad_param_type
!= bad_param_session_initiate_with_bad_peer_addr_set
else '10:DE:AD:DE:AD:11'
220 initiator
.add_peer(responder
, peeraddr
, new_peer_addr
)
221 if bad_param_type
== bad_param_session_initiate_response_with_zero_llt
:
222 initiator
.set_fst_parameters(llt
='0')
223 sid
= initiator
.add_session()
224 initiator
.configure_session(sid
, new_iface
)
225 if bad_param_type
== bad_param_session_initiate_no_params
:
227 elif bad_param_type
== bad_param_session_initiate_bad_session_id
:
229 if bad_param_type
== bad_param_session_initiate_request_with_bad_stie
:
230 actual_fsts_id
= initiator
.get_fsts_id_by_sid(sid
)
231 initiator
.send_test_session_setup_request(str(actual_fsts_id
), "bad_new_band")
232 responder
.wait_for_session_event(5)
233 elif bad_param_type
== bad_param_session_initiate_response_with_reject
:
234 initiator
.send_session_setup_request(sid
)
235 initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
236 setup_event
= responder
.wait_for_session_event(5, [],
238 if not 'id' in setup_event
:
239 raise Exception("No session id in FST setup event")
240 responder
.send_session_setup_response(str(setup_event
['id']),
242 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
243 if event
['new_state'] != "INITIAL" or event
['reason'] != "REASON_REJECT":
244 raise Exception("Response with reject not handled as expected")
245 bad_parameter_detected
= True
246 elif bad_param_type
== bad_param_session_initiate_response_with_bad_stie
:
247 initiator
.send_session_setup_request(sid
)
248 initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
249 responder
.wait_for_session_event(5, [], ['EVENT_FST_SETUP'])
250 actual_fsts_id
= initiator
.get_fsts_id_by_sid(sid
)
251 responder
.send_test_session_setup_response(str(actual_fsts_id
),
252 "accept", "bad_new_band")
253 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
254 if event
['new_state'] != "INITIAL" or event
['reason'] != "REASON_ERROR_PARAMS":
255 raise Exception("Response with bad STIE not handled as expected")
256 bad_parameter_detected
= True
257 elif bad_param_type
== bad_param_session_initiate_response_with_zero_llt
:
258 initiator
.initiate_session(sid
, "accept")
259 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
260 if event
['new_state'] != "TRANSITION_DONE":
261 raise Exception("Response reception for a session with llt=0 not handled as expected")
262 bad_parameter_detected
= True
263 elif bad_param_type
== bad_param_session_initiate_stt_no_response
:
264 initiator
.send_session_setup_request(sid
)
265 initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
266 responder
.wait_for_session_event(5, [], ['EVENT_FST_SETUP'])
267 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
268 if event
['new_state'] != "INITIAL" or event
['reason'] != "REASON_STT":
269 raise Exception("No response scenario not handled as expected")
270 bad_parameter_detected
= True
271 elif bad_param_type
== bad_param_session_initiate_concurrent_setup_request
:
272 responder
.add_peer(initiator
)
273 resp_sid
= responder
.add_session()
274 responder
.configure_session(resp_sid
, resp_newif
)
275 initiator
.send_session_setup_request(sid
)
276 actual_fsts_id
= initiator
.get_fsts_id_by_sid(sid
)
277 responder
.send_test_session_setup_request(str(actual_fsts_id
))
278 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
279 initiator_addr
= initiator
.get_own_mac_address()
280 responder_addr
= responder
.get_own_mac_address()
281 if initiator_addr
< responder_addr
:
282 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
283 if event
['new_state'] != "INITIAL" or event
['reason'] != "REASON_SETUP":
284 raise Exception("Concurrent setup scenario not handled as expected")
285 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SETUP"])
286 # The incoming setup request received by the initiator has
287 # priority over the one sent previously by the initiator itself
288 # because the initiator's MAC address is numerically lower than
289 # the one of the responder. Thus, the initiator should generate
290 # an FST_SETUP event.
292 event
= initiator
.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
293 if event
['new_state'] != "INITIAL" or event
['reason'] != "REASON_STT":
294 raise Exception("Concurrent setup scenario not handled as expected")
295 # The incoming setup request was dropped at the initiator
296 # because its MAC address is numerically bigger than the one of
297 # the responder. Thus, the initiator continue to wait for a
298 # setup response until the STT event fires.
299 bad_parameter_detected
= True
301 initiator
.initiate_session(sid
, "accept")
303 if e
.args
[0].startswith("Cannot initiate fst session"):
304 if bad_param_type
!= bad_param_none
:
305 bad_parameter_detected
= True
306 elif e
.args
[0].startswith("No FST-EVENT-SESSION received"):
307 if bad_param_type
== bad_param_session_initiate_request_with_bad_stie
:
308 bad_parameter_detected
= True
309 if not bad_parameter_detected
:
310 #The exception was unexpected
312 exception_already_raised
= True
315 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
316 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
317 if not exception_already_raised
:
318 if bad_parameter_detected
:
319 logger
.info("Success. Bad parameter was detected (%s)" % bad_param_names
[bad_param_type
])
321 if bad_param_type
== bad_param_none
:
322 logger
.info("Success. Session initiated")
324 raise Exception("Failure. Bad parameter was not detected (%s)" % bad_param_names
[bad_param_type
])
326 print "Failure. Unexpected exception"
328 def fst_transfer_session(apdev
, test_params
, bad_param_type
, init_on_ap
):
329 """This function makes the necessary preparations and then adds, sets,
330 initiates and attempts to transfer a session using either correct or
331 incorrect parameters at each stage depending on the value of bad_param_type.
332 If the call ends as expected the function silently exits. Otherwise, it
333 throws an exception thus failing the test."""
334 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
335 bad_parameter_detected
= False
336 exception_already_raised
= False
338 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
339 # This call makes sure FstHostapd singleton object is created and, as a
340 # result, the global control interface is registered (this is done from
342 ap1
.get_global_instance()
346 new_iface
= ap2
.ifname()
347 new_peer_addr
= ap2
.get_actual_peer_addr()
351 new_iface
= sta2
.ifname()
352 new_peer_addr
= sta2
.get_actual_peer_addr()
353 initiator
.add_peer(responder
, new_peer_addr
= new_peer_addr
)
354 sid
= initiator
.add_session()
355 initiator
.configure_session(sid
, new_iface
)
356 if bad_param_type
!= bad_param_session_transfer_setup_skipped
:
357 initiator
.initiate_session(sid
, "accept")
358 if bad_param_type
== bad_param_session_transfer_no_params
:
360 elif bad_param_type
== bad_param_session_transfer_bad_session_id
:
362 initiator
.transfer_session(sid
)
364 if e
.args
[0].startswith("Cannot transfer fst session"):
365 if bad_param_type
!= bad_param_none
:
366 bad_parameter_detected
= True
367 if not bad_parameter_detected
:
368 # The exception was unexpected
370 exception_already_raised
= True
373 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
374 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
375 if not exception_already_raised
:
376 if bad_parameter_detected
:
377 logger
.info("Success. Bad parameter was detected (%s)" % bad_param_names
[bad_param_type
])
379 if bad_param_type
== bad_param_none
:
380 logger
.info("Success. Session transferred")
382 raise Exception("Failure. Bad parameter was not detected (%s)" % bad_param_names
[bad_param_type
])
384 print "Failure. Unexpected exception"
387 def fst_tear_down_session(apdev
, test_params
, bad_param_type
, init_on_ap
):
388 """This function makes the necessary preparations and then adds, sets, and
389 initiates a session. It then issues a tear down command using either
390 correct or incorrect parameters at each stage. If the call ends as expected,
391 the function silently exits. Otherwise, it throws an exception thus failing
393 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
394 bad_parameter_detected
= False
395 exception_already_raised
= False
397 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
398 # This call makes sure FstHostapd singleton object is created and, as a
399 # result, the global control interface is registered (this is done from
401 ap1
.get_global_instance()
405 new_iface
= ap2
.ifname()
406 new_peer_addr
= ap2
.get_actual_peer_addr()
410 new_iface
= sta2
.ifname()
411 new_peer_addr
= sta2
.get_actual_peer_addr()
412 initiator
.add_peer(responder
, new_peer_addr
= new_peer_addr
)
413 sid
= initiator
.add_session()
414 initiator
.configure_session(sid
, new_iface
)
415 if bad_param_type
!= bad_param_session_teardown_setup_skipped
:
416 initiator
.initiate_session(sid
, "accept")
417 if bad_param_type
== bad_param_session_teardown_bad_fsts_id
:
418 initiator
.send_test_tear_down('-1')
419 responder
.wait_for_session_event(5)
421 if bad_param_type
== bad_param_session_teardown_no_params
:
423 elif bad_param_type
== bad_param_session_teardown_bad_session_id
:
425 initiator
.teardown_session(sid
)
427 if e
.args
[0].startswith("Cannot tear down fst session"):
428 if (bad_param_type
== bad_param_session_teardown_no_params
or
429 bad_param_type
== bad_param_session_teardown_bad_session_id
or
430 bad_param_type
== bad_param_session_teardown_setup_skipped
):
431 bad_parameter_detected
= True
432 elif e
.args
[0].startswith("No FST-EVENT-SESSION received"):
433 if bad_param_type
== bad_param_session_teardown_bad_fsts_id
:
434 bad_parameter_detected
= True
435 if not bad_parameter_detected
:
436 # The exception was unexpected
438 exception_already_raised
= True
441 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
442 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
443 if not exception_already_raised
:
444 if bad_parameter_detected
:
445 logger
.info("Success. Bad parameter was detected (%s)" % bad_param_names
[bad_param_type
])
447 if bad_param_type
== bad_param_none
:
448 logger
.info("Success. Session torn down")
450 raise Exception("Failure. Bad parameter was not detected (%s)" % bad_param_names
[bad_param_type
])
452 print "Failure. Unexpected exception"
455 #enum - remove session scenarios
456 remove_scenario_no_params
= 0
457 remove_scenario_bad_session_id
= 1
458 remove_scenario_non_established_session
= 2
459 remove_scenario_established_session
= 3
461 remove_scenario_names
= ("No params",
463 "Remove non-established session",
464 "Remove established session")
467 def fst_remove_session(apdev
, test_params
, remove_session_scenario
, init_on_ap
):
468 """This function attempts to remove a session at various stages of its
469 formation, depending on the value of remove_session_scenario. If the call
470 ends as expected, the function silently exits. Otherwise, it throws an
471 exception thus failing the test."""
472 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
473 bad_parameter_detected
= False
474 exception_already_raised
= False
476 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
477 # This call makes sure FstHostapd singleton object is created and, as a
478 # result, the global control interface is registered (this is done from
480 ap1
.get_global_instance()
484 new_iface
= ap2
.ifname()
485 new_peer_addr
= ap2
.get_actual_peer_addr()
489 new_iface
= sta2
.ifname()
490 new_peer_addr
= sta2
.get_actual_peer_addr()
491 initiator
.add_peer(responder
, new_peer_addr
= new_peer_addr
)
492 sid
= initiator
.add_session()
493 initiator
.configure_session(sid
, new_iface
)
494 if remove_session_scenario
!= remove_scenario_no_params
:
495 if remove_session_scenario
!= remove_scenario_non_established_session
:
496 initiator
.initiate_session(sid
, "accept")
497 if remove_session_scenario
== remove_scenario_no_params
:
499 elif remove_session_scenario
== remove_scenario_bad_session_id
:
501 initiator
.remove_session(sid
)
503 if e
.args
[0].startswith("Cannot remove fst session"):
504 if (remove_session_scenario
== remove_scenario_no_params
or
505 remove_session_scenario
== remove_scenario_bad_session_id
):
506 bad_parameter_detected
= True
507 elif e
.args
[0].startswith("No FST-EVENT-SESSION received"):
508 if remove_session_scenario
== remove_scenario_non_established_session
:
509 bad_parameter_detected
= True
510 if not bad_parameter_detected
:
511 #The exception was unexpected
513 exception_already_raised
= True
516 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
517 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
518 if not exception_already_raised
:
519 if bad_parameter_detected
:
520 logger
.info("Success. Remove scenario ended as expected (%s)" % remove_scenario_names
[remove_session_scenario
])
522 if remove_session_scenario
== remove_scenario_established_session
:
523 logger
.info("Success. Session removed")
525 raise Exception("Failure. Remove scenario ended in an unexpected way (%s)" % remove_scenario_names
[remove_session_scenario
])
527 print "Failure. Unexpected exception"
531 frame_type_session_request
= 0
532 frame_type_session_response
= 1
533 frame_type_ack_request
= 2
534 frame_type_ack_response
= 3
535 frame_type_tear_down
= 4
537 frame_type_names
= ("Session request",
543 def fst_send_unexpected_frame(apdev
, test_params
, frame_type
, send_from_ap
, additional_param
= ''):
544 """This function creates two pairs of APs and stations, makes them connect
545 and then causes one side to send an unexpected FST frame of the specified
546 type to the other. The other side should then identify and ignore the
548 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
549 exception_already_raised
= False
550 frame_receive_timeout
= False
552 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
553 # This call makes sure FstHostapd singleton object is created and, as a
554 # result, the global control interface is registered (this is done from
556 ap1
.get_global_instance()
560 new_iface
= ap2
.ifname()
561 new_peer_addr
= ap2
.get_actual_peer_addr()
565 new_iface
= sta2
.ifname()
566 new_peer_addr
= sta2
.get_actual_peer_addr()
567 sender
.add_peer(receiver
, new_peer_addr
= new_peer_addr
)
568 sid
=sender
.add_session()
569 sender
.configure_session(sid
, new_iface
)
570 if frame_type
== frame_type_session_request
:
571 sender
.send_session_setup_request(sid
)
572 event
= receiver
.wait_for_session_event(5)
573 if event
['type'] != 'EVENT_FST_SETUP':
574 raise Exception("Unexpected indication: " + event
['type'])
575 elif frame_type
== frame_type_session_response
:
576 #fsts_id doesn't matter, no actual session exists
577 sender
.send_test_session_setup_response('0', additional_param
)
578 receiver
.wait_for_session_event(5)
579 elif frame_type
== frame_type_ack_request
:
580 #fsts_id doesn't matter, no actual session exists
581 sender
.send_test_ack_request('0')
582 receiver
.wait_for_session_event(5)
583 elif frame_type
== frame_type_ack_response
:
584 #fsts_id doesn't matter, no actual session exists
585 sender
.send_test_ack_response('0')
586 receiver
.wait_for_session_event(5)
587 elif frame_type
== frame_type_tear_down
:
588 #fsts_id doesn't matter, no actual session exists
589 sender
.send_test_tear_down('0')
590 receiver
.wait_for_session_event(5)
592 if e
.args
[0].startswith("No FST-EVENT-SESSION received"):
593 if frame_type
!= frame_type_session_request
:
594 frame_receive_timeout
= True
597 exception_already_raised
= True
600 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
601 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
602 if not exception_already_raised
:
603 if frame_receive_timeout
:
604 logger
.info("Success. Frame was ignored (%s)" % frame_type_names
[frame_type
])
606 if frame_type
== frame_type_session_request
:
607 logger
.info("Success. Frame received, session created")
609 raise Exception("Failure. Frame was not ignored (%s)" % frame_type_names
[frame_type
])
611 print "Failure. Unexpected exception"
614 #enum - bad session transfer scenarios
615 bad_scenario_none
= 0
616 bad_scenario_ack_req_session_not_set_up
= 1
617 bad_scenario_ack_req_session_not_established_init_side
= 2
618 bad_scenario_ack_req_session_not_established_resp_side
= 3
619 bad_scenario_ack_req_bad_fsts_id
= 4
620 bad_scenario_ack_resp_session_not_set_up
= 5
621 bad_scenario_ack_resp_session_not_established_init_side
= 6
622 bad_scenario_ack_resp_session_not_established_resp_side
= 7
623 bad_scenario_ack_resp_no_ack_req
= 8
624 bad_scenario_ack_resp_bad_fsts_id
= 9
626 bad_scenario_names
= ("None",
627 "Ack request received before the session was set up",
628 "Ack request received on the initiator side before session was established",
629 "Ack request received on the responder side before session was established",
630 "Ack request received with bad fsts_id",
631 "Ack response received before the session was set up",
632 "Ack response received on the initiator side before session was established",
633 "Ack response received on the responder side before session was established",
634 "Ack response received before ack request was sent",
635 "Ack response received with bad fsts_id")
637 def fst_bad_transfer(apdev
, test_params
, bad_scenario_type
, init_on_ap
):
638 """This function makes the necessary preparations and then adds and sets a
639 session. It then initiates and it unless instructed otherwise) and attempts
640 to send one of the frames involved in the session transfer protocol,
641 skipping or distorting one of the stages according to the value of
642 bad_scenario_type parameter."""
643 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
644 bad_parameter_detected
= False
645 exception_already_raised
= False
647 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
648 # This call makes sure FstHostapd singleton object is created and, as a
649 # result, the global control interface is registered (this is done from
651 ap1
.get_global_instance()
655 new_iface
= ap2
.ifname()
656 new_peer_addr
= ap2
.get_actual_peer_addr()
660 new_iface
= sta2
.ifname()
661 new_peer_addr
= sta2
.get_actual_peer_addr()
662 initiator
.add_peer(responder
, new_peer_addr
= new_peer_addr
)
663 sid
= initiator
.add_session()
664 initiator
.configure_session(sid
, new_iface
)
665 if (bad_scenario_type
!= bad_scenario_ack_req_session_not_set_up
and
666 bad_scenario_type
!= bad_scenario_ack_resp_session_not_set_up
):
667 if (bad_scenario_type
!= bad_scenario_ack_req_session_not_established_init_side
and
668 bad_scenario_type
!= bad_scenario_ack_resp_session_not_established_init_side
and
669 bad_scenario_type
!= bad_scenario_ack_req_session_not_established_resp_side
and
670 bad_scenario_type
!= bad_scenario_ack_resp_session_not_established_resp_side
):
674 initiator
.initiate_session(sid
, response
)
675 if bad_scenario_type
== bad_scenario_ack_req_session_not_set_up
:
676 #fsts_id doesn't matter, no actual session exists
677 responder
.send_test_ack_request('0')
678 initiator
.wait_for_session_event(5)
679 # We want to send the unexpected frame to the side that already has
681 elif bad_scenario_type
== bad_scenario_ack_resp_session_not_set_up
:
682 #fsts_id doesn't matter, no actual session exists
683 responder
.send_test_ack_response('0')
684 initiator
.wait_for_session_event(5)
685 # We want to send the unexpected frame to the side that already has
687 elif bad_scenario_type
== bad_scenario_ack_req_session_not_established_init_side
:
688 #fsts_id doesn't matter, no actual session exists
689 initiator
.send_test_ack_request('0')
690 responder
.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
691 elif bad_scenario_type
== bad_scenario_ack_req_session_not_established_resp_side
:
692 #fsts_id doesn't matter, no actual session exists
693 responder
.send_test_ack_request('0')
694 initiator
.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
695 elif bad_scenario_type
== bad_scenario_ack_resp_session_not_established_init_side
:
696 #fsts_id doesn't matter, no actual session exists
697 initiator
.send_test_ack_response('0')
698 responder
.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
699 elif bad_scenario_type
== bad_scenario_ack_resp_session_not_established_resp_side
:
700 #fsts_id doesn't matter, no actual session exists
701 responder
.send_test_ack_response('0')
702 initiator
.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
703 elif bad_scenario_type
== bad_scenario_ack_req_bad_fsts_id
:
704 initiator
.send_test_ack_request('-1')
705 responder
.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
706 elif bad_scenario_type
== bad_scenario_ack_resp_bad_fsts_id
:
707 initiator
.send_test_ack_response('-1')
708 responder
.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
709 elif bad_scenario_type
== bad_scenario_ack_resp_no_ack_req
:
710 actual_fsts_id
= initiator
.get_fsts_id_by_sid(sid
)
711 initiator
.send_test_ack_response(str(actual_fsts_id
))
712 responder
.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
714 raise Exception("Unknown bad scenario identifier")
716 if e
.args
[0].startswith("No FST-EVENT-SESSION received"):
717 bad_parameter_detected
= True
718 if not bad_parameter_detected
:
719 # The exception was unexpected
721 exception_already_raised
= True
724 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
725 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
726 if not exception_already_raised
:
727 if bad_parameter_detected
:
728 logger
.info("Success. Bad scenario was handled correctly (%s)" % bad_scenario_names
[bad_scenario_type
])
730 raise Exception("Failure. Bad scenario was handled incorrectly (%s)" % bad_scenario_names
[bad_scenario_type
])
732 print "Failure. Unexpected exception"
734 def test_fst_sta_connect_to_non_fst_ap(dev
, apdev
, test_params
):
735 """FST STA connecting to non-FST AP"""
736 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
737 with
HWSimRadio() as (radio
, iface
):
738 non_fst_ap
= hostapd
.add_ap(iface
, { "ssid": "non_fst_11g" })
740 orig_sta1_mbies
= sta1
.get_local_mbies()
741 orig_sta2_mbies
= sta2
.get_local_mbies()
744 sta2
.connect_to_external_ap(non_fst_ap
, ssid
="non_fst_11g",
745 key_mgmt
="NONE", scan_freq
=freq
)
747 res_sta1_mbies
= sta1
.get_local_mbies()
748 res_sta2_mbies
= sta2
.get_local_mbies()
749 if (orig_sta1_mbies
.startswith("FAIL") or
750 orig_sta2_mbies
.startswith("FAIL") or
751 not res_sta1_mbies
.startswith("FAIL") or
752 not res_sta2_mbies
.startswith("FAIL")):
753 raise Exception("Failure. MB IEs have not been removed on the stations")
758 sta2
.disconnect_from_external_ap()
759 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
761 def test_fst_sta_connect_to_fst_ap(dev
, apdev
, test_params
):
762 """FST STA connecting to FST AP"""
763 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
765 orig_sta2_mbies
= sta2
.get_local_mbies()
766 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
767 sta1
.connect(ap1
, key_mgmt
="NONE",
768 scan_freq
=fst_test_common
.fst_test_def_freq_a
)
770 res_sta2_mbies
= sta2
.get_local_mbies()
771 if res_sta2_mbies
== orig_sta2_mbies
:
772 raise Exception("Failure. MB IEs have not been updated")
778 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
780 def test_fst_ap_connect_to_fst_sta(dev
, apdev
, test_params
):
781 """FST AP connecting to FST STA"""
782 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
784 orig_ap_mbies
= ap1
.get_local_mbies()
785 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
786 sta1
.connect(ap1
, key_mgmt
="NONE",
787 scan_freq
=fst_test_common
.fst_test_def_freq_a
)
789 res_ap_mbies
= ap1
.get_local_mbies()
790 if res_ap_mbies
!= orig_ap_mbies
:
791 raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
797 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
799 def test_fst_ap_connect_to_non_fst_sta(dev
, apdev
, test_params
):
800 """FST AP connecting to non-FST STA"""
801 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
803 orig_ap_mbies
= ap2
.get_local_mbies()
804 vals
= dev
[0].scan(None, fst_test_common
.fst_test_def_freq_g
)
805 fst_module_aux
.external_sta_connect(dev
[0], ap2
, key_mgmt
="NONE",
806 scan_freq
=fst_test_common
.fst_test_def_freq_g
)
808 res_ap_mbies
= ap2
.get_local_mbies()
809 if res_ap_mbies
!= orig_ap_mbies
:
810 raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
815 fst_module_aux
.disconnect_external_sta(dev
[0], ap2
)
816 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
818 def test_fst_second_sta_connect_to_non_fst_ap(dev
, apdev
, test_params
):
819 """FST STA 2nd connecting to non-FST AP"""
820 fst_ap1
, fst_ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
821 with
HWSimRadio() as (radio
, iface
):
822 non_fst_ap
= hostapd
.add_ap(iface
, { "ssid": "non_fst_11g" })
824 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
825 sta1
.connect(fst_ap1
, key_mgmt
="NONE", scan_freq
=fst_test_common
.fst_test_def_freq_a
)
827 orig_sta1_mbies
= sta1
.get_local_mbies()
828 orig_sta2_mbies
= sta2
.get_local_mbies()
831 sta2
.connect_to_external_ap(non_fst_ap
, ssid
="non_fst_11g", key_mgmt
="NONE", scan_freq
=freq
)
833 res_sta1_mbies
= sta1
.get_local_mbies()
834 res_sta2_mbies
= sta2
.get_local_mbies()
835 if (orig_sta1_mbies
.startswith("FAIL") or
836 orig_sta2_mbies
.startswith("FAIL") or
837 not res_sta1_mbies
.startswith("FAIL") or
838 not res_sta2_mbies
.startswith("FAIL")):
839 raise Exception("Failure. MB IEs have not been removed on the stations")
845 sta2
.disconnect_from_external_ap()
846 fst_module_aux
.stop_two_ap_sta_pairs(fst_ap1
, fst_ap2
, sta1
, sta2
)
849 def test_fst_second_sta_connect_to_fst_ap(dev
, apdev
, test_params
):
850 """FST STA 2nd connecting to FST AP"""
851 fst_ap1
, fst_ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
852 with
HWSimRadio() as (radio
, iface
):
853 non_fst_ap
= hostapd
.add_ap(iface
, { "ssid": "non_fst_11g" })
857 sta2
.connect_to_external_ap(non_fst_ap
, ssid
="non_fst_11g", key_mgmt
="NONE", scan_freq
=freq
)
859 orig_sta1_mbies
= sta1
.get_local_mbies()
860 orig_sta2_mbies
= sta2
.get_local_mbies()
861 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
862 sta1
.connect(fst_ap1
, key_mgmt
="NONE", scan_freq
=fst_test_common
.fst_test_def_freq_a
)
864 res_sta1_mbies
= sta1
.get_local_mbies()
865 res_sta2_mbies
= sta2
.get_local_mbies()
866 if (not orig_sta1_mbies
.startswith("FAIL") or
867 not orig_sta2_mbies
.startswith("FAIL") or
868 not res_sta1_mbies
.startswith("FAIL") or
869 not res_sta2_mbies
.startswith("FAIL")):
870 raise Exception("Failure. MB IEs should have stayed non-present on the stations")
876 sta2
.disconnect_from_external_ap()
877 fst_module_aux
.stop_two_ap_sta_pairs(fst_ap1
, fst_ap2
, sta1
, sta2
)
879 def test_fst_disconnect_1_of_2_stas_from_non_fst_ap(dev
, apdev
, test_params
):
880 """FST disconnect 1 of 2 STAs from non-FST AP"""
881 fst_ap1
, fst_ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
882 with
HWSimRadio() as (radio
, iface
):
883 non_fst_ap
= hostapd
.add_ap(iface
, { "ssid": "non_fst_11g" })
885 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
886 sta1
.connect(fst_ap1
, key_mgmt
="NONE", scan_freq
=fst_test_common
.fst_test_def_freq_a
)
889 sta2
.connect_to_external_ap(non_fst_ap
, ssid
="non_fst_11g", key_mgmt
="NONE", scan_freq
=freq
)
891 orig_sta1_mbies
= sta1
.get_local_mbies()
892 orig_sta2_mbies
= sta2
.get_local_mbies()
893 sta2
.disconnect_from_external_ap()
895 res_sta1_mbies
= sta1
.get_local_mbies()
896 res_sta2_mbies
= sta2
.get_local_mbies()
897 if (not orig_sta1_mbies
.startswith("FAIL") or
898 not orig_sta2_mbies
.startswith("FAIL") or
899 res_sta1_mbies
.startswith("FAIL") or
900 res_sta2_mbies
.startswith("FAIL")):
901 raise Exception("Failure. MB IEs haven't reappeared on the stations")
907 sta2
.disconnect_from_external_ap()
908 fst_module_aux
.stop_two_ap_sta_pairs(fst_ap1
, fst_ap2
, sta1
, sta2
)
911 def test_fst_disconnect_1_of_2_stas_from_fst_ap(dev
, apdev
, test_params
):
912 """FST disconnect 1 of 2 STAs from FST AP"""
913 fst_ap1
, fst_ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
914 with
HWSimRadio() as (radio
, iface
):
915 non_fst_ap
= hostapd
.add_ap(iface
, { "ssid": "non_fst_11g" })
917 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
918 sta1
.connect(fst_ap1
, key_mgmt
="NONE", scan_freq
=fst_test_common
.fst_test_def_freq_a
)
921 sta2
.connect_to_external_ap(non_fst_ap
, ssid
="non_fst_11g", key_mgmt
="NONE", scan_freq
=freq
)
923 orig_sta1_mbies
= sta1
.get_local_mbies()
924 orig_sta2_mbies
= sta2
.get_local_mbies()
927 res_sta1_mbies
= sta1
.get_local_mbies()
928 res_sta2_mbies
= sta2
.get_local_mbies()
929 if (not orig_sta1_mbies
.startswith("FAIL") or
930 not orig_sta2_mbies
.startswith("FAIL") or
931 not res_sta1_mbies
.startswith("FAIL") or
932 not res_sta2_mbies
.startswith("FAIL")):
933 raise Exception("Failure. MB IEs should have stayed non-present on the stations")
939 sta2
.disconnect_from_external_ap()
940 fst_module_aux
.stop_two_ap_sta_pairs(fst_ap1
, fst_ap2
, sta1
, sta2
)
942 def test_fst_disconnect_2_of_2_stas_from_non_fst_ap(dev
, apdev
, test_params
):
943 """FST disconnect 2 of 2 STAs from non-FST AP"""
944 fst_ap1
, fst_ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
945 with
HWSimRadio() as (radio
, iface
):
946 non_fst_ap
= hostapd
.add_ap(iface
, { "ssid": "non_fst_11g" })
948 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
949 sta1
.connect(fst_ap1
, key_mgmt
="NONE", scan_freq
=fst_test_common
.fst_test_def_freq_a
)
952 sta2
.connect_to_external_ap(non_fst_ap
, ssid
="non_fst_11g", key_mgmt
="NONE", scan_freq
=freq
)
956 orig_sta1_mbies
= sta1
.get_local_mbies()
957 orig_sta2_mbies
= sta2
.get_local_mbies()
958 sta2
.disconnect_from_external_ap()
960 res_sta1_mbies
= sta1
.get_local_mbies()
961 res_sta2_mbies
= sta2
.get_local_mbies()
962 if (not orig_sta1_mbies
.startswith("FAIL") or
963 not orig_sta2_mbies
.startswith("FAIL") or
964 res_sta1_mbies
.startswith("FAIL") or
965 res_sta2_mbies
.startswith("FAIL")):
966 raise Exception("Failure. MB IEs haven't reappeared on the stations")
972 sta2
.disconnect_from_external_ap()
973 fst_module_aux
.stop_two_ap_sta_pairs(fst_ap1
, fst_ap2
, sta1
, sta2
)
975 def test_fst_disconnect_2_of_2_stas_from_fst_ap(dev
, apdev
, test_params
):
976 """FST disconnect 2 of 2 STAs from FST AP"""
977 fst_ap1
, fst_ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
978 with
HWSimRadio() as (radio
, iface
):
979 non_fst_ap
= hostapd
.add_ap(iface
, { "ssid": "non_fst_11g"})
981 vals
= sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
982 sta1
.connect(fst_ap1
, key_mgmt
="NONE", scan_freq
=fst_test_common
.fst_test_def_freq_a
)
985 sta2
.connect_to_external_ap(non_fst_ap
, ssid
="non_fst_11g", key_mgmt
="NONE", scan_freq
=freq
)
987 sta2
.disconnect_from_external_ap()
989 orig_sta1_mbies
= sta1
.get_local_mbies()
990 orig_sta2_mbies
= sta2
.get_local_mbies()
993 res_sta1_mbies
= sta1
.get_local_mbies()
994 res_sta2_mbies
= sta2
.get_local_mbies()
995 if (orig_sta1_mbies
.startswith("FAIL") or
996 orig_sta2_mbies
.startswith("FAIL") or
997 res_sta1_mbies
.startswith("FAIL") or
998 res_sta2_mbies
.startswith("FAIL")):
999 raise Exception("Failure. MB IEs should have stayed present on both stations")
1000 # Mandatory part of 8.4.2.140 Multi-band element is 24 bytes = 48 hex chars
1001 basic_sta1_mbies
= res_sta1_mbies
[0:48] + res_sta1_mbies
[60:108]
1002 basic_sta2_mbies
= res_sta2_mbies
[0:48] + res_sta2_mbies
[60:108]
1003 if (basic_sta1_mbies
!= basic_sta2_mbies
):
1004 raise Exception("Failure. Basic MB IEs should have become identical on both stations")
1005 addr_sta1_str
= sta1
.get_own_mac_address().replace(":", "")
1006 addr_sta2_str
= sta2
.get_own_mac_address().replace(":", "")
1007 # Mandatory part of 8.4.2.140 Multi-band element is followed by STA MAC Address field (6 bytes = 12 hex chars)
1008 addr_sta1_mbie1
= res_sta1_mbies
[48:60]
1009 addr_sta1_mbie2
= res_sta1_mbies
[108:120]
1010 addr_sta2_mbie1
= res_sta2_mbies
[48:60]
1011 addr_sta2_mbie2
= res_sta2_mbies
[108:120]
1012 if (addr_sta1_mbie1
!= addr_sta1_mbie2
or
1013 addr_sta1_mbie1
!= addr_sta2_str
or
1014 addr_sta2_mbie1
!= addr_sta2_mbie2
or
1015 addr_sta2_mbie1
!= addr_sta1_str
):
1016 raise Exception("Failure. STA Address in MB IEs should have been same as the other STA's")
1017 except Exception, e
:
1022 sta2
.disconnect_from_external_ap()
1023 fst_module_aux
.stop_two_ap_sta_pairs(fst_ap1
, fst_ap2
, sta1
, sta2
)
1025 def test_fst_disconnect_non_fst_sta(dev
, apdev
, test_params
):
1026 """FST disconnect non-FST STA"""
1027 ap1
, ap2
, fst_sta1
, fst_sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
1028 external_sta_connected
= False
1030 vals
= fst_sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
1031 fst_sta1
.connect(ap1
, key_mgmt
="NONE",
1032 scan_freq
=fst_test_common
.fst_test_def_freq_a
)
1033 vals
= dev
[0].scan(None, fst_test_common
.fst_test_def_freq_g
)
1034 fst_module_aux
.external_sta_connect(dev
[0], ap2
, key_mgmt
="NONE",
1035 scan_freq
=fst_test_common
.fst_test_def_freq_g
)
1036 external_sta_connected
= True
1038 fst_sta1
.disconnect()
1040 orig_ap_mbies
= ap2
.get_local_mbies()
1041 fst_module_aux
.disconnect_external_sta(dev
[0], ap2
)
1042 external_sta_connected
= False
1044 res_ap_mbies
= ap2
.get_local_mbies()
1045 if res_ap_mbies
!= orig_ap_mbies
:
1046 raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
1047 except Exception, e
:
1051 fst_sta1
.disconnect()
1052 if external_sta_connected
:
1053 fst_module_aux
.disconnect_external_sta(dev
[0], ap2
)
1054 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, fst_sta1
, fst_sta2
)
1056 def test_fst_disconnect_fst_sta(dev
, apdev
, test_params
):
1057 """FST disconnect FST STA"""
1058 ap1
, ap2
, fst_sta1
, fst_sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
1059 external_sta_connected
= False;
1061 vals
= fst_sta1
.scan(freq
=fst_test_common
.fst_test_def_freq_a
)
1062 fst_sta1
.connect(ap1
, key_mgmt
="NONE",
1063 scan_freq
=fst_test_common
.fst_test_def_freq_a
)
1064 vals
= dev
[0].scan(None, fst_test_common
.fst_test_def_freq_g
)
1065 fst_module_aux
.external_sta_connect(dev
[0], ap2
, key_mgmt
="NONE",
1066 scan_freq
=fst_test_common
.fst_test_def_freq_g
)
1067 external_sta_connected
= True
1069 fst_module_aux
.disconnect_external_sta(dev
[0], ap2
)
1070 external_sta_connected
= False
1072 orig_ap_mbies
= ap2
.get_local_mbies()
1073 fst_sta1
.disconnect()
1075 res_ap_mbies
= ap2
.get_local_mbies()
1076 if res_ap_mbies
!= orig_ap_mbies
:
1077 raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
1078 except Exception, e
:
1082 fst_sta1
.disconnect()
1083 if external_sta_connected
:
1084 fst_module_aux
.disconnect_external_sta(dev
[0], ap2
)
1085 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, fst_sta1
, fst_sta2
)
1087 def test_fst_dynamic_iface_attach(dev
, apdev
, test_params
):
1088 """FST dynamic interface attach"""
1089 ap1
= fst_module_aux
.FstAP(apdev
[0]['ifname'], 'fst_11a', 'a',
1090 fst_test_common
.fst_test_def_chan_a
,
1091 fst_test_common
.fst_test_def_group
,
1092 fst_test_common
.fst_test_def_prio_low
,
1093 fst_test_common
.fst_test_def_llt
)
1095 ap2
= fst_module_aux
.FstAP(apdev
[1]['ifname'], 'fst_11g', 'b',
1096 fst_test_common
.fst_test_def_chan_g
,
1100 sta1
= fst_module_aux
.FstSTA('wlan5',
1101 fst_module_aux
.fst_test_common
.fst_test_def_group
,
1102 fst_test_common
.fst_test_def_prio_low
,
1103 fst_test_common
.fst_test_def_llt
)
1105 sta2
= fst_module_aux
.FstSTA('wlan6', '', '', '')
1109 orig_sta2_mbies
= sta2
.get_local_mbies()
1110 orig_ap2_mbies
= ap2
.get_local_mbies()
1111 sta2
.send_iface_attach_request(sta2
.ifname(),
1112 fst_module_aux
.fst_test_common
.fst_test_def_group
,
1114 event
= sta2
.wait_for_iface_event(5)
1115 if event
['event_type'] != 'attached':
1116 raise Exception("Failure. Iface was not properly attached")
1117 ap2
.send_iface_attach_request(ap2
.ifname(),
1118 fst_module_aux
.fst_test_common
.fst_test_def_group
,
1120 event
= ap2
.wait_for_iface_event(5)
1121 if event
['event_type'] != 'attached':
1122 raise Exception("Failure. Iface was not properly attached")
1124 res_sta2_mbies
= sta2
.get_local_mbies()
1125 res_ap2_mbies
= ap2
.get_local_mbies()
1126 sta2
.send_iface_detach_request(sta2
.ifname())
1127 event
= sta2
.wait_for_iface_event(5)
1128 if event
['event_type'] != 'detached':
1129 raise Exception("Failure. Iface was not properly detached")
1130 ap2
.send_iface_detach_request(ap2
.ifname())
1131 event
= ap2
.wait_for_iface_event(5)
1132 if event
['event_type'] != 'detached':
1133 raise Exception("Failure. Iface was not properly detached")
1134 if (not orig_sta2_mbies
.startswith("FAIL") or
1135 not orig_ap2_mbies
.startswith("FAIL") or
1136 res_sta2_mbies
.startswith("FAIL") or
1137 res_ap2_mbies
.startswith("FAIL")):
1138 raise Exception("Failure. MB IEs should have appeared on the station and on the AP")
1139 except Exception, e
:
1148 # AP side FST module tests
1150 def test_fst_ap_start_session(dev
, apdev
, test_params
):
1151 """FST AP start session"""
1152 fst_start_session(apdev
, test_params
, bad_param_none
, True)
1154 def test_fst_ap_start_session_no_add_params(dev
, apdev
, test_params
):
1155 """FST AP start session - no add params"""
1156 fst_start_session(apdev
, test_params
, bad_param_session_add_no_params
, True)
1158 def test_fst_ap_start_session_bad_group_id(dev
, apdev
, test_params
):
1159 """FST AP start session - bad group id"""
1160 fst_start_session(apdev
, test_params
, bad_param_group_id
, True)
1162 def test_fst_ap_start_session_no_set_params(dev
, apdev
, test_params
):
1163 """FST AP start session - no set params"""
1164 fst_start_session(apdev
, test_params
, bad_param_session_set_no_params
, True)
1166 def test_fst_ap_start_session_set_unknown_param(dev
, apdev
, test_params
):
1167 """FST AP start session - set unknown param"""
1168 fst_start_session(apdev
, test_params
, bad_param_session_set_unknown_param
,
1171 def test_fst_ap_start_session_bad_session_id(dev
, apdev
, test_params
):
1172 """FST AP start session - bad session id"""
1173 fst_start_session(apdev
, test_params
, bad_param_session_id
, True)
1175 def test_fst_ap_start_session_bad_new_iface(dev
, apdev
, test_params
):
1176 """FST AP start session - bad new iface"""
1177 fst_start_session(apdev
, test_params
, bad_param_new_iface
, True)
1179 def test_fst_ap_start_session_bad_old_iface(dev
, apdev
, test_params
):
1180 """FST AP start session - bad old iface"""
1181 fst_start_session(apdev
, test_params
, bad_param_old_iface
, True)
1183 def test_fst_ap_start_session_negative_llt(dev
, apdev
, test_params
):
1184 """FST AP start session - negative llt"""
1185 fst_start_session(apdev
, test_params
, bad_param_negative_llt
, True)
1187 def test_fst_ap_start_session_zero_llt(dev
, apdev
, test_params
):
1188 """FST AP start session - zero llt"""
1189 fst_start_session(apdev
, test_params
, bad_param_zero_llt
, True)
1191 def test_fst_ap_start_session_llt_too_big(dev
, apdev
, test_params
):
1192 """FST AP start session - llt too large"""
1193 fst_start_session(apdev
, test_params
, bad_param_llt_too_big
, True)
1195 def test_fst_ap_start_session_invalid_peer_addr(dev
, apdev
, test_params
):
1196 """FST AP start session - invalid peer address"""
1197 fst_start_session(apdev
, test_params
, bad_param_peer_addr
, True,
1198 'GG:GG:GG:GG:GG:GG')
1200 def test_fst_ap_start_session_multicast_peer_addr(dev
, apdev
, test_params
):
1201 """FST AP start session - multicast peer address"""
1202 fst_start_session(apdev
, test_params
, bad_param_peer_addr
, True,
1203 '01:00:11:22:33:44')
1205 def test_fst_ap_start_session_broadcast_peer_addr(dev
, apdev
, test_params
):
1206 """FST AP start session - broadcast peer address"""
1207 fst_start_session(apdev
, test_params
, bad_param_peer_addr
, True,
1208 'FF:FF:FF:FF:FF:FF')
1210 def test_fst_ap_initiate_session(dev
, apdev
, test_params
):
1211 """FST AP initiate session"""
1212 fst_initiate_session(apdev
, test_params
, bad_param_none
, True)
1214 def test_fst_ap_initiate_session_no_params(dev
, apdev
, test_params
):
1215 """FST AP initiate session - no params"""
1216 fst_initiate_session(apdev
, test_params
,
1217 bad_param_session_initiate_no_params
, True)
1219 def test_fst_ap_initiate_session_invalid_session_id(dev
, apdev
, test_params
):
1220 """FST AP initiate session - invalid session id"""
1221 fst_initiate_session(apdev
, test_params
,
1222 bad_param_session_initiate_bad_session_id
, True)
1224 def test_fst_ap_initiate_session_no_new_iface(dev
, apdev
, test_params
):
1225 """FST AP initiate session - no new iface"""
1226 fst_initiate_session(apdev
, test_params
,
1227 bad_param_session_initiate_with_no_new_iface_set
, True)
1229 def test_fst_ap_initiate_session_bad_peer_addr(dev
, apdev
, test_params
):
1230 """FST AP initiate session - bad peer address"""
1231 fst_initiate_session(apdev
, test_params
,
1232 bad_param_session_initiate_with_bad_peer_addr_set
,
1235 def test_fst_ap_initiate_session_request_with_bad_stie(dev
, apdev
, test_params
):
1236 """FST AP initiate session - request with bad stie"""
1237 fst_initiate_session(apdev
, test_params
,
1238 bad_param_session_initiate_request_with_bad_stie
, True)
1240 def test_fst_ap_initiate_session_response_with_reject(dev
, apdev
, test_params
):
1241 """FST AP initiate session - response with reject"""
1242 fst_initiate_session(apdev
, test_params
,
1243 bad_param_session_initiate_response_with_reject
, True)
1245 def test_fst_ap_initiate_session_response_with_bad_stie(dev
, apdev
,
1247 """FST AP initiate session - response with bad stie"""
1248 fst_initiate_session(apdev
, test_params
,
1249 bad_param_session_initiate_response_with_bad_stie
,
1252 def test_fst_ap_initiate_session_response_with_zero_llt(dev
, apdev
,
1254 """FST AP initiate session - zero llt"""
1255 fst_initiate_session(apdev
, test_params
,
1256 bad_param_session_initiate_response_with_zero_llt
,
1259 def test_fst_ap_initiate_session_stt_no_response(dev
, apdev
, test_params
):
1260 """FST AP initiate session - stt no response"""
1261 fst_initiate_session(apdev
, test_params
,
1262 bad_param_session_initiate_stt_no_response
, True)
1264 def test_fst_ap_initiate_session_concurrent_setup_request(dev
, apdev
,
1266 """FST AP initiate session - concurrent setup request"""
1267 fst_initiate_session(apdev
, test_params
,
1268 bad_param_session_initiate_concurrent_setup_request
,
1271 def test_fst_ap_session_request_with_no_session(dev
, apdev
, test_params
):
1272 """FST AP session request with no session"""
1273 fst_send_unexpected_frame(apdev
, test_params
, frame_type_session_request
,
1276 def test_fst_ap_session_response_accept_with_no_session(dev
, apdev
,
1278 """FST AP session response accept with no session"""
1279 fst_send_unexpected_frame(apdev
, test_params
, frame_type_session_response
,
1282 def test_fst_ap_session_response_reject_with_no_session(dev
, apdev
,
1284 """FST AP session response reject with no session"""
1285 fst_send_unexpected_frame(apdev
, test_params
, frame_type_session_response
,
1288 def test_fst_ap_ack_request_with_no_session(dev
, apdev
, test_params
):
1289 """FST AP ack request with no session"""
1290 fst_send_unexpected_frame(apdev
, test_params
, frame_type_ack_request
, True)
1292 def test_fst_ap_ack_response_with_no_session(dev
, apdev
, test_params
):
1293 """FST AP ack response with no session"""
1294 fst_send_unexpected_frame(apdev
, test_params
, frame_type_ack_response
, True)
1296 def test_fst_ap_tear_down_response_with_no_session(dev
, apdev
, test_params
):
1297 """FST AP tear down response with no session"""
1298 fst_send_unexpected_frame(apdev
, test_params
, frame_type_tear_down
, True)
1300 def test_fst_ap_transfer_session(dev
, apdev
, test_params
):
1301 """FST AP transfer session"""
1302 fst_transfer_session(apdev
, test_params
, bad_param_none
, True)
1304 def test_fst_ap_transfer_session_no_params(dev
, apdev
, test_params
):
1305 """FST AP transfer session - no params"""
1306 fst_transfer_session(apdev
, test_params
,
1307 bad_param_session_transfer_no_params
, True)
1309 def test_fst_ap_transfer_session_bad_session_id(dev
, apdev
, test_params
):
1310 """FST AP transfer session - bad session id"""
1311 fst_transfer_session(apdev
, test_params
,
1312 bad_param_session_transfer_bad_session_id
, True)
1314 def test_fst_ap_transfer_session_setup_skipped(dev
, apdev
, test_params
):
1315 """FST AP transfer session - setup skipped"""
1316 fst_transfer_session(apdev
, test_params
,
1317 bad_param_session_transfer_setup_skipped
, True)
1319 def test_fst_ap_ack_request_with_session_not_set_up(dev
, apdev
, test_params
):
1320 """FST AP ack request with session not set up"""
1321 fst_bad_transfer(apdev
, test_params
,
1322 bad_scenario_ack_req_session_not_set_up
, True)
1324 def test_fst_ap_ack_request_with_session_not_established_init_side(dev
, apdev
,
1326 """FST AP ack request with session not established init side"""
1327 fst_bad_transfer(apdev
, test_params
,
1328 bad_scenario_ack_req_session_not_established_init_side
,
1331 def test_fst_ap_ack_request_with_session_not_established_resp_side(dev
, apdev
,
1333 """FST AP ack request with session not established resp side"""
1334 fst_bad_transfer(apdev
, test_params
,
1335 bad_scenario_ack_req_session_not_established_resp_side
,
1338 def test_fst_ap_ack_request_with_bad_fsts_id(dev
, apdev
, test_params
):
1339 """FST AP ack request with bad fsts id"""
1340 fst_bad_transfer(apdev
, test_params
, bad_scenario_ack_req_bad_fsts_id
, True)
1342 def test_fst_ap_ack_response_with_session_not_set_up(dev
, apdev
, test_params
):
1343 """FST AP ack response with session not set up"""
1344 fst_bad_transfer(apdev
, test_params
,
1345 bad_scenario_ack_resp_session_not_set_up
, True)
1347 def test_fst_ap_ack_response_with_session_not_established_init_side(dev
, apdev
, test_params
):
1348 """FST AP ack response with session not established init side"""
1349 fst_bad_transfer(apdev
, test_params
,
1350 bad_scenario_ack_resp_session_not_established_init_side
,
1353 def test_fst_ap_ack_response_with_session_not_established_resp_side(dev
, apdev
, test_params
):
1354 """FST AP ack response with session not established resp side"""
1355 fst_bad_transfer(apdev
, test_params
,
1356 bad_scenario_ack_resp_session_not_established_resp_side
,
1359 def test_fst_ap_ack_response_with_no_ack_request(dev
, apdev
, test_params
):
1360 """FST AP ack response with no ack request"""
1361 fst_bad_transfer(apdev
, test_params
, bad_scenario_ack_resp_no_ack_req
, True)
1363 def test_fst_ap_tear_down_session(dev
, apdev
, test_params
):
1364 """FST AP tear down session"""
1365 fst_tear_down_session(apdev
, test_params
, bad_param_none
, True)
1367 def test_fst_ap_tear_down_session_no_params(dev
, apdev
, test_params
):
1368 """FST AP tear down session - no params"""
1369 fst_tear_down_session(apdev
, test_params
,
1370 bad_param_session_teardown_no_params
, True)
1372 def test_fst_ap_tear_down_session_bad_session_id(dev
, apdev
, test_params
):
1373 """FST AP tear down session - bad session id"""
1374 fst_tear_down_session(apdev
, test_params
,
1375 bad_param_session_teardown_bad_session_id
, True)
1377 def test_fst_ap_tear_down_session_setup_skipped(dev
, apdev
, test_params
):
1378 """FST AP tear down session - setup skipped"""
1379 fst_tear_down_session(apdev
, test_params
,
1380 bad_param_session_teardown_setup_skipped
, True)
1382 def test_fst_ap_tear_down_session_bad_fsts_id(dev
, apdev
, test_params
):
1383 """FST AP tear down session - bad fsts id"""
1384 fst_tear_down_session(apdev
, test_params
,
1385 bad_param_session_teardown_bad_fsts_id
, True)
1387 def test_fst_ap_remove_session_not_established(dev
, apdev
, test_params
):
1388 """FST AP remove session - not established"""
1389 fst_remove_session(apdev
, test_params
,
1390 remove_scenario_non_established_session
, True)
1392 def test_fst_ap_remove_session_established(dev
, apdev
, test_params
):
1393 """FST AP remove session - established"""
1394 fst_remove_session(apdev
, test_params
,
1395 remove_scenario_established_session
, True)
1397 def test_fst_ap_remove_session_no_params(dev
, apdev
, test_params
):
1398 """FST AP remove session - no params"""
1399 fst_remove_session(apdev
, test_params
, remove_scenario_no_params
, True)
1401 def test_fst_ap_remove_session_bad_session_id(dev
, apdev
, test_params
):
1402 """FST AP remove session - bad session id"""
1403 fst_remove_session(apdev
, test_params
, remove_scenario_bad_session_id
, True)
1405 def test_fst_ap_ctrl_iface(dev
, apdev
, test_params
):
1406 """FST control interface behavior"""
1407 ap1
, ap2
, sta1
, sta2
= fst_module_aux
.start_two_ap_sta_pairs(apdev
)
1409 fst_module_aux
.connect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
1412 initiator
.add_peer(responder
, None)
1413 initiator
.set_fst_parameters(group_id
=None)
1414 sid
= initiator
.add_session()
1415 res
= initiator
.get_session_params(sid
)
1416 logger
.info("Initial session params:\n" + str(res
))
1417 if res
['state'] != 'INITIAL':
1418 raise Exception("Unexpected state: " + res
['state'])
1419 initiator
.set_fst_parameters(llt
=None)
1420 initiator
.configure_session(sid
, ap2
.ifname(), None)
1421 res
= initiator
.get_session_params(sid
)
1422 logger
.info("Session params after configuration:\n" + str(res
))
1423 res
= initiator
.iface_peers(initiator
.ifname())
1424 logger
.info("Interface peers: " + str(res
))
1426 raise Exception("Unexpected number of peers")
1427 res
= initiator
.get_peer_mbies(initiator
.ifname(),
1428 initiator
.get_new_peer_addr())
1429 logger
.info("Peer MB IEs: " + str(res
))
1430 res
= initiator
.list_ifaces()
1431 logger
.info("Interfaces: " + str(res
))
1433 raise Exception("Unexpected number of interfaces")
1434 res
= initiator
.list_groups()
1435 logger
.info("Groups: " + str(res
))
1437 raise Exception("Unexpected number of groups")
1439 tests
= [ "LIST_IFACES unknown",
1440 "LIST_IFACES unknown2",
1441 "SESSION_GET 12345678",
1442 "SESSION_SET " + sid
+ " unknown=foo",
1443 "SESSION_RESPOND 12345678 foo",
1444 "SESSION_RESPOND " + sid
,
1445 "SESSION_RESPOND " + sid
+ " foo",
1449 "GET_PEER_MBIES unknown",
1450 "GET_PEER_MBIES unknown unknown",
1451 "GET_PEER_MBIES unknown " + initiator
.get_new_peer_addr(),
1452 "GET_PEER_MBIES " + initiator
.ifname() + " 01:ff:ff:ff:ff:ff",
1455 "IFACE_PEERS unknown",
1456 "IFACE_PEERS unknown unknown",
1457 "IFACE_PEERS " + initiator
.fst_group
,
1458 "IFACE_PEERS " + initiator
.fst_group
+ " unknown" ]
1460 if "FAIL" not in initiator
.grequest("FST-MANAGER " + t
):
1461 raise Exception("Unexpected response for invalid FST-MANAGER command " + t
)
1462 if "UNKNOWN FST COMMAND" not in initiator
.grequest("FST-MANAGER unknown"):
1463 raise Exception("Unexpected response for unknown FST-MANAGER command")
1465 tests
= [ "FST-DETACH", "FST-DETACH ", "FST-DETACH unknown",
1466 "FST-ATTACH", "FST-ATTACH ", "FST-ATTACH unknown",
1467 "FST-ATTACH unknown unknown" ]
1469 if "FAIL" not in initiator
.grequest(t
):
1470 raise Exception("Unexpected response for invalid command " + t
)
1473 # Trying to add same interface again needs to fail.
1474 ap1
.send_iface_attach_request(ap1
.iface
, ap1
.fst_group
,
1475 ap1
.fst_llt
, ap1
.fst_pri
)
1476 raise Exception("Duplicate FST-ATTACH succeeded")
1477 except Exception, e
:
1478 if not str(e
).startswith("Cannot attach"):
1481 fst_module_aux
.disconnect_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
1482 fst_module_aux
.stop_two_ap_sta_pairs(ap1
, ap2
, sta1
, sta2
)
1484 def test_fst_ap_start_session_oom(dev
, apdev
, test_params
):
1485 """FST AP setup failing due to OOM"""
1486 ap1
= fst_module_aux
.FstAP(apdev
[0]['ifname'], 'fst_11a', 'a',
1487 fst_test_common
.fst_test_def_chan_a
,
1488 fst_test_common
.fst_test_def_group
,
1489 fst_test_common
.fst_test_def_prio_low
,
1490 fst_test_common
.fst_test_def_llt
)
1492 with
alloc_fail(ap1
, 1, "fst_iface_create"):
1495 ap2
= fst_module_aux
.FstAP(apdev
[1]['ifname'], 'fst_11g', 'b',
1496 fst_test_common
.fst_test_def_chan_g
,
1497 fst_test_common
.fst_test_def_group
,
1498 fst_test_common
.fst_test_def_prio_high
,
1499 fst_test_common
.fst_test_def_llt
)
1501 # This will fail in fst_iface_create() OOM
1512 # STA side FST module tests
1514 def test_fst_sta_start_session(dev
, apdev
, test_params
):
1515 """FST STA start session"""
1516 fst_start_session(apdev
, test_params
, bad_param_none
, False)
1518 def test_fst_sta_start_session_no_add_params(dev
, apdev
, test_params
):
1519 """FST STA start session - no add params"""
1520 fst_start_session(apdev
, test_params
, bad_param_session_add_no_params
,
1523 def test_fst_sta_start_session_bad_group_id(dev
, apdev
, test_params
):
1524 """FST STA start session - bad group id"""
1525 fst_start_session(apdev
, test_params
, bad_param_group_id
, False)
1527 def test_fst_sta_start_session_no_set_params(dev
, apdev
, test_params
):
1528 """FST STA start session - no set params"""
1529 fst_start_session(apdev
, test_params
, bad_param_session_set_no_params
,
1532 def test_fst_sta_start_session_set_unknown_param(dev
, apdev
, test_params
):
1533 """FST STA start session - set unknown param"""
1534 fst_start_session(apdev
, test_params
, bad_param_session_set_unknown_param
,
1537 def test_fst_sta_start_session_bad_session_id(dev
, apdev
, test_params
):
1538 """FST STA start session - bad session id"""
1539 fst_start_session(apdev
, test_params
, bad_param_session_id
, False)
1541 def test_fst_sta_start_session_bad_new_iface(dev
, apdev
, test_params
):
1542 """FST STA start session - bad new iface"""
1543 fst_start_session(apdev
, test_params
, bad_param_new_iface
, False)
1545 def test_fst_sta_start_session_bad_old_iface(dev
, apdev
, test_params
):
1546 """FST STA start session - bad old iface"""
1547 fst_start_session(apdev
, test_params
, bad_param_old_iface
, False)
1549 def test_fst_sta_start_session_negative_llt(dev
, apdev
, test_params
):
1550 """FST STA start session - negative llt"""
1551 fst_start_session(apdev
, test_params
, bad_param_negative_llt
, False)
1553 def test_fst_sta_start_session_zero_llt(dev
, apdev
, test_params
):
1554 """FST STA start session - zero llt"""
1555 fst_start_session(apdev
, test_params
, bad_param_zero_llt
, False)
1557 def test_fst_sta_start_session_llt_too_big(dev
, apdev
, test_params
):
1558 """FST STA start session - llt too large"""
1559 fst_start_session(apdev
, test_params
, bad_param_llt_too_big
, False)
1561 def test_fst_sta_start_session_invalid_peer_addr(dev
, apdev
, test_params
):
1562 """FST STA start session - invalid peer address"""
1563 fst_start_session(apdev
, test_params
, bad_param_peer_addr
, False,
1564 'GG:GG:GG:GG:GG:GG')
1566 def test_fst_sta_start_session_multicast_peer_addr(dev
, apdev
, test_params
):
1567 """FST STA start session - multicast peer address"""
1568 fst_start_session(apdev
, test_params
, bad_param_peer_addr
, False,
1569 '11:00:11:22:33:44')
1571 def test_fst_sta_start_session_broadcast_peer_addr(dev
, apdev
, test_params
):
1572 """FST STA start session - broadcast peer addr"""
1573 fst_start_session(apdev
, test_params
, bad_param_peer_addr
, False,
1574 'FF:FF:FF:FF:FF:FF')
1576 def test_fst_sta_initiate_session(dev
, apdev
, test_params
):
1577 """FST STA initiate session"""
1578 fst_initiate_session(apdev
, test_params
, bad_param_none
, False)
1580 def test_fst_sta_initiate_session_no_params(dev
, apdev
, test_params
):
1581 """FST STA initiate session - no params"""
1582 fst_initiate_session(apdev
, test_params
,
1583 bad_param_session_initiate_no_params
, False)
1585 def test_fst_sta_initiate_session_invalid_session_id(dev
, apdev
, test_params
):
1586 """FST STA initiate session - invalid session id"""
1587 fst_initiate_session(apdev
, test_params
,
1588 bad_param_session_initiate_bad_session_id
, False)
1590 def test_fst_sta_initiate_session_no_new_iface(dev
, apdev
, test_params
):
1591 """FST STA initiate session - no new iface"""
1592 fst_initiate_session(apdev
, test_params
,
1593 bad_param_session_initiate_with_no_new_iface_set
,
1596 def test_fst_sta_initiate_session_bad_peer_addr(dev
, apdev
, test_params
):
1597 """FST STA initiate session - bad peer address"""
1598 fst_initiate_session(apdev
, test_params
,
1599 bad_param_session_initiate_with_bad_peer_addr_set
,
1602 def test_fst_sta_initiate_session_request_with_bad_stie(dev
, apdev
,
1604 """FST STA initiate session - request with bad stie"""
1605 fst_initiate_session(apdev
, test_params
,
1606 bad_param_session_initiate_request_with_bad_stie
,
1609 def test_fst_sta_initiate_session_response_with_reject(dev
, apdev
, test_params
):
1610 """FST STA initiate session - response with reject"""
1611 fst_initiate_session(apdev
, test_params
, bad_param_session_initiate_response_with_reject
, False)
1613 def test_fst_sta_initiate_session_response_with_bad_stie(dev
, apdev
, test_params
):
1614 """FST STA initiate session - response with bad stie"""
1615 fst_initiate_session(apdev
, test_params
,
1616 bad_param_session_initiate_response_with_bad_stie
,
1619 def test_fst_sta_initiate_session_response_with_zero_llt(dev
, apdev
,
1621 """FST STA initiate session - response with zero llt"""
1622 fst_initiate_session(apdev
, test_params
,
1623 bad_param_session_initiate_response_with_zero_llt
,
1626 def test_fst_sta_initiate_session_stt_no_response(dev
, apdev
, test_params
):
1627 """FST STA initiate session - stt no response"""
1628 fst_initiate_session(apdev
, test_params
,
1629 bad_param_session_initiate_stt_no_response
, False)
1631 def test_fst_sta_initiate_session_concurrent_setup_request(dev
, apdev
,
1633 """FST STA initiate session - concurrent setup request"""
1634 fst_initiate_session(apdev
, test_params
,
1635 bad_param_session_initiate_concurrent_setup_request
,
1638 def test_fst_sta_session_request_with_no_session(dev
, apdev
, test_params
):
1639 """FST STA session request with no session"""
1640 fst_send_unexpected_frame(apdev
, test_params
, frame_type_session_request
,
1643 def test_fst_sta_session_response_accept_with_no_session(dev
, apdev
,
1645 """FST STA session response accept with no session"""
1646 fst_send_unexpected_frame(apdev
, test_params
, frame_type_session_response
,
1649 def test_fst_sta_session_response_reject_with_no_session(dev
, apdev
,
1651 """FST STA session response reject with no session"""
1652 fst_send_unexpected_frame(apdev
, test_params
, frame_type_session_response
,
1655 def test_fst_sta_ack_request_with_no_session(dev
, apdev
, test_params
):
1656 """FST STA ack request with no session"""
1657 fst_send_unexpected_frame(apdev
, test_params
, frame_type_ack_request
, False)
1659 def test_fst_sta_ack_response_with_no_session(dev
, apdev
, test_params
):
1660 """FST STA ack response with no session"""
1661 fst_send_unexpected_frame(apdev
, test_params
, frame_type_ack_response
,
1664 def test_fst_sta_tear_down_response_with_no_session(dev
, apdev
, test_params
):
1665 """FST STA tear down response with no session"""
1666 fst_send_unexpected_frame(apdev
, test_params
, frame_type_tear_down
, False)
1668 def test_fst_sta_transfer_session(dev
, apdev
, test_params
):
1669 """FST STA transfer session"""
1670 fst_transfer_session(apdev
, test_params
, bad_param_none
, False)
1672 def test_fst_sta_transfer_session_no_params(dev
, apdev
, test_params
):
1673 """FST STA transfer session - no params"""
1674 fst_transfer_session(apdev
, test_params
,
1675 bad_param_session_transfer_no_params
, False)
1677 def test_fst_sta_transfer_session_bad_session_id(dev
, apdev
, test_params
):
1678 """FST STA transfer session - bad session id"""
1679 fst_transfer_session(apdev
, test_params
,
1680 bad_param_session_transfer_bad_session_id
, False)
1682 def test_fst_sta_transfer_session_setup_skipped(dev
, apdev
, test_params
):
1683 """FST STA transfer session - setup skipped"""
1684 fst_transfer_session(apdev
, test_params
,
1685 bad_param_session_transfer_setup_skipped
, False)
1687 def test_fst_sta_ack_request_with_session_not_set_up(dev
, apdev
, test_params
):
1688 """FST STA ack request with session not set up"""
1689 fst_bad_transfer(apdev
, test_params
,
1690 bad_scenario_ack_req_session_not_set_up
, False)
1692 def test_fst_sta_ack_request_with_session_not_established_init_side(dev
, apdev
, test_params
):
1693 """FST STA ack request with session not established init side"""
1694 fst_bad_transfer(apdev
, test_params
,
1695 bad_scenario_ack_req_session_not_established_init_side
,
1698 def test_fst_sta_ack_request_with_session_not_established_resp_side(dev
, apdev
, test_params
):
1699 """FST STA ack request with session not established resp side"""
1700 fst_bad_transfer(apdev
, test_params
,
1701 bad_scenario_ack_req_session_not_established_resp_side
,
1704 def test_fst_sta_ack_request_with_bad_fsts_id(dev
, apdev
, test_params
):
1705 """FST STA ack request with bad fsts id"""
1706 fst_bad_transfer(apdev
, test_params
, bad_scenario_ack_req_bad_fsts_id
,
1709 def test_fst_sta_ack_response_with_session_not_set_up(dev
, apdev
, test_params
):
1710 """FST STA ack response with session not set up"""
1711 fst_bad_transfer(apdev
, test_params
,
1712 bad_scenario_ack_resp_session_not_set_up
, False)
1714 def test_fst_sta_ack_response_with_session_not_established_init_side(dev
, apdev
, test_params
):
1715 """FST STA ack response with session not established init side"""
1716 fst_bad_transfer(apdev
, test_params
,
1717 bad_scenario_ack_resp_session_not_established_init_side
,
1720 def test_fst_sta_ack_response_with_session_not_established_resp_side(dev
, apdev
, test_params
):
1721 """FST STA ack response with session not established resp side"""
1722 fst_bad_transfer(apdev
, test_params
,
1723 bad_scenario_ack_resp_session_not_established_resp_side
,
1726 def test_fst_sta_ack_response_with_no_ack_request(dev
, apdev
, test_params
):
1727 """FST STA ack response with no ack request"""
1728 fst_bad_transfer(apdev
, test_params
, bad_scenario_ack_resp_no_ack_req
,
1731 def test_fst_sta_tear_down_session(dev
, apdev
, test_params
):
1732 """FST STA tear down session"""
1733 fst_tear_down_session(apdev
, test_params
, bad_param_none
, False)
1735 def test_fst_sta_tear_down_session_no_params(dev
, apdev
, test_params
):
1736 """FST STA tear down session - no params"""
1737 fst_tear_down_session(apdev
, test_params
,
1738 bad_param_session_teardown_no_params
, False)
1740 def test_fst_sta_tear_down_session_bad_session_id(dev
, apdev
, test_params
):
1741 """FST STA tear down session - bad session id"""
1742 fst_tear_down_session(apdev
, test_params
,
1743 bad_param_session_teardown_bad_session_id
, False)
1745 def test_fst_sta_tear_down_session_setup_skipped(dev
, apdev
, test_params
):
1746 """FST STA tear down session - setup skipped"""
1747 fst_tear_down_session(apdev
, test_params
,
1748 bad_param_session_teardown_setup_skipped
, False)
1750 def test_fst_sta_tear_down_session_bad_fsts_id(dev
, apdev
, test_params
):
1751 """FST STA tear down session - bad fsts id"""
1752 fst_tear_down_session(apdev
, test_params
,
1753 bad_param_session_teardown_bad_fsts_id
, False)
1755 def test_fst_sta_remove_session_not_established(dev
, apdev
, test_params
):
1756 """FST STA tear down session - not established"""
1757 fst_remove_session(apdev
, test_params
,
1758 remove_scenario_non_established_session
, False)
1760 def test_fst_sta_remove_session_established(dev
, apdev
, test_params
):
1761 """FST STA remove session - established"""
1762 fst_remove_session(apdev
, test_params
,
1763 remove_scenario_established_session
, False)
1765 def test_fst_sta_remove_session_no_params(dev
, apdev
, test_params
):
1766 """FST STA remove session - no params"""
1767 fst_remove_session(apdev
, test_params
, remove_scenario_no_params
, False)
1769 def test_fst_sta_remove_session_bad_session_id(dev
, apdev
, test_params
):
1770 """FST STA remove session - bad session id"""
1771 fst_remove_session(apdev
, test_params
, remove_scenario_bad_session_id
,