bgpd: correction in json output structure for no data case

Problem:

The VTYSH JSON output is not in the proper format when bgp l2vpn-evpn
information is missing or not populated for a given vni-id. This results
in a malformed JSON structure, which causes a parsing error.

Fix:
Corrected the JSON output structure generated during command execution
to properly handle cases where no bgp l2vpn-evpn data is available for a
given vni-id.

Before Fix:

```
{}
{
}
```

After Fix:

```
{
}

```

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
(cherry picked from commit a8f1785c2b)
This commit is contained in:
Sindhu Parvathi Gopinathan 2025-10-14 21:09:00 -07:00 committed by Mergify
parent f467e9553e
commit 71c54fad41

View file

@ -3331,13 +3331,9 @@ static void evpn_show_vni(struct vty *vty, struct bgp *bgp, vni_t vni,
}
}
if (!found) {
if (json) {
vty_out(vty, "{}\n");
} else {
vty_out(vty, "VNI not found\n");
return;
}
if (!found && !json) {
vty_out(vty, "VNI not found\n");
return;
}
}