faucet.vlan module

VLAN configuration.

class faucet.vlan.HostCacheEntry(eth_src, port, cache_time)[source]

Bases: object

Association of a host with a port.

class faucet.vlan.NullVLAN[source]

Bases: object

Placeholder null VLAN.

name = 'Null VLAN'
vid = 0
class faucet.vlan.VLAN(_id, dp_id, conf=None)[source]

Bases: faucet.conf.Conf

Contains state for one VLAN, including its configuration.

acl_in = None
acls_in = None
add_cache_host(eth_src, port, cache_time)[source]
add_route(ip_dst, ip_gw)[source]

Add an IP route.

all_ip_gws(ipv)[source]

Return list of all IP gateways for specified IP version.

bgp_as = None
bgp_connect_mode = None
bgp_ipvs()[source]

Return list of IP versions for BGP configured on this VLAN.

bgp_local_address = None
bgp_neighbor_addresses = []
bgp_neighbor_addresses_by_ipv(ipv)[source]

Return list of BGP neighbor addresses with specified IP version on this VLAN.

bgp_neighbor_as = None
bgp_neighbour_addresses = []
bgp_neighbour_as = None
bgp_port = None
bgp_routerid = None
bgp_server_addresses = []
bgp_server_addresses_by_ipv(ipv)[source]

Return list of BGP server addresses with specified IP version on this VLAN.

cached_host(eth_src)[source]
cached_host_on_port(eth_src, port)[source]

Return host cache entry if host in cache and on specified port.

cached_hosts_count_on_port(port)[source]

Return count of all hosts learned on a port.

cached_hosts_on_port(port)[source]

Return all hosts learned on a port.

check_config()[source]

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

clear_cache_hosts_on_port(port)[source]

Clear all hosts learned on a port.

defaults = {'acl_in': None, 'acls_in': None, 'bgp_as': None, 'bgp_connect_mode': 'passive', 'bgp_local_address': None, 'bgp_neighbor_addresses': [], 'bgp_neighbor_as': None, 'bgp_neighbour_addresses': [], 'bgp_neighbour_as': None, 'bgp_port': 9179, 'bgp_routerid': None, 'bgp_server_addresses': ['0.0.0.0', '::'], 'description': None, 'faucet_mac': '0e:00:00:00:00:01', 'faucet_vips': None, 'max_hosts': 256, 'minimum_ip_size_check': True, 'name': None, 'proactive_arp_limit': 0, 'proactive_nd_limit': 0, 'routes': None, 'targeted_gw_resolution': False, 'unicast_flood': True, 'vid': None}
defaults_types = {'acl_in': (<class 'int'>, <class 'str'>), 'acls_in': <class 'list'>, 'bgp_as': <class 'int'>, 'bgp_connect_mode': <class 'str'>, 'bgp_local_address': <class 'str'>, 'bgp_neighbor_addresses': <class 'list'>, 'bgp_neighbor_as': <class 'int'>, 'bgp_neighbour_addresses': <class 'list'>, 'bgp_neighbour_as': <class 'int'>, 'bgp_port': <class 'int'>, 'bgp_routerid': <class 'str'>, 'bgp_server_addresses': <class 'list'>, 'description': <class 'str'>, 'faucet_mac': <class 'str'>, 'faucet_vips': <class 'list'>, 'max_hosts': <class 'int'>, 'minimum_ip_size_check': <class 'bool'>, 'name': <class 'str'>, 'proactive_arp_limit': <class 'int'>, 'proactive_nd_limit': <class 'int'>, 'routes': <class 'list'>, 'targeted_gw_resolution': <class 'bool'>, 'unicast_flood': <class 'bool'>, 'vid': <class 'int'>}
del_route(ip_dst)[source]

Delete an IP route.

dp_id = None
dyn_bgp_neighbor_addresses_by_ipv = None
dyn_bgp_server_addresses_by_ipv = None
dyn_faucet_vips_by_ipv = None
dyn_gws_by_ipv = None
dyn_host_cache = None
dyn_host_cache_by_port = None
dyn_last_time_hosts_expired = None
dyn_learn_ban_count = 0
dyn_neigh_cache_by_ipv = None
dyn_oldest_host_time = None
dyn_routes_by_ipv = None
expire_cache_host(eth_src)[source]

Expire a host from caches.

expire_cache_hosts(now, learn_timeout)[source]

Expire stale host entries.

faucet_mac = None
faucet_vips = None
faucet_vips_by_ipv(ipv)[source]

Return list of VIPs with specified IP version on this VLAN.

flood_pkt(packet_builder, random_order, *args)[source]
flood_ports(configured_ports, exclude_unicast)[source]
from_connected_to_vip(src_ip, dst_ip)[source]

Return True if src_ip in connected network and dst_ip is a VIP.

Parameters:
  • src_ip (ipaddress.ip_address) – source IP.
  • dst_ip (ipaddress.ip_address) – destination IP
Returns:

True if local traffic for a VIP.

get_ports()[source]

Return list of all ports on this VLAN.

hairpin_ports()[source]

Return all ports with hairpin enabled.

hosts_count()[source]

Return number of hosts learned on this VLAN.

ip_dsts_for_ip_gw(ip_gw)[source]

Return list of IP destinations, for specified gateway.

ip_in_vip_subnet(ipa)[source]

Return faucet_vip if IP in same IP network as a VIP on this VLAN.

ipvs()[source]

Return list of IP versions configured on this VLAN.

is_faucet_vip(ipa)[source]

Return True if IP is a VIP on this VLAN.

lags()[source]

Return dict of LAGs mapped to member ports.

max_hosts = None
mirrored_ports()[source]

Return list of ports that are mirrored on this VLAN.

name = None
neigh_cache_by_ipv(ipv)[source]

Return neighbor cache for specified IP version on this VLAN.

neigh_cache_count_by_ipv(ipv)[source]

Return number of hosts in neighbor cache for specified IP version on this VLAN.

output_port(port, hairpin=False)[source]
pkt_out_port(packet_builder, port, *args)[source]
port_is_tagged(port)[source]

Return True if port number is an tagged port on this VLAN.

port_is_untagged(port)[source]

Return True if port number is an untagged port on this VLAN.

proactive_arp_limit = None
proactive_nd_limit = None
reset_caches()[source]

Reset dynamic caches.

reset_ports(ports)[source]
route_count_by_ipv(ipv)[source]

Return route table count for specified IP version on this VLAN.

routes = None
routes_by_ipv(ipv)[source]

Return route table for specified IP version on this VLAN.

set_defaults()[source]

Set default values and run any basic sanity checks.

tagged = None
tagged_flood_ports(exclude_unicast)[source]
targeted_gw_resolution = None
to_conf()[source]

Return configuration as a dict.

unicast_flood = None
untagged = None
untagged_flood_ports(exclude_unicast)[source]
vid = None
static vid_valid(vid)[source]

Return True if VID valid.