Documentation ¶
Overview ¶
Package gobgp contains Ligato GoBGP Plugin implementation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct { local.PluginInfraDeps // inject SessionConfig *config.Bgp // optional inject (if not injected, it must be set using external config file) }
Deps combines all needed dependencies for Plugin struct. These dependencies should be injected into Plugin by using constructor's Deps parameter.
type Plugin ¶
type Plugin struct { Deps // contains filtered or unexported fields }
Plugin is GoBGP Ligato BGP Plugin implementation. Purpose of this plugin is to retrieve BGP related information and expose it to watchers that can register to this plugin. To be able to communicate using BGP communication protocol, this plugin uses GoBGP library
func New ¶
New creates a GoBGP Ligato BGP Plugin implementation. Needed <dependencies> are injected into plugin implementation.
func (*Plugin) AfterInit ¶
AfterInit starts gobgp with dedicated goroutine for watching gobgp and forwarding best path reachable ip routes to registered watchers. After start of gobgp session, known neighbors from configuration are added to gobgp server. AfterInit fails if session start or adding of known neighbors from configuration fails. Due to fact that AfterInit is called once Init() of all plugins have returned without error, other plugins can be registered watchers from the start of gobgp server if they call this plugin's WatchIPRoutes() in their Init(). In this way they won't miss any information forwarded to registered watchers just because they registered too late.
func (*Plugin) Close ¶
Close stops dedicated goroutine for watching gobgp. Then stops watcher provider by gobgp server and finally stops that gobgp server itself. Close will fail if bgpServer fails to stop.
func (*Plugin) Init ¶
Init creates the gobgp server and checks if needed SessionConfig was injected and fails if it is not.
func (*Plugin) WatchIPRoutes ¶
func (plugin *Plugin) WatchIPRoutes(watcher string, callback func(*bgp.ReachableIPRoute)) (bgp.WatchRegistration, error)
WatchIPRoutes register watcher to notifications for any new learned IP-based routes. Watcher have to identify himself by name(<watcher> param) and provide <callback> so that GoBGP can sent information to watcher. WatchIPRoutes returns <bgp.WatchRegistration> as way how to control the watcher-goBGPlugin agreement from the watcher side in the future. It also returns error to indicate failure, but currently for this plugin is not known use case of failure. WatchRegistration is not retroactive, that means that any IP-based routes learned in the past are not send to new watchers. This also means that if you want be notified of all learned IP-based routes, you must register before calling of AfterInit(). In case of external(=not other plugin started with this plugin) watchers this means before plugin start. However, late-registered watchers are permitted (no error will be returned), but they can miss some learned IP-based routes.