faucet.valve_of module

Utility functions to parse/create OpenFlow messages.

faucet.valve_of.apply_actions(actions)[source]

Return instruction that applies action list.

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

Return instruction to apply a meter.

faucet.valve_of.barrier()[source]

Return OpenFlow barrier request.

Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPBarrierRequest: barrier request.
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, ipv6_nd_target=None, icmpv6_type=None, nw_proto=None, nw_src=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:
ryu.ofproto.ofproto_v1_3_parser.OFPActionDecNwTtl: decrement IP TTL.
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.

Args:
vid (int): VLAN VID with VID_PRESENT.
Returns:
int: VLAN VID.
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.

Args:
table (ValveTable): table to goto.
Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPInstruction: goto instruction.
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.

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

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

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

Return True if flow message is a FlowMod.

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

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

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

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

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

Return True if OF message is a GroupMod.

Args:
ofmsg: ryu.ofproto.ofproto_v1_3_parser message.
Returns:
bool: True if is a GroupMod
faucet.valve_of.match(match_fields)[source]

Return OpenFlow matches from dict.

Args:
match_fields (dict): match fields and values.
Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPMatch: matches.
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.

Args:
max_len (int): max number of bytes from packet to output.
Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput: packet in action.
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.

Args:
port_num (int): port to output to. max_len (int): maximum length of packet to output (default no maximum).
Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput: output to port action.
faucet.valve_of.packetout(port_num, data)[source]

Return OpenFlow action to packet out to dataplane from controller.

Args:
port_num (int): port to output to. data (str): raw packet to output.
Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPActionOutput: packet out action.
faucet.valve_of.pop_vlan()[source]

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

Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPActionPopVlan: Pop VLAN.
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.

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

Return action to set destination Ethernet MAC address.

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

Return action to set source Ethernet MAC address.

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

Set VLAN VID with VID_PRESENT flag set.

Args:
vid (int): VLAN VID
Returns:
ryu.ofproto.ofproto_v1_3_parser.OFPActionSetField: set VID with VID_PRESENT.
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.

Args:
vid (int): VLAN VID
Returns:
int: VLAN VID with VID_PRESENT.