bgp_path

BGP path management module.

Border Gateway Protocol (BGP) is a standardized exterior gateway routing protocol designed to exchange routing and reachability information among autonomous systems (AS). In EOS, BGP follows RFC4271.

This module provides APIs to query BGP paths in the Adj-RIB-In.

An example of the API usage is in examples/BgpPathAgent.cpp.

namespace eos
class bgp_path_iter_t
#include <bgp_path.h>

An iterator that yields an bgp_path_t for each BGP path in Adj-RIB-In.

Private Functions

bgp_path_iter_t(bgp_path_iter_impl * const)

Friends

friend class bgp_path_iter_impl
class bgp_path_mgr
#include <bgp_path.h>

A manager of BGP RIB paths.

Public Functions

virtual ~bgp_path_mgr()
virtual bgp_path_iter_t ipv6_unicast_path_iter(bgp_path_options_t &) const = 0

Returns an iterator over IPv6 Unicast BGP paths in Adj-RIB-In, which contains unprocessed routing information that has been advertised to the local BGP speaker by its peers.

Protected Functions

bgp_path_mgr()

Private Members

bgp_path_mgr

Type definitions in bgp_path

namespace eos

Enums

bgp_receive_route_stage_t enum

The BGP path stage before/after the inbound policies are applied on the route.

Values:

  • BGP_PATH_PRE_POLICY -
  • BGP_PATH_POST_POLICY -
class bgp_path_attr_fields_t
#include <bgp_path.h>

The BGP path option to enable lookup of additional path attributes fields.

Public Functions

bgp_path_attr_fields_t()
bgp_path_attr_fields_t(bool next_hop)

Create BGP path attribute field options.

bool next_hop() const

Getter for ‘next_hop’: true if these path attribute options enable next hop lookup, false otherwise.

void next_hop_is(bool next_hop)

Setter for ‘next_hop’.

bool community_list() const

Getter for ‘community_list’: true if these path attribute options enable community list lookup, false otherwise.

void community_list_is(bool community_list)

Setter for ‘community_list’.

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

The hash function for type bgp_path_attr_fields_t.

std::string to_string() const

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

Private Members

bool next_hop_
bool community_list_

Friends

friend std::ostream & operator<<

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

class bgp_path_options_t
#include <bgp_path.h>

The BGP path lookup options.

Public Functions

bgp_path_options_t()
bgp_path_options_t(bgp_receive_route_stage_t receive_route_stage)

Create BGP path options.

bgp_receive_route_stage_t receive_route_stage() const

Getter for ‘receive_route_stage’: The received routes stage of a path to lookup when retrieving the path entry.

void receive_route_stage_is(bgp_receive_route_stage_t receive_route_stage)

Setter for ‘receive_route_stage’.

bgp_path_attr_fields_t path_attr_fields() const

Getter for ‘path_attr_fields’: The additional path attributes to populate when retrieving the path entry.

void path_attr_fields_is(bgp_path_attr_fields_t const & path_attr_fields)

Setter for ‘path_attr_fields’.

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

The hash function for type bgp_path_options_t.

std::string to_string() const

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

Private Members

bgp_receive_route_stage_t receive_route_stage_
bgp_path_attr_fields_t path_attr_fields_

Friends

friend std::ostream & operator<<

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

class bgp_path_attr_t
#include <bgp_path.h>

The BGP path attribute entry.

Public Functions

bgp_path_attr_t()
bgp_path_attr_t(uint8_t origin, uint32_t med, uint32_t local_pref)
ip_addr_t next_hop() const

Getter for ‘next_hop’: The nexthop address for the route.

void next_hop_is(ip_addr_t const & next_hop)

Setter for ‘next_hop’.

uint8_t origin() const

Getter for ‘origin’: The route origin.

void origin_is(uint8_t origin)

Setter for ‘origin’.

uint32_t med() const

Getter for ‘med’: The Multi Exit Discriminator for the route.

void med_is(uint32_t med)

Setter for ‘med’.

uint32_t local_pref() const

Getter for ‘local_pref’: The I-BGP Local preference indicator.

void local_pref_is(uint32_t local_pref)

Setter for ‘local_pref’.

std::unordered_set< uint32_t > const & community_list() const

Getter for ‘community_list’: The route community list.

void community_list_is(std::unordered_set< uint32_t > const & community_list)

Setter for ‘community_list’.

void community_list_set(uint32_t const & value)

Inserts one community_list of ‘value’ to the set.

void community_list_del(uint32_t const & value)

Deletes one community_list of ‘value’ from the set.

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

The hash function for type bgp_path_attr_t.

std::string to_string() const

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

Private Members

ip_addr_t next_hop_
uint8_t origin_
uint32_t med_
uint32_t local_pref_
std::unordered_set< uint32_t > community_list_

Friends

friend std::ostream & operator<<

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

class bgp_path_key_t
#include <bgp_path.h>

The key which uniquely identifies a BGP path. Supports IPV4/IPV6 Unicast.

Public Functions

bgp_path_key_t()
bgp_path_key_t(ip_prefix_t const & prefix, ip_addr_t const & peer_addr, std::string const & vrf_name)

Create BGP path key.

ip_prefix_t prefix() const

Getter for ‘prefix’: IPv4/IPv6 network prefix.

void prefix_is(ip_prefix_t const & prefix)

Setter for ‘prefix’.

ip_addr_t peer_addr() const

Getter for ‘peer_addr’: BGP peer address.

void peer_addr_is(ip_addr_t const & peer_addr)

Setter for ‘peer_addr’.

std::string vrf_name() const

Getter for ‘vrf_name’: VRF name.

void vrf_name_is(std::string const & vrf_name)

Setter for ‘vrf_name’.

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

The hash function for type bgp_path_key_t.

std::string to_string() const

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

Private Members

ip_prefix_t prefix_
ip_addr_t peer_addr_
std::string vrf_name_

Friends

friend std::ostream & operator<<

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

class bgp_path_t
#include <bgp_path.h>

The BGP path entry.

Public Functions

bgp_path_t()
bgp_path_t(bgp_path_key_t const & path_key)
bgp_path_key_t path_key() const

Getter for ‘path_key’: The BGP path key.

void path_key_is(bgp_path_key_t const & path_key)

Setter for ‘path_key’.

bgp_path_attr_t path_attr() const

Getter for ‘path_attr’: The BGP path attributes.

void path_attr_is(bgp_path_attr_t const & path_attr)

Setter for ‘path_attr’.

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

The hash function for type bgp_path_t.

std::string to_string() const

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

Private Members

bgp_path_key_t path_key_
bgp_path_attr_t path_attr_

Friends

friend std::ostream & operator<<

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

Table Of Contents

Previous topic

bfd

Next topic

class_map