faucet.valve_of module

Utility functions to parse/create OpenFlow messages.

faucet.valve_of.apply_actions(actions)[source]

Return instruction that applies action list.

Parameters:actions (list) – list of OpenFlow actions.
Returns:instruction of actions.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPInstruction
faucet.valve_of.apply_meter(meter_id)[source]

Return instruction to apply a meter.

faucet.valve_of.barrier()[source]

Return OpenFlow barrier request.

Returns:barrier request.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPBarrierRequest
faucet.valve_of.bucket(weight=0, watch_port=4294967295, watch_group=4294967295, actions=None)[source]

Return a group action bucket with provided actions.

faucet.valve_of.build_match_dict(in_port=None, vlan=None, eth_type=None, eth_src=None, eth_dst=None, eth_dst_mask=None, icmpv6_type=None, nw_proto=None, nw_dst=None)[source]
faucet.valve_of.controller_pps_meteradd(datapath=None, pps=0)[source]

Add a PPS meter towards controller.

faucet.valve_of.controller_pps_meterdel(datapath=None)[source]

Delete a PPS meter towards controller.

faucet.valve_of.dec_ip_ttl()[source]

Return OpenFlow action to decrement IP TTL.

Returns:decrement IP TTL.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPActionDecNwTtl
faucet.valve_of.desc_stats_request(datapath=None)[source]

Query switch description.

faucet.valve_of.devid_present(vid)[source]

Return VLAN VID without VID_PRESENT flag set.

Parameters:vid (int) – VLAN VID with VID_PRESENT.
Returns:VLAN VID.
Return type:int
faucet.valve_of.faucet_async(datapath=None)[source]

Return async message config for FAUCET.

faucet.valve_of.faucet_config(datapath=None)[source]

Return switch config for FAUCET.

faucet.valve_of.flood_tagged_port_outputs(ports, in_port, exclude_ports=None)[source]

Return list of actions necessary to flood to list of tagged ports.

faucet.valve_of.flood_untagged_port_outputs(ports, in_port, exclude_ports=None)[source]

Return list of actions necessary to flood to list of untagged ports.

faucet.valve_of.flowmod(cookie, command, table_id, priority, out_port, out_group, match_fields, inst, hard_timeout, idle_timeout, flags=0)[source]
faucet.valve_of.gauge_async(datapath=None)[source]

Return async message config for Gauge.

faucet.valve_of.goto_table(table)[source]

Return instruction to goto table.

Parameters:table (ValveTable) – table to goto.
Returns:goto instruction.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPInstruction
faucet.valve_of.group_act(group_id)[source]

Return an action to run a group.

faucet.valve_of.group_flood_buckets(ports, untagged)[source]
faucet.valve_of.groupadd(datapath=None, type_=0, group_id=0, buckets=None)[source]

Add a group.

faucet.valve_of.groupadd_ff(datapath=None, group_id=0, buckets=None)[source]

Add a fast failover group.

faucet.valve_of.groupdel(datapath=None, group_id=4294967292)[source]

Delete a group (default all groups).

faucet.valve_of.groupmod(datapath=None, type_=0, group_id=0, buckets=None)[source]

Modify a group.

faucet.valve_of.groupmod_ff(datapath=None, group_id=0, buckets=None)[source]

Modify a fast failover group.

faucet.valve_of.ignore_port(port_num)[source]

Return True if FAUCET should ignore this port.

Parameters:port_num (int) – switch port.
Returns:True if FAUCET should ignore this port.
Return type:bool
faucet.valve_of.is_flowdel(ofmsg)[source]

Return True if flow message is a FlowMod and a delete.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a FlowMod delete/strict.
Return type:bool
faucet.valve_of.is_flowmod(ofmsg)[source]

Return True if flow message is a FlowMod.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a FlowMod
Return type:bool
faucet.valve_of.is_groupadd(ofmsg)[source]

