Split routing server into BGP watcher and routing handler under felix #800
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
routingServer
with mixed responsibilities:routingServer
into three focused components:Summary of Components:
1. BGPWatcher (
watchers/bgp_watcher.go
)BGPHandler
)BGPHandler
2. BGPHandler (
felix/routing/bgp_handler.go
)RoutingHandler
):Connectivity
events)SRv6Policy
events)ConnectivityAdded
- Route learned from BGP peerConnectivityDeleted
- Route withdrawn by BGP peerSRv6PolicyAdded
- SRv6 tunnel route learnedSRv6PolicyDeleted
- SRv6 tunnel route withdrawn3. RoutingHandler (
felix/routing/routing_handler.go
)BGPHandler
):BGPPath
events →BGPHandler
→GoBGP server
)BGPPathAdded
- Local prefix to announceBGPPathDeleted
- Local prefix to withdraw4. PeerHandler (
felix/routing/peer_handler.go
)BGPHandler
)BGPPeer
events →BGPHandler
→GoBGP server
)BGPPeerAdded
- New peer to configureBGPPeerUpdated
- Peer configuration changedBGPPeerDeleted
- Peer to remove5. ConnectivityHandler (
felix/connectivity/connectivity_handler.go
)Event-Driven Architecture
The refactoring introduces a clean event-driven pattern:
Event Flow
All BGP related events now flow through Felix server's event loop:
New Events Registered
The following events are now registered in
felix_server.go
and handled inhandleFelixServerEvents()
:Separation of Watching vs Business Logic
Watching Logic (Observation)
Business Logic (Decision & Execution)
BGPHandler
]BGPHandler
]