diff options
Diffstat (limited to 'isisd/isisd.c')
-rw-r--r-- | isisd/isisd.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/isisd/isisd.c b/isisd/isisd.c index 382a6aa3b..982df0839 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -2649,6 +2649,7 @@ void show_isis_database_lspdb_json(struct json_object *json, struct lspdb_head *lspdb, const char *sysid_str, int ui_level) { + struct json_object *array_json, *lsp_json; struct isis_lsp *lsp; int lsp_count; struct json_object *lsp_arr_json; @@ -2661,11 +2662,19 @@ void show_isis_database_lspdb_json(struct json_object *json, } if (lsp) { + json_object_object_get_ex(json, "lsps", &array_json); + if (!array_json) { + array_json = json_object_new_array(); + json_object_object_add(json, "lsps", array_json); + } + lsp_json = json_object_new_object(); + json_object_array_add(array_json, lsp_json); + if (ui_level == ISIS_UI_LEVEL_DETAIL) - lsp_print_detail(lsp, NULL, json, + lsp_print_detail(lsp, NULL, lsp_json, area->dynhostname, area->isis); else - lsp_print_json(lsp, json, area->dynhostname, + lsp_print_json(lsp, lsp_json, area->dynhostname, area->isis); } else if (sysid_str == NULL) { lsp_arr_json = json_object_new_array(); @@ -2739,6 +2748,8 @@ static void show_isis_database_json(struct json_object *json, const char *sysid_ json_object_object_add(area_json,"area",tag_area_json); json_object_object_add(area_json,"levels",arr_json); for (level = 0; level < ISIS_LEVELS; level++) { + if (lspdb_count(&area->lspdb[level]) == 0) + continue; lsp_json = json_object_new_object(); show_isis_database_lspdb_json(lsp_json, area, level, &area->lspdb[level], |