faucet.port module

Port configuration.

class faucet.port.Port(_id, dp_id, conf=None)[source]

Bases: Conf

Stores state for ports, including the configuration.

actor_init()[source]

Set the LACP actor state to INIT

actor_none()[source]

Set the LACP actor state to NONE

actor_nosync()[source]

Set the LACP actor state to NOSYNC

actor_notconfigured()[source]

Set the LACP actor state to NOTCONFIGURED

actor_state()[source]

Return the current LACP actor state

static actor_state_name(state)[source]

Return the string of the actor state

actor_up()[source]

Set the LACP actor state to UP

check_config()[source]

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

clone_dyn_state(prev_port)[source]
contains_tunnel_acl(tunnel_id=None)[source]

Searches through acls_in for a tunnel ACL with a matching tunnel_id

coprocessor_defaults_types = {'strategy': <class 'str'>, 'vlan_vid_base': <class 'int'>}
deconfigure_port()[source]

Set LACP port state to NOTCONFIGURED

defaults: dict = {'acl_in': None, 'acls_in': None, 'coprocessor': {}, 'count_untag_vlan_miss': False, 'description': None, 'dot1x': False, 'dot1x_acl': False, 'dot1x_dyn_acl': False, 'dot1x_mab': False, 'enabled': True, 'hairpin': False, 'hairpin_unicast': False, 'lacp': 0, 'lacp_active': False, 'lacp_collect_and_distribute': False, 'lacp_passthrough': None, 'lacp_port_id': -1, 'lacp_port_priority': 255, 'lacp_resp_interval': 1, 'lacp_selected': False, 'lacp_standby': False, 'lacp_unselected': False, 'lldp_beacon': {}, 'lldp_peer_mac': None, 'loop_protect': False, 'loop_protect_external': False, 'max_hosts': 255, 'max_lldp_lost': 3, 'mirror': None, 'name': None, 'native_vlan': None, 'number': None, 'opstatus_reconf': True, 'output_only': False, 'permanent_learn': False, 'receive_lldp': False, 'restricted_bcast_arpnd': False, 'stack': None, 'tagged_vlans': None, 'unicast_flood': True}
defaults_types: dict = {'acl_in': (<class 'str'>, <class 'int'>), 'acls_in': <class 'list'>, 'coprocessor': <class 'dict'>, 'count_untag_vlan_miss': <class 'bool'>, 'description': <class 'str'>, 'dot1x': <class 'bool'>, 'dot1x_acl': <class 'bool'>, 'dot1x_dyn_acl': <class 'bool'>, 'dot1x_mab': <class 'bool'>, 'enabled': <class 'bool'>, 'hairpin': <class 'bool'>, 'hairpin_unicast': <class 'bool'>, 'lacp': <class 'int'>, 'lacp_active': <class 'bool'>, 'lacp_collect_and_distribute': <class 'bool'>, 'lacp_passthrough': <class 'list'>, 'lacp_port_id': <class 'int'>, 'lacp_port_priority': <class 'int'>, 'lacp_resp_interval': <class 'int'>, 'lacp_selected': <class 'bool'>, 'lacp_standby': <class 'bool'>, 'lacp_unselected': <class 'bool'>, 'lldp_beacon': <class 'dict'>, 'lldp_peer_mac': <class 'str'>, 'loop_protect': <class 'bool'>, 'loop_protect_external': <class 'bool'>, 'max_hosts': <class 'int'>, 'max_lldp_lost': <class 'int'>, 'mirror': (<class 'list'>, <class 'str'>, <class 'int'>), 'name': <class 'str'>, 'native_vlan': (<class 'str'>, <class 'int'>), 'number': <class 'int'>, 'opstatus_reconf': <class 'bool'>, 'output_only': <class 'bool'>, 'permanent_learn': <class 'bool'>, 'receive_lldp': <class 'bool'>, 'restricted_bcast_arpnd': <class 'bool'>, 'stack': <class 'dict'>, 'tagged_vlans': <class 'list'>, 'unicast_flood': <class 'bool'>}
deselect_port()[source]

