summaryrefslogtreecommitdiff
path: root/isisd/isisd.c
diff options
context:
space:
mode:
authoranlan_cs <anlan_cs@tom.com>2024-05-07 10:16:00 +0800
committeranlan_cs <anlan_cs@tom.com>2024-05-07 14:23:06 +0800
commit639d8027f166f1853d7a22e162c15355b7beec1b (patch)
treea8cdc5e3dee977654127596d5ae348af72d88006 /isisd/isisd.c
parentc54bc7a8dd7c0a07b8897d790c2c6fdabec76d82 (diff)
isisd: fix json display for database command
The current json display lost a lot of LSPs, added them. Fixed the json format for two commands: "show isis database detail json" "show isis database json" Signed-off-by: anlan_cs <anlan_cs@tom.com>
Diffstat (limited to 'isisd/isisd.c')
-rw-r--r--isisd/isisd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/isisd/isisd.c b/isisd/isisd.c
index c1eda4822a..6535b8fcc0 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -2681,6 +2681,7 @@ void show_isis_database_lspdb_json(struct json_object *json,
{
struct isis_lsp *lsp;
int lsp_count;
+ struct json_object *lsp_arr_json;
if (lspdb_count(lspdb) > 0) {
lsp = lsp_for_sysid(lspdb, sysid_str, area->isis);
@@ -2697,9 +2698,12 @@ void show_isis_database_lspdb_json(struct json_object *json,
lsp_print_json(lsp, json, area->dynhostname,
area->isis);
} else if (sysid_str == NULL) {
- lsp_count =
- lsp_print_all(NULL, json, lspdb, ui_level,
- area->dynhostname, area->isis);
+ lsp_arr_json = json_object_new_array();
+ json_object_object_add(json, "lsps", lsp_arr_json);
+
+ lsp_count = lsp_print_all(NULL, lsp_arr_json, lspdb,
+ ui_level, area->dynhostname,
+ area->isis);
json_object_int_add(json, "count", lsp_count);
}