bgp¶
BGP 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 information including BGP peer state.
An example of the API usage is in examples/BgpAgent.cpp
-
namespace
eos
-
class
bgp_peer_handler
- #include <bgp.h>
The BGP peer handler.
This class provides handler APIs to react to a BGP peer’s session state change.
Public Functions
-
bgp_peer_handler
(bgp_mgr * mgr)
-
bgp_mgr *
get_bgp_mgr
() const
-
void
watch_all_peers
(bool) Register to receive notifications when any peer changes state.
-
void
watch_peer
(bgp_peer_key_t const & peer_key, bool) Register to receive notifications when the specified peer changes state.
-
virtual void
on_peer_state
(bgp_peer_key_t const & peer_key, bgp_peer_state_t peer_state) Called when BGP peer state change.
-
virtual void
on_peer_set
(bgp_peer_key_t const & peer_key) Called when a BGP peer is created.
-
virtual void
on_peer_del
(bgp_peer_key_t const & peer_key) Called when a BGP peer is deleted.
-
-
class
bgp_mgr
- #include <bgp.h>
A manager of BGP configurations.
Public Functions
-
virtual
~bgp_mgr
()
-
virtual bool
exists
(bgp_peer_key_t const & peer_key) const = 0 Test for existence of a BGP peer.
-
virtual bgp_peer_state_t
peer_state
(bgp_peer_key_t const & peer_key) const = 0 Returns the state of a peer session.
If the given peer does not have a valid status or it didn’t match any peers in the system, this would returns PEER_UNKNOWN;
Protected Functions
-
bgp_mgr
()
Private Members
-
bgp_mgr
Friends
-
friend class
bgp_peer_handler
-
virtual
-
class
Type definitions in bgp¶
-
namespace
eos
Typedefs
-
typedef uint32_t
bgp_asn_t
Enums
- bgp_peer_state_t enum
The operational state of a BGP peer session.
Values:
PEER_UNKNOWN
-PEER_IDLE
-PEER_CONNECT
-PEER_ACTIVE
-PEER_OPENSENT
-PEER_OPENCONFIRM
-PEER_ESTABLISHED
-
-
class
bgp_peer_key_t
- #include <bgp.h>
The BGP peer key which consists of the peer address and the VRF itresides in.
Public Functions
-
bgp_peer_key_t
()
-
bgp_peer_key_t
(std::string const & vrf_name, ip_addr_t const & peer_addr)
-
bgp_peer_key_t
(const bgp_peer_key_t & other)
-
bgp_peer_key_t &
operator=
(bgp_peer_key_t const & other)
-
std::string
vrf_name
() const Getter for ‘vrf_name’: VRF name.
-
void
vrf_name_is
(std::string const & vrf_name) Setter for ‘vrf_name’.
-
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’.
-
bool
operator==
(bgp_peer_key_t const & other) const
-
bool
operator!=
(bgp_peer_key_t const & other) const
-
bool
operator<
(bgp_peer_key_t const & other) const
-
uint32_t
hash
() const The hash function for type bgp_peer_key_t.
-
void
mix_me
(hash_mix & h) const The hash mix function for type bgp_peer_key_t.
-
std::string
to_string
() const Returns a string representation of the current object’s values.
Private Members
-
std::shared_ptr< bgp_peer_key_impl_t >
pimpl
Friends
-
friend std::ostream &
operator<<
A utility stream operator that adds a string representation of bgp_peer_key_t to the ostream.
-
-
typedef uint32_t