diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-06-02 05:48:06 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-06-06 12:43:20 +0900 |
commit | 5c7df672664f06a8bcdf411667e1c61000805c8c (patch) | |
tree | 07380532413e49b2971249d27eb4af7a2bb7bcf2 /server | |
parent | 222d4dba8e2c97f0edc2b1e97c0afa1d25f44822 (diff) |
server/table: support bgp multipath
This patch adds multiPathList field to watcherEventBestPathMsg and
fills it when global.use-multiple-paths.config.enable = true
Following patches add support injecting multipath to zebra and
monitoring it via gRPC
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 12 | ||||
-rw-r--r-- | server/watcher.go | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/server/server.go b/server/server.go index 4d5ebf43..539c4086 100644 --- a/server/server.go +++ b/server/server.go @@ -401,10 +401,10 @@ func (server *BgpServer) dropPeerAllRoutes(peer *Peer, families []bgp.RouteFamil ids = append(ids, table.GLOBAL_RIB_NAME) } for _, rf := range families { - best, _ := server.globalRib.DeletePathsByPeer(ids, peer.fsm.peerInfo, rf) + best, _, multipath := server.globalRib.DeletePathsByPeer(ids, peer.fsm.peerInfo, rf) if !peer.isRouteServerClient() { - server.watchers.notify(WATCHER_EVENT_BESTPATH_CHANGE, &watcherEventBestPathMsg{pathList: best[table.GLOBAL_RIB_NAME]}) + server.watchers.notify(WATCHER_EVENT_BESTPATH_CHANGE, &watcherEventBestPathMsg{pathList: best[table.GLOBAL_RIB_NAME], multiPathList: multipath}) } for _, targetPeer := range server.neighborMap { @@ -498,7 +498,7 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] ids = append(ids, targetPeer.TableID()) } } - best, withdrawn = rib.ProcessPaths(ids, append(pathList, moded...)) + best, withdrawn, _ = rib.ProcessPaths(ids, append(pathList, moded...)) } else { for idx, path := range pathList { path = server.policy.ApplyPolicy(table.GLOBAL_RIB_NAME, table.POLICY_DIRECTION_IMPORT, path, nil) @@ -549,11 +549,12 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) ([] } } alteredPathList = pathList - best, withdrawn = rib.ProcessPaths([]string{table.GLOBAL_RIB_NAME}, pathList) + var multi [][]*table.Path + best, withdrawn, multi = rib.ProcessPaths([]string{table.GLOBAL_RIB_NAME}, pathList) if len(best[table.GLOBAL_RIB_NAME]) == 0 { return nil, alteredPathList } - server.watchers.notify(WATCHER_EVENT_BESTPATH_CHANGE, &watcherEventBestPathMsg{pathList: best[table.GLOBAL_RIB_NAME]}) + server.watchers.notify(WATCHER_EVENT_BESTPATH_CHANGE, &watcherEventBestPathMsg{pathList: best[table.GLOBAL_RIB_NAME], multiPathList: multi}) } for _, targetPeer := range server.neighborMap { @@ -1538,6 +1539,7 @@ func (server *BgpServer) handleModConfig(grpcReq *GrpcRequest) error { server.bgpConfig.Global = *c // update route selection options table.SelectionOptions = c.RouteSelectionOptions.Config + table.UseMultiplePaths = c.UseMultiplePaths.Config return nil } diff --git a/server/watcher.go b/server/watcher.go index 4b4b700c..87039479 100644 --- a/server/watcher.go +++ b/server/watcher.go @@ -87,7 +87,8 @@ type watcherEventAdjInMsg struct { } type watcherEventBestPathMsg struct { - pathList []*table.Path + pathList []*table.Path + multiPathList [][]*table.Path } type watcher interface { |