faucet.valve module¶
Implementation of Valve learning layer 2/3 switch.
-
class
faucet.valve.
AlliedTelesis
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
faucet.valve.OVSValve
Valve implementation for AT.
-
DEC_TTL
= False¶
-
acl_manager
¶
-
dot1x
¶
-
dp
¶
-
flood_manager
¶
-
host_manager
¶
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
pipeline
¶
-
recent_ofmsgs
¶
-
-
class
faucet.valve.
ArubaValve
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
faucet.valve.TfmValve
Valve implementation for Aruba.
-
DEC_TTL
= False¶
-
FILL_REQ
= False¶
-
acl_manager
¶
-
dot1x
¶
-
dp
¶
-
flood_manager
¶
-
host_manager
¶
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
pipeline
¶
-
recent_ofmsgs
¶
-
-
class
faucet.valve.
CiscoC9KValve
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
faucet.valve.TfmValve
Valve implementation for C9K.
-
acl_manager
¶
-
dot1x
¶
-
dp
¶
-
flood_manager
¶
-
host_manager
¶
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
pipeline
¶
-
recent_ofmsgs
¶
-
-
class
faucet.valve.
NoviFlowValve
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
faucet.valve.Valve
Valve implementation for NoviFlow with static pipeline.
-
STATIC_TABLE_IDS
= True¶
-
USE_BARRIERS
= True¶
-
acl_manager
¶
-
dot1x
¶
-
dp
¶
-
flood_manager
¶
-
host_manager
¶
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
pipeline
¶
-
recent_ofmsgs
¶
-
-
class
faucet.valve.
OVSTfmValve
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
faucet.valve.TfmValve
Valve implementation for OVS.
-
MAX_TABLE_ID
= 253¶
-
MIN_MAX_FLOWS
= 1000000¶
-
USE_BARRIERS
= False¶
-
USE_OXM_IDS
= False¶
-
acl_manager
¶
-
dot1x
¶
-
dp
¶
-
flood_manager
¶
-
host_manager
¶
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
pipeline
¶
-
recent_ofmsgs
¶
-
-
class
faucet.valve.
OVSValve
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
faucet.valve.Valve
Valve implementation for OVS.
-
USE_BARRIERS
= False¶
-
acl_manager
¶
-
dot1x
¶
-
dp
¶
-
flood_manager
¶
-
host_manager
¶
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
pipeline
¶
-
recent_ofmsgs
¶
-
-
class
faucet.valve.
TfmValve
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
faucet.valve.Valve
Valve implementation that uses OpenFlow send table features messages.
-
FILL_REQ
= True¶
-
MAX_TABLE_ID
= 0¶
-
MIN_MAX_FLOWS
= 0¶
-
USE_OXM_IDS
= True¶
-
acl_manager
¶
-
dot1x
¶
-
dp
¶
-
flood_manager
¶
-
host_manager
¶
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
pipeline
¶
-
recent_ofmsgs
¶
-
-
class
faucet.valve.
Valve
(dp, logname, metrics, notifier, dot1x)[source]¶ Bases:
object
Generates the messages to configure a datapath as a l2 learning switch.
Vendor specific implementations may require sending configuration flows. This can be achieved by inheriting from this class and overwriting the function switch_features.
-
DEC_TTL
= True¶
-
GROUPS
= True¶
-
STATIC_TABLE_IDS
= False¶
-
USE_BARRIERS
= True¶
-
acl_manager
¶
-
datapath_connect
(now, discovered_up_ports)[source]¶ Handle Ryu datapath connection event and provision pipeline.
- Parameters
now (float) – current epoch time.
discovered_up_ports (set) – datapath port numbers that are up.
- Returns
OpenFlow messages to send to datapath.
- Return type
list
-
dot1x
¶
-
dp
¶
-
fast_state_expire
(now, other_valves)[source]¶ Called periodically to verify the state of stack ports.
-
flood_manager
¶
-
flow_timeout
(now, table_id, match)[source]¶ Call flow timeout message handler:
- Parameters
now (float) – current epoch time.
table_id (int) – ID of table where flow was installed.
match (dict) – match conditions for expired flow.
- Returns
OpenFlow messages, if any.
- Return type
list
-
get_lacp_dpid_nomination
(lacp_id, 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
-
host_manager
¶
-
lacp_disable_forwarding
(port, cold_start=False)[source]¶ - Return OpenFlow messages for initial LACP states and
when packets from the link should not be sent through the pipeline
-
lacp_enable_forwarding
(port)[source]¶ - Enables packets from the LAG link to progress through the pipeline
also recomputes the flooding & host rules
Should only be called when a LACP port is both ACTOR_UP & SELECTED Return OpenFlow messages when LACP is UP and SELECTED on a port
-
lacp_handler
(now, pkt_meta, other_valves)[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
- Returns
dict: OpenFlow messages, if any by Valve
-
lacp_update
(port, lacp_up, now=None, lacp_pkt=None, other_valves=None)[source]¶ - Update the port’s LACP states and enables/disables packets
from the link to be processed further through the pipeline based on the state changes
- Parameters
port – The port the packet is being received on
lacp_up (bool) – Whether the lacp actor is up
now (float) – The current time
lacp_pkt (PacketMeta) – The received LACP packet
other_valves (list) – List of other valves (in the stack)
- Returns
ofmsgs
-
lacp_update_actor_state
(port, lacp_up, now=None, lacp_pkt=None, cold_start=False)[source]¶ Updates a LAG actor state :param port: LACP port :param lacp_up: Whether LACP is going UP or DOWN :type lacp_up: bool :param now: Current epoch time :type now: float :param lacp_pkt: LACP packet :type lacp_pkt: PacketMeta :param cold_start: Whether the port is being cold started :type cold_start: bool
- Returns
True if LACP state changed
- Return type
bool
-
lacp_update_port_selection_state
(port, other_valves=None, cold_start=False)[source]¶ Update the LACP port selection state :param port: LACP port :type port: Port :param other_valves: List of other valves :type other_valves: list :param cold_start: Whether the port is being cold started :type cold_start: bool
- Returns
True if port state changed
- Return type
bool
-
learn_host
(now, pkt_meta, other_valves)[source]¶ Possibly learn a host on a port.
- Parameters
now (float) – current epoch time.
pkt_meta (PacketMeta) – PacketMeta instance for packet received.
other_valves (list) – all Valves other than this one.
- Returns
OpenFlow messages, if any.
- Return type
list
-
lldp_handler
(now, pkt_meta, other_valves)[source]¶ Handle an LLDP packet.
- Parameters
pkt_meta (PacketMeta) – packet for control plane.
-
logger
¶
-
logname
¶
-
metrics
¶
-
notifier
¶
-
ofchannel_logger
¶
-
oferror
(msg)[source]¶ Correlate OFError message with flow we sent, if any.
- Parameters
msg (ryu.controller.ofp_event.EventOFPMsgBase) – message from datapath.
-
parse_rcv_packet
(in_port, vlan_vid, eth_type, data, orig_len, pkt, eth_pkt, vlan_pkt)[source]¶ Parse a received packet into a PacketMeta instance.
- Parameters
in_port (int) – port packet was received on.
vlan_vid (int) – VLAN VID of port packet was received on.
eth_type (int) – Ethernet type of packet.
data (bytes) – Raw packet data.
orig_len (int) – Original length of packet.
pkt (ryu.lib.packet.packet) – parsed packet received.
ekt_pkt (ryu.lib.packet.ethernet) – parsed Ethernet header.
vlan_pkt (ryu.lib.packet.vlan) – parsed VLAN Ethernet header.
- Returns
PacketMeta instance.
-
pipeline
¶
-
port_add
(port_num)[source]¶ Handle addition of a single port.
- Parameters
port_num (list) – list of port numbers.
- Returns
OpenFlow messages, if any.
- Return type
list
-
port_delete
(port_num, keep_cache=False, other_valves=None)[source]¶ Return flow messages that delete port from pipeline.
-
port_status_handler
(port_no, reason, state, _other_valves, now)[source]¶ Return OpenFlow messages responding to port operational status change.
-
ports_add
(port_nums, cold_start=False, log_msg='up')[source]¶ Handle the addition of ports.
- Parameters
port_num (list) – list of port numbers.
cold_start (bool) – True if configuring datapath from scratch.
- Returns
OpenFlow messages, if any.
- Return type
list
-
ports_delete
(port_nums, log_msg='down', keep_cache=False, other_valves=None)[source]¶ Handle the deletion of ports.
- Parameters
port_nums (list) – list of port numbers.
- Returns
OpenFlow messages, if any.
- Return type
list
-
prepare_send_flows
(flow_msgs)[source]¶ Prepare to send flows to datapath.
- Parameters
flow_msgs (list) – OpenFlow messages to send.
-
rcv_packet
(now, other_valves, pkt_meta)[source]¶ Handle a packet from the dataplane (eg to re/learn a host).
The packet may be sent to us also in response to FAUCET initiating IPv6 neighbor discovery, or ARP, to resolve a nexthop.
- Parameters
other_valves (list) – all Valves other than this one.
pkt_meta (PacketMeta) – packet for control plane.
- Returns
OpenFlow messages, if any by Valve.
- Return type
dict
-
recent_ofmsgs
¶
-
reload_config
(_now, new_dp)[source]¶ Reload configuration new_dp.
- Following config changes are currently supported:
- Port config: support all available configs
(e.g. native_vlan, acl_in) & change operations (add, delete, modify) a port
- ACL config:support any modification, currently reload all
rules belonging to an ACL
VLAN config: enable, disable routing, etc…
- Parameters
now (float) – current epoch time.
new_dp (DP) – new dataplane configuration.
- Returns
OpenFlow messages.
- Return type
ofmsgs (list)
-
resolve_gateways
(now, _other_valves)[source]¶ Call route managers to re/resolve gateways.
- Returns
OpenFlow messages, if any by Valve.
- Return type
dict
-
router_learn_host
(pkt_meta)[source]¶ Add L3 forwarding rule.
- Parameters
pkt_meta (PacketMeta) – PacketMeta instance for packet received.
- Returns
OpenFlow messages, if any.
- Return type
list
-
router_rcv_packet
(now, pkt_meta)[source]¶ Process packets destined for router or run resolver.
- Parameters
now (float) – current epoch time.
pkt_meta (PacketMeta) – packet for control plane.
- Returns
OpenFlow messages.
- Return type
list
-
send_flows
(ryu_dp, flow_msgs)[source]¶ Send flows to datapath (or disconnect an OF session).
- Parameters
ryu_dp (ryu.controller.controller.Datapath) – datapath.
flow_msgs (list) – OpenFlow messages to send.
-
state_expire
(now, other_valves)[source]¶ Expire controller caches/state (e.g. hosts learned).
- Parameters
now (float) – current epoch time.
other_valves (list) – all Valves other than this one.
- Returns
OpenFlow messages, if any by Valve.
- Return type
dict
-