diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 7 | ||||
-rw-r--r-- | server/server_test.go | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/server/server.go b/server/server.go index da6feba2..ed245ff8 100644 --- a/server/server.go +++ b/server/server.go @@ -1542,10 +1542,13 @@ func (s *BgpServer) GetServer() (c *config.Global) { return c } -func (s *BgpServer) GetNeighbor(getAdvertised bool) (l []*config.Neighbor) { +func (s *BgpServer) GetNeighbor(address string, getAdvertised bool) (l []*config.Neighbor) { s.mgmtOperation(func() error { l = make([]*config.Neighbor, 0, len(s.neighborMap)) - for _, peer := range s.neighborMap { + for k, peer := range s.neighborMap { + if address != "" && address != k { + continue + } l = append(l, peer.ToConfig(getAdvertised)) } return nil diff --git a/server/server_test.go b/server/server_test.go index 3aaa7374..9caf8a62 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -109,7 +109,7 @@ func TestMonitor(test *testing.T) { for { time.Sleep(time.Second) - if t.GetNeighbor(false)[0].State.SessionState == config.SESSION_STATE_ESTABLISHED { + if t.GetNeighbor("", false)[0].State.SessionState == config.SESSION_STATE_ESTABLISHED { break } } |