summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-04-02 22:23:26 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-04-02 22:23:26 +0900
commit0f122bd85d683836eb582ca67fd91ac2fb464b13 (patch)
treef38a623986b8f5b9c725361c6ce1c99dd3aa84dd
parent6a3bffa10435f0289a54b60b8cf85bbfdf0a66bc (diff)
api: simplify adj-in/out json format
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rwxr-xr-xcli/gobgpcli6
-rw-r--r--server/peer.go9
2 files changed, 5 insertions, 10 deletions
diff --git a/cli/gobgpcli b/cli/gobgpcli
index f3cde90a..6dfded5f 100755
--- a/cli/gobgpcli
+++ b/cli/gobgpcli
@@ -339,11 +339,7 @@ class Show(object):
self.show_routes(f, d["Paths"], True, True)
elif self.args[2] == "adj-rib-in" or self.args[2] == "adj-rib-out":
- rfs = ["RF_IPv4_UC", "RF_IPv6_UC"]
- for rf in rfs:
- if rf in r.json():
- paths = r.json()[rf]
- self.show_routes(f, paths, False, timestamp)
+ self.show_routes(f, r.json(), False, timestamp)
return 0
def show_routes(self, f, paths, showBest=False, timestamp=False):
diff --git a/server/peer.go b/server/peer.go
index 6677e0bc..8ff38191 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -312,19 +312,18 @@ func (peer *Peer) handleREST(restReq *api.RestRequest) {
pathList := peer.adjRib.GetOutPathList(restReq.RouteFamily)
peer.sendMessages(table.CreateUpdateMsgFromPaths(pathList))
case api.REQ_ADJ_RIB_IN, api.REQ_ADJ_RIB_OUT:
- adjrib := make(map[string][]table.Path)
rf := restReq.RouteFamily
if restReq.RequestType == api.REQ_ADJ_RIB_IN {
paths := peer.adjRib.GetInPathList(rf)
- adjrib[rf.String()] = paths
+ j, _ := json.Marshal(paths)
+ result.Data = j
log.Debugf("RouteFamily=%v adj-rib-in found : %d", rf.String(), len(paths))
} else {
paths := peer.adjRib.GetOutPathList(rf)
- adjrib[rf.String()] = paths
+ j, _ := json.Marshal(paths)
+ result.Data = j
log.Debugf("RouteFamily=%v adj-rib-out found : %d", rf.String(), len(paths))
}
- j, _ := json.Marshal(adjrib)
- result.Data = j
case api.REQ_NEIGHBOR_ENABLE, api.REQ_NEIGHBOR_DISABLE:
r := make(map[string]string)
if restReq.RequestType == api.REQ_NEIGHBOR_ENABLE {