Return True if OF message is a GroupMod and command is add.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a GroupMod add
Return type:bool
faucet.valve_of.is_groupdel(ofmsg)[source]

Return True if OF message is a GroupMod and command is delete.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a GroupMod delete
Return type:bool
faucet.valve_of.is_groupmod(ofmsg)[source]

Return True if OF message is a GroupMod.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a GroupMod
Return type:bool
faucet.valve_of.is_meteradd(ofmsg)[source]

Return True if OF message is a MeterMod and command is add.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a MeterMod add
Return type:bool
faucet.valve_of.is_meterdel(ofmsg)[source]

Return True if OF message is a MeterMod and command is delete.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a MeterMod delete
Return type:bool
faucet.valve_of.is_metermod(ofmsg)[source]

Return True if OF message is a MeterMod.

Parameters:ofmsg – ryu.ofproto.ofproto_v1_3_parser message.
Returns:True if is a MeterMod
Return type:bool
faucet.valve_of.match(match_fields)[source]

Return OpenFlow matches from dict.

Parameters:match_fields (dict) – match fields and values.
Returns:matches.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPMatch
faucet.valve_of.match_from_dict(match_dict)[source]
faucet.valve_of.meteradd(meter_conf)[source]

Add a meter based on YAML configuration.

faucet.valve_of.meterdel(datapath=None, meter_id=4294967295)[source]

Delete a meter (default all meters).

faucet.valve_of.output_controller(max_len=128)[source]

Return OpenFlow action to packet in to the controller.

Parameters:max_len (int) – max number of bytes from packet to output.
Returns:packet in action.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput
faucet.valve_of.output_in_port()[source]

Return OpenFlow action to output out input port.

Returns:ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput.
faucet.valve_of.output_port(port_num, max_len=0)[source]

Return OpenFlow action to output to a port.

Parameters:
  • port_num (int) – port to output to.
  • max_len (int) – maximum length of packet to output (default no maximum).
Returns:

output to port action.

Return type:

ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput

faucet.valve_of.packetout(port_num, data)[source]

Return OpenFlow action to packet out to dataplane from controller.

Parameters:
  • port_num (int) – port to output to.
  • data (str) – raw packet to output.
Returns:

packet out action.

Return type:

ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput

faucet.valve_of.pop_vlan()[source]

Return OpenFlow action to pop outermost Ethernet 802.1Q VLAN header.

Returns:Pop VLAN.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPActionPopVlan
faucet.valve_of.port_status_from_state(state)[source]

Return True if OFPPS_LINK_DOWN is not set.

faucet.valve_of.push_vlan_act(vlan_vid, eth_type=33024)[source]

Return OpenFlow action list to push Ethernet 802.1Q header with VLAN VID.

Parameters:vid (int) – VLAN VID
Returns:actions to push 802.1Q header with VLAN VID set.
Return type:list
faucet.valve_of.set_eth_dst(eth_dst)[source]

Return action to set destination Ethernet MAC address.

Parameters:eth_src (str) – destination Ethernet MAC address.
Returns:set field action.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPActionSetField
faucet.valve_of.set_eth_src(eth_src)[source]

Return action to set source Ethernet MAC address.

Parameters:eth_src (str) – source Ethernet MAC address.
Returns:set field action.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPActionSetField
faucet.valve_of.set_vlan_vid(vlan_vid)[source]

Set VLAN VID with VID_PRESENT flag set.

Parameters:vid (int) – VLAN VID
Returns:set VID with VID_PRESENT.
Return type:ryu.ofproto.ofproto_v1_3_parser.OFPActionSetField
faucet.valve_of.table_features(body)[source]
faucet.valve_of.valve_flowreorder(input_ofmsgs)[source]

Reorder flows for better OFA performance.

faucet.valve_of.valve_match_vid(value)[source]
faucet.valve_of.vid_present(vid)[source]

Return VLAN VID with VID_PRESENT flag set.

Parameters:vid (int) – VLAN VID
Returns:VLAN VID with VID_PRESENT.
Return type:int