]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: fix 'json detail' output structure
authorTrey Aspelund <taspelund@nvidia.com>
Fri, 10 Feb 2023 19:05:27 +0000 (19:05 +0000)
committerTrey Aspelund <taspelund@nvidia.com>
Thu, 16 Feb 2023 16:05:16 +0000 (16:05 +0000)
commitf9f2d188e3980d2338747739848001a432ad30b2
treeac5e2ee9c082ae1dd5aa445c63d2eea51416dda9
parentbf9bc2e5f2213069801dd1445abc2bfa95214fdf
bgpd: fix 'json detail' output structure

"show bgp <afi> <safi> json detail" was incorrectly displaying header
information from route_vty_out_detail_header() as an element of the
"paths" array. This corrects the behavior for 'json detail' so that a
route holds a dictionary with keys for "paths" and header info, which
aligns with how we structure the output for a specific prefix, e.g.
"show bgp <afi> <safi> <prefix> json".

Before:
```
ub20# show ip bgp json detail
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 3,
 "routerId": "100.64.0.222",
 "defaultLocPrf": 100,
 "localAS": 1,
 "routes": { "2.2.2.2/32": [
  {                           <<<<<<<<<  should be outside the array
    "prefix":"2.2.2.2/32",
    "version":1,
    "advertisedTo":{
      "192.168.122.12":{
        "hostname":"ub20-2"
      }
    }
  },
  {
    "aspath":{
      "string":"Local",
      "segments":[
      ],
      "length":0
    },
<snip>
```

After:
```
ub20# show ip bgp json detail
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 3,
 "routerId": "100.64.0.222",
 "defaultLocPrf": 100,
 "localAS": 1,
 "routes": { "2.2.2.2/32": {
"prefix": "2.2.2.2/32",
"version": "1",
"advertisedTo": {
  "192.168.122.12":{
    "hostname":"ub20-2"
  }
}
,"paths": [
  {
    "aspath":{
      "string":"Local",
      "segments":[
      ],
      "length":0
    },
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
bgpd/bgp_evpn_vty.c
bgpd/bgp_route.c
bgpd/bgp_route.h