Skip to content

Commit

Permalink
ospf6d: Json support added for command "show ipv6 ospf6 neighbor [json]"
Browse files Browse the repository at this point in the history
Modify code to add JSON format output in show command
"show ipv6 ospf6 neighbor" with proper formating

Signed-off-by: Yash Ranjan <[email protected]>
  • Loading branch information
YashRanjanVMWare committed Nov 5, 2020
1 parent dc7b85a commit 6a5bb30
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 114 deletions.
7 changes: 4 additions & 3 deletions doc/user/ospf6d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ Showing OSPF6 information

To see OSPF interface configuration like costs.

.. index:: show ipv6 ospf6 neighbor
.. clicmd:: show ipv6 ospf6 neighbor
.. index:: show ipv6 ospf6 neighbor [json]
.. clicmd:: show ipv6 ospf6 neighbor [json]

Shows state and chosen (Backup) DR of neighbor.
Shows state and chosen (Backup) DR of neighbor. JSON output can be
obtained by appending 'json' at the end.

.. index:: show ipv6 ospf6 request-list A.B.C.D
.. clicmd:: show ipv6 ospf6 request-list A.B.C.D
Expand Down
5 changes: 3 additions & 2 deletions ospf6d/ospf6_bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ void ospf6_bfd_info_free(void **bfd_info)
/*
* ospf6_bfd_show_info - Show BFD info structure
*/
void ospf6_bfd_show_info(struct vty *vty, void *bfd_info, int param_only)
void ospf6_bfd_show_info(struct vty *vty, void *bfd_info, int param_only,
json_object *json_obj, bool use_json)
{
if (param_only)
bfd_show_param(vty, bfd_info, 1, 0, 0, NULL);
else
bfd_show_info(vty, bfd_info, 0, 1, 0, NULL);
bfd_show_info(vty, bfd_info, 0, 1, use_json, json_obj);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions ospf6d/ospf6_bfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "lib/json.h"
#ifndef OSPF6_BFD_H
#define OSPF6_BFD_H

Expand All @@ -35,8 +35,8 @@ extern void ospf6_bfd_info_nbr_create(struct ospf6_interface *oi,

extern void ospf6_bfd_info_free(void **bfd_info);

extern void ospf6_bfd_show_info(struct vty *vty, void *bfd_info,
int param_only);
extern void ospf6_bfd_show_info(struct vty *vty, void *bfd_info, int param_only,
json_object *json_obj, bool use_json);

extern void ospf6_bfd_reg_dereg_nbr(struct ospf6_neighbor *on, int command);
#endif /* OSPF6_BFD_H */
2 changes: 1 addition & 1 deletion ospf6d/ospf6_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
(oi->thread_send_lsack ? "on" : "off"));
for (ALL_LSDB(oi->lsack_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name);
ospf6_bfd_show_info(vty, oi->bfd_info, 1);
ospf6_bfd_show_info(vty, oi->bfd_info, 1, NULL, false);
return 0;
}

Expand Down
Loading

0 comments on commit 6a5bb30

Please sign in to comment.