]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: Json support added for command "show ipv6 ospf6 interface prefix [json]"
authorYash Ranjan <ranjany@vmware.com>
Mon, 25 Jan 2021 10:51:39 +0000 (02:51 -0800)
committerYash Ranjan <ranjany@vmware.com>
Wed, 27 Jan 2021 04:06:02 +0000 (20:06 -0800)
Modify code to add JSON format output in show command
"show ipv6 ospf6 interface prefix" with proper formating

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
doc/user/ospf6d.rst
ospf6d/ospf6_interface.c

index 9d1c2e0b9d07d8a97061566d37d4d1b82a59e85a..d518409d83b49e0753dd71fbf1404aad89fffe87 100644 (file)
@@ -255,6 +255,13 @@ Showing OSPF6 information
    The additional match option will match the given address to the destination
    of the routes, and return the result accordingly.
 
+.. index:: show ipv6 ospf6 interface [IFNAME] prefix [detail|<X:X::X:X|X:X::X:X/M> [<match|detail>]] [json]
+.. clicmd:: show ipv6 ospf6 interface [IFNAME] prefix [detail|<X:X::X:X|X:X::X:X/M> [<match|detail>]] [json]
+
+   This command shows the prefixes present in the interface routing table.
+   Interface name can also be given. JSON output can be obtained by appending
+   'json' to the end of command.
+
 OSPF6 Configuration Examples
 ============================
 
index fd5878921257109a6d1acacabb6b6ab324d1a2a2..0cc3bd2cc95b8b7dc5b3e1dbfb392072494ec1d7 100644 (file)
@@ -1416,7 +1416,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
           [<\
            detail\
            |<X:X::X:X|X:X::X:X/M> [<match|detail>]\
-         >]",
+         >] [json]",
        SHOW_STR
        IP6_STR
        OSPF6_STR
@@ -1427,12 +1427,14 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
        OSPF6_ROUTE_ADDRESS_STR
        OSPF6_ROUTE_PREFIX_STR
        OSPF6_ROUTE_MATCH_STR
-       "Display details of the prefixes\n")
+       "Display details of the prefixes\n"
+       JSON_STR)
 {
        int idx_ifname = 4;
        int idx_prefix = 6;
        struct interface *ifp;
        struct ospf6_interface *oi;
+       bool uj = use_json(argc, argv);
 
        ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
        if (ifp == NULL) {
@@ -1448,7 +1450,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
        }
 
        ospf6_route_table_show(vty, idx_prefix, argc, argv, oi->route_connected,
-                              false);
+                              uj);
 
        return CMD_SUCCESS;
 }
@@ -1459,7 +1461,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix,
           [<\
            detail\
            |<X:X::X:X|X:X::X:X/M> [<match|detail>]\
-         >]",
+         >] [json]",
        SHOW_STR
        IP6_STR
        OSPF6_STR
@@ -1469,12 +1471,14 @@ DEFUN (show_ipv6_ospf6_interface_prefix,
        OSPF6_ROUTE_ADDRESS_STR
        OSPF6_ROUTE_PREFIX_STR
        OSPF6_ROUTE_MATCH_STR
-       "Display details of the prefixes\n")
+       "Display details of the prefixes\n"
+       JSON_STR)
 {
        struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
        int idx_prefix = 5;
        struct ospf6_interface *oi;
        struct interface *ifp;
+       bool uj = use_json(argc, argv);
 
        FOR_ALL_INTERFACES (vrf, ifp) {
                oi = (struct ospf6_interface *)ifp->info;
@@ -1482,7 +1486,7 @@ DEFUN (show_ipv6_ospf6_interface_prefix,
                        continue;
 
                ospf6_route_table_show(vty, idx_prefix, argc, argv,
-                                      oi->route_connected, false);
+                                      oi->route_connected, uj);
        }
 
        return CMD_SUCCESS;