summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2024-05-21 11:48:56 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2024-05-23 14:59:19 +0200
commit2864b96332056e1244dfa0ba8c235976ee0b0d99 (patch)
tree41c557fbaee6c9c6620a6d5ea71840ef64dfc255
parentisisd: fix show database json format (diff)
downloadfrr-2864b96332056e1244dfa0ba8c235976ee0b0d99.tar.xz
frr-2864b96332056e1244dfa0ba8c235976ee0b0d99.zip
isisd: add json display of extended admin groups
Add JSON display of extended admin groups Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
-rw-r--r--isisd/isis_tlvs.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index c20b1d812..6c6cab87c 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -492,8 +492,23 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
if (IS_SUBTLV(exts, EXT_EXTEND_ADM_GRP) &&
admin_group_nb_words(&exts->ext_admin_group) != 0) {
- if (!json) {
- /* TODO json after fix show database detail json */
+ if (json) {
+ struct json_object *ext_adm_grp_json;
+ size_t i;
+ ext_adm_grp_json = json_object_new_object();
+ json_object_object_add(json, "extendedAdminGroup",
+ ext_adm_grp_json);
+ for (i = 0;
+ i < admin_group_nb_words(&exts->ext_admin_group);
+ i++) {
+ snprintfrr(cnt_buf, sizeof(cnt_buf), "%lu",
+ (unsigned long)i);
+ json_object_string_addf(ext_adm_grp_json,
+ cnt_buf, "0x%x",
+ exts->ext_admin_group
+ .bitmap.data[i]);
+ }
+ } else {
sbuf_push(buf, indent, "Ext Admin Group: %s\n",
admin_group_string(
admin_group_buf,