faucet.dp module

Configuration for a datapath.

class faucet.dp.DP(_id, dp_id, conf)[source]

Bases: faucet.conf.Conf

Stores state related to a datapath controlled by Faucet, including configuration.

add_acl(acl_ident, acl)[source]

Add an ACL to this DP.

add_port(port)[source]

Add a port to this DP.

add_router(router_ident, router)[source]

Add a router to this DP.

Add a stack link to the stack graph.

base_prom_labels()[source]

Return base Prometheus labels for this DP.

bgp_routers()[source]

Return list of routers with BGP enabled.

check_config()[source]

Check config at instantiation time for errors, typically via assert.

classification_table()[source]

Returns classification table

clone_dyn_state(prev_dp)[source]
default_table_sizes_types = {'classification': <class 'int'>, 'eth_dst': <class 'int'>, 'eth_dst_hairpin': <class 'int'>, 'eth_src': <class 'int'>, 'flood': <class 'int'>, 'ipv4_fib': <class 'int'>, 'ipv6_fib': <class 'int'>, 'port_acl': <class 'int'>, 'vip': <class 'int'>, 'vlan': <class 'int'>, 'vlan_acl': <class 'int'>}
defaults = {'advertise_interval': 30, 'arp_neighbor_timeout': 30, 'cache_update_guard_time': 0, 'combinatorial_port_flood': False, 'cookie': 1524372928, 'description': None, 'dot1x': None, 'dp_acls': None, 'dp_id': None, 'drop_broadcast_source_address': True, 'drop_spoofed_faucet_mac': True, 'egress_pipeline': False, 'fast_advertise_interval': 5, 'faucet_dp_mac': '0e:00:00:00:00:01', 'global_vlan': 0, 'group_table': False, 'hardware': 'Open vSwitch', 'high_priority': None, 'highest_priority': None, 'idle_dst': True, 'ignore_learn_ins': 10, 'interface_ranges': {}, 'interfaces': {}, 'lacp_timeout': 30, 'learn_ban_timeout': 0, 'learn_jitter': 0, 'lldp_beacon': {}, 'low_priority': None, 'lowest_priority': None, 'max_host_fib_retry_count': 10, 'max_hosts_per_resolve_cycle': 5, 'max_resolve_backoff_time': 64, 'max_wildcard_table_size': 1280, 'metrics_rate_limit_sec': 0, 'min_wildcard_table_size': 32, 'multi_out': True, 'name': None, 'nd_neighbor_timeout': 30, 'ofchannel_log': None, 'packetin_pps': None, 'priority_offset': 0, 'proactive_learn_v4': True, 'proactive_learn_v6': True, 'stack': None, 'strict_packet_in_cookie': True, 'table_sizes': {}, 'timeout': 300, 'use_classification': False, 'use_idle_timeout': False}
defaults_types = {'advertise_interval': <class 'int'>, 'arp_neighbor_timeout': <class 'int'>, 'cache_update_guard_time': <class 'int'>, 'combinatorial_port_flood': <class 'bool'>, 'cookie': <class 'int'>, 'description': <class 'str'>, 'dot1x': <class 'dict'>, 'dp_acls': <class 'list'>, 'dp_id': <class 'int'>, 'drop_broadcast_source_address': <class 'bool'>, 'drop_spoofed_faucet_mac': <class 'bool'>, 'egress_pipeline': <class 'bool'>, 'fast_advertise_interval': <class 'int'>, 'faucet_dp_mac': <class 'str'>, 'global_vlan': <class 'int'>, 'group_table': <class 'bool'>, 'hardware': <class 'str'>, 'high_priority': <class 'int'>, 'highest_priority': <class 'int'>, 'idle_dst': <class 'bool'>, 'ignore_learn_ins': <class 'int'>, 'interface_ranges': <class 'dict'>, 'interfaces': <class 'dict'>, 'lacp_timeout': <class 'int'>, 'learn_ban_timeout': <class 'int'>, 'learn_jitter': <class 'int'>, 'lldp_beacon': <class 'dict'>, 'low_priority': <class 'int'>, 'lowest_priority': <class 'int'>, 'max_host_fib_retry_count': <class 'int'>, 'max_hosts_per_resolve_cycle': <class 'int'>, 'max_resolve_backoff_time': <class 'int'>, 'max_wildcard_table_size': <class 'int'>, 'metrics_rate_limit_sec': <class 'int'>, 'min_wildcard_table_size': <class 'int'>, 'multi_out': <class 'bool'>, 'name': <class 'str'>, 'nd_neighbor_timeout': <class 'int'>, 'ofchannel_log': <class 'str'>, 'packetin_pps': <class 'int'>, 'priority_offset': <class 'int'>, 'proactive_learn_v4': <class 'bool'>, 'proactive_learn_v6': <class 'bool'>, 'stack': <class 'dict'>, 'strict_packet_in_cookie': <class 'bool'>, 'table_sizes': <class 'dict'>, 'timeout': <class 'int'>, 'use_classification': <class 'bool'>, 'use_idle_timeout': <class 'bool'>}
dot1x_defaults_types = {'auth_acl': <class 'str'>, 'nfv_intf': <class 'str'>, 'nfv_sw_port': <class 'int'>, 'noauth_acl': <class 'str'>, 'radius_ip': <class 'str'>, 'radius_port': <class 'int'>, 'radius_secret': <class 'str'>}
dot1x_ports()[source]

