faucet.valve_switch_standalone module

Manage flooding/learning on standalone datapaths.

class faucet.valve_switch_standalone.ValveSwitchFlowRemovedManager(logger, ports, vlans, vlan_table, vlan_acl_table, eth_src_table, eth_dst_table, eth_dst_hairpin_table, flood_table, classification_table, pipeline, use_group_table, groups, combinatorial_port_flood, canonical_port_order, restricted_bcast_arpnd, has_externals, learn_ban_timeout, learn_timeout, learn_jitter, cache_update_guard_time, idle_dst, dp_high_priority, dp_highest_priority, faucet_dp_mac, drop_spoofed_faucet_mac)[source]

Bases: ValveSwitchManager

Trigger relearning on flow removed notifications.

Note

not currently reliable.

expire_hosts_from_vlan(_vlan, _now)[source]

Expire hosts from VLAN cache.

flow_timeout(now, table_id, match)[source]

Handle a flow timed out message from dataplane.

class faucet.valve_switch_standalone.ValveSwitchManager(logger, ports, vlans, vlan_table, vlan_acl_table, eth_src_table, eth_dst_table, eth_dst_hairpin_table, flood_table, classification_table, pipeline, use_group_table, groups, combinatorial_port_flood, canonical_port_order, restricted_bcast_arpnd, has_externals, learn_ban_timeout, learn_timeout, learn_jitter, cache_update_guard_time, idle_dst, dp_high_priority, dp_highest_priority, faucet_dp_mac, drop_spoofed_faucet_mac)[source]

Bases: ValveManagerBase

Implement dataplane based flooding/learning for standalone dataplanes.

FLOOD_DSTS = ((True, None, None, None), (False, None, '01:80:c2:00:00:00', 'ff:ff:ff:00:00:00'), (False, None, '01:00:5E:00:00:00', 'ff:ff:ff:00:00:00'), (False, None, '33:33:00:00:00:00', 'ff:ff:00:00:00:00'), (False, None, 'ff:ff:ff:ff:ff:ff', 'ff:ff:ff:ff:ff:ff'))
RESTRICTED_FLOOD_DISTS = ((False, 2054, 'ff:ff:ff:ff:ff:ff', 'ff:ff:ff:ff:ff:ff'), (False, 34525, '33:33:FF:00:00:00', 'ff:ff:ff:00:00:00'), (False, 34525, '33:33:00:00:00:02', 'ff:ff:ff:ff:ff:ff'), (False, 34525, '33:33:00:00:00:01', 'ff:ff:ff:ff:ff:ff'))
add_drop_spoofed_faucet_mac_rules(vlan)[source]

Install rules to drop spoofed faucet mac

add_port(port)[source]

install flows in response to a new port

add_vlan(vlan, cold_start)[source]

install flows in response to a new VLAN

ban_rules(pkt_meta)[source]

Limit learning to a maximum configured on this port/VLAN.

Parameters:

pkt_meta – PacketMeta instance.

Returns:

OpenFlow messages, if any.

Return type:

list

del_port(port)[source]

delete flows in response to a port removal

del_vlan(vlan)[source]

delete flows in response to a VLAN removal

delete_host_from_vlan(eth_src, vlan)[source]

Delete a host from a VLAN.

disable_forwarding(port)[source]
static edge_learn_port(_other_valves, pkt_meta)[source]

Possibly learn a host on a port.

Parameters:
  • other_valves (list) – All Valves other than this one.

  • pkt_meta (PacketMeta) – PacketMeta instance for packet received.

Returns:

port to learn host on.

enable_forwarding(port)[source]
expire_hosts_from_vlan(vlan, now)[source]

Expire hosts from VLAN cache.

static floods_to_root(_dp_obj)[source]

Return True if the given dp floods (only) to root switch

static flow_timeout(_now, _table_id, _match)[source]

Handle a flow timed out message from dataplane.

static get_lacp_dpid_nomination(lacp_id, valve, other_valves)[source]

Chooses the DP for a given LAG.

The DP will be nominated by the following conditions in order:
  1. Number of LAG ports

  2. Root DP

  3. Lowest DPID

Parameters:
  • lacp_id – The LACP LAG ID

  • other_valves (list) – list of other valves

Returns:

nominated_dpid, reason

initialise_tables()[source]

Initialise the flood table with filtering flows.

lacp_advertise(port)[source]

Return flows to send LACP if active.

lacp_handler(now, pkt_meta, valve, other_valves, lacp_update)[source]

Handle receiving an LACP packet :param now: current epoch time :type now: float :param pkt_meta: packet for control plane :type pkt_meta: PacketMeta :param valve: valve instance :type valve: Valve :param other_valves: all other valves :type other_valves: list :param lacp_update: callable to signal LACP state changes

Returns

dict: OpenFlow messages, if any by Valve

lacp_req_reply(lacp_pkt, port)[source]

Constructs a LACP req-reply packet.

Parameters:
  • lacp_pkt (PacketMeta) – LACP packet received

  • port – LACP port

  • other_valves (list) – List of other valves

Returns:

list packetout OpenFlow msgs.

lacp_update_actor_state(port, lacp_up, now=None, lacp_pkt=None, cold_start=False)[source]

Updates a LAG actor state.

Parameters:
  • port – LACP port

  • lacp_up (bool) – Whether LACP is going UP or DOWN

  • now (float) – Current epoch time

  • lacp_pkt (PacketMeta) – LACP packet

  • cold_start (bool) – Whether the port is being cold started

Returns:

True if LACP state changed

Return type:

bool

lacp_update_port_selection_state(port, valve, other_valves=None, cold_start=False)[source]

Update the LACP port selection state.

Parameters:
  • port (Port) – LACP port

  • other_valves (list) – List of other valves

  • cold_start (bool) – Whether the port is being cold started

Returns:

True if port state changed

Return type:

bool

static learn_host_from_pkt(valve, now, pkt_meta, other_valves)[source]

Learn host from packet.

learn_host_on_vlan_port_flows(port, vlan, eth_src, delete_existing, refresh_rules, src_rule_idle_timeout, src_rule_hard_timeout, dst_rule_idle_timeout)[source]

Return flows that implement learning a host on a port.

learn_host_on_vlan_ports(now, port, vlan, eth_src, delete_existing=True, last_dp_coldstart_time=None)[source]

Learn a host on a port.

update_vlan(vlan)[source]

flows in response to updating an existing VLAN.