123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743 |
- # FST functionality tests
- # Copyright (c) 2015, Qualcomm Atheros, Inc.
- #
- # This software may be distributed under the terms of the BSD license.
- # See README for more details.
- import logging
- logger = logging.getLogger()
- import subprocess
- import time
- import os
- import hwsim_utils
- from hwsim import HWSimRadio
- import hostapd
- import fst_test_common
- import fst_module_aux
- #enum - bad parameter types
- bad_param_none = 0
- bad_param_session_add_no_params = 1
- bad_param_group_id = 2
- bad_param_session_set_no_params = 3
- bad_param_session_set_unknown_param = 4
- bad_param_session_id = 5
- bad_param_old_iface = 6
- bad_param_new_iface = 7
- bad_param_negative_llt = 8
- bad_param_zero_llt = 9
- bad_param_llt_too_big = 10
- bad_param_llt_nan = 11
- bad_param_peer_addr = 12
- bad_param_session_initiate_no_params = 13
- bad_param_session_initiate_bad_session_id = 14
- bad_param_session_initiate_with_no_new_iface_set = 15
- bad_param_session_initiate_with_bad_peer_addr_set = 16
- bad_param_session_initiate_request_with_bad_stie = 17
- bad_param_session_initiate_response_with_reject = 18
- bad_param_session_initiate_response_with_bad_stie = 19
- bad_param_session_initiate_response_with_zero_llt = 20
- bad_param_session_initiate_stt_no_response = 21
- bad_param_session_initiate_concurrent_setup_request = 22
- bad_param_session_transfer_no_params = 23
- bad_param_session_transfer_bad_session_id = 24
- bad_param_session_transfer_setup_skipped = 25
- bad_param_session_teardown_no_params = 26
- bad_param_session_teardown_bad_session_id = 27
- bad_param_session_teardown_setup_skipped = 28
- bad_param_session_teardown_bad_fsts_id = 29
- bad_param_names = ("None",
- "No params passed to session add",
- "Group ID",
- "No params passed to session set",
- "Unknown param passed to session set",
- "Session ID",
- "Old interface name",
- "New interface name",
- "Negative LLT",
- "Zero LLT",
- "LLT too big",
- "LLT is not a number",
- "Peer address",
- "No params passed to session initiate",
- "Session ID",
- "No new_iface was set",
- "Peer address",
- "Request with bad st ie",
- "Response with reject",
- "Response with bad st ie",
- "Response with zero llt",
- "No response, STT",
- "Concurrent setup request",
- "No params passed to session transfer",
- "Session ID",
- "Session setup skipped",
- "No params passed to session teardown",
- "Bad session",
- "Session setup skipped",
- "Bad fsts_id")
- def fst_start_session(apdev, test_params, bad_param_type, start_on_ap,
- peer_addr = None):
- """This function makes the necessary preparations and the adds and sets a
- session using either correct or incorrect parameters depending on the value
- of bad_param_type. If the call ends as expected (with session being
- successfully added and set in case of correct parameters or with the
- expected exception in case of incorrect parameters), 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)
- bad_parameter_detected = False
- exception_already_raised = False
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if start_on_ap:
- initiator = ap1
- responder = sta1
- new_iface = ap2.ifname()
- new_peer_addr = ap2.get_actual_peer_addr()
- else:
- initiator = sta1
- responder = ap1
- new_iface = sta2.ifname()
- new_peer_addr = sta2.get_actual_peer_addr()
- initiator.add_peer(responder, peer_addr, new_peer_addr)
- group_id = None
- if bad_param_type == bad_param_group_id:
- group_id = '-1'
- elif bad_param_type == bad_param_session_add_no_params:
- group_id = ''
- initiator.set_fst_parameters(group_id=group_id)
- sid = initiator.add_session()
- if bad_param_type == bad_param_session_set_no_params:
- res = initiator.set_session_param(None)
- if not res.startswith("OK"):
- raise Exception("Session set operation failed")
- elif bad_param_type == bad_param_session_set_unknown_param:
- res = initiator.set_session_param("bad_param=1")
- if not res.startswith("OK"):
- raise Exception("Session set operation failed")
- else:
- if bad_param_type == bad_param_session_initiate_with_no_new_iface_set:
- new_iface = None
- elif bad_param_type == bad_param_new_iface:
- new_iface = 'wlan12'
- old_iface = None if bad_param_type != bad_param_old_iface else 'wlan12'
- llt = None
- if bad_param_type == bad_param_negative_llt:
- llt = '-1'
- elif bad_param_type == bad_param_zero_llt:
- llt = '0'
- elif bad_param_type == bad_param_llt_too_big:
- llt = '4294967296' #0x100000000
- elif bad_param_type == bad_param_llt_nan:
- llt = 'nan'
- elif bad_param_type == bad_param_session_id:
- sid = '-1'
- initiator.set_fst_parameters(llt=llt)
- initiator.configure_session(sid, new_iface, old_iface)
- except Exception, e:
- if e.args[0].startswith("Cannot add FST session with groupid"):
- if bad_param_type == bad_param_group_id or bad_param_type == bad_param_session_add_no_params:
- bad_parameter_detected = True
- elif e.args[0].startswith("Cannot set FST session new_ifname:"):
- if bad_param_type == bad_param_new_iface:
- bad_parameter_detected = True
- elif e.args[0].startswith("Session set operation failed"):
- if (bad_param_type == bad_param_session_set_no_params or
- bad_param_type == bad_param_session_set_unknown_param):
- bad_parameter_detected = True
- elif e.args[0].startswith("Cannot set FST session old_ifname:"):
- if (bad_param_type == bad_param_old_iface or
- bad_param_type == bad_param_session_id or
- bad_param_type == bad_param_session_set_no_params):
- bad_parameter_detected = True
- elif e.args[0].startswith("Cannot set FST session llt:"):
- if (bad_param_type == bad_param_negative_llt or
- bad_param_type == bad_param_llt_too_big or
- bad_param_type == bad_param_llt_nan):
- bad_parameter_detected = True
- elif e.args[0].startswith("Cannot set FST session peer address:"):
- if bad_param_type == bad_param_peer_addr:
- bad_parameter_detected = True
- if not bad_parameter_detected:
- # The exception was unexpected
- logger.info(e)
- exception_already_raised = True
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if not exception_already_raised:
- if bad_parameter_detected:
- logger.info("Success. Bad parameter was detected (%s)" % bad_param_names[bad_param_type])
- else:
- if bad_param_type == bad_param_none or bad_param_type == bad_param_zero_llt:
- logger.info("Success. Session added and set")
- else:
- exception_text = ""
- if bad_param_type == bad_param_peer_addr:
- exception_text = "Failure. Bad parameter was not detected (Peer address == %s)" % ap1.get_new_peer_addr()
- else:
- exception_text = "Failure. Bad parameter was not detected (%s)" % bad_param_names[bad_param_type]
- raise Exception(exception_text)
- else:
- print "Failure. Unexpected exception"
- def fst_initiate_session(apdev, test_params, bad_param_type, init_on_ap):
- """This function makes the necessary preparations and then adds, sets and
- initiates 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
- (with session being successfully added, set and initiated in case of correct
- parameters or with the expected exception in case of incorrect parameters),
- 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)
- bad_parameter_detected = False
- exception_already_raised = False
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- # 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).
- ap1.get_global_instance()
- if init_on_ap:
- initiator = ap1
- responder = sta1
- new_iface = ap2.ifname() if bad_param_type != bad_param_session_initiate_with_no_new_iface_set else None
- new_peer_addr = ap2.get_actual_peer_addr()
- resp_newif = sta2.ifname()
- else:
- initiator = sta1
- responder = ap1
- new_iface = sta2.ifname() if bad_param_type != bad_param_session_initiate_with_no_new_iface_set else None
- new_peer_addr = sta2.get_actual_peer_addr()
- resp_newif = ap2.ifname()
- peeraddr = None if bad_param_type != bad_param_session_initiate_with_bad_peer_addr_set else '10:DE:AD:DE:AD:11'
- initiator.add_peer(responder, peeraddr, new_peer_addr)
- if bad_param_type == bad_param_session_initiate_response_with_zero_llt:
- initiator.set_fst_parameters(llt='0')
- sid = initiator.add_session()
- initiator.configure_session(sid, new_iface)
- if bad_param_type == bad_param_session_initiate_no_params:
- sid = ''
- elif bad_param_type == bad_param_session_initiate_bad_session_id:
- sid = '-1'
- if bad_param_type == bad_param_session_initiate_request_with_bad_stie:
- actual_fsts_id = initiator.get_fsts_id_by_sid(sid)
- initiator.send_test_session_setup_request(str(actual_fsts_id), "bad_new_band")
- responder.wait_for_session_event(5)
- elif bad_param_type == bad_param_session_initiate_response_with_reject:
- initiator.send_session_setup_request(sid)
- initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- setup_event = responder.wait_for_session_event(5, [],
- ['EVENT_FST_SETUP'])
- if not 'id' in setup_event:
- raise Exception("No session id in FST setup event")
- responder.send_session_setup_response(str(setup_event['id']),
- "reject")
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- if event['new_state'] != "INITIAL" or event['reason'] != "REASON_REJECT":
- raise Exception("Response with reject not handled as expected")
- bad_parameter_detected = True
- elif bad_param_type == bad_param_session_initiate_response_with_bad_stie:
- initiator.send_session_setup_request(sid)
- initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- responder.wait_for_session_event(5, [], ['EVENT_FST_SETUP'])
- actual_fsts_id = initiator.get_fsts_id_by_sid(sid)
- responder.send_test_session_setup_response(str(actual_fsts_id),
- "accept", "bad_new_band")
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- if event['new_state'] != "INITIAL" or event['reason'] != "REASON_ERROR_PARAMS":
- raise Exception("Response with bad STIE not handled as expected")
- bad_parameter_detected = True
- elif bad_param_type == bad_param_session_initiate_response_with_zero_llt:
- initiator.initiate_session(sid, "accept")
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- if event['new_state'] != "TRANSITION_DONE":
- raise Exception("Response reception for a session with llt=0 not handled as expected")
- bad_parameter_detected = True
- elif bad_param_type == bad_param_session_initiate_stt_no_response:
- initiator.send_session_setup_request(sid)
- initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- responder.wait_for_session_event(5, [], ['EVENT_FST_SETUP'])
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- if event['new_state'] != "INITIAL" or event['reason'] != "REASON_STT":
- raise Exception("No response scenario not handled as expected")
- bad_parameter_detected = True
- elif bad_param_type == bad_param_session_initiate_concurrent_setup_request:
- responder.add_peer(initiator)
- resp_sid = responder.add_session()
- responder.configure_session(resp_sid, resp_newif)
- initiator.send_session_setup_request(sid)
- actual_fsts_id = initiator.get_fsts_id_by_sid(sid)
- responder.send_test_session_setup_request(str(actual_fsts_id))
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- initiator_addr = initiator.get_own_mac_address()
- responder_addr = responder.get_own_mac_address()
- if initiator_addr < responder_addr:
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- if event['new_state'] != "INITIAL" or event['reason'] != "REASON_SETUP":
- raise Exception("Concurrent setup scenario not handled as expected")
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SETUP"])
- # The incoming setup request received by the initiator has
- # priority over the one sent previously by the initiator itself
- # because the initiator's MAC address is numerically lower than
- # the one of the responder. Thus, the initiator should generate
- # an FST_SETUP event.
- else:
- event = initiator.wait_for_session_event(5, [], ["EVENT_FST_SESSION_STATE"])
- if event['new_state'] != "INITIAL" or event['reason'] != "REASON_STT":
- raise Exception("Concurrent setup scenario not handled as expected")
- # The incoming setup request was dropped at the initiator
- # because its MAC address is numerically bigger than the one of
- # the responder. Thus, the initiator continue to wait for a
- # setup response until the STT event fires.
- bad_parameter_detected = True
- else:
- initiator.initiate_session(sid, "accept")
- except Exception, e:
- if e.args[0].startswith("Cannot initiate fst session"):
- if bad_param_type != bad_param_none:
- bad_parameter_detected = True
- elif e.args[0].startswith("No FST-EVENT-SESSION received"):
- if bad_param_type == bad_param_session_initiate_request_with_bad_stie:
- bad_parameter_detected = True
- if not bad_parameter_detected:
- #The exception was unexpected
- logger.info(e)
- exception_already_raised = True
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if not exception_already_raised:
- if bad_parameter_detected:
- logger.info("Success. Bad parameter was detected (%s)" % bad_param_names[bad_param_type])
- else:
- if bad_param_type == bad_param_none:
- logger.info("Success. Session initiated")
- else:
- raise Exception("Failure. Bad parameter was not detected (%s)" % bad_param_names[bad_param_type])
- else:
- print "Failure. Unexpected exception"
- def fst_transfer_session(apdev, test_params, bad_param_type, init_on_ap):
- """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)
- bad_parameter_detected = False
- exception_already_raised = False
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- # 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).
- ap1.get_global_instance()
- if init_on_ap:
- initiator = ap1
- responder = sta1
- new_iface = ap2.ifname()
- new_peer_addr = ap2.get_actual_peer_addr()
- else:
- initiator = sta1
- responder = ap1
- new_iface = sta2.ifname()
- new_peer_addr = sta2.get_actual_peer_addr()
- initiator.add_peer(responder, new_peer_addr = new_peer_addr)
- sid = initiator.add_session()
- initiator.configure_session(sid, new_iface)
- if bad_param_type != bad_param_session_transfer_setup_skipped:
- initiator.initiate_session(sid, "accept")
- if bad_param_type == bad_param_session_transfer_no_params:
- sid = ''
- elif bad_param_type == bad_param_session_transfer_bad_session_id:
- sid = '-1'
- initiator.transfer_session(sid)
- except Exception, e:
- if e.args[0].startswith("Cannot transfer fst session"):
- if bad_param_type != bad_param_none:
- bad_parameter_detected = True
- if not bad_parameter_detected:
- # The exception was unexpected
- logger.info(e)
- exception_already_raised = True
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if not exception_already_raised:
- if bad_parameter_detected:
- logger.info("Success. Bad parameter was detected (%s)" % bad_param_names[bad_param_type])
- else:
- if bad_param_type == bad_param_none:
- logger.info("Success. Session transferred")
- else:
- raise Exception("Failure. Bad parameter was not detected (%s)" % bad_param_names[bad_param_type])
- else:
- print "Failure. Unexpected exception"
- def fst_tear_down_session(apdev, test_params, bad_param_type, init_on_ap):
- """This function makes the necessary preparations and then adds, sets, and
- initiates a session. It then issues a tear down command using either
- correct or incorrect parameters at each stage. 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)
- bad_parameter_detected = False
- exception_already_raised = False
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- # 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).
- ap1.get_global_instance()
- if init_on_ap:
- initiator = ap1
- responder = sta1
- new_iface = ap2.ifname()
- new_peer_addr = ap2.get_actual_peer_addr()
- else:
- initiator = sta1
- responder = ap1
- new_iface = sta2.ifname()
- new_peer_addr = sta2.get_actual_peer_addr()
- initiator.add_peer(responder, new_peer_addr = new_peer_addr)
- sid = initiator.add_session()
- initiator.configure_session(sid, new_iface)
- if bad_param_type != bad_param_session_teardown_setup_skipped:
- initiator.initiate_session(sid, "accept")
- if bad_param_type == bad_param_session_teardown_bad_fsts_id:
- initiator.send_test_tear_down('-1')
- responder.wait_for_session_event(5)
- else:
- if bad_param_type == bad_param_session_teardown_no_params:
- sid = ''
- elif bad_param_type == bad_param_session_teardown_bad_session_id:
- sid = '-1'
- initiator.teardown_session(sid)
- except Exception, e:
- if e.args[0].startswith("Cannot tear down fst session"):
- if (bad_param_type == bad_param_session_teardown_no_params or
- bad_param_type == bad_param_session_teardown_bad_session_id or
- bad_param_type == bad_param_session_teardown_setup_skipped):
- bad_parameter_detected = True
- elif e.args[0].startswith("No FST-EVENT-SESSION received"):
- if bad_param_type == bad_param_session_teardown_bad_fsts_id:
- bad_parameter_detected = True
- if not bad_parameter_detected:
- # The exception was unexpected
- logger.info(e)
- exception_already_raised = True
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if not exception_already_raised:
- if bad_parameter_detected:
- logger.info("Success. Bad parameter was detected (%s)" % bad_param_names[bad_param_type])
- else:
- if bad_param_type == bad_param_none:
- logger.info("Success. Session torn down")
- else:
- raise Exception("Failure. Bad parameter was not detected (%s)" % bad_param_names[bad_param_type])
- else:
- print "Failure. Unexpected exception"
- #enum - remove session scenarios
- remove_scenario_no_params = 0
- remove_scenario_bad_session_id = 1
- remove_scenario_non_established_session = 2
- remove_scenario_established_session = 3
- remove_scenario_names = ("No params",
- "Bad session id",
- "Remove non-established session",
- "Remove established session")
- def fst_remove_session(apdev, test_params, remove_session_scenario, init_on_ap):
- """This function attempts to remove a session at various stages of its
- formation, depending on the value of remove_session_scenario. 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)
- bad_parameter_detected = False
- exception_already_raised = False
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- # 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).
- ap1.get_global_instance()
- if init_on_ap:
- initiator = ap1
- responder = sta1
- new_iface = ap2.ifname()
- new_peer_addr = ap2.get_actual_peer_addr()
- else:
- initiator = sta1
- responder = ap1
- new_iface = sta2.ifname()
- new_peer_addr = sta2.get_actual_peer_addr()
- initiator.add_peer(responder, new_peer_addr = new_peer_addr)
- sid = initiator.add_session()
- initiator.configure_session(sid, new_iface)
- if remove_session_scenario != remove_scenario_no_params:
- if remove_session_scenario != remove_scenario_non_established_session:
- initiator.initiate_session(sid, "accept")
- if remove_session_scenario == remove_scenario_no_params:
- sid = ''
- elif remove_session_scenario == remove_scenario_bad_session_id:
- sid = '-1'
- initiator.remove_session(sid)
- except Exception, e:
- if e.args[0].startswith("Cannot remove fst session"):
- if (remove_session_scenario == remove_scenario_no_params or
- remove_session_scenario == remove_scenario_bad_session_id):
- bad_parameter_detected = True
- elif e.args[0].startswith("No FST-EVENT-SESSION received"):
- if remove_session_scenario == remove_scenario_non_established_session:
- bad_parameter_detected = True
- if not bad_parameter_detected:
- #The exception was unexpected
- logger.info(e)
- exception_already_raised = True
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if not exception_already_raised:
- if bad_parameter_detected:
- logger.info("Success. Remove scenario ended as expected (%s)" % remove_scenario_names[remove_session_scenario])
- else:
- if remove_session_scenario == remove_scenario_established_session:
- logger.info("Success. Session removed")
- else:
- raise Exception("Failure. Remove scenario ended in an unexpected way (%s)" % remove_scenario_names[remove_session_scenario])
- else:
- print "Failure. Unexpected exception"
- #enum - frame types
- frame_type_session_request = 0
- frame_type_session_response = 1
- frame_type_ack_request = 2
- frame_type_ack_response = 3
- frame_type_tear_down = 4
- frame_type_names = ("Session request",
- "Session Response",
- "Ack request",
- "Ack response",
- "Tear down")
- def fst_send_unexpected_frame(apdev, test_params, frame_type, send_from_ap, additional_param = ''):
- """This function creates two pairs of APs and stations, makes them connect
- and then causes one side to send an unexpected FST frame of the specified
- type to the other. The other side should then identify and ignore the
- frame."""
- ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- exception_already_raised = False
- frame_receive_timeout = False
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- # 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).
- ap1.get_global_instance()
- if send_from_ap:
- sender = ap1
- receiver = sta1
- new_iface = ap2.ifname()
- new_peer_addr = ap2.get_actual_peer_addr()
- else:
- sender = sta1
- receiver = ap1
- new_iface = sta2.ifname()
- new_peer_addr = sta2.get_actual_peer_addr()
- sender.add_peer(receiver, new_peer_addr = new_peer_addr)
- sid=sender.add_session()
- sender.configure_session(sid, new_iface)
- if frame_type == frame_type_session_request:
- sender.send_session_setup_request(sid)
- event = receiver.wait_for_session_event(5)
- if event['type'] != 'EVENT_FST_SETUP':
- raise Exception("Unexpected indication: " + event['type'])
- elif frame_type == frame_type_session_response:
- #fsts_id doesn't matter, no actual session exists
- sender.send_test_session_setup_response('0', additional_param)
- receiver.wait_for_session_event(5)
- elif frame_type == frame_type_ack_request:
- #fsts_id doesn't matter, no actual session exists
- sender.send_test_ack_request('0')
- receiver.wait_for_session_event(5)
- elif frame_type == frame_type_ack_response:
- #fsts_id doesn't matter, no actual session exists
- sender.send_test_ack_response('0')
- receiver.wait_for_session_event(5)
- elif frame_type == frame_type_tear_down:
- #fsts_id doesn't matter, no actual session exists
- sender.send_test_tear_down('0')
- receiver.wait_for_session_event(5)
- except Exception, e:
- if e.args[0].startswith("No FST-EVENT-SESSION received"):
- if frame_type != frame_type_session_request:
- frame_receive_timeout = True
- else:
- logger.info(e)
- exception_already_raised = True
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if not exception_already_raised:
- if frame_receive_timeout:
- logger.info("Success. Frame was ignored (%s)" % frame_type_names[frame_type])
- else:
- if frame_type == frame_type_session_request:
- logger.info("Success. Frame received, session created")
- else:
- raise Exception("Failure. Frame was not ignored (%s)" % frame_type_names[frame_type])
- else:
- print "Failure. Unexpected exception"
- #enum - bad session transfer scenarios
- bad_scenario_none = 0
- bad_scenario_ack_req_session_not_set_up = 1
- bad_scenario_ack_req_session_not_established_init_side = 2
- bad_scenario_ack_req_session_not_established_resp_side = 3
- bad_scenario_ack_req_bad_fsts_id = 4
- bad_scenario_ack_resp_session_not_set_up = 5
- bad_scenario_ack_resp_session_not_established_init_side = 6
- bad_scenario_ack_resp_session_not_established_resp_side = 7
- bad_scenario_ack_resp_no_ack_req = 8
- bad_scenario_ack_resp_bad_fsts_id = 9
- bad_scenario_names = ("None",
- "Ack request received before the session was set up",
- "Ack request received on the initiator side before session was established",
- "Ack request received on the responder side before session was established",
- "Ack request received with bad fsts_id",
- "Ack response received before the session was set up",
- "Ack response received on the initiator side before session was established",
- "Ack response received on the responder side before session was established",
- "Ack response received before ack request was sent",
- "Ack response received with bad fsts_id")
- def fst_bad_transfer(apdev, test_params, bad_scenario_type, init_on_ap):
- """This function makes the necessary preparations and then adds and sets a
- session. It then initiates and it unless instructed otherwise) and attempts
- to send one of the frames involved in the session transfer protocol,
- skipping or distorting one of the stages according to the value of
- bad_scenario_type parameter."""
- ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- bad_parameter_detected = False
- exception_already_raised = False
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- # 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).
- ap1.get_global_instance()
- if init_on_ap:
- initiator = ap1
- responder = sta1
- new_iface = ap2.ifname()
- new_peer_addr = ap2.get_actual_peer_addr()
- else:
- initiator = sta1
- responder = ap1
- new_iface = sta2.ifname()
- new_peer_addr = sta2.get_actual_peer_addr()
- initiator.add_peer(responder, new_peer_addr = new_peer_addr)
- sid = initiator.add_session()
- initiator.configure_session(sid, new_iface)
- if (bad_scenario_type != bad_scenario_ack_req_session_not_set_up and
- bad_scenario_type != bad_scenario_ack_resp_session_not_set_up):
- if (bad_scenario_type != bad_scenario_ack_req_session_not_established_init_side and
- bad_scenario_type != bad_scenario_ack_resp_session_not_established_init_side and
- bad_scenario_type != bad_scenario_ack_req_session_not_established_resp_side and
- bad_scenario_type != bad_scenario_ack_resp_session_not_established_resp_side):
- response = "accept"
- else:
- response = ''
- initiator.initiate_session(sid, response)
- if bad_scenario_type == bad_scenario_ack_req_session_not_set_up:
- #fsts_id doesn't matter, no actual session exists
- responder.send_test_ack_request('0')
- initiator.wait_for_session_event(5)
- # We want to send the unexpected frame to the side that already has
- # a session created
- elif bad_scenario_type == bad_scenario_ack_resp_session_not_set_up:
- #fsts_id doesn't matter, no actual session exists
- responder.send_test_ack_response('0')
- initiator.wait_for_session_event(5)
- # We want to send the unexpected frame to the side that already has
- # a session created
- elif bad_scenario_type == bad_scenario_ack_req_session_not_established_init_side:
- #fsts_id doesn't matter, no actual session exists
- initiator.send_test_ack_request('0')
- responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
- elif bad_scenario_type == bad_scenario_ack_req_session_not_established_resp_side:
- #fsts_id doesn't matter, no actual session exists
- responder.send_test_ack_request('0')
- initiator.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
- elif bad_scenario_type == bad_scenario_ack_resp_session_not_established_init_side:
- #fsts_id doesn't matter, no actual session exists
- initiator.send_test_ack_response('0')
- responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
- elif bad_scenario_type == bad_scenario_ack_resp_session_not_established_resp_side:
- #fsts_id doesn't matter, no actual session exists
- responder.send_test_ack_response('0')
- initiator.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
- elif bad_scenario_type == bad_scenario_ack_req_bad_fsts_id:
- initiator.send_test_ack_request('-1')
- responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
- elif bad_scenario_type == bad_scenario_ack_resp_bad_fsts_id:
- initiator.send_test_ack_response('-1')
- responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
- elif bad_scenario_type == bad_scenario_ack_resp_no_ack_req:
- actual_fsts_id = initiator.get_fsts_id_by_sid(sid)
- initiator.send_test_ack_response(str(actual_fsts_id))
- responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
- else:
- raise Exception("Unknown bad scenario identifier")
- except Exception, e:
- if e.args[0].startswith("No FST-EVENT-SESSION received"):
- bad_parameter_detected = True
- if not bad_parameter_detected:
- # The exception was unexpected
- logger.info(e)
- exception_already_raised = True
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- if not exception_already_raised:
- if bad_parameter_detected:
- logger.info("Success. Bad scenario was handled correctly (%s)" % bad_scenario_names[bad_scenario_type])
- else:
- raise Exception("Failure. Bad scenario was handled incorrectly (%s)" % bad_scenario_names[bad_scenario_type])
- else:
- print "Failure. Unexpected exception"
- def test_fst_sta_connect_to_non_fst_ap(dev, apdev, test_params):
- """FST STA connecting to non-FST AP"""
- ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- with HWSimRadio() as (radio, iface):
- non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
- try:
- orig_sta1_mbies = sta1.get_local_mbies()
- orig_sta2_mbies = sta2.get_local_mbies()
- vals = sta2.scan()
- freq = vals['freq']
- sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g",
- key_mgmt="NONE", scan_freq=freq)
- time.sleep(2)
- res_sta1_mbies = sta1.get_local_mbies()
- res_sta2_mbies = sta2.get_local_mbies()
- if (orig_sta1_mbies.startswith("FAIL") or
- orig_sta2_mbies.startswith("FAIL") or
- not res_sta1_mbies.startswith("FAIL") or
- not res_sta2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs have not been removed on the stations")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta2.disconnect_from_external_ap()
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- def test_fst_sta_connect_to_fst_ap(dev, apdev, test_params):
- """FST STA connecting to FST AP"""
- ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- try:
- orig_sta2_mbies = sta2.get_local_mbies()
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(ap1, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_a)
- time.sleep(2)
- res_sta2_mbies = sta2.get_local_mbies()
- if res_sta2_mbies == orig_sta2_mbies:
- raise Exception("Failure. MB IEs have not been updated")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- def test_fst_ap_connect_to_fst_sta(dev, apdev, test_params):
- """FST AP connecting to FST STA"""
- ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- try:
- orig_ap_mbies = ap1.get_local_mbies()
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(ap1, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_a)
- time.sleep(2)
- res_ap_mbies = ap1.get_local_mbies()
- if res_ap_mbies != orig_ap_mbies:
- raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- def test_fst_ap_connect_to_non_fst_sta(dev, apdev, test_params):
- """FST AP connecting to non-FST STA"""
- ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- try:
- orig_ap_mbies = ap2.get_local_mbies()
- vals = dev[0].scan(None, fst_test_common.fst_test_def_freq_g)
- fst_module_aux.external_sta_connect(dev[0], ap2, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_g)
- time.sleep(2)
- res_ap_mbies = ap2.get_local_mbies()
- if res_ap_mbies != orig_ap_mbies:
- raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- fst_module_aux.disconnect_external_sta(dev[0], ap2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- def test_fst_second_sta_connect_to_non_fst_ap(dev, apdev, test_params):
- """FST STA 2nd connecting to non-FST AP"""
- fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- with HWSimRadio() as (radio, iface):
- non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
- try:
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
- time.sleep(2)
- orig_sta1_mbies = sta1.get_local_mbies()
- orig_sta2_mbies = sta2.get_local_mbies()
- vals = sta2.scan()
- freq = vals['freq']
- sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
- time.sleep(2)
- res_sta1_mbies = sta1.get_local_mbies()
- res_sta2_mbies = sta2.get_local_mbies()
- if (orig_sta1_mbies.startswith("FAIL") or
- orig_sta2_mbies.startswith("FAIL") or
- not res_sta1_mbies.startswith("FAIL") or
- not res_sta2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs have not been removed on the stations")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- sta2.disconnect_from_external_ap()
- fst_module_aux.stop_two_ap_sta_pairs(fst_ap1, fst_ap2, sta1, sta2)
- def test_fst_second_sta_connect_to_fst_ap(dev, apdev, test_params):
- """FST STA 2nd connecting to FST AP"""
- fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- with HWSimRadio() as (radio, iface):
- non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
- try:
- vals = sta2.scan()
- freq = vals['freq']
- sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
- time.sleep(2)
- orig_sta1_mbies = sta1.get_local_mbies()
- orig_sta2_mbies = sta2.get_local_mbies()
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
- time.sleep(2)
- res_sta1_mbies = sta1.get_local_mbies()
- res_sta2_mbies = sta2.get_local_mbies()
- if (not orig_sta1_mbies.startswith("FAIL") or
- not orig_sta2_mbies.startswith("FAIL") or
- not res_sta1_mbies.startswith("FAIL") or
- not res_sta2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs should have stayed non-present on the stations")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- sta2.disconnect_from_external_ap()
- fst_module_aux.stop_two_ap_sta_pairs(fst_ap1, fst_ap2, sta1, sta2)
- def test_fst_disconnect_1_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
- """FST disconnect 1 of 2 STAs from non-FST AP"""
- fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- with HWSimRadio() as (radio, iface):
- non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
- try:
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
- vals = sta2.scan()
- freq = vals['freq']
- sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
- time.sleep(2)
- orig_sta1_mbies = sta1.get_local_mbies()
- orig_sta2_mbies = sta2.get_local_mbies()
- sta2.disconnect_from_external_ap()
- time.sleep(2)
- res_sta1_mbies = sta1.get_local_mbies()
- res_sta2_mbies = sta2.get_local_mbies()
- if (not orig_sta1_mbies.startswith("FAIL") or
- not orig_sta2_mbies.startswith("FAIL") or
- res_sta1_mbies.startswith("FAIL") or
- res_sta2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs haven't reappeared on the stations")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- sta2.disconnect_from_external_ap()
- fst_module_aux.stop_two_ap_sta_pairs(fst_ap1, fst_ap2, sta1, sta2)
- def test_fst_disconnect_1_of_2_stas_from_fst_ap(dev, apdev, test_params):
- """FST disconnect 1 of 2 STAs from FST AP"""
- fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- with HWSimRadio() as (radio, iface):
- non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
- try:
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
- vals = sta2.scan()
- freq = vals['freq']
- sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
- time.sleep(2)
- orig_sta1_mbies = sta1.get_local_mbies()
- orig_sta2_mbies = sta2.get_local_mbies()
- sta1.disconnect()
- time.sleep(2)
- res_sta1_mbies = sta1.get_local_mbies()
- res_sta2_mbies = sta2.get_local_mbies()
- if (not orig_sta1_mbies.startswith("FAIL") or
- not orig_sta2_mbies.startswith("FAIL") or
- not res_sta1_mbies.startswith("FAIL") or
- not res_sta2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs should have stayed non-present on the stations")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- sta2.disconnect_from_external_ap()
- fst_module_aux.stop_two_ap_sta_pairs(fst_ap1, fst_ap2, sta1, sta2)
- def test_fst_disconnect_2_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
- """FST disconnect 2 of 2 STAs from non-FST AP"""
- fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- with HWSimRadio() as (radio, iface):
- non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g" })
- try:
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
- vals = sta2.scan()
- freq = vals['freq']
- sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
- time.sleep(2)
- sta1.disconnect()
- time.sleep(2)
- orig_sta1_mbies = sta1.get_local_mbies()
- orig_sta2_mbies = sta2.get_local_mbies()
- sta2.disconnect_from_external_ap()
- time.sleep(2)
- res_sta1_mbies = sta1.get_local_mbies()
- res_sta2_mbies = sta2.get_local_mbies()
- if (not orig_sta1_mbies.startswith("FAIL") or
- not orig_sta2_mbies.startswith("FAIL") or
- res_sta1_mbies.startswith("FAIL") or
- res_sta2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs haven't reappeared on the stations")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- sta2.disconnect_from_external_ap()
- fst_module_aux.stop_two_ap_sta_pairs(fst_ap1, fst_ap2, sta1, sta2)
- def test_fst_disconnect_2_of_2_stas_from_fst_ap(dev, apdev, test_params):
- """FST disconnect 2 of 2 STAs from FST AP"""
- fst_ap1, fst_ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- with HWSimRadio() as (radio, iface):
- non_fst_ap = hostapd.add_ap(iface, { "ssid": "non_fst_11g"})
- try:
- vals = sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- sta1.connect(fst_ap1, key_mgmt="NONE", scan_freq=fst_test_common.fst_test_def_freq_a)
- vals = sta2.scan()
- freq = vals['freq']
- sta2.connect_to_external_ap(non_fst_ap, ssid="non_fst_11g", key_mgmt="NONE", scan_freq=freq)
- time.sleep(2)
- sta2.disconnect_from_external_ap()
- time.sleep(2)
- orig_sta1_mbies = sta1.get_local_mbies()
- orig_sta2_mbies = sta2.get_local_mbies()
- sta1.disconnect()
- time.sleep(2)
- res_sta1_mbies = sta1.get_local_mbies()
- res_sta2_mbies = sta2.get_local_mbies()
- if (orig_sta1_mbies.startswith("FAIL") or
- orig_sta2_mbies.startswith("FAIL") or
- res_sta1_mbies.startswith("FAIL") or
- res_sta2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs should have stayed present on both stations")
- # Mandatory part of 8.4.2.140 Multi-band element is 24 bytes = 48 hex chars
- basic_sta1_mbies = res_sta1_mbies[0:48] + res_sta1_mbies[60:108]
- basic_sta2_mbies = res_sta2_mbies[0:48] + res_sta2_mbies[60:108]
- if (basic_sta1_mbies != basic_sta2_mbies):
- raise Exception("Failure. Basic MB IEs should have become identical on both stations")
- addr_sta1_str = sta1.get_own_mac_address().replace(":", "")
- addr_sta2_str = sta2.get_own_mac_address().replace(":", "")
- # Mandatory part of 8.4.2.140 Multi-band element is followed by STA MAC Address field (6 bytes = 12 hex chars)
- addr_sta1_mbie1 = res_sta1_mbies[48:60]
- addr_sta1_mbie2 = res_sta1_mbies[108:120]
- addr_sta2_mbie1 = res_sta2_mbies[48:60]
- addr_sta2_mbie2 = res_sta2_mbies[108:120]
- if (addr_sta1_mbie1 != addr_sta1_mbie2 or
- addr_sta1_mbie1 != addr_sta2_str or
- addr_sta2_mbie1 != addr_sta2_mbie2 or
- addr_sta2_mbie1 != addr_sta1_str):
- raise Exception("Failure. STA Address in MB IEs should have been same as the other STA's")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- sta1.disconnect()
- sta2.disconnect_from_external_ap()
- fst_module_aux.stop_two_ap_sta_pairs(fst_ap1, fst_ap2, sta1, sta2)
- def test_fst_disconnect_non_fst_sta(dev, apdev, test_params):
- """FST disconnect non-FST STA"""
- ap1, ap2, fst_sta1, fst_sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- external_sta_connected = False
- try:
- vals = fst_sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- fst_sta1.connect(ap1, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_a)
- vals = dev[0].scan(None, fst_test_common.fst_test_def_freq_g)
- fst_module_aux.external_sta_connect(dev[0], ap2, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_g)
- external_sta_connected = True
- time.sleep(2)
- fst_sta1.disconnect()
- time.sleep(2)
- orig_ap_mbies = ap2.get_local_mbies()
- fst_module_aux.disconnect_external_sta(dev[0], ap2)
- external_sta_connected = False
- time.sleep(2)
- res_ap_mbies = ap2.get_local_mbies()
- if res_ap_mbies != orig_ap_mbies:
- raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- fst_sta1.disconnect()
- if external_sta_connected:
- fst_module_aux.disconnect_external_sta(dev[0], ap2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, fst_sta1, fst_sta2)
- def test_fst_disconnect_fst_sta(dev, apdev, test_params):
- """FST disconnect FST STA"""
- ap1, ap2, fst_sta1, fst_sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- external_sta_connected = False;
- try:
- vals = fst_sta1.scan(freq=fst_test_common.fst_test_def_freq_a)
- fst_sta1.connect(ap1, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_a)
- vals = dev[0].scan(None, fst_test_common.fst_test_def_freq_g)
- fst_module_aux.external_sta_connect(dev[0], ap2, key_mgmt="NONE",
- scan_freq=fst_test_common.fst_test_def_freq_g)
- external_sta_connected = True
- time.sleep(2)
- fst_module_aux.disconnect_external_sta(dev[0], ap2)
- external_sta_connected = False
- time.sleep(2)
- orig_ap_mbies = ap2.get_local_mbies()
- fst_sta1.disconnect()
- time.sleep(2)
- res_ap_mbies = ap2.get_local_mbies()
- if res_ap_mbies != orig_ap_mbies:
- raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- fst_sta1.disconnect()
- if external_sta_connected:
- fst_module_aux.disconnect_external_sta(dev[0], ap2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, fst_sta1, fst_sta2)
- def test_fst_dynamic_iface_attach(dev, apdev, test_params):
- """FST dynamic interface attach"""
- ap1 = fst_module_aux.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)
- ap1.start()
- ap2 = fst_module_aux.FstAP(apdev[1]['ifname'], 'fst_11g', 'b',
- fst_test_common.fst_test_def_chan_g,
- '', '', '')
- ap2.start()
- sta1 = fst_module_aux.FstSTA('wlan5',
- fst_module_aux.fst_test_common.fst_test_def_group,
- fst_test_common.fst_test_def_prio_low,
- fst_test_common.fst_test_def_llt)
- sta1.start()
- sta2 = fst_module_aux.FstSTA('wlan6', '', '', '')
- sta2.start()
- try:
- orig_sta2_mbies = sta2.get_local_mbies()
- orig_ap2_mbies = ap2.get_local_mbies()
- sta2.send_iface_attach_request(sta2.ifname(),
- fst_module_aux.fst_test_common.fst_test_def_group,
- '52', '27')
- event = sta2.wait_for_iface_event(5)
- if event['event_type'] != 'attached':
- raise Exception("Failure. Iface was not properly attached")
- ap2.send_iface_attach_request(ap2.ifname(),
- fst_module_aux.fst_test_common.fst_test_def_group,
- '102', '77')
- event = ap2.wait_for_iface_event(5)
- if event['event_type'] != 'attached':
- raise Exception("Failure. Iface was not properly attached")
- time.sleep(2)
- res_sta2_mbies = sta2.get_local_mbies()
- res_ap2_mbies = ap2.get_local_mbies()
- sta2.send_iface_detach_request(sta2.ifname())
- event = sta2.wait_for_iface_event(5)
- if event['event_type'] != 'detached':
- raise Exception("Failure. Iface was not properly detached")
- ap2.send_iface_detach_request(ap2.ifname())
- event = ap2.wait_for_iface_event(5)
- if event['event_type'] != 'detached':
- raise Exception("Failure. Iface was not properly detached")
- if (not orig_sta2_mbies.startswith("FAIL") or
- not orig_ap2_mbies.startswith("FAIL") or
- res_sta2_mbies.startswith("FAIL") or
- res_ap2_mbies.startswith("FAIL")):
- raise Exception("Failure. MB IEs should have appeared on the station and on the AP")
- except Exception, e:
- logger.info(e)
- raise
- finally:
- ap1.stop()
- ap2.stop()
- sta1.stop()
- sta2.stop()
- # AP side FST module tests
- def test_fst_ap_start_session(dev, apdev, test_params):
- """FST AP start session"""
- fst_start_session(apdev, test_params, bad_param_none, True)
- def test_fst_ap_start_session_no_add_params(dev, apdev, test_params):
- """FST AP start session - no add params"""
- fst_start_session(apdev, test_params, bad_param_session_add_no_params, True)
- def test_fst_ap_start_session_bad_group_id(dev, apdev, test_params):
- """FST AP start session - bad group id"""
- fst_start_session(apdev, test_params, bad_param_group_id, True)
- def test_fst_ap_start_session_no_set_params(dev, apdev, test_params):
- """FST AP start session - no set params"""
- fst_start_session(apdev, test_params, bad_param_session_set_no_params, True)
- def test_fst_ap_start_session_set_unknown_param(dev, apdev, test_params):
- """FST AP start session - set unknown param"""
- fst_start_session(apdev, test_params, bad_param_session_set_unknown_param,
- True)
- def test_fst_ap_start_session_bad_session_id(dev, apdev, test_params):
- """FST AP start session - bad session id"""
- fst_start_session(apdev, test_params, bad_param_session_id, True)
- def test_fst_ap_start_session_bad_new_iface(dev, apdev, test_params):
- """FST AP start session - bad new iface"""
- fst_start_session(apdev, test_params, bad_param_new_iface, True)
- def test_fst_ap_start_session_bad_old_iface(dev, apdev, test_params):
- """FST AP start session - bad old iface"""
- fst_start_session(apdev, test_params, bad_param_old_iface, True)
- def test_fst_ap_start_session_negative_llt(dev, apdev, test_params):
- """FST AP start session - negative llt"""
- fst_start_session(apdev, test_params, bad_param_negative_llt, True)
- def test_fst_ap_start_session_zero_llt(dev, apdev, test_params):
- """FST AP start session - zero llt"""
- fst_start_session(apdev, test_params, bad_param_zero_llt, True)
- def test_fst_ap_start_session_llt_too_big(dev, apdev, test_params):
- """FST AP start session - llt too large"""
- fst_start_session(apdev, test_params, bad_param_llt_too_big, True)
- def test_fst_ap_start_session_invalid_peer_addr(dev, apdev, test_params):
- """FST AP start session - invalid peer address"""
- fst_start_session(apdev, test_params, bad_param_peer_addr, True,
- 'GG:GG:GG:GG:GG:GG')
- def test_fst_ap_start_session_multicast_peer_addr(dev, apdev, test_params):
- """FST AP start session - multicast peer address"""
- fst_start_session(apdev, test_params, bad_param_peer_addr, True,
- '01:00:11:22:33:44')
- def test_fst_ap_start_session_broadcast_peer_addr(dev, apdev, test_params):
- """FST AP start session - broadcast peer address"""
- fst_start_session(apdev, test_params, bad_param_peer_addr, True,
- 'FF:FF:FF:FF:FF:FF')
- def test_fst_ap_initiate_session(dev, apdev, test_params):
- """FST AP initiate session"""
- fst_initiate_session(apdev, test_params, bad_param_none, True)
- def test_fst_ap_initiate_session_no_params(dev, apdev, test_params):
- """FST AP initiate session - no params"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_no_params, True)
- def test_fst_ap_initiate_session_invalid_session_id(dev, apdev, test_params):
- """FST AP initiate session - invalid session id"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_bad_session_id, True)
- def test_fst_ap_initiate_session_no_new_iface(dev, apdev, test_params):
- """FST AP initiate session - no new iface"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_with_no_new_iface_set, True)
- def test_fst_ap_initiate_session_bad_peer_addr(dev, apdev, test_params):
- """FST AP initiate session - bad peer address"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_with_bad_peer_addr_set,
- True)
- def test_fst_ap_initiate_session_request_with_bad_stie(dev, apdev, test_params):
- """FST AP initiate session - request with bad stie"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_request_with_bad_stie, True)
- def test_fst_ap_initiate_session_response_with_reject(dev, apdev, test_params):
- """FST AP initiate session - response with reject"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_response_with_reject, True)
- def test_fst_ap_initiate_session_response_with_bad_stie(dev, apdev,
- test_params):
- """FST AP initiate session - response with bad stie"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_response_with_bad_stie,
- True)
- def test_fst_ap_initiate_session_response_with_zero_llt(dev, apdev,
- test_params):
- """FST AP initiate session - zero llt"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_response_with_zero_llt,
- True)
- def test_fst_ap_initiate_session_stt_no_response(dev, apdev, test_params):
- """FST AP initiate session - stt no response"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_stt_no_response, True)
- def test_fst_ap_initiate_session_concurrent_setup_request(dev, apdev,
- test_params):
- """FST AP initiate session - concurrent setup request"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_concurrent_setup_request,
- True)
- def test_fst_ap_session_request_with_no_session(dev, apdev, test_params):
- """FST AP session request with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_session_request,
- True)
- def test_fst_ap_session_response_accept_with_no_session(dev, apdev,
- test_params):
- """FST AP session response accept with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_session_response,
- True, "accept")
- def test_fst_ap_session_response_reject_with_no_session(dev, apdev,
- test_params):
- """FST AP session response reject with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_session_response,
- True, "reject")
- def test_fst_ap_ack_request_with_no_session(dev, apdev, test_params):
- """FST AP ack request with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_ack_request, True)
- def test_fst_ap_ack_response_with_no_session(dev, apdev, test_params):
- """FST AP ack response with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_ack_response, True)
- def test_fst_ap_tear_down_response_with_no_session(dev, apdev, test_params):
- """FST AP tear down response with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_tear_down, True)
- def test_fst_ap_transfer_session(dev, apdev, test_params):
- """FST AP transfer session"""
- fst_transfer_session(apdev, test_params, bad_param_none, True)
- def test_fst_ap_transfer_session_no_params(dev, apdev, test_params):
- """FST AP transfer session - no params"""
- fst_transfer_session(apdev, test_params,
- bad_param_session_transfer_no_params, True)
- def test_fst_ap_transfer_session_bad_session_id(dev, apdev, test_params):
- """FST AP transfer session - bad session id"""
- fst_transfer_session(apdev, test_params,
- bad_param_session_transfer_bad_session_id, True)
- def test_fst_ap_transfer_session_setup_skipped(dev, apdev, test_params):
- """FST AP transfer session - setup skipped"""
- fst_transfer_session(apdev, test_params,
- bad_param_session_transfer_setup_skipped, True)
- def test_fst_ap_ack_request_with_session_not_set_up(dev, apdev, test_params):
- """FST AP ack request with session not set up"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_req_session_not_set_up, True)
- def test_fst_ap_ack_request_with_session_not_established_init_side(dev, apdev,
- test_params):
- """FST AP ack request with session not established init side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_req_session_not_established_init_side,
- True)
- def test_fst_ap_ack_request_with_session_not_established_resp_side(dev, apdev,
- test_params):
- """FST AP ack request with session not established resp side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_req_session_not_established_resp_side,
- True)
- def test_fst_ap_ack_request_with_bad_fsts_id(dev, apdev, test_params):
- """FST AP ack request with bad fsts id"""
- fst_bad_transfer(apdev, test_params, bad_scenario_ack_req_bad_fsts_id, True)
- def test_fst_ap_ack_response_with_session_not_set_up(dev, apdev, test_params):
- """FST AP ack response with session not set up"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_resp_session_not_set_up, True)
- def test_fst_ap_ack_response_with_session_not_established_init_side(dev, apdev, test_params):
- """FST AP ack response with session not established init side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_resp_session_not_established_init_side,
- True)
- def test_fst_ap_ack_response_with_session_not_established_resp_side(dev, apdev, test_params):
- """FST AP ack response with session not established resp side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_resp_session_not_established_resp_side,
- True)
- def test_fst_ap_ack_response_with_no_ack_request(dev, apdev, test_params):
- """FST AP ack response with no ack request"""
- fst_bad_transfer(apdev, test_params, bad_scenario_ack_resp_no_ack_req, True)
- def test_fst_ap_tear_down_session(dev, apdev, test_params):
- """FST AP tear down session"""
- fst_tear_down_session(apdev, test_params, bad_param_none, True)
- def test_fst_ap_tear_down_session_no_params(dev, apdev, test_params):
- """FST AP tear down session - no params"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_no_params, True)
- def test_fst_ap_tear_down_session_bad_session_id(dev, apdev, test_params):
- """FST AP tear down session - bad session id"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_bad_session_id, True)
- def test_fst_ap_tear_down_session_setup_skipped(dev, apdev, test_params):
- """FST AP tear down session - setup skipped"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_setup_skipped, True)
- def test_fst_ap_tear_down_session_bad_fsts_id(dev, apdev, test_params):
- """FST AP tear down session - bad fsts id"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_bad_fsts_id, True)
- def test_fst_ap_remove_session_not_established(dev, apdev, test_params):
- """FST AP remove session - not established"""
- fst_remove_session(apdev, test_params,
- remove_scenario_non_established_session, True)
- def test_fst_ap_remove_session_established(dev, apdev, test_params):
- """FST AP remove session - established"""
- fst_remove_session(apdev, test_params,
- remove_scenario_established_session, True)
- def test_fst_ap_remove_session_no_params(dev, apdev, test_params):
- """FST AP remove session - no params"""
- fst_remove_session(apdev, test_params, remove_scenario_no_params, True)
- def test_fst_ap_remove_session_bad_session_id(dev, apdev, test_params):
- """FST AP remove session - bad session id"""
- fst_remove_session(apdev, test_params, remove_scenario_bad_session_id, True)
- def test_fst_ap_ctrl_iface(dev, apdev, test_params):
- """FST control interface behavior"""
- ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
- try:
- fst_module_aux.connect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- initiator = ap1
- responder = sta1
- initiator.add_peer(responder, None)
- initiator.set_fst_parameters(group_id=None)
- sid = initiator.add_session()
- res = initiator.get_session_params(sid)
- logger.info("Initial session params:\n" + str(res))
- if res['state'] != 'INITIAL':
- raise Exception("Unexpected state: " + res['state'])
- initiator.set_fst_parameters(llt=None)
- initiator.configure_session(sid, ap2.ifname(), None)
- res = initiator.get_session_params(sid)
- logger.info("Session params after configuration:\n" + str(res))
- res = initiator.iface_peers(initiator.ifname())
- logger.info("Interface peers: " + str(res))
- if len(res) != 1:
- raise Exception("Unexpected number of peers")
- res = initiator.get_peer_mbies(initiator.ifname(),
- initiator.get_new_peer_addr())
- logger.info("Peer MB IEs: " + str(res))
- res = initiator.list_ifaces()
- logger.info("Interfaces: " + str(res))
- if len(res) != 2:
- raise Exception("Unexpected number of interfaces")
- res = initiator.list_groups()
- logger.info("Groups: " + str(res))
- if len(res) != 1:
- raise Exception("Unexpected number of groups")
- tests = [ "LIST_IFACES unknown",
- "LIST_IFACES unknown2",
- "SESSION_GET 12345678",
- "SESSION_SET " + sid + " unknown=foo",
- "SESSION_RESPOND 12345678 foo",
- "SESSION_RESPOND " + sid,
- "SESSION_RESPOND " + sid + " foo",
- "TEST_REQUEST foo",
- "GET_PEER_MBIES",
- "GET_PEER_MBIES ",
- "GET_PEER_MBIES unknown",
- "GET_PEER_MBIES unknown unknown",
- "GET_PEER_MBIES unknown " + initiator.get_new_peer_addr(),
- "GET_PEER_MBIES " + initiator.ifname() + " 01:ff:ff:ff:ff:ff",
- "IFACE_PEERS",
- "IFACE_PEERS ",
- "IFACE_PEERS unknown",
- "IFACE_PEERS unknown unknown",
- "IFACE_PEERS " + initiator.fst_group,
- "IFACE_PEERS " + initiator.fst_group + " unknown" ]
- for t in tests:
- if "FAIL" not in initiator.grequest("FST-MANAGER " + t):
- raise Exception("Unexpected response for invalid FST-MANAGER command " + t)
- if "UNKNOWN FST COMMAND" not in initiator.grequest("FST-MANAGER unknown"):
- raise Exception("Unexpected response for unknown FST-MANAGER command")
- tests = [ "FST-DETACH", "FST-DETACH ", "FST-DETACH unknown",
- "FST-ATTACH", "FST-ATTACH ", "FST-ATTACH unknown",
- "FST-ATTACH unknown unknown" ]
- for t in tests:
- if "FAIL" not in initiator.grequest(t):
- raise Exception("Unexpected response for invalid command " + t)
- try:
- # Trying to add same interface again needs to fail.
- ap1.send_iface_attach_request(ap1.iface, ap1.fst_group,
- ap1.fst_llt, ap1.fst_pri)
- raise Exception("Duplicate FST-ATTACH succeeded")
- except Exception, e:
- if not str(e).startswith("Cannot attach"):
- raise
- finally:
- fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- fst_module_aux.stop_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
- # STA side FST module tests
- def test_fst_sta_start_session(dev, apdev, test_params):
- """FST STA start session"""
- fst_start_session(apdev, test_params, bad_param_none, False)
- def test_fst_sta_start_session_no_add_params(dev, apdev, test_params):
- """FST STA start session - no add params"""
- fst_start_session(apdev, test_params, bad_param_session_add_no_params,
- False)
- def test_fst_sta_start_session_bad_group_id(dev, apdev, test_params):
- """FST STA start session - bad group id"""
- fst_start_session(apdev, test_params, bad_param_group_id, False)
- def test_fst_sta_start_session_no_set_params(dev, apdev, test_params):
- """FST STA start session - no set params"""
- fst_start_session(apdev, test_params, bad_param_session_set_no_params,
- False)
- def test_fst_sta_start_session_set_unknown_param(dev, apdev, test_params):
- """FST STA start session - set unknown param"""
- fst_start_session(apdev, test_params, bad_param_session_set_unknown_param,
- False)
- def test_fst_sta_start_session_bad_session_id(dev, apdev, test_params):
- """FST STA start session - bad session id"""
- fst_start_session(apdev, test_params, bad_param_session_id, False)
- def test_fst_sta_start_session_bad_new_iface(dev, apdev, test_params):
- """FST STA start session - bad new iface"""
- fst_start_session(apdev, test_params, bad_param_new_iface, False)
- def test_fst_sta_start_session_bad_old_iface(dev, apdev, test_params):
- """FST STA start session - bad old iface"""
- fst_start_session(apdev, test_params, bad_param_old_iface, False)
- def test_fst_sta_start_session_negative_llt(dev, apdev, test_params):
- """FST STA start session - negative llt"""
- fst_start_session(apdev, test_params, bad_param_negative_llt, False)
- def test_fst_sta_start_session_zero_llt(dev, apdev, test_params):
- """FST STA start session - zero llt"""
- fst_start_session(apdev, test_params, bad_param_zero_llt, False)
- def test_fst_sta_start_session_llt_too_big(dev, apdev, test_params):
- """FST STA start session - llt too large"""
- fst_start_session(apdev, test_params, bad_param_llt_too_big, False)
- def test_fst_sta_start_session_invalid_peer_addr(dev, apdev, test_params):
- """FST STA start session - invalid peer address"""
- fst_start_session(apdev, test_params, bad_param_peer_addr, False,
- 'GG:GG:GG:GG:GG:GG')
- def test_fst_sta_start_session_multicast_peer_addr(dev, apdev, test_params):
- """FST STA start session - multicast peer address"""
- fst_start_session(apdev, test_params, bad_param_peer_addr, False,
- '11:00:11:22:33:44')
- def test_fst_sta_start_session_broadcast_peer_addr(dev, apdev, test_params):
- """FST STA start session - broadcast peer addr"""
- fst_start_session(apdev, test_params, bad_param_peer_addr, False,
- 'FF:FF:FF:FF:FF:FF')
- def test_fst_sta_initiate_session(dev, apdev, test_params):
- """FST STA initiate session"""
- fst_initiate_session(apdev, test_params, bad_param_none, False)
- def test_fst_sta_initiate_session_no_params(dev, apdev, test_params):
- """FST STA initiate session - no params"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_no_params, False)
- def test_fst_sta_initiate_session_invalid_session_id(dev, apdev, test_params):
- """FST STA initiate session - invalid session id"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_bad_session_id, False)
- def test_fst_sta_initiate_session_no_new_iface(dev, apdev, test_params):
- """FST STA initiate session - no new iface"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_with_no_new_iface_set,
- False)
- def test_fst_sta_initiate_session_bad_peer_addr(dev, apdev, test_params):
- """FST STA initiate session - bad peer address"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_with_bad_peer_addr_set,
- False)
- def test_fst_sta_initiate_session_request_with_bad_stie(dev, apdev,
- test_params):
- """FST STA initiate session - request with bad stie"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_request_with_bad_stie,
- False)
- def test_fst_sta_initiate_session_response_with_reject(dev, apdev, test_params):
- """FST STA initiate session - response with reject"""
- fst_initiate_session(apdev, test_params, bad_param_session_initiate_response_with_reject, False)
- def test_fst_sta_initiate_session_response_with_bad_stie(dev, apdev, test_params):
- """FST STA initiate session - response with bad stie"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_response_with_bad_stie,
- False)
- def test_fst_sta_initiate_session_response_with_zero_llt(dev, apdev,
- test_params):
- """FST STA initiate session - response with zero llt"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_response_with_zero_llt,
- False)
- def test_fst_sta_initiate_session_stt_no_response(dev, apdev, test_params):
- """FST STA initiate session - stt no response"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_stt_no_response, False)
- def test_fst_sta_initiate_session_concurrent_setup_request(dev, apdev,
- test_params):
- """FST STA initiate session - concurrent setup request"""
- fst_initiate_session(apdev, test_params,
- bad_param_session_initiate_concurrent_setup_request,
- False)
- def test_fst_sta_session_request_with_no_session(dev, apdev, test_params):
- """FST STA session request with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_session_request,
- False)
- def test_fst_sta_session_response_accept_with_no_session(dev, apdev,
- test_params):
- """FST STA session response accept with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_session_response,
- False, "accept")
- def test_fst_sta_session_response_reject_with_no_session(dev, apdev,
- test_params):
- """FST STA session response reject with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_session_response,
- False, "reject")
- def test_fst_sta_ack_request_with_no_session(dev, apdev, test_params):
- """FST STA ack request with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_ack_request, False)
- def test_fst_sta_ack_response_with_no_session(dev, apdev, test_params):
- """FST STA ack response with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_ack_response,
- False)
- def test_fst_sta_tear_down_response_with_no_session(dev, apdev, test_params):
- """FST STA tear down response with no session"""
- fst_send_unexpected_frame(apdev, test_params, frame_type_tear_down, False)
- def test_fst_sta_transfer_session(dev, apdev, test_params):
- """FST STA transfer session"""
- fst_transfer_session(apdev, test_params, bad_param_none, False)
- def test_fst_sta_transfer_session_no_params(dev, apdev, test_params):
- """FST STA transfer session - no params"""
- fst_transfer_session(apdev, test_params,
- bad_param_session_transfer_no_params, False)
- def test_fst_sta_transfer_session_bad_session_id(dev, apdev, test_params):
- """FST STA transfer session - bad session id"""
- fst_transfer_session(apdev, test_params,
- bad_param_session_transfer_bad_session_id, False)
- def test_fst_sta_transfer_session_setup_skipped(dev, apdev, test_params):
- """FST STA transfer session - setup skipped"""
- fst_transfer_session(apdev, test_params,
- bad_param_session_transfer_setup_skipped, False)
- def test_fst_sta_ack_request_with_session_not_set_up(dev, apdev, test_params):
- """FST STA ack request with session not set up"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_req_session_not_set_up, False)
- def test_fst_sta_ack_request_with_session_not_established_init_side(dev, apdev, test_params):
- """FST STA ack request with session not established init side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_req_session_not_established_init_side,
- False)
- def test_fst_sta_ack_request_with_session_not_established_resp_side(dev, apdev, test_params):
- """FST STA ack request with session not established resp side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_req_session_not_established_resp_side,
- False)
- def test_fst_sta_ack_request_with_bad_fsts_id(dev, apdev, test_params):
- """FST STA ack request with bad fsts id"""
- fst_bad_transfer(apdev, test_params, bad_scenario_ack_req_bad_fsts_id,
- False)
- def test_fst_sta_ack_response_with_session_not_set_up(dev, apdev, test_params):
- """FST STA ack response with session not set up"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_resp_session_not_set_up, False)
- def test_fst_sta_ack_response_with_session_not_established_init_side(dev, apdev, test_params):
- """FST STA ack response with session not established init side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_resp_session_not_established_init_side,
- False)
- def test_fst_sta_ack_response_with_session_not_established_resp_side(dev, apdev, test_params):
- """FST STA ack response with session not established resp side"""
- fst_bad_transfer(apdev, test_params,
- bad_scenario_ack_resp_session_not_established_resp_side,
- False)
- def test_fst_sta_ack_response_with_no_ack_request(dev, apdev, test_params):
- """FST STA ack response with no ack request"""
- fst_bad_transfer(apdev, test_params, bad_scenario_ack_resp_no_ack_req,
- False)
- def test_fst_sta_tear_down_session(dev, apdev, test_params):
- """FST STA tear down session"""
- fst_tear_down_session(apdev, test_params, bad_param_none, False)
- def test_fst_sta_tear_down_session_no_params(dev, apdev, test_params):
- """FST STA tear down session - no params"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_no_params, False)
- def test_fst_sta_tear_down_session_bad_session_id(dev, apdev, test_params):
- """FST STA tear down session - bad session id"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_bad_session_id, False)
- def test_fst_sta_tear_down_session_setup_skipped(dev, apdev, test_params):
- """FST STA tear down session - setup skipped"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_setup_skipped, False)
- def test_fst_sta_tear_down_session_bad_fsts_id(dev, apdev, test_params):
- """FST STA tear down session - bad fsts id"""
- fst_tear_down_session(apdev, test_params,
- bad_param_session_teardown_bad_fsts_id, False)
- def test_fst_sta_remove_session_not_established(dev, apdev, test_params):
- """FST STA tear down session - not established"""
- fst_remove_session(apdev, test_params,
- remove_scenario_non_established_session, False)
- def test_fst_sta_remove_session_established(dev, apdev, test_params):
- """FST STA remove session - established"""
- fst_remove_session(apdev, test_params,
- remove_scenario_established_session, False)
- def test_fst_sta_remove_session_no_params(dev, apdev, test_params):
- """FST STA remove session - no params"""
- fst_remove_session(apdev, test_params, remove_scenario_no_params, False)
- def test_fst_sta_remove_session_bad_session_id(dev, apdev, test_params):
- """FST STA remove session - bad session id"""
- fst_remove_session(apdev, test_params, remove_scenario_bad_session_id,
- False)
|