[SEBA-885] Ability to restart EAPOL and DHCP if the state machine doesn't complete
Change-Id: I2f0c7be787ab9ca2ddf59deadaa6c789456cd3d4
diff --git a/internal/bbsim/devices/onu_state_machine_test.go b/internal/bbsim/devices/onu_state_machine_test.go
index c8ad84c..c169c12 100644
--- a/internal/bbsim/devices/onu_state_machine_test.go
+++ b/internal/bbsim/devices/onu_state_machine_test.go
@@ -81,6 +81,15 @@
assert.Equal(t, onu.InternalState.Current(), "eap_response_challenge_sent")
onu.InternalState.Event("eap_response_success_received")
assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received")
+
+ // test that we can retrigger EAPOL
+ states := []string{"eap_start_sent", "eap_response_identity_sent", "eap_response_challenge_sent", "eap_response_success_received", "auth_failed", "dhcp_ack_received", "dhcp_failed"}
+ for _, state := range states {
+ onu.InternalState.SetState(state)
+ err := onu.InternalState.Event("start_auth")
+ assert.Equal(t, err, nil)
+ assert.Equal(t, onu.InternalState.Current(), "auth_started")
+ }
}
func Test_Onu_StateMachine_dhcp_start(t *testing.T) {
@@ -121,4 +130,14 @@
assert.Equal(t, onu.InternalState.Current(), "dhcp_request_sent")
onu.InternalState.Event("dhcp_ack_received")
assert.Equal(t, onu.InternalState.Current(), "dhcp_ack_received")
+
+ // test that we can retrigger DHCP
+ onu.DhcpFlowReceived = true
+ states := []string{"eap_response_success_received", "dhcp_discovery_sent", "dhcp_request_sent", "dhcp_ack_received", "dhcp_failed"}
+ for _, state := range states {
+ onu.InternalState.SetState(state)
+ err := onu.InternalState.Event("start_dhcp")
+ assert.Equal(t, err, nil)
+ assert.Equal(t, onu.InternalState.Current(), "dhcp_started")
+ }
}