faucet.valve_stack module

Manage higher level stack functions

class faucet.valve_stack.ValveStackManager(logger, dp, stack, tunnel_acls, acl_manager, output_table, **_kwargs)[source]

Bases: ValveManagerBase

Implement stack manager, this handles the more higher-order stack functions. This includes port nominations and flood directionality.

acl_update_tunnel(acl)[source]

Return ofmsgs for all tunnels in an ACL with a tunnel rule

add_port(port)[source]

Need to add tunnel if port comes up with tunnel ACLs.

add_tunnel_acls()[source]

Returns ofmsgs installing the tunnel path rules

adjacent_stack_ports(peer_dp)[source]

Return list of ports that connect to an adjacent DP

consistent_roots(expected_root_name, valve, other_valves)[source]

Returns true if all the stack nodes have the root configured correctly

default_port_towards(dp_name)[source]

Default shortest path towards the provided destination, via direct shortest path

Parameters:

dp_name (str) – Destination DP

Returns:

port from current node that is shortest directly towards destination

Return type:

Port

edge_learn_port_towards(pkt_meta, edge_dp)[source]

Returns the port towards the edge DP

Parameters:
  • pkt_meta (PacketMeta) – Packet on the edge DP

  • edge_dp (DP) – Edge DP that received the packet

Returns:

Port towards the edge DP via some stack chosen metric

Return type:

Port

is_away(port)[source]

Return whether the port is an away port for the node

is_pruned_port(port)[source]

Return true if the port is to be pruned

is_selected_towards_root_port(port)[source]

Return true if the port is the chosen towards root port

static is_stack_port(port)[source]

Return whether the port is a stack port

is_towards_root(port)[source]

Return whether the port is a port towards the root for the node

static nominate_stack_root(root_valve, other_valves, now, last_live_times, update_time)[source]

Nominate a new stack root

Parameters:
  • root_valve (Valve) – Previous/current root Valve object

  • other_valves (list) – List of other valves (not including previous root)

  • now (float) – Current time

  • last_live_times (dict) – Last live time value for each DP

  • update_time (int) – Stack root update interval time

Returns:

Name of the new elected stack root

Return type:

str

relative_port_towards(dp_name)[source]

Returns the shortest path towards provided destination, via either the root or away paths

Parameters:

dp_name (str) – Destination DP

Returns:

port from current node that is towards/away the destination DP depending on

relative position of the current node

Return type:

Port

reset_peer_distances()[source]

Recalculates the towards and away ports for this node

stack_ports()[source]

Yield the stack ports of this stack node

static stacked_valves(valves)[source]

Return set of valves that have stacking enabled

tunnel_outport(src_dp, dst_dp, dst_port)[source]

Returns the output port for the current stack node for the tunnel path

Parameters:
  • src_dp (str) – Source DP name of the tunnel

  • dst_dp (str) – Destination DP name of the tunnel

  • dst_port (int) – Destination port of the tunnel

Returns:

Output port number for the current node of the tunnel

Return type:

int

update_health(now, last_live_times, update_time)[source]
Returns whether the current stack node is healthy, a healthy stack node

is one that attempted connected recently, or was known to be running recently, has all LAGs UP and any stack port UP

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:

True if current stack node is healthy

Return type:

bool

update_stack_topo(event, dp, port)[source]

Update the stack topo according to the event.

Parameters:
  • event (bool) – True if the port is UP

  • dp (DP) – DP object

  • port (Port) – The port being brought UP/DOWN