Skip to content

Commit

Permalink
Merge pull request #132 from MichaelWasher/upgrade_chewie
Browse files Browse the repository at this point in the history
BUGFIX: Fix EAP Response to Preemptive Requests from Chewie
  • Loading branch information
gizmoguy authored May 23, 2019
2 parents 5648a1a + 5d18597 commit b7773b1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chewie/state_machines/eap_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def event(self, event):
# TODO remove and refactor code - Just placing here to separate main pipeline for internals of SM
if (isinstance(event, EventPreemptiveEAPResponseMessageReceived)
and event.preemptive_eap_id != self.current_id):
self.logget.info("Resetting eap due to recieved response to preemtive request")
self.logger.info("Resetting eap due to received response to preemtive request")
self.eap_restart = True
self.override_current_id = event.preemptive_eap_id

Expand Down
36 changes: 36 additions & 0 deletions test/test_chewie.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,42 @@ def test_success_dot1x(self):
'00:00:00:00:00:01').state,
FullEAPStateMachine.SUCCESS2)




@patch_things
@setup_generators(sup_replies_success, radius_replies_success)
def test_chewie_identity_response_dot1x(self):
"""test port status api and that identity request is sent after port up"""

global TO_SUPPLICANT
pool = eventlet.GreenPool()
pool.spawn(self.chewie.run)
eventlet.sleep(1)
self.chewie.port_down("00:00:00:00:00:01")

self.chewie.port_up("00:00:00:00:00:01")

while not self.fake_scheduler.jobs:
eventlet.sleep(SHORT_SLEEP)
self.fake_scheduler.run_jobs(num_jobs=1)

# check preemptive sent directly after port up
out_packet = TO_SUPPLICANT.get()
self.assertEqual(out_packet,
bytes.fromhex('0180C2000003000000000001888e010000050167000501'))

# Send a response to the request
FROM_SUPPLICANT.put_nowait(bytes.fromhex("0000000000010242ac17006f888e010000050167000501"))
eventlet.sleep(2)

self.assertEqual(
self.chewie.get_state_machine('02:42:ac:17:00:6f',
'00:00:00:00:00:01').state,
FullEAPStateMachine.AAA_IDLE)



@patch_things
def test_port_status_changes(self):
"""test port status api and that identity request is sent after port up"""
Expand Down

0 comments on commit b7773b1

Please sign in to comment.