eth_intf

namespace eos
class eth_intf_handler
#include <eth_intf.h>

Event handler for ethernet interface specific events.

Handles events on ethernet interfaces. Includes physical interfaces and LAGs (port-channels) among other interface types.

Public Functions

eth_intf_handler(eth_intf_mgr *)
eth_intf_mgr * get_eth_intf_mgr() const
void watch_all_eth_intfs(bool)

Registers to receive updates on changes to the interface.

Parameters
  • bool -

    Signifies whether notifications should be propagated to this handler instance or not.

void watch_eth_intf(intf_id_t, bool)

Registers this class to receive change updates on the given interface.

Parameters
  • intf_id_t -

    Signifies which interface to subscribe to.

  • bool -

    Signifies whether notifications should be propagated to this handler instance or not.

virtual void on_eth_intf_create(intf_id_t)

Handler called when an ethernet interface is created.

After on_eth_intf_create is called, the given intf_id is guaranteed to exist (ie eth_intf_mgr::exists will return true). At that point, the intf_id can be used will all methods of the eth_intf_mgr class.

This also means that the intf_id can be used with all other relevant *intf_mgr classes (ie intf_mgr, eth_phy_intf_mgr, eth_lag_intf_mgr, and subintf_mgr as appropriate based on the intf_type).

virtual void on_eth_intf_delete(intf_id_t)

Handler called when an ethernet interface is deleted.

After on_eth_intf_delete is called, the given intf_id is guaranteed to not exist (ie eth_intf_mgr::exists will return false). At that point, the intf_id cannot be used will any methods in the eth_intf_mgr class.

This also means that the intf_id can no longer be used with all other relevant *intf_mgr classes (ie intf_mgr, eth_phy_intf_mgr, eth_lag_intf_mgr, and subintf_mgr as appropriate based on the intf_type).

virtual void on_eth_addr(intf_id_t, eth_addr_t)

Handler called when the mac address of an interface changes

Note that for physical interfaces, the on_eth_addr handler will get called with the default eth_addr_t value when the hardware for that physical interface is removed.

class eth_intf_iter_t
#include <eth_intf.h>

Iterator type for ethernet interfaces.

Private Functions

eth_intf_iter_t(eth_intf_iter_impl * const)

Friends

friend class eth_intf_iter_impl
class eth_intf_mgr
#include <eth_intf.h>

The ethernet interface manager.

Public Functions

virtual ~eth_intf_mgr()
virtual eth_intf_iter_t eth_intf_iter() const = 0
virtual bool exists(intf_id_t) const = 0

Returns whether the given ethernet interface exists.

If exists returns true, then this intf_id_t can be successfully passed into every method of the eth_intf_mgr. If not, then methods of the eth_intf_mgr can throw a no_such_interface_error exception.

The exists method of all *intf_mgr classes that manage a given interface (ie intf_mgr, eth_intf_mgr, eth_phy_intf_mgr, eth_lag_intf_mgr, and/or subintf_mgr) are all guaranteed to return the same result.

virtual eth_addr_t eth_addr(intf_id_t) const = 0

Returns the operational ethernet address of the interface.

virtual eth_addr_t configured_eth_addr(intf_id_t) const = 0

Returns the currently configured ethernet address.

virtual void eth_addr_is(intf_id_t, eth_addr_t) = 0

Configures the ethernet address of the interface

Parameters
  • intf_id_t -

    The interface ID of the interface to change the address of

  • eth_addr_t -

    The address to set

virtual switchport_mode_t switchport_mode(intf_id_t) const = 0

Returns the currently configured mode of operation of a given interface. Note that only Ethernet and Port-Channel interfaces can be switchports, using any other type of interface will lead to a panic.

virtual void switchport_mode_is(intf_id_t, switchport_mode_t) = 0

Configures the mode of operation of a given interface. Note that only Ethernet and Port-Channel interfaces can be switchports, using any other type of interface will lead to a panic.

virtual vlan_id_t default_vlan(intf_id_t) const = 0

Returns the ‘default’ VLAN of a given interface. The ‘default’ VLAN depends on the switchport mode of the interface. If the interface is in access mode, then the access VLAN is returned. If the interface is in tap or trunk mode, then the native VLAN is returned. If no native VLAN is configured, then 0 is returned.

virtual void default_vlan_is(intf_id_t, vlan_id_t) = 0

Configures the ‘default’ VLAN of a given interface. The ‘default’ VLAN depends on the switchport mode of the interface. If the interface is in access mode, then the access VLAN is configured. If the interface is in tap or trunk mode, then the native VLAN is configured.

virtual vlan_set_t trunk_vlans(intf_id_t) const = 0

Returns the set of VLANs trunked on this interface. Note that by default all VLANs are trunked on all interfaces.

virtual void trunk_vlan_set(intf_id_t, vlan_id_t) = 0

Adds a VLAN to the set of allowed VLANs when in trunk mode. If the interface isn’t in trunk mode, then the configuration is changed nevertheless, but the configuration won’t take effect until the interface is switched to trunk mode.

virtual void trunk_vlan_is(intf_id_t, vlan_set_t const & vlans) = 0

Configures the set of allowed VLANs when in trunk mode. If the interface isn’t in trunk mode, then the configuration is changed nevertheless, but the configuration won’t take effect until the interface is switched to trunk mode.

virtual void trunk_vlan_del(intf_id_t, vlan_id_t) = 0

Removes a VLAN to the set of allowed VLANs when in trunk mode. If the interface isn’t in trunk mode, then the configuration is changed nevertheless, but the configuration won’t take effect until the interface is switched to trunk mode.

Protected Functions

eth_intf_mgr()

Private Members

eth_intf_mgr

Friends

friend class eth_intf_handler

Type definitions in eth_intf

namespace eos

Enums

switchport_mode_t enum

The mode of operation of a switch port.

Values:

  • SWITCHPORT_MODE_ACCESS -

    Interface only has access to its access VLAN.

  • SWITCHPORT_MODE_TRUNK -

    Interface is in 802.1q mode (“trunk mode”).

  • SWITCHPORT_MODE_DOT1Q_TUNNEL -

    Interface is in 802.1ad mode (“QinQ mode”).

  • SWITCHPORT_MODE_TAP -

    Interface is in tap mode (“span mode”).

  • SWITCHPORT_MODE_TOOL -

    Interface is a tool port (egress for a tap).

  • SWITCHPORT_MODE_ROUTED -

    Interface is routed (“no switchport”).

Table Of Contents

Previous topic

eth

Next topic

eth_lag_intf