summaryrefslogtreecommitdiff
path: root/isisd/isis_lsp.c
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2024-05-21 14:48:44 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2024-05-23 14:43:21 +0200
commitd5879267aa064e127a26b42eba192b87f91896f5 (patch)
treee4c75c8dd60124d5e66bd115eabfba51bf1ed8cf /isisd/isis_lsp.c
parentc3ccc0a53ba731c7995c3c8407665878f5a3cf34 (diff)
isisd: fix show database json format
"show isis database [detail] json" returns invalid or incorrect JSON that is difficult to parse. Fix key with '-' characters, add booleans and null data when possible. Deprecate the old format. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'isisd/isis_lsp.c')
-rw-r--r--isisd/isis_lsp.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 9d671137e9..1ce57747ff 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -746,6 +746,10 @@ void lsp_print_common(struct isis_lsp *lsp, struct vty *vty, struct json_object
}
}
+#if CONFDATE > 20240916
+CPP_NOTICE("Remove JSON in '-' format")
+#endif
+
void lsp_print_json(struct isis_lsp *lsp, struct json_object *json,
char dynhost, struct isis *isis)
{
@@ -759,10 +763,20 @@ void lsp_print_json(struct isis_lsp *lsp, struct json_object *json,
own_json = json_object_new_object();
json_object_object_add(json, "lsp", own_json);
json_object_string_add(own_json, "id", LSPid);
+#if CONFDATE > 20240916
+ CPP_NOTICE("remove own key")
+#endif
json_object_string_add(own_json, "own", lsp->own_lsp ? "*" : " ");
+ if (lsp->own_lsp)
+ json_object_boolean_add(own_json, "ownLSP", true);
json_object_int_add(json, "pdu-len", lsp->hdr.pdu_len);
+ json_object_int_add(json, "pduLen", lsp->hdr.pdu_len);
snprintfrr(buf, sizeof(buf), "0x%08x", lsp->hdr.seqno);
+#if CONFDATE > 20240916
+ CPP_NOTICE("remove seq-number key")
+#endif
json_object_string_add(json, "seq-number", buf);
+ json_object_string_add(json, "seqNumber", buf);
snprintfrr(buf, sizeof(buf), "0x%04hx", lsp->hdr.checksum);
json_object_string_add(json, "chksum", buf);
if (lsp->hdr.rem_lifetime == 0) {
@@ -772,8 +786,13 @@ void lsp_print_json(struct isis_lsp *lsp, struct json_object *json,
} else {
json_object_int_add(json, "holdtime", lsp->hdr.rem_lifetime);
}
+#if CONFDATE > 20240916
+ CPP_NOTICE("remove att-p-ol key")
+#endif
json_object_string_add(
json, "att-p-ol", lsp_bits2string(lsp->hdr.lsp_bits, b, sizeof(b)));
+ json_object_string_add(json, "attPOl",
+ lsp_bits2string(lsp->hdr.lsp_bits, b, sizeof(b)));
}
void lsp_print_vty(struct isis_lsp *lsp, struct vty *vty,