diff options
author | rgirada <rgirada@vmware.com> | 2020-07-24 01:25:04 +0200 |
---|---|---|
committer | rgirada <rgirada@vmware.com> | 2020-11-01 17:25:40 +0100 |
commit | f328dc606e35abea55706452b105bd8d78728d6c (patch) | |
tree | d183453cd869b942a3e66e4d4e6d8ae10526d82e /ospfd/ospf_opaque.c | |
parent | Merge pull request #7429 from opensourcerouting/rpm-subpkgs (diff) | |
download | frr-f328dc606e35abea55706452b105bd8d78728d6c.tar.xz frr-f328dc606e35abea55706452b105bd8d78728d6c.zip |
ospfd: json support for ospf database command.
Description:
Added json support to ospf lsdb command and its subcommands.
Added json to the following sub commands.
show ip ospf database json
show ip ospf database router json
show ip ospf database network json
show ip ospf database external json
show ip ospf database summary json
show ip ospf database asbr-summary json
show ip ospf database nssa-external json
show ip ospf databas max-age json
show ip ospf database self-originate json
Signed-off-by: Rajesh Girada <rgirada@vmware.com>
Diffstat (limited to 'ospfd/ospf_opaque.c')
-rw-r--r-- | ospfd/ospf_opaque.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 5ba61b318..eb0c4a949 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -1159,7 +1159,8 @@ void ospf_opaque_config_write_debug(struct vty *vty) return; } -void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa) +void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa, + json_object *json) { struct lsa_header *lsah = lsa->data; uint32_t lsid = ntohl(lsah->id.s_addr); @@ -1169,13 +1170,17 @@ void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa) /* Switch output functionality by vty address. */ if (vty != NULL) { - vty_out(vty, " Opaque-Type %u (%s)\n", opaque_type, - ospf_opaque_type_name(opaque_type)); - vty_out(vty, " Opaque-ID 0x%x\n", opaque_id); - - vty_out(vty, " Opaque-Info: %u octets of data%s\n", - ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE, - VALID_OPAQUE_INFO_LEN(lsah) ? "" : "(Invalid length?)"); + if (!json) { + vty_out(vty, " Opaque-Type %u (%s)\n", opaque_type, + ospf_opaque_type_name(opaque_type)); + vty_out(vty, " Opaque-ID 0x%x\n", opaque_id); + + vty_out(vty, " Opaque-Info: %u octets of data%s\n", + ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE, + VALID_OPAQUE_INFO_LEN(lsah) + ? "" + : "(Invalid length?)"); + } } else { zlog_debug(" Opaque-Type %u (%s)", opaque_type, ospf_opaque_type_name(opaque_type)); @@ -1200,7 +1205,7 @@ void ospf_opaque_lsa_dump(struct stream *s, uint16_t length) struct ospf_lsa lsa; lsa.data = (struct lsa_header *)stream_pnt(s); - show_opaque_info_detail(NULL, &lsa); + show_opaque_info_detail(NULL, &lsa, NULL); return; } |