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.
- 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'))
- 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
- 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.
- 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:
Number of LAG ports
Root DP
Lowest DPID
- Parameters:
lacp_id – The LACP LAG ID
other_valves (list) – list of other valves
- Returns:
nominated_dpid, reason
- 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
- 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.