faucet.vlan module

VLAN configuration.

class faucet.vlan.AnyVLAN[source]

Bases: object

Placeholder any tagged VLAN.

name = 'Any VLAN'
vid = 4096
class faucet.vlan.HostCacheEntry(eth_src, port, cache_time)[source]

Bases: object

Association of a host with a port.

cache_time
eth_src
eth_src_int
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.

add_cache_host(eth_src, port, cache_time)[source]

Add/update a host to the cache on a port at at time.

add_route(ip_dst, ip_gw)[source]

Add an IP route.

all_ip_gws(ipv)[source]

Return all IP gateways for specified IP version.

cached_host(eth_src)[source]

Return host from cache or None.

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, 'acl_out': None, 'acls_in': None, 'acls_out': None, 'description': None, 'dot1x_assigned': False, '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, 'reserved_internal_vlan': False, 'routes': None, 'targeted_gw_resolution': True, 'unicast_flood': True, 'vid': None}
defaults_types = {'acl_in': (<class 'int'>, <class 'str'>), 'acl_out': (<class 'int'>, <class 'str'>), 'acls_in': <class 'list'>, 'acls_out': <class 'list'>, 'description': <class 'str'>, 'dot1x_assigned': <class 'bool'>, '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'>, 'reserved_internal_vlan': <class 'bool'>, 'routes': <class 'list'>, 'targeted_gw_resolution': <class 'bool'>, 'unicast_flood': <class 'bool'>, 'vid': <class 'int'>}
del_route(ip_dst)[source]

Delete an IP route.

exclude_native_if_dot1x()[source]

Don’t output on native vlan, if dynamic (1x) vlan is in use

exclude_same_lag_member_ports(in_port=None)[source]

Ensure output on only one member of a LAG.

expire_cache_host(eth_src)[source]

Expire a host from caches.

expire_cache_hosts(now, learn_timeout)[source]

Expire stale host entries.

faucet_vips_by_ipv(ipv)[source]

Return VIPs with specified IP version on this VLAN.

flood_pkt(packet_builder, multi_out=True, *args)[source]
static 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 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, faucet_vip=None)[source]

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

ipvs()[source]

Return IP versions configured on this VLAN.

is_faucet_vip(ipa, faucet_vip=None)[source]

Return True if IP is a VIP on this VLAN.

is_host_fib_route(host_ip)[source]

Return True if IP destination is a host FIB route.

Parameters

host_ip – (ipaddress.ip_address): potential host FIB route.

Returns

True if a host FIB route (and not used as a gateway).

lacp_ports()[source]

Return ports that have LACP on this VLAN.

lacp_up_ports()[source]

Return ports that have LACP up on this VLAN.

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.

Return link local and non-link local VIPs.

loop_protect_external_ports()[source]

Return ports wth external loop protection set.

loop_protect_external_ports_up()[source]

Return up ports with external loop protection set.

mirrored_ports()[source]

Return ports that are mirrored on this VLAN.

mutable_attrs = frozenset({'dot1x_untagged', 'tagged', 'untagged'})
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, output_table=None, loop_protect_field=None)[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.

reset_caches()[source]

Reset dynamic caches.

reset_ports(ports)[source]

Reset tagged and untagged port lists.

route_count_by_ipv(ipv)[source]

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

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_flood_ports(exclude_unicast)[source]
untagged_flood_ports(exclude_unicast)[source]
static vid_valid(vid)[source]

Return True if VID valid.

vip_map(ipa)[source]