summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_top.c
diff options
context:
space:
mode:
authorYash Ranjan <ranjany@vmware.com>2020-10-28 11:51:39 +0100
committerYash Ranjan <ranjany@vmware.com>2021-01-27 05:06:02 +0100
commiteacd0828d4a95684fbf691e28730b229c5a8b799 (patch)
treed432a4eae6ed9f5e79240c3700f394d23c4c0269 /ospf6d/ospf6_top.c
parentMerge pull request #7935 from donaldsharp/ospf6_use_after_free (diff)
downloadfrr-eacd0828d4a95684fbf691e28730b229c5a8b799.tar.xz
frr-eacd0828d4a95684fbf691e28730b229c5a8b799.zip
ospf6d: Json support added for command "show ipv6 ospf6 route [json]"
Modify code to add JSON format output in show command "show ipv6 ospf6 route [<intra-area|inter-area|external-1| external-2|X:X::X:X|X:X::X:X/M|detail|summary>]" with proper formating Signed-off-by: Yash Ranjan <ranjany@vmware.com>
Diffstat (limited to 'ospf6d/ospf6_top.c')
-rw-r--r--ospf6d/ospf6_top.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 7b4ed84d5..212f59965 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -51,6 +51,7 @@
#include "ospf6_intra.h"
#include "ospf6_spf.h"
#include "ospf6d.h"
+#include "lib/json.h"
DEFINE_QOBJ_TYPE(ospf6)
@@ -1165,7 +1166,7 @@ DEFUN(show_ipv6_ospf6,
DEFUN (show_ipv6_ospf6_route,
show_ipv6_ospf6_route_cmd,
- "show ipv6 ospf6 route [<intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary>]",
+ "show ipv6 ospf6 route [<intra-area|inter-area|external-1|external-2|X:X::X:X|X:X::X:X/M|detail|summary>] [json]",
SHOW_STR
IP6_STR
OSPF6_STR
@@ -1177,41 +1178,44 @@ DEFUN (show_ipv6_ospf6_route,
"Specify IPv6 address\n"
"Specify IPv6 prefix\n"
"Detailed information\n"
- "Summary of route table\n")
+ "Summary of route table\n"
+ JSON_STR)
{
struct ospf6 *ospf6;
+ bool uj = use_json(argc, argv);
ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
OSPF6_CMD_CHECK_RUNNING(ospf6);
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
+ ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}
DEFUN (show_ipv6_ospf6_route_match,
show_ipv6_ospf6_route_match_cmd,
- "show ipv6 ospf6 route X:X::X:X/M <match|longer>",
+ "show ipv6 ospf6 route X:X::X:X/M <match|longer> [json]",
SHOW_STR
IP6_STR
OSPF6_STR
ROUTE_STR
"Specify IPv6 prefix\n"
"Display routes which match the specified route\n"
- "Display routes longer than the specified route\n")
+ "Display routes longer than the specified route\n"
+ JSON_STR)
{
struct ospf6 *ospf6;
+ bool uj = use_json(argc, argv);
ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
OSPF6_CMD_CHECK_RUNNING(ospf6);
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
-
+ ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}
DEFUN (show_ipv6_ospf6_route_match_detail,
show_ipv6_ospf6_route_match_detail_cmd,
- "show ipv6 ospf6 route X:X::X:X/M match detail",
+ "show ipv6 ospf6 route X:X::X:X/M match detail [json]",
SHOW_STR
IP6_STR
OSPF6_STR
@@ -1219,21 +1223,22 @@ DEFUN (show_ipv6_ospf6_route_match_detail,
"Specify IPv6 prefix\n"
"Display routes which match the specified route\n"
"Detailed information\n"
- )
+ JSON_STR)
{
struct ospf6 *ospf6;
+ bool uj = use_json(argc, argv);
ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
OSPF6_CMD_CHECK_RUNNING(ospf6);
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
+ ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}
DEFUN (show_ipv6_ospf6_route_type_detail,
show_ipv6_ospf6_route_type_detail_cmd,
- "show ipv6 ospf6 route <intra-area|inter-area|external-1|external-2> detail",
+ "show ipv6 ospf6 route <intra-area|inter-area|external-1|external-2> detail [json]",
SHOW_STR
IP6_STR
OSPF6_STR
@@ -1243,14 +1248,15 @@ DEFUN (show_ipv6_ospf6_route_type_detail,
"Display Type-1 External routes\n"
"Display Type-2 External routes\n"
"Detailed information\n"
- )
+ JSON_STR)
{
struct ospf6 *ospf6;
+ bool uj = use_json(argc, argv);
ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
OSPF6_CMD_CHECK_RUNNING(ospf6);
- ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table);
+ ospf6_route_table_show(vty, 4, argc, argv, ospf6->route_table, uj);
return CMD_SUCCESS;
}