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 notification when any MPLS route in the hardware gets deleted or added.

void watch_mpls_route(mpls_label_t const & label, bool)

Register to receive notification when a particular MPLS route is added to or removed from hardware.

virtual void on_mpls_route_set(mpls_label_t label, mpls_fec_id_t fec)

Handler when a MPLS route is to be programmed into hardware or when it is assigned a new FEC ID.

virtual void on_mpls_route_del(mpls_label_t label)

Handler when a MPLS route is deleted from hardware.

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

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

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_route_metric_t metric(mpls_label_t) const = 0

Given an MPLS label, this method returns the active metric that is being used in hardware to forward traffic, or 0 if the given label does not have any active vias programmed.

Protected Functions

mpls_route_mgr()

Private Members

mpls_route_mgr

Friends

friend class mpls_route_handler

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_label_t top_label() const

Getter for ‘top_label’: the label to match on ingress route lookup. 0 is the null metric; valid MPLS routes must have a metric in range 1..255.

void top_label_is(mpls_label_t top_label)

Setter for ‘top_label’.

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’.

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.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

mpls_label_t top_label_
mpls_route_metric_t metric_

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_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.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

mpls_route_key_t key_

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_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.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

mpls_route_key_t route_key_
ip_addr_t hop_
intf_id_t intf_
mpls_label_t pushswap_label_
mpls_action_t label_action_
mpls_ttl_mode_t ttl_mode_
mpls_payload_type_t payload_type_
bool skip_egress_acl_
std::string nexthop_group_

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)
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.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

uint64_t id_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of mpls_fec_id_t to the ostream.

Table Of Contents

Previous topic

mpls

Next topic

neighbor_table