faucet.stack module¶
Configuration for a stack.
-
class
faucet.stack.
Stack
(_id, dp_id, name, canonical_port_order, lacp_down_ports, lacp_ports, conf)[source]¶ Bases:
faucet.conf.Conf
Stores state related to DP stack information, this includes the current elected root as that is technically a fixed allocation for this DP Stack instance.
-
clone_dyn_state
(prev_stack, dps=None)[source]¶ Copy dyn state from the old stack instance when warm/cold starting
-
defaults
= {'down_time_multiple': 3, 'min_lacp_health': 1.0, 'min_stack_health': 1.0, 'priority': None, 'route_learning': False}¶
-
defaults_types
= {'down_time_multiple': <class 'int'>, 'min_lacp_health': <class 'float'>, 'min_stack_health': <class 'float'>, 'priority': <class 'int'>, 'route_learning': <class 'bool'>}¶
-
is_in_path
(src_dp, dst_dp)[source]¶ Return True if the current DP is in the path from src_dp to dst_dp
- Parameters
src_dp (str) – DP name
dst_dp (str) – DP name
- Returns
True if self is in the path from the src_dp to the dst_dp.
- Return type
bool
-
lacp_port_healthy
()[source]¶ Determines the percentage of UP LACP ports, and whether the current stack node can be considered healthy according to the min_lacp_health configuration option.
- Returns
Whether threshold from DOWN LACP ports is met; considered healthy, float: Percentage of LACP ports UP out of all lacp ports
- Return type
bool
-
live_timeout_healthy
(last_live_time, now, update_time)[source]¶ Determines the timeout of the current stack node, and whether the current stack node can be considered healthy according to the down_time_multiple number of stack root update time intervals.
- Parameters
last_live_time (float) – Last known live time for this current stack node
now (float) – Current time
update_time (int) – Update time interval
- Returns
If node down time is still in update time interval threshold; considered healthy, float: Time elapsed since timed out
- Return type
bool
-
static
modify_topology
(graph, dp, port, add=True)[source]¶ Add/remove an edge to the stack graph which originates from this dp and port.
-
peer_symmetric_up_ports
(peer_dp)[source]¶ Return list of stack ports that are up towards us from a peer
-
resolve_topology
(dps, meta_dp_state)[source]¶ Resolve & verify correct inter-DP stacking config
- Parameters
dps (list) – List of configured DPs
meta_dp_state (MetaDPState) – Provided if reloading when choosing a new root DP
-
shortest_path_port
(dest_dp)[source]¶ Return first port on our DP, that is the shortest path towards dest DP.
-
shortest_symmetric_path_port
(peer_dp)[source]¶ Return port on our DP that is the first port of the adjacent DP towards us
-
stack_port_healthy
()[source]¶ Determines the percentage of UP stack ports, and whether the current stack node can be considered healthy according to the min_stack_health configuration option.
- Returns
Whether threshold from DOWN stack ports is met; considered healthy, float: Percentage of stack ports UP out of all stack ports
- Return type
bool
-
update_health
(now, dp_last_live_time, update_time)[source]¶ Determines whether the current stack node is healthy
- Parameters
now (float) – Current time
last_live_times (dict) – Last live time value for each DP
update_time (int) – Stack root update interval time
- Returns
Current stack node health state, str: Reason for the current state
- Return type
tuple
-