faucet.dp module

Configuration for a datapath.

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

Bases: Conf

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

DEFAULT_LLDP_MAX_PER_INTERVAL = 5
DEFAULT_LLDP_SEND_INTERVAL = 5
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.

all_lags_up()[source]

Return True if all LAGs have at least one port up.

base_prom_labels()[source]

Return base Prometheus labels for this DP.

bgp_routers()[source]

Return list of routers with BGP enabled.

static canonical_port_order(ports)[source]

Return iterable of ports in consistent order.

check_config()[source]

Check configuration of this dp

classification_table()[source]

Returns classification table

clone_dyn_state(prev_dp, dps=None)[source]

Clone dynamic state for this dp

cold_start(now)[source]

Update to reflect a cold start

coprocessor_ports()[source]

Return list of coprocessor ports.

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: dict = {'advertise_interval': 30, 'arp_neighbor_timeout': 30, 'cache_update_guard_time': 0, 'combinatorial_port_flood': False, 'cookie': 1524372928, 'description': None, 'dot1x': {}, '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, 'port_table_scale_factor': 1.0, 'priority_offset': 0, 'proactive_learn_v4': True, 'proactive_learn_v6': True, 'slowpath_pps': None, 'stack': None, 'strict_packet_in_cookie': True, 'table_sizes': {}, 'timeout': 300, 'use_classification': False, 'use_idle_timeout': False}
defaults_types: dict = {'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'>, 'port_table_scale_factor': <class 'float'>, 'priority_offset': <class 'int'>, 'proactive_learn_v4': <class 'bool'>, 'proactive_learn_v6': <class 'bool'>, 'slowpath_pps': <class 'int'>, '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()[source]

Need to configure OF tables as very last step.

finalize_config(dps)[source]

Perform consistency checks after initial config parsing.

finalize_tunnel_acls(dps)[source]

Resolve each tunnels sources

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 port numbers. added_ports (set): 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. all_meters_changed (bool): True if all meters changed deleted_meters (set): deleted meter numbers added_meters (set): Added meter numbers changed_meters (set): changed/added meter numbers

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.

lacp_down_ports()[source]

Return ports that have LACP not UP

lacp_nosync_ports()[source]

Return ports that have LACP status NO_SYNC.

lacp_ports()[source]

Return ports that have LACP.

lacp_up_ports()[source]

Return ports that have LACP up.

lags()[source]

Return dict of LAGs mapped to member ports.

lags_nosync()[source]

Return dict of LAGs mapped to member ports that have LACP in NO SYNC.

lags_up()[source]

Return dict of LAGs mapped to member ports that have LACP up.

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.

mutable_attrs: frozenset = frozenset({'vlans'})
non_vlan_ports()[source]

Ports that don’t have VLANs on them.

output_table()[source]

Returns first output table

output_tables()[source]

Return tables that cause a packet to be forwarded.

pipeline_str()[source]

Text description of pipeline.

pipeline_tableids()[source]

Return pipeline table IDs.

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.

reset_refs(vlans=None)[source]

Resets VLAN references.

resolve_port(port_name)[source]

Resolve a port by number or name.

resolve_stack_topology(dps, meta_dp_state)[source]

Resolve inter-DP config for stacking

restricted_bcast_arpnd_ports()[source]

Return ports that have restricted broadcast set.

set_defaults()[source]

Set default values and run any basic sanity checks.

stack_ports()[source]

Return list of stack ports

table_by_id(table_id)[source]

Gets first table with table id