summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-25 06:30:20 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-25 06:30:20 -0800
commit4da71624586971c253bfb2625bdd91e121254b22 (patch)
tree5b9563d6fff428511685854a160b0397a3ded114 /server/server.go
parent3234ade75edd5c4b01f817cc127a13feb9c25c7b (diff)
server: support /neighbors URL
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go
index 2852598b..6a633d3e 100644
--- a/server/server.go
+++ b/server/server.go
@@ -152,6 +152,16 @@ func (server *BgpServer) broadcast(msg *message) {
func (server *BgpServer) handleRest(restReq *api.RestRequest) {
switch restReq.RequestType {
+ case api.REQ_NEIGHBORS:
+ result := &api.RestResponseDefault{}
+ peerList := make([]*Peer, 0)
+ for _, peer := range server.peerMap {
+ peerList = append(peerList, peer)
+ }
+ result.Data = peerList
+ restReq.ResponseCh <- result
+ close(restReq.ResponseCh)
+
case api.REQ_NEIGHBOR: // get neighbor state
remoteAddr := restReq.RemoteAddr