summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2021-08-08 20:25:39 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2021-08-08 20:25:39 +0900
commitf99c0674039227bf47a7d02c9fe038ee57229da3 (patch)
treec3da28d07ea85f84280afeed74e2cc2dc6043c0b
parent9e48a36ed97c699e2a5b5d8dfd3f9fb6e6119e0b (diff)
server: fix ListVrf api to handle Name member
Currently, just ignored. Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
-rw-r--r--pkg/server/server.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go
index 3cdcd6e4..37985e5e 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -2163,7 +2163,7 @@ func (s *BgpServer) listVrf() (l []*table.Vrf) {
return l
}
-func (s *BgpServer) ListVrf(ctx context.Context, _ *api.ListVrfRequest, fn func(*api.Vrf)) error {
+func (s *BgpServer) ListVrf(ctx context.Context, rq *api.ListVrfRequest, fn func(*api.Vrf)) error {
toApi := func(v *table.Vrf) *api.Vrf {
return &api.Vrf{
Name: v.Name,
@@ -2176,7 +2176,10 @@ func (s *BgpServer) ListVrf(ctx context.Context, _ *api.ListVrfRequest, fn func(
var l []*api.Vrf
s.mgmtOperation(func() error {
l = make([]*api.Vrf, 0, len(s.globalRib.Vrfs))
- for _, vrf := range s.globalRib.Vrfs {
+ for name, vrf := range s.globalRib.Vrfs {
+ if rq.Name != "" && rq.Name != name {
+ continue
+ }
l = append(l, toApi(vrf.Clone()))
}
return nil