fib

System Forwarding Information Base (FIB) management

The FIB represents the system forwarding tables. In this way, it is generally the result of the programming of any routing agents in the system including static and dynamic routing protocols.

This module allows for direct manipulation of the FIB, as well as a means of reacting to the contents of the table as well as perform queries.

namespace eos
class fib_route_iter_t : public eos::iter_base<fib_route_t, fib_route_iter_impl>

Private Functions

explicit fib_route_iter_t(fib_route_iter_impl*const)

Friends

friend class fib_route_iter_impl
class fib_fec_iter_t : public eos::iter_base<fib_fec_t, fib_fec_iter_impl>

Private Functions

explicit fib_fec_iter_t(fib_fec_iter_impl*const)

Friends

friend class fib_fec_iter_impl
class fib_handler : public eos::base_handler<fib_mgr, fib_handler>
#include <fib.h>

This class receives changes route/fec collection.

Public Functions

explicit fib_handler(fib_mgr*)
inline fib_mgr *get_fib_mgr() const
virtual void on_route_set(fib_route_t const&)

Handler called when a route gets added or updated.

virtual void on_route_del(fib_route_key_t const&)

Handler called when a route gets deleted.

virtual void on_fec_set(fib_fec_t const&)

Handler called when a FEC gets added or updated.

virtual void on_fec_del(fib_fec_key_t const&)

Handler called when a FEC gets deleted.

class fib_mgr : public eos::base_mgr<fib_handler>
#include <fib.h>

The FIB Manager.

Public Functions

virtual ~fib_mgr()
virtual void set_routeinit_task(int const) = 0
virtual void set_route6init_task(int const) = 0
virtual void set_fecinit_task(int const) = 0
virtual void set_fec6init_task(int const) = 0
virtual void set_fecGeninit_task(int const) = 0
virtual fib_route_iter_t fib_route_iter() const = 0
virtual fib_fec_iter_t fib_fec_iter() const = 0
virtual bool fib_fec_set(fib_fec_t const&) = 0
virtual void fib_fec_del(fib_fec_key_t const&) = 0
virtual bool fib_fec_exists(fib_fec_key_t const&) = 0
virtual fib_fec_t fib_fec(fib_fec_key_t const&) = 0
virtual bool fib_route_set(fib_route_t const&) = 0
virtual void fib_route_del(fib_route_key_t const&) = 0
virtual bool fib_route_exists(fib_route_key_t const&) = 0
virtual fib_route_t fib_route(fib_route_key_t const&) = 0
virtual bool register_vrf(std::string const&, bool) = 0
virtual mgr_mode_type_t mode_type() = 0

Returns the mode this manager is in. This mode is set during the construction of the manager, i.e.: sdk.get_fib_mgr(MODE_TYPE_READ_NOTIFYING). If MODE_TYPE_READ_ONLY, only the getters and iterators of this manager will function.

Protected Functions

fib_mgr()

Private Members

fib_mgr

Friends

friend class fib_handler

Type definitions in fib

namespace eos

Enums

enum fib_route_type_t

Enums for host routes and FIB routes.

Values:

enumerator ROUTE_TYPE_INVALID
enumerator ROUTE_TYPE_RECEIVE

Host routes.

enumerator ROUTE_TYPE_RECEIVE_BCAST
enumerator ROUTE_TYPE_ATTACHED
enumerator ROUTE_TYPE_UNKNOWN

Unknows routing protocol.

enumerator ROUTE_TYPE_STATIC_CONFIG

FIB routes.

enumerator ROUTE_TYPE_KERNEL
enumerator ROUTE_TYPE_RIP
enumerator ROUTE_TYPE_CONNECTED
enumerator ROUTE_TYPE_REDIRECT
enumerator ROUTE_TYPE_BGP_AGGREGATE
enumerator ROUTE_TYPE_OSPF_AGGREGATE
enumerator ROUTE_TYPE_OSPF_INTRA_AREA
enumerator ROUTE_TYPE_OSPF_INTER_AREA
enumerator ROUTE_TYPE_OSPF_EXTERNAL_TYPE1
enumerator ROUTE_TYPE_OSPF_EXTERNAL_TYPE2
enumerator ROUTE_TYPE_OSPF_NSSA_EXTERNAL_TYPE1
enumerator ROUTE_TYPE_OSPF_NSSA_EXTERNAL_TYPE2
enumerator ROUTE_TYPE_BGP
enumerator ROUTE_TYPE_IBGP
enumerator ROUTE_TYPE_EBGP
enumerator ROUTE_TYPE_LBGP
enumerator ROUTE_TYPE_ISIS

