Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interface for managing BGP process with goBGP implementation
This commit introduces an interface defining methods for managing a BGP (Border Gateway Protocol) process. Currently, only the goBGP implementation is available, but more implementations might be added in the future. The methods included in this interface are: - `Start() error`: starts the BGP process. - `Stop() error`: terminates the BGP process. - `AddPeers(peerConfigs []PeerConfig, ipFamily net.IPFamily) error`: adds BGP peers. The peers must be either all IPv4 or all IPv6. The fields of `PeerConfig` are: - `Address`: IP address of the peer. - `Port`: port on which the peer listens. - `ASN`: ASN of the peer. - `AuthPassword`: password used by the peer to establish a BGP session. - `MultihopTTL`: TTL value for multi-hop sessions. Set to more than 1 for multi-hop, otherwise set to 1. - `GracefulRestartTimeSeconds`: duration for which a BGP peer retains routing information and maintains forwarding state after a session disruption. - `UpdatePeers(peerConfigs []PeerConfig, ipFamily net.IPFamily) error`: updates existing BGP peers. The peers must be either all IPv4 or all IPv6. - `RemovePeers(peerConfigs []PeerConfig) error`: removes BGP peers. - `GetPeers() ([]PeerStatus, error)`: retrieves the status of BGP peers. In addition to the basic `PeerConfig` information, the status in `PeerStatus` includes: - `SessionState`: current state of the BGP peer. - `UptimeSeconds`: uptime of the BGP peer if the session is in the `Established` state. - `AdvertiseRoutes(routes []Route, ipFamily net.IPFamily) error`: advertises routes to all BGP peers. The routes must be either all IPv4 or all IPv6. Currently, only the prefix (e.g., "192.168.0.0/24") is needed. - `WithdrawRoutes(routes []Route, ipFamily net.IPFamily) error`: withdraws routes from all BGP peers. - `GetRoutes(routeType RouteType, peerAddress string, ipFamily net.IPFamily) ([]Route, error)`: retrieves routes for a specific BGP peer and given IP family. The `RouteType` can be: - `RouteAdvertised`: routes advertised to the BGP peer. - `RouteReceived`: routes received from the BGP peer. Signed-off-by: Hongliang Liu <lhongliang@vmware.com>
- Loading branch information