summaryrefslogtreecommitdiffhomepage
path: root/api/grpc_server.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2017-02-13 07:49:42 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-02-15 00:10:15 +0900
commit9a45ed09b0a1b55be1391e3e5ba0e008b776d262 (patch)
treecb7f53dd331a635a006c3cc1543f83f560d91a46 /api/grpc_server.go
parent52356c26f821fdebb3fdf943a1b898a2d1b4d0db (diff)
cli: add current option to monitor commands
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r--api/grpc_server.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go
index 8fbe53a2..bd1f1885 100644
--- a/api/grpc_server.go
+++ b/api/grpc_server.go
@@ -340,21 +340,22 @@ func (s *Server) GetRib(ctx context.Context, arg *GetRibRequest) (*GetRibRespons
}, err
}
-func (s *Server) MonitorRib(arg *Table, stream GobgpApi_MonitorRibServer) error {
- if arg == nil {
+func (s *Server) MonitorRib(arg *MonitorRibRequest, stream GobgpApi_MonitorRibServer) error {
+ if arg == nil || arg.Table == nil {
return fmt.Errorf("invalid request")
}
+ t := arg.Table
w, err := func() (*server.Watcher, error) {
- switch arg.Type {
+ switch t.Type {
case Resource_GLOBAL:
- return s.bgpServer.Watch(server.WatchBestPath(false)), nil
+ return s.bgpServer.Watch(server.WatchBestPath(arg.Current)), nil
case Resource_ADJ_IN:
- if arg.PostPolicy {
- return s.bgpServer.Watch(server.WatchPostUpdate(false)), nil
+ if t.PostPolicy {
+ return s.bgpServer.Watch(server.WatchPostUpdate(arg.Current)), nil
}
- return s.bgpServer.Watch(server.WatchUpdate(false)), nil
+ return s.bgpServer.Watch(server.WatchUpdate(arg.Current)), nil
default:
- return nil, fmt.Errorf("unsupported resource type: %v", arg.Type)
+ return nil, fmt.Errorf("unsupported resource type: %v", t.Type)
}
}()
if err != nil {
@@ -367,7 +368,7 @@ func (s *Server) MonitorRib(arg *Table, stream GobgpApi_MonitorRibServer) error
sendPath := func(pathList []*table.Path) error {
dsts := make(map[string]*Destination)
for _, path := range pathList {
- if path == nil || (arg.Family != 0 && bgp.RouteFamily(arg.Family) != path.GetRouteFamily()) {
+ if path == nil || (t.Family != 0 && bgp.RouteFamily(t.Family) != path.GetRouteFamily()) {
continue
}
if dst, y := dsts[path.GetNlri().String()]; y {