mpls_route¶
-
namespace
eos
-
class
mpls_route_handler
: public eos::base_handler<mpls_route_mgr, mpls_route_handler>¶ - #include <mpls_route.h>
The MPLS route handler.
This class provides handler APIs to react to a MPLS route’s addition/deletion in the hardware.
Public Functions
-
explicit
mpls_route_handler
(mpls_route_mgr *mgr)¶
-
inline mpls_route_mgr *
get_mpls_route_mgr
() const¶
-
void
watch_all_mpls_routes
(bool)¶ Register to receive a notification when any MPLS route in the hardware gets deleted or added.
-
void
watch_mpls_route
(mpls_label_t const &label, bool)¶ Legacy method to register to receive a notification when a particular single-label MPLS route with the given label is added to or removed from hardware.
-
void
watch_mpls_route
(mpls_route_key_t const &route_key, bool)¶ Register to receive a notification when a particular MPLS route with the given label stack is added to or removed from hardware.
-
virtual void
on_mpls_route_set
(mpls_label_t label, mpls_fec_id_t fec)¶ Legacy handler for when a single-label MPLS route is to be programmed into hardware or when it is assigned a new FEC ID. Note: Only one of the on_mpls_route_set methods should be implemented.
-
virtual void
on_mpls_route_set
(mpls_route_key_t const &route_key, mpls_fec_id_t fec)¶ Handler when an MPLS route is to be programmed into hardware or when it is assigned a new FEC ID. Note: Only one of the on_mpls_route_set methods should be implemented.
-
virtual void
on_mpls_route_del
(mpls_label_t label)¶ Legacy handler for when a single-label MPLS route is deleted from hardware. Note: Only one of the on_mpls_route_del methods should be implemented.
-
virtual void
on_mpls_route_del
(mpls_route_key_t const &route_key)¶ Handler when an MPLS route is deleted from hardware. Note: Only one of the on_mpls_route_del methods should be implemented.
-
virtual void
on_mpls_fec_set
(mpls_fec_id_t fec)¶ Handler that describes when an MPLS FEC is created or updated in hardware. This FEC represents a set of vias that one or more routes points to.
-
virtual void
on_mpls_fec_del
(mpls_fec_id_t fec)¶ Handler called when an MPLS FEC is removed.
-
explicit
-
class
mpls_route_iter_t
: public eos::iter_base<mpls_route_t, mpls_route_iter_impl>¶ - #include <mpls_route.h>
An iterator over configured MPLS routes.
Private Functions
-
explicit
mpls_route_iter_t
(mpls_route_iter_impl*const)¶
Friends
- friend class mpls_route_iter_impl
-
explicit
-
class
mpls_route_via_iter_t
: public eos::iter_base<mpls_route_via_t, mpls_route_via_iter_impl>¶ - #include <mpls_route.h>
An iterator over configured MPLS route vias.
Private Functions
-
explicit
mpls_route_via_iter_t
(mpls_route_via_iter_impl*const)¶
Friends
- friend class mpls_route_via_iter_impl
-
explicit
-
class
mpls_route_status_iter_t
: public eos::iter_base<mpls_route_key_t, mpls_route_status_iter_impl>¶ - #include <mpls_route.h>
An iterator over MPLS routes in hardware.
Private Functions
-
explicit
mpls_route_status_iter_t
(mpls_route_status_iter_impl*const)¶
Friends
- friend class mpls_route_status_iter_impl
-
explicit
-
class
mpls_route_via_status_iter_t
: public eos::iter_base<mpls_route_via_t, mpls_route_via_status_iter_impl>¶ - #include <mpls_route.h>
An iterator over MPLS route vias in hardware.
Private Functions
-
explicit
mpls_route_via_status_iter_t
(mpls_route_via_status_iter_impl*const)¶
Friends
- friend class mpls_route_via_status_iter_impl
-
explicit
-
class
mpls_route_mgr
: public eos::base_mgr<mpls_route_handler, mpls_route_key_t>¶ - #include <mpls_route.h>
The IP static route manager.
Public Functions
-
virtual
~mpls_route_mgr
()¶
-
virtual void
resync_init
() = 0¶ Begin resync mode.
-
virtual void
resync_complete
() = 0¶ Complete resync mode, ready for regular updates.
-
virtual mpls_route_iter_t
mpls_route_iter
() const = 0¶ Returns an iterator over configured MPLS routes.
-
virtual mpls_route_status_iter_t
mpls_route_status_iter
() const = 0¶ Returns an iterator for MPLS routes in hardware.
-
virtual mpls_route_via_iter_t
mpls_route_via_iter
(mpls_route_key_t const&) const = 0¶ Returns a configured MPLS vias iterator for a given route (key).
-
mpls_route_via_iter_t
mpls_route_backup_via_iter
(mpls_route_key_t const&)¶ Returns a configured MPLS backup vias iterator for a given route (key).
-
virtual mpls_route_via_status_iter_t
mpls_route_via_status_iter
(mpls_label_t const) const = 0¶ Legacy method that returns an iterator for MPLS vias in hardware for a given label.
-
virtual mpls_route_via_status_iter_t
mpls_route_via_status_iter
(mpls_route_key_t const&) const = 0¶ Returns an iterator for MPLS vias in hardware for a given route key.
-
virtual mpls_route_via_status_iter_t
mpls_route_via_status_iter
(mpls_fec_id_t) const = 0¶ Returns an iterator for MPLS vias in hardware for a given MPLS FEC. The vias returned from this iterator are unbound, meaning they have an empty mpls_route_key_t.
-
virtual bool
exists
(mpls_route_key_t const&) const = 0¶ Tests for existence of any routes matching the route key in the switch config.
-
virtual bool
exists
(mpls_route_via_t const&) const = 0¶ Tests if the given via exists in the switch config.
-
virtual void
mpls_route_set
(mpls_route_t const&) = 0¶ MPLS route management functions.
Inserts or updates MPLS static route in the switch configuration
-
virtual void
mpls_route_del
(mpls_route_key_t const&) = 0¶ Removes the MPLS route and all vias matching the route key.
-
virtual void
mpls_route_via_set
(mpls_route_via_t const&) = 0¶ Adds a via to an mpls_route_t.
-
virtual void
mpls_route_via_del
(mpls_route_via_t const&) = 0¶ Removes a via from an mpls_route_t. When all vias are removed, the route still exists with no nexthop information.
-
void
mpls_route_backup_via_set
(mpls_route_via_t const&)¶ Adds a backup via to an mpls_route_t.
-
void
mpls_route_backup_via_del
(mpls_route_via_t const&)¶ Removes a backup via from an mpls_route_t.
-
virtual mpls_fec_id_t
fec_id
(mpls_label_t) const = 0¶ Legacy method that returns the FEC ID corresponding to the given MPLS label if this route is programmed in hardware, or an empty mpls_fec_id_t otherwise.
-
virtual mpls_fec_id_t
fec_id
(mpls_route_key_t const&) const = 0¶ Returns the FEC ID corresponding to the given MPLS route key if this route is programmed in hardware, or an empty mpls_fec_id_t otherwise. Note: The metric value in the route key is not used
-
virtual mpls_route_metric_t
metric
(mpls_label_t) const = 0¶ Legacy method that returns the active metric that is being used in hardware to forward traffic for the given label, or 0 if the label does not have any active vias programmed.
-
virtual mpls_route_metric_t
metric
(mpls_route_key_t const&) const = 0¶ Returns the active metric that is being used in hardware to forward traffic for the given MPLS route key, or 0 if the route key does not have any active vias programmed. Note: The metric value in the route key is not used
Protected Functions
-
mpls_route_mgr
()¶
Private Members
-
mpls_route_mgr
Friends
- friend class mpls_route_handler
-
virtual
-
class
Type definitions in mpls_route¶
-
namespace
eos
Typedefs
-
typedef uint8_t
mpls_route_metric_t
¶ 1..255; default/null is 0.
-
class
mpls_route_key_t
¶ - #include <mpls_route.h>
An MPLS route key is used for MPLS RIB configuration.
Public Functions
-
mpls_route_key_t
()¶
-
mpls_route_key_t
(mpls_label_t top_label, mpls_route_metric_t metric)¶ Constructor taking an ingress MPLS route label and a metric.
- Parameters
mpls_label_t – The MPLS label to match on ingress for this route.
mpls_route_metric_t – A metric value between 0 and 255. If it is set to 0, the routing agent will assume a default metric value of 100.
-
mpls_route_key_t
(std::vector<mpls_label_t> const &labels, mpls_route_metric_t metric)¶ Constructor taking a list of ingress MPLS route labels and a metric.
- Parameters
const – std::vector<mpls_label_t> The MPLS labels to match on ingress for this route.
mpls_route_metric_t – A metric value between 0 and 255. If it is set to 0, the routing agent will assume a default metric value of 100.
-
mpls_route_key_t
(const mpls_route_key_t &other)¶
-
mpls_route_key_t &
operator=
(mpls_route_key_t const &other)¶
-
mpls_route_key_t
(mpls_route_key_t &&other) noexcept¶
-
mpls_route_key_t &
operator=
(mpls_route_key_t &&other) noexcept¶
-
std::vector<mpls_label_t> const &
labels
() const¶ Getter for ‘labels’: a list of labels ( [ TOP, …, BOT ] ) to match on ingress route lookup. 0 is the null metric; valid MPLS routes must have a metric in range 1..255.
-
void
labels_is
(std::vector<mpls_label_t> const &labels)¶ Setter for ‘labels’.
-
void
labels_is
(std::vector<mpls_label_t> &&labels)¶ Moving Setter for ‘labels’.
-
void
label_set
(uint32_t index, mpls_label_t const &value)¶
-
void
label_set
(uint32_t index, mpls_label_t &&value)¶
-
void
label_del
(uint32_t index)¶
-
mpls_route_metric_t
metric
() const¶ Getter for ‘metric’: the MPLS route metric. Lower metric routes are preferred.
-
void
metric_is
(mpls_route_metric_t metric)¶ Setter for ‘metric’.
-
mpls_label_t
top_label
() const¶ Getter for the label to match on ingress route lookup. This API exists for legacy reasons, from when only one label could be matched.
-
void
top_label_is
(mpls_label_t top_label)¶ Replaces the label stack with a new vector only containing the given top_label.
-
bool
operator==
(mpls_route_key_t const &other) const¶
-
bool
operator!=
(mpls_route_key_t const &other) const¶
-
bool
operator<
(mpls_route_key_t const &other) const¶
-
uint32_t
hash
() const¶ The hash function for type mpls_route_key_t.
-
void
mix_me
(hash_mix &h) const¶ The hash mix function for type mpls_route_key_t.
Public Static Functions
-
static void
operator delete
(void*) noexcept¶
Friends
-
friend std::ostream &
operator<<
(std::ostream &os, const mpls_route_key_t &obj)¶ A utility stream operator that adds a string representation of mpls_route_key_t to the ostream.
-
-
class
mpls_route_t
¶ - #include <mpls_route.h>
An MPLS v4/v6 static route.
Public Functions
-
mpls_route_t
()¶ Default value constructor.
-
explicit
mpls_route_t
(mpls_route_key_t key)¶ MPLS route constructor taking an MPLS route key.
-
explicit
mpls_route_t
(mpls_route_key_t key, uint32_t version_id)¶ MPLS route constructor taking an MPLS route key and a version.
-
mpls_route_t
(const mpls_route_t &other)¶
-
mpls_route_t &
operator=
(mpls_route_t const &other)¶
-
mpls_route_t
(mpls_route_t &&other) noexcept¶
-
mpls_route_t &
operator=
(mpls_route_t &&other) noexcept¶
-
mpls_route_key_t
key
() const¶ Getter for ‘key’: the MPLS route key.
-
void
key_is
(mpls_route_key_t key)¶ Setter for ‘key’.
-
uint32_t
version_id
() const¶ Getter for ‘version_id’: the MPLS route version.
-
void
version_id_is
(uint32_t version_id)¶ Setter for ‘version_id’.
-
bool
operator==
(mpls_route_t const &other) const¶
-
bool
operator!=
(mpls_route_t const &other) const¶
-
uint32_t
hash
() const¶ The hash function for type mpls_route_t.
-
void
mix_me
(hash_mix &h) const¶ The hash mix function for type mpls_route_t.
Public Static Functions
-
static void
operator delete
(void*) noexcept¶
Friends
-
friend std::ostream &
operator<<
(std::ostream &os, const mpls_route_t &obj)¶ A utility stream operator that adds a string representation of mpls_route_t to the ostream.
-
-
class
mpls_route_via_t
¶ - #include <mpls_route.h>
An MPLS route via, defining the action to take for a given MPLS route.
Public Functions
-
mpls_route_via_t
()¶
-
explicit
mpls_route_via_t
(mpls_route_key_t route_key)¶
-
explicit
mpls_route_via_t
(mpls_route_key_t route_key, mpls_action_t label_action)¶
-
mpls_route_via_t
(const mpls_route_via_t &other)¶
-
mpls_route_via_t &
operator=
(mpls_route_via_t const &other)¶
-
mpls_route_via_t
(mpls_route_via_t &&other) noexcept¶
-
mpls_route_via_t &
operator=
(mpls_route_via_t &&other) noexcept¶
-
mpls_route_key_t
route_key
() const¶
-
void
route_key_is
(mpls_route_key_t route_key)¶
-
intf_id_t
intf
() const¶ Getter for ‘intf’: sets the nexthop interface. Use the named interface if not a default intf_id_t.
-
mpls_label_t
pushswap_label
() const¶ Getter for “pushswap_label”: deprecated in favor of “pushswap_label_stack”.
-
void
pushswap_label_is
(mpls_label_t top_label)¶ Setter for “pushswap_label”: Deprecated in favor of “pushswap_label_stack”.
-
mpls_action_t
label_action
() const¶ Getter for ‘label_action’: perform this MPLS operation.
-
void
label_action_is
(mpls_action_t label_action)¶ Setter for ‘label_action’.
-
mpls_ttl_mode_t
ttl_mode
() const¶ Getter for ‘ttl_mode’: applies to push and pop.
-
void
ttl_mode_is
(mpls_ttl_mode_t ttl_mode)¶ Setter for ‘ttl_mode’.
-
mpls_payload_type_t
payload_type
() const¶ Getter for ‘payload_type’: used to assign ethertype after final pop.
-
void
payload_type_is
(mpls_payload_type_t payload_type)¶ Setter for ‘payload_type’.
-
bool
skip_egress_acl
() const¶ Getter for ‘skip_egress_acl’: set if matching packets should ignore the egress ACL.
-
void
skip_egress_acl_is
(bool skip_egress_acl)¶ Setter for ‘skip_egress_acl’.
-
std::string
nexthop_group
() const¶ Getter for ‘nexthop_group’: set when packets are forwarded into a nexthop- group.
-
uint32_t
weight
() const¶ Getter for ‘weight’: the weight for this via.
-
void
weight_is
(uint32_t weight)¶ Setter for ‘weight’.
-
std::forward_list<mpls_label_t> const &
pushswap_label_stack
() const¶ Getter for ‘pushswap_label_stack’: push or swap this label stack.
-
void
pushswap_label_stack_is
(std::forward_list<mpls_label_t> const &pushswap_label_stack)¶ Setter for ‘pushswap_label_stack’.
-
void
pushswap_label_stack_is
(std::forward_list<mpls_label_t> &&pushswap_label_stack)¶ Moving Setter for ‘pushswap_label_stack’.
-
void
pushswap_label_stack_set
(mpls_label_t const &pushswap_label_stack)¶ Prepend one pushswap_label_stack to the list.
-
void
pushswap_label_stack_set
(mpls_label_t &&pushswap_label_stack)¶ Prepend one pushswap_label_stack to the list.
-
void
pushswap_label_stack_del
(mpls_label_t const &pushswap_label_stack)¶ Remove all matching pushswap_label_stack elements.
-
bool
operator==
(mpls_route_via_t const &other) const¶
-
bool
operator!=
(mpls_route_via_t const &other) const¶
-
uint32_t
hash
() const¶ The hash function for type mpls_route_via_t.
-
void
mix_me
(hash_mix &h) const¶ The hash mix function for type mpls_route_via_t.
Public Static Functions
-
static void
operator delete
(void*) noexcept¶
Friends
-
friend std::ostream &
operator<<
(std::ostream &os, const mpls_route_via_t &obj)¶ A utility stream operator that adds a string representation of mpls_route_via_t to the ostream.
-
-
class
mpls_fec_id_t
¶ - #include <mpls_route.h>
Represents a forward equivalency class (FEC) for an MPLS route. One or more routes points to a FEC, and the FEC corresponds to a set of MPLS vias that are programmed into hardware.
Public Functions
-
mpls_fec_id_t
()¶
-
explicit
mpls_fec_id_t
(uint64_t id)¶
-
mpls_fec_id_t
(const mpls_fec_id_t &other)¶
-
mpls_fec_id_t &
operator=
(mpls_fec_id_t const &other)¶
-
mpls_fec_id_t
(mpls_fec_id_t &&other) noexcept¶
-
mpls_fec_id_t &
operator=
(mpls_fec_id_t &&other) noexcept¶
-
uint64_t
id
() const¶ Getter for ‘id’: the internal ID of this FEC. A value of 0 denotes that the FEC ID is not set.
-
void
id_is
(uint64_t id)¶ Setter for ‘id’.
-
bool
operator==
(mpls_fec_id_t const &other) const¶
-
bool
operator!=
(mpls_fec_id_t const &other) const¶
-
bool
operator<
(mpls_fec_id_t const &other) const¶
-
uint32_t
hash
() const¶ The hash function for type mpls_fec_id_t.
-
void
mix_me
(hash_mix &h) const¶ The hash mix function for type mpls_fec_id_t.
Public Static Functions
-
static void
operator delete
(void*) noexcept¶
Friends
-
friend std::ostream &
operator<<
(std::ostream &os, const mpls_fec_id_t &obj)¶ A utility stream operator that adds a string representation of mpls_fec_id_t to the ostream.
-
-
typedef uint8_t