Unused in EOS 4.15.1, use ROUTE_TYPE_ISIS_LEVEL1/2 instead.

enumerator ROUTE_TYPE_ISIS_LEVEL1
enumerator ROUTE_TYPE_ISIS_LEVEL2
enumerator ROUTE_TYPE_NEXTHOP_GROUP
enumerator ROUTE_TYPE_OSPF3
enum fib_fec_type_t

Values:

enumerator FEC_TYPE_FORWARD
enumerator FEC_TYPE_DROP
enumerator FEC_TYPE_RECEIVE
enumerator FEC_TYPE_ATTACHED
enumerator FEC_TYPE_RECEIVE_BCAST
enumerator FEC_TYPE_NEXTHOP_GROUP
enumerator FEC_TYPE_KERNEL
enumerator FEC_TYPE_UNKNOWN
class fib_route_key_t
#include <fib.h>

An IP route key that goes in FIB.

Public Functions

fib_route_key_t()
explicit fib_route_key_t(ip_prefix_t const &prefix)
fib_route_key_t(const fib_route_key_t &other)
fib_route_key_t &operator=(fib_route_key_t const &other)
fib_route_key_t(fib_route_key_t &&other) noexcept
fib_route_key_t &operator=(fib_route_key_t &&other) noexcept
ip_prefix_t prefix() const

Getter for ‘prefix’: IP v4/v6 network prefix.

void prefix_is(ip_prefix_t const &prefix)

Setter for ‘prefix’.

void prefix_is(ip_prefix_t &&prefix)

Moving Setter for ‘prefix’.

bool operator==(fib_route_key_t const &other) const
bool operator!=(fib_route_key_t const &other) const
uint32_t hash() const

The hash function for type fib_route_key_t.

void mix_me(hash_mix &h) const

The hash mix function for type fib_route_key_t.

std::string to_string() const

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

Public Static Functions

static inline void *operator new(std::size_t, void *ptr)
static void *operator new(std::size_t)
static void operator delete(void*) noexcept

Private Members

std::shared_ptr<fib_route_key_impl_t> pimpl

Friends

friend std::ostream &operator<<(std::ostream &os, const fib_route_key_t &obj)

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

class fib_route_t
#include <fib.h>

An IP route that goes in FIB. The “fec_id” represents the fec a.k.a adjacency associated with the route. Note FEC stands for Forwarding Equivalence Class.

Public Functions

fib_route_t()
explicit fib_route_t(fib_route_key_t const &route_key)
fib_route_t(const fib_route_t &other)
fib_route_t &operator=(fib_route_t const &other)
fib_route_t(fib_route_t &&other) noexcept
fib_route_t &operator=(fib_route_t &&other) noexcept
fib_route_key_t route_key() const

Getter for ‘route_key’: IP v4/v6 network route key consisting of prefix.

void route_key_is(fib_route_key_t const &route_key)

Setter for ‘route_key’.

void route_key_is(fib_route_key_t &&route_key)

Moving Setter for ‘route_key’.

ip_route_preference_t preference() const

Getter for ‘preference’: 0..255 only, defaults to 1.

void preference_is(ip_route_preference_t preference)

Setter for ‘preference’.

ip_route_metric_t metric() const
void metric_is(ip_route_metric_t metric)
fib_route_type_t route_type() const
void route_type_is(fib_route_type_t route_type)
uint64_t fec_id() const

Getter for ‘fec_id’: id that links prefix to the fec a.k.a Adjacency.

void fec_id_is(uint64_t fec_id)

Setter for ‘fec_id’.

bool operator==(fib_route_t const &other) const
bool operator!=(fib_route_t const &other) const
uint32_t hash() const

The hash function for type fib_route_t.

void mix_me(hash_mix &h) const

The hash mix function for type fib_route_t.

std::string to_string() const

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

Public Static Functions

static inline void *operator new(std::size_t, void *ptr)
static void *operator new(std::size_t)
static void operator delete(void*) noexcept

Private Members

std::shared_ptr<fib_route_impl_t> pimpl

Friends

friend std::ostream &operator<<(std::ostream &os, const fib_route_t &obj)

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

class fib_fec_key_t
#include <fib.h>

FEC key that goes in FIB.

Public Functions