Return list of ports with 802.1x enabled.

finalize_config(dps)[source]

Perform consistency checks after initial config parsing.

finalize_tunnel_acls(dps)[source]

Turn off ACLs not in use and resolve the src dp & port for relevant ACLs :param dps: :type dps: list

get_config_changes(logger, new_dp)[source]

Detect any config changes.

Parameters
  • logger (ValveLogger) – logger instance

  • new_dp (DP) – new dataplane configuration.

Returns

changes tuple containing:

deleted_ports (set): deleted port numbers. changed_ports (set): changed/added port numbers. changed_acl_ports (set): changed ACL only port numbers. deleted_vlans (set): deleted VLAN IDs. changed_vlans (set): changed/added VLAN IDs. all_ports_changed (bool): True if all ports changed.

Return type

(tuple)

get_config_dict()[source]

Return DP config as a dict for API call.

get_native_vlan(port_num)[source]

Return native VLAN for a port by number, or None.

get_tables()[source]

Return tables as dict for API call.

in_port_tables()[source]

Return list of tables that specify in_port as a match.

is_in_path(src_dp, dst_dp)[source]

Returns true if the current DP is in the path from src_dp to dst_dp :param src_dp: :type src_dp: DP :param dst_dp: :type dst_dp: DP

Returns

True if self is in the path from the src_dp to the dst_dp

False otherwise

Return type

bool

is_stack_edge()[source]

Return True if this DP is a stack edge.

is_stack_root()[source]

Return True if this DP is the root of the stack.

lldp_beacon_defaults_types = {'max_per_interval': <class 'int'>, 'send_interval': <class 'int'>, 'system_name': <class 'str'>}
lldp_beacon_send_ports(now)[source]

Return list of ports to send LLDP packets; stacked ports always send LLDP.

match_tables(match_type)[source]

Return list of tables with matches of a specific match type.

static modify_stack_topology(graph, dp, port, add=True)[source]

Add/remove an edge to the stack graph which originates from this dp and port.

mutable_attrs = frozenset({'stack', 'vlans'})
output_table()[source]

Returns first output table

output_tables()[source]

Return tables that cause a packet to be forwarded.

peer_stack_up_ports(peer_dp)[source]

Return list of stack ports that are up towards a peer.

port_labels(port_no)[source]

Return port name and description labels for a port number.

port_no_valid(port_no)[source]

Return True if supplied port number valid on this datapath.

Remove a stack link to the stack graph.

reset_refs(vlans=None, root_dp=None)[source]

Resets vlan references

resolve_port(port_name)[source]

Resolve a port by number or name.

resolve_stack_topology(dps)[source]

Resolve inter-DP config for stacking.

set_defaults()[source]

Set default values and run any basic sanity checks.

shortest_path(dest_dp, src_dp=None)[source]

Return shortest path to a DP, as a list of DPs.

shortest_path_port(dest_dp)[source]

Return first port on our DP, that is the shortest path towards dest DP.

shortest_path_to_root()[source]

Return shortest path to root DP, as list of DPs.

stack_defaults_types = {'priority': <class 'int'>}
table_by_id(table_id)[source]

Gets first table with table id