UNSELECT the current LACP port

finalize()[source]

Configuration parsing marked complete.

get_lacp_flags()[source]

Get the LACP flags for the state the port is in Return sync, collecting, distributing flag values

hosts(vlans=None)[source]

Return all host cache entries this port has learned (on all or specified VLANs).

hosts_count(vlans=None)[source]

Return count of all hosts this port has learned (on all or specified VLANs).

is_actor_init()[source]

Return true if the LACP actor state is INIT

is_actor_none()[source]

Return true if the LACP actor state is NONE

is_actor_nosync()[source]

Return true if the LACP actor state is NOSYNC

is_actor_up()[source]

Return true if the LACP actor state is UP

is_port_selected()[source]

Return true if the lacp is a SELECTED port

is_port_standby()[source]

Return true if the lacp is a port in STANDBY

is_port_unselected()[source]

Return true if the lacp is an UNSELECTED port

is_stack_admin_down()[source]

Return True if port is in ADMIN_DOWN state.

is_stack_bad()[source]

Return True if port is in BAD state.

is_stack_gone()[source]

Return True if port is in GONE state.

is_stack_init()[source]

Return True if port is in INIT state.

is_stack_none()[source]

Return True if port is in NONE state.

is_stack_up()[source]

Return True if port is in UP state.

lacp_actor_update(lacp_up, now=None, lacp_pkt=None, cold_start=False)[source]

Update the LACP actor state :param lacp_up: The intended LACP/port state :type lacp_up: bool :param now: Current time :type now: float :param lacp_pkt: Received LACP packet :type lacp_pkt: PacketMeta :param cold_start: Whether the port is being cold started :type cold_start: bool

Returns:

current LACP actor state

lacp_port_state()[source]

Return the current LACP port state

lacp_port_update(selected, cold_start=False)[source]

Updates the LACP port selection state :param selected: Whether the port’s DPID is the selected one :type selected: bool :param cold_start: Whether the port is being cold started :type cold_start: bool

Returns

current lacp port state

lldp_beacon_defaults_types = {'enable': <class 'bool'>, 'org_tlvs': <class 'list'>, 'port_descr': <class 'str'>, 'system_name': <class 'str'>}
lldp_beacon_enabled()[source]

Return True if LLDP beacon enabled on this port.

lldp_org_tlv_defaults_types = {'info': (<class 'str'>, <class 'bytearray'>), 'oui': (<class 'int'>, <class 'bytearray'>), 'subtype': (<class 'int'>, <class 'bytearray'>)}
mirror_actions()[source]

Return OF actions to mirror this port.

non_stack_forwarding()[source]

Returns True if port is not-stacking and, and able to forward packets.

static port_role_name(state)[source]

Return the LACP port role state name

running()[source]

Return True if port enabled and up.

select_port()[source]

SELECT the current LACP port

set_defaults()[source]

Set default values and run any basic sanity checks.

stack_admin_down()[source]

Change the current stack state to ADMIN_DOWN.

stack_bad()[source]

Change the current stack state to BAD.

stack_defaults_types = {'dp': <class 'str'>, 'port': (<class 'str'>, <class 'int'>)}
stack_descr()[source]

Return stacking annotation if this is a stacking port.

stack_gone()[source]

Change the current stack state to GONE.

stack_init()[source]

Change the current stack state to INIT_DOWN.

stack_port_update(now)[source]

Progesses through the stack link state machine

Parameters:

now (float) – Current time

Returns:

Current (new) stack port state string: reason for the state change and additional information

Return type:

int

stack_state()[source]

Return the current port stack state

static stack_state_name(state)[source]

Return stack state name

stack_up()[source]

Change the current stack state to UP.

standby_port()[source]

Set LACP port state to STANDBY

tunnel_acls()[source]

Return any tunnel ACLs on this port.

vlans()[source]

Return all VLANs this port is in.