mpls_route¶
-
namespace
eos
-
class
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
-
mpls_route_handler
(mpls_route_mgr * mgr)
-
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.
-
-
class
mpls_route_iter_t
- #include <mpls_route.h>
An iterator over configured MPLS routes.
Private Functions
-
mpls_route_iter_t
(mpls_route_iter_impl * const)
Friends
-
friend class
mpls_route_iter_impl
-
-
class
mpls_route_via_iter_t
- #include <mpls_route.h>
An iterator over configured MPLS route vias.
Private Functions
-
mpls_route_via_iter_t
(mpls_route_via_iter_impl * const)
Friends
-
friend class
mpls_route_via_iter_impl
-
-
class
mpls_route_status_iter_t
- #include <mpls_route.h>
An iterator over MPLS routes in hardware.
Private Functions
-
mpls_route_status_iter_t
(mpls_route_status_iter_impl * const)
Friends
-
friend class
mpls_route_status_iter_impl
-
-
class
mpls_route_via_status_iter_t
- #include <mpls_route.h>
An iterator over MPLS route vias in hardware.
Private Functions
-
mpls_route_via_status_iter_t
(mpls_route_via_status_iter_impl * const)
Friends
-
friend class
mpls_route_via_status_iter_impl
-
-
class
mpls_route_mgr
- #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).
-
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.
-
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)
-
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
label_set
(uint32_t index, mpls_label_t const & 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.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< mpls_route_key_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
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.
-
mpls_route_t
(mpls_route_key_t key) MPLS route constructor taking an MPLS route key.
-
mpls_route_t
(const mpls_route_t & other)
-
mpls_route_t &
operator=
(mpls_route_t const & other)
-
mpls_route_key_t
key
() const Getter for ‘key’: the MPLS route key.
-
void
key_is
(mpls_route_key_t key) Setter for ‘key’.
-
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.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< mpls_route_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
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
()
-
mpls_route_via_t
(mpls_route_key_t route_key)
-
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_key_t
route_key
() const
-
void
route_key_is
(mpls_route_key_t route_key)
-
ip_addr_t
hop
() const Getter for ‘hop’: IP v4/v6 nexthop address (for decap and IP forward).
-
void
hop_is
(ip_addr_t const & hop) Setter for ‘hop’.
-
intf_id_t
intf
() const Getter for ‘intf’: sets the nexthop interface. Use the named interface if not a default intf_id_t.
-
void
intf_is
(intf_id_t const & intf) Setter for ‘intf’.
-
mpls_label_t
pushswap_label
() const Getter for ‘pushswap_label’: push or swap this label.
-
void
pushswap_label_is
(mpls_label_t pushswap_label) Setter for ‘pushswap_label’.
-
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.
-
void
nexthop_group_is
(std::string nexthop_group) Setter for ‘nexthop_group’.
-
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.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< mpls_route_via_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
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
()
-
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)
-
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.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< mpls_fec_id_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
A utility stream operator that adds a string representation of mpls_fec_id_t to the ostream.
-
-
typedef uint8_t