Skip to content

Commit

Permalink
isisd: add json display of extended admin groups
Browse files Browse the repository at this point in the history
Add JSON display of extended admin groups

Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed May 21, 2024
1 parent fc93649 commit e00987e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions isisd/isis_tlvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,22 @@ 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", 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,
Expand Down

0 comments on commit e00987e

Please sign in to comment.