diff options
| author | Louis Scalbert <louis.scalbert@6wind.com> | 2022-09-05 10:22:52 +0200 |
|---|---|---|
| committer | Louis Scalbert <louis.scalbert@6wind.com> | 2024-05-23 14:43:21 +0200 |
| commit | 980d76c403de248139339bfea68946b50f0bb338 (patch) | |
| tree | 8f0e6aeacf469c6b6468669e4e28d6feac742145 | |
| parent | 2bd3c6b4ff43a1290e839d09bc41fe4b97ea4568 (diff) | |
isisd: fix display of router in show isis database <rtr> json
Display information about a particular router in show isis database in
an single value array for compatibility with the display of all routers.
Fixes: a2cac12a63 ("isisd: Add json to show isis database command.")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| -rw-r--r-- | isisd/isisd.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/isisd/isisd.c b/isisd/isisd.c index 382a6aa3be..2c4cee0607 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(); |
