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.

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.

Add a stack link to the stack graph.

all_lags_up()[source]

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

any_stack_port_up()[source]

Return True if any stack port is 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]
check_config()[source]

Check configuration of this dp

classification_table()[source]

Returns classification table

clone_dyn_state(prev_dp)[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 = {'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 = {'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.

Return network stacking graph as a node link representation

get_tables()[source]

Return tables as dict for API call.

static hash_graph(graph)[source]

Return hash of a topology graph

in_port_tables()[source]

Return list of tables that specify in_port as a match.

is_in_path(src_dp, dst_dp)[source]

Return True if the current DP is in the path from src_dp to dst_dp :param src_dp: DP name :type src_dp: str :param dst_dp: DP name :type dst_dp: str

Returns

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

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.

is_stack_root_candidate()[source]

Return True if this DP could be a root of the stack.

is_transit_stack_switch()[source]
Return true if this is a stack switch

in reset_refs self.stack might not be configured yet

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_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.

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'})
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.

peer_stack_up_ports(peer_dp)[source]

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

peer_symmetric_up_ports(peer_dp)[source]

Return list of stack ports that are up towards us from 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)[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.

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(src_dp=None)[source]

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

shortest_symmetric_path_port(adj_dp)[source]

Return port on our DP that is the first port of the adjacent DP towards us

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

Return length of the longest path to root in the stack.

table_by_id(table_id)[source]

Gets first table with table id