]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix proper json format for unicast statistics for non exists vrf
authorSindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
Mon, 26 Aug 2024 07:02:46 +0000 (00:02 -0700)
committerChirag Shah <chirag@nvidia.com>
Tue, 3 Sep 2024 00:22:01 +0000 (17:22 -0700)
Ticket: #4060069

show bgp vrf afi unicast statistics json output is not return in json
format for non exists vrf.

Fix:
Json output is formatted for non exists vrf cases.

Command supported:

```
show bgp vrf <VRFNAME> ipv4/ipv6 unicast statistics json
show bgp vrf <VRFNAME> l2vpn evpn statistics json
```

Before Fix:

```
leaf11#
leaf11# show bgp vrf test ipv4 unicast statistics json
View/Vrf test is unknown
leaf11#
leaf11#
leaf11# show bgp vrf test ipv6 unicast statistics json
View/Vrf test is unknown
leaf11#
leaf11#
leaf11# show bgp vrf default1 l2vpn evpn statistics json
View/Vrf default1 is unknown
leaf11#

```

After Fix:

```
leaf11#
leaf11# show bgp vrf test ipv4 unicast statistics json
{
  "warning":"View/Vrf is unknown"
}
leaf11#
leaf11#
leaf11# show bgp vrf test ipv6 unicast statistics json
{
  "warning":"View/Vrf is unknown"
}
leaf11#
leaf11# show bgp vrf default1 l2vpn evpn statistics json
{
  "warning":"View/Vrf is unknown"
}
leaf11#
```

Ticket: #4060069

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
bgpd/bgp_route.c

index 3ff7dbc07041ceb8af93212773a522170b3220ab..4b7a70487409f456438919094bb83f8147b9c7bc 100644 (file)
@@ -12934,7 +12934,7 @@ DEFUN (show_ip_bgp_l2vpn_evpn_statistics,
        struct json_object *json_afi_safi = NULL, *json = NULL;
 
        bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
-                                           &bgp, false);
+                                           &bgp, uj);
        if (!idx)
                return CMD_WARNING;
 
@@ -12972,7 +12972,7 @@ DEFUN(show_ip_bgp_afi_safi_statistics, show_ip_bgp_afi_safi_statistics_cmd,
        struct json_object *json_afi_safi = NULL, *json = NULL;
 
        bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
-                                           &bgp, false);
+                                           &bgp, uj);
        if (!idx)
                return CMD_WARNING;