fib_fec_key_t()
explicit fib_fec_key_t(uint64_t fec_id)
fib_fec_key_t(const fib_fec_key_t &other)
fib_fec_key_t &operator=(fib_fec_key_t const &other)
fib_fec_key_t(fib_fec_key_t &&other) noexcept
fib_fec_key_t &operator=(fib_fec_key_t &&other) noexcept
uint64_t fec_id() const

Getter for ‘fec_id’: fec_id[56:63] denotes the feature, 0: fib Fec, 1: resilientEcmp feature, 2: nextHopGroup feature.

void fec_id_is(uint64_t fec_id)

Setter for ‘fec_id’.

bool operator==(fib_fec_key_t const &other) const
bool operator!=(fib_fec_key_t const &other) const
uint32_t hash() const

The hash function for type fib_fec_key_t.

void mix_me(hash_mix &h) const

The hash mix function for type fib_fec_key_t.

std::string to_string() const

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

Public Static Functions

static inline void *operator new(std::size_t, void *ptr)
static void *operator new(std::size_t)
static void operator delete(void*) noexcept

Private Members

std::shared_ptr<fib_fec_key_impl_t> pimpl

Friends

friend std::ostream &operator<<(std::ostream &os, const fib_fec_key_t &obj)

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

class fib_via_t
#include <fib.h>

via (nexthop) information.

Public Functions

fib_via_t()
fib_via_t(ip_addr_t const &hop, intf_id_t intf)
fib_via_t(const fib_via_t &other)
fib_via_t &operator=(fib_via_t const &other)
fib_via_t(fib_via_t &&other) noexcept
fib_via_t &operator=(fib_via_t &&other) noexcept
ip_addr_t hop() const
void hop_is(ip_addr_t const &hop)
void hop_is(ip_addr_t &&hop)
intf_id_t intf() const
void intf_is(intf_id_t intf)
mpls_label_t mpls_label() const
void mpls_label_is(mpls_label_t mpls_label)
bool operator==(fib_via_t const &other) const
bool operator!=(fib_via_t const &other) const
uint32_t hash() const

The hash function for type fib_via_t.

void mix_me(hash_mix &h) const

The hash mix function for type fib_via_t.

std::string to_string() const

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

Public Static Functions

static inline void *operator new(std::size_t, void *ptr)
static void *operator new(std::size_t)
static void operator delete(void*) noexcept

Private Members

std::shared_ptr<fib_via_impl_t> pimpl

Friends

friend std::ostream &operator<<(std::ostream &os, const fib_via_t &obj)

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

class fib_fec_t
#include <fib.h>

FEC (Forwarding Equivalence Class), consists of collection (one or more) vias.

Public Functions

fib_fec_t()
explicit fib_fec_t(fib_fec_key_t fec_key)
fib_fec_t(const fib_fec_t &other)
fib_fec_t &operator=(fib_fec_t const &other)
fib_fec_t(fib_fec_t &&other) noexcept
fib_fec_t &operator=(fib_fec_t &&other) noexcept
fib_fec_key_t fec_key() const

Getter for ‘fec_key’: fec_key consisting of fec_id.

void fec_key_is(fib_fec_key_t fec_key)

Setter for ‘fec_key’.

fib_fec_type_t fec_type() const
void fec_type_is(fib_fec_type_t fec_type)
std::string nexthop_group_name() const

Getter for ‘nexthop_group_name’: Name of the nexthop group, in case fec_type is FEC_TYPE_NEXTHOP_GROUP.

void nexthop_group_name_is(std::string nexthop_group_name)

Setter for ‘nexthop_group_name’.

std::forward_list<fib_via_t> const &via() const

Getter for ‘via’: A list of vias that traffic will be distributed amongst. Duplicate vias will be weighted heavily.

void via_is(std::forward_list<fib_via_t> const &via)

Setter for ‘via’.

void via_is(std::forward_list<fib_via_t> &&via)

Moving Setter for ‘via’.

void via_set(fib_via_t const &via)

Prepend one via to the list.

void via_set(fib_via_t &&via)

Prepend one via to the list.

void via_del(fib_via_t const &via)

Remove all matching via elements.

uint32_t hash() const

The hash function for type fib_fec_t.

void mix_me(hash_mix &h) const

The hash mix function for type fib_fec_t.

std::string to_string() const

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

Public Static Functions

static inline void *operator new(std::size_t, void *ptr)
static void *operator new(std::size_t)
static void operator delete(void*) noexcept

Private Members

std::shared_ptr<fib_fec_impl_t> pimpl

Friends

friend std::ostream &operator<<(std::ostream &os, const fib_fec_t &obj)

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