BBSim Internals¶
Other Resources:
BBSim heavily leverages state machines to control the device lifecycle and channels to propagate and react to state changes.
The most common pattern throughout the code is that any operations,
for example a gRPC call to the ActivateOnu
endpoint will result in:
A state change in the ONU device, that will
Send a message on the ONU Channel, that will
Trigger some operation (for example send Indications to the OLT)
OLT State Machine¶
Here is a list of possible states for an OLT:
Initialized |
Enabled |
Disabled |
Deleted |
|
---|---|---|---|---|
Data model is created for OLT, NNIs, PONs and ONUs |
Starts the listener on the NNI interface and the DHCP server,
Starts the OLT gRPC server,
Moves the ONUs to |
Sends OLT, NNIs and PONs |
Transition the ONUs into |
Stops the OLT gRPC Server |
Below is a diagram of the state machine allowed transitions:
![digraph {
rankdir=LR
newrank=true
graph [pad="1,1" bgcolor="#cccccc"]
node [style=filled, fillcolor="#bee7fa"]
created -> initialized -> enabled -> disabled -> deleted
disabled -> enabled
deleted -> initialized
}](../../../../_images/graphviz-e1515a3ca7b3f931cb881963378cea660cbd95fa.png)
ONU State Machine¶
Here is a list of possible state transitions for an ONU in BBSim:
Transition |
Starting States |
End State |
Notes |
---|---|---|---|
created |
|||
initialize |
created, disabled, pon_disabled |
initialized |
|
discover |
initialized |
discovered |
|
enable |
discovered, disabled, pon_disabled |
enabled |
|
disable |
enabled |
disabled |
This state signifies that the ONU has been disabled |
pon_disabled |
enabled |
pon_disabled |
This state signifies that the parent PON Port has been disabled, the ONU state hasn’t been affected. |
Below is a diagram of the state machine:
In blue PON related states
In purple operator driven states
![digraph {
rankdir=LR
newrank=true
graph [pad="1,1" bgcolor="#cccccc"]
node [style=filled]
subgraph {
node [fillcolor="#bee7fa"]
created [peripheries=2]
initialized
discovered
{
rank=same
enabled
disabled [fillcolor="#f9d6ff"]
pon_disabled [fillcolor="#f9d6ff"]
}
{created, disabled} -> initialized -> discovered -> enabled
}
disabled -> enabled
enabled -> pon_disabled
pon_disabled -> {initialized, disabled, enabled}
}](../../../../_images/graphviz-25b76d2234e7b2740e4f5649f20a7a9b0a8977c1.png)
Service State Machine¶
![digraph {
rankdir=TB
newrank=true
graph [pad="1,1" bgcolor="#cccccc"]
node [style=filled]
subgraph cluster_lifecycle {
node [fillcolor="#bee7fa"]
style=dotted
created [peripheries=2]
initialized
disabled
created -> initialized -> disabled
disabled -> initialized
}
subgraph cluster_eapol {
style=rounded
style=dotted
node [fillcolor="#e6ffc2"]
auth_started [peripheries=2]
eap_start_sent
eap_response_identity_sent
eap_response_challenge_sent
{
rank=same
eap_response_success_received
auth_failed
}
auth_started -> eap_start_sent -> eap_response_identity_sent -> eap_response_challenge_sent -> eap_response_success_received
auth_started -> auth_failed
eap_start_sent -> auth_failed
eap_response_identity_sent -> auth_failed
eap_response_challenge_sent -> auth_failed
auth_failed -> auth_started
}
subgraph cluster_dhcp {
node [fillcolor="#fffacc"]
style=rounded
style=dotted
dhcp_started [peripheries=2]
dhcp_discovery_sent
dhcp_request_sent
{
rank=same
dhcp_ack_received
dhcp_failed
}
dhcp_started -> dhcp_discovery_sent -> dhcp_request_sent -> dhcp_ack_received
dhcp_started -> dhcp_failed
dhcp_discovery_sent -> dhcp_failed
dhcp_request_sent -> dhcp_failed
dhcp_ack_received dhcp_failed
}
subgraph cluster_igmp {
node [fillcolor="#ffaaff"]
style=rounded
style=dotted
igmp_join_started [peripheries=2]
igmp_join_started -> igmp_join_error -> igmp_join_started
igmp_join_started -> igmp_left
}
}](../../../../_images/graphviz-4cdc45a9e6f77f1aaf955b17061f86a96a80c53b.png)