[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.go b/internal/bbsim/devices/onu.go
index 6182577..dbbeb2b 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -116,7 +116,7 @@
// NOTE should disabled state be diffente for oper_disabled (emulating an error) and admin_disabled (received a disabled call via VOLTHA)?
{Name: "disable", Src: []string{"eap_response_success_received", "auth_failed", "dhcp_ack_received", "dhcp_failed"}, Dst: "disabled"},
// EAPOL
- {Name: "start_auth", Src: []string{"eapol_flow_received", "gem_port_added", "eap_response_success_received", "auth_failed", "dhcp_ack_received", "dhcp_failed"}, Dst: "auth_started"},
+ {Name: "start_auth", Src: []string{"eapol_flow_received", "gem_port_added", "eap_start_sent", "eap_response_identity_sent", "eap_response_challenge_sent", "eap_response_success_received", "auth_failed", "dhcp_ack_received", "dhcp_failed"}, Dst: "auth_started"},
{Name: "eap_start_sent", Src: []string{"auth_started"}, Dst: "eap_start_sent"},
{Name: "eap_response_identity_sent", Src: []string{"eap_start_sent"}, Dst: "eap_response_identity_sent"},
{Name: "eap_response_challenge_sent", Src: []string{"eap_response_identity_sent"}, Dst: "eap_response_challenge_sent"},
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")
+ }
}