summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/peer.go2
-rw-r--r--server/server.go12
2 files changed, 5 insertions, 9 deletions
diff --git a/server/peer.go b/server/peer.go
index 66514d11..71144067 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -105,7 +105,7 @@ func (peer *Peer) path2update(pathList []table.Path) []*bgp.BGPMessage {
}
func (peer *Peer) handleREST(restReq *api.RestRequest) {
- result := &api.RestResponseDefault{}
+ result := &api.RestResponse{}
result.Data = peer.rib.Tables[bgp.RF_IPv4_UC]
restReq.ResponseCh <- result
close(restReq.ResponseCh)
diff --git a/server/server.go b/server/server.go
index 6a633d3e..ac1e4f81 100644
--- a/server/server.go
+++ b/server/server.go
@@ -20,7 +20,6 @@ import (
log "github.com/Sirupsen/logrus"
"github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/config"
- "github.com/osrg/gobgp/packet"
"net"
"os"
"strconv"
@@ -153,7 +152,7 @@ func (server *BgpServer) broadcast(msg *message) {
func (server *BgpServer) handleRest(restReq *api.RestRequest) {
switch restReq.RequestType {
case api.REQ_NEIGHBORS:
- result := &api.RestResponseDefault{}
+ result := &api.RestResponse{}
peerList := make([]*Peer, 0)
for _, peer := range server.peerMap {
peerList = append(peerList, peer)
@@ -165,13 +164,10 @@ func (server *BgpServer) handleRest(restReq *api.RestRequest) {
case api.REQ_NEIGHBOR: // get neighbor state
remoteAddr := restReq.RemoteAddr
- result := &api.RestResponseNeighbor{}
+ result := &api.RestResponse{}
peer, found := server.peerMap[remoteAddr]
if found {
- c := peer.peerConfig
- result.NeighborState = bgp.FSMState(c.BgpNeighborCommonState.State).String()
- result.RemoteAddr = c.NeighborAddress.String()
- result.RemoteAs = c.PeerAs
+ result.Data = peer
} else {
result.ResponseErr = fmt.Errorf("Neighbor that has %v does not exist.", remoteAddr)
}
@@ -179,7 +175,7 @@ func (server *BgpServer) handleRest(restReq *api.RestRequest) {
close(restReq.ResponseCh)
case api.REQ_LOCAL_RIB:
remoteAddr := restReq.RemoteAddr
- result := &api.RestResponseNeighbor{}
+ result := &api.RestResponse{}
peer, found := server.peerMap[remoteAddr]
if found {
msg := message{