The "show zebra mpls .. json" vty command may return empty information
in case the MPLS database is empty or a given label entry is not
available. When those errors occur, add the braces to return a
valid json format.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
/* Lookup table. */
lsp_table = zvrf->lsp_table;
- if (!lsp_table)
+ if (!lsp_table) {
+ if (use_json)
+ vty_out(vty, "{}\n");
return;
+ }
/* If entry is not present, exit. */
tmp_ile.in_label = label;
lsp = hash_lookup(lsp_table, &tmp_ile);
- if (!lsp)
+ if (!lsp) {
+ if (use_json)
+ vty_out(vty, "{}\n");
return;
+ }
if (use_json) {
json = lsp_json(lsp);