[SEBA-819][SEBA-820] Adding commands to restart EAPOL and DHCP

Change-Id: I283dcae58bc5dbf0ef405c4ce6b5f2e8b818b993
diff --git a/docs/source/onu-state-machine.rst b/docs/source/onu-state-machine.rst
index 9df3ca6..f66dd22 100644
--- a/docs/source/onu-state-machine.rst
+++ b/docs/source/onu-state-machine.rst
@@ -3,46 +3,46 @@
 ONU State Machine
 =================
 
-In ``BBSim`` the device state is createdtained using a state machine
+In ``BBSim`` the device state is created using a state machine
 library: `fsm <https://github.com/looplab/fsm>`__.
 
 Here is a list of possible state transitions in BBSim:
 
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| Transition                     | Starting States                                                                        | End State                      | Notes                                                                                         |
-+================================+========================================================================================+================================+===============================================================================================+
-|                                |                                                                                        | created                        |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| discover                       | created                                                                                | discovered                     |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| enable                         | discovered, disabled                                                                   | enabled                        |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| receive_eapol_flow             | enabled, gem_port_added                                                                | eapol_flow_received            |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| add_gem_port                   | enabled, eapol_flow_received                                                           | gem_port_added                 | We need to wait for both the flow and the gem port to come before moving to ``auth_started``  |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| start_auth                     | eapol_flow_received, gem_port_added                                                    | auth_started                   |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| eap_start_sent                 | auth_started                                                                           | eap_start_sent                 |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| eap_response_identity_sent     | eap_start_sent                                                                         | eap_response_identity_sent     |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| eap_response_challenge_sent    | eap_response_identity_sent                                                             | eap_response_challenge_sent    |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| eap_response_success_received  | eap_response_challenge_sent                                                            | eap_response_success_received  |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| auth_failed                    | auth_started, eap_start_sent, eap_response_identity_sent, eap_response_challenge_sent  | auth_failed                    |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| start_dhcp                     | eap_response_success_received                                                          | dhcp_started                   |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| dhcp_discovery_sent            | dhcp_started                                                                           | dhcp_discovery_sent            |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| dhcp_request_sent              | dhcp_discovery_sent                                                                    | dhcp_request_sent              |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| dhcp_ack_received              | dhcp_request_sent                                                                      | dhcp_ack_received              |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
-| dhcp_failed                    | dhcp_started, dhcp_discovery_sent, dhcp_request_sent                                   | dhcp_failed                    |                                                                                               |
-+--------------------------------+----------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| Transition                     | Starting States                                                                                                   | End State                      | Notes                                                                                         |
++================================+===================================================================================================================+================================+===============================================================================================+
+|                                |                                                                                                                   | created                        |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| discover                       | created                                                                                                           | discovered                     |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| enable                         | discovered, disabled                                                                                              | enabled                        |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| receive_eapol_flow             | enabled, gem_port_added                                                                                           | eapol_flow_received            |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| add_gem_port                   | enabled, eapol_flow_received                                                                                      | gem_port_added                 | We need to wait for both the flow and the gem port to come before moving to ``auth_started``  |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| start_auth                     | eapol_flow_received, gem_port_added, eap_response_success_received, auth_failed, dhcp_ack_received, dhcp_failed   | auth_started                   |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| eap_start_sent                 | auth_started                                                                                                      | eap_start_sent                 |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| eap_response_identity_sent     | eap_start_sent                                                                                                    | eap_response_identity_sent     |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| eap_response_challenge_sent    | eap_response_identity_sent                                                                                        | eap_response_challenge_sent    |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| eap_response_success_received  | eap_response_challenge_sent                                                                                       | eap_response_success_received  |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| auth_failed                    | auth_started, eap_start_sent, eap_response_identity_sent, eap_response_challenge_sent                             | auth_failed                    |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| start_dhcp                     | eap_response_success_received, dhcp_ack_received, dhcp_failed                                                     | dhcp_started                   |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| dhcp_discovery_sent            | dhcp_started                                                                                                      | dhcp_discovery_sent            |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| dhcp_request_sent              | dhcp_discovery_sent                                                                                               | dhcp_request_sent              |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| dhcp_ack_received              | dhcp_request_sent                                                                                                 | dhcp_ack_received              |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
+| dhcp_failed                    | dhcp_started, dhcp_discovery_sent, dhcp_request_sent                                                              | dhcp_failed                    |                                                                                               |
++--------------------------------+-------------------------------------------------------------------------------------------------------------------+--------------------------------+-----------------------------------------------------------------------------------------------+
 
 In addition some transition can be forced via the API:
 
@@ -98,6 +98,11 @@
         eap_response_identity_sent -> auth_failed
         eap_response_challenge_sent -> auth_failed
 
+        eap_response_success_received -> auth_started
+        auth_failed -> auth_started
+        dhcp_ack_received -> auth_started
+        dhcp_failed -> auth_started
+
         eap_response_success_received -> dhcp_started
         dhcp_started -> dhcp_discovery_sent -> dhcp_request_sent -> dhcp_ack_received
         dhcp_started -> dhcp_failed
@@ -110,4 +115,7 @@
         dhcp_ack_received -> disabled
         dhcp_failed -> disabled
         disabled -> enabled
+
+        dhcp_ack_received -> dhcp_started
+        dhcp_failed -> dhcp_started
     }
\ No newline at end of file