From: Donald Sharp Date: Thu, 7 Feb 2019 14:07:32 +0000 (-0500) Subject: sharpd: Add 'sharp data route" dump command X-Git-Tag: 7.1_pulled~267^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f59e641827dda277ddedf234d6389717ad53073d;p=matthieu%2Ffrr.git sharpd: Add 'sharp data route" dump command When you are using the install/remove routes command, the output goes to a log file. This command allows for ease of dump of timing information from the vty or vtysh. Signed-off-by: Donald Sharp --- diff --git a/doc/user/sharp.rst b/doc/user/sharp.rst index c2d32a718e..a0da6af4d4 100644 --- a/doc/user/sharp.rst +++ b/doc/user/sharp.rst @@ -56,6 +56,14 @@ keyword. At present, no sharp commands will be preserved in the config. log and when all routes have been successfully deleted the debug log will be updated with this information as well. +.. index:: sharp data route +.. clicmd:: sharp data route + + Allow end user doing route install and deletion to get timing information + from the vty or vtysh instead of having to read the log file. This command + is informational only and you should look at sharp_vty.c for explanation + of the output as that it may change. + .. index:: sharp label .. clicmd:: sharp label vrf NAME label (0-1000000) diff --git a/sharpd/sharp_globals.h b/sharpd/sharp_globals.h index d3c802af43..b0d35a91f2 100644 --- a/sharpd/sharp_globals.h +++ b/sharpd/sharp_globals.h @@ -42,6 +42,7 @@ struct sharp_routes { }; struct sharp_global { + /* Global data about route install/deletions */ struct sharp_routes r; }; diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index a8819932e9..36455a226d 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -79,6 +79,27 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd, return CMD_SUCCESS; } +DEFPY (install_routes_data_dump, + install_routes_data_dump_cmd, + "sharp data route", + "Sharp routing Protocol\n" + "Data about what is going on\n" + "Route Install/Removal Information\n") +{ + char buf[PREFIX_STRLEN]; + struct timeval r; + + timersub(&sg.r.t_end, &sg.r.t_start, &r); + vty_out(vty, "Prefix: %s Total: %u %u %u Time: %ld.%ld\n", + prefix2str(&sg.r.orig_prefix, buf, sizeof(buf)), + sg.r.total_routes, + sg.r.installed_routes, + sg.r.removed_routes, + r.tv_sec, r.tv_usec); + + return CMD_SUCCESS; +} + DEFPY (install_routes, install_routes_cmd, "sharp install routes |nexthop-group NAME$nexthop_group> (1-1000000)$routes [instance (0-255)$instance] [repeat (2-1000)$rpt]", @@ -235,6 +256,7 @@ DEFUN_NOSH (show_debugging_sharpd, void sharp_vty_init(void) { + install_element(ENABLE_NODE, &install_routes_data_dump_cmd); install_element(ENABLE_NODE, &install_routes_cmd); install_element(ENABLE_NODE, &remove_routes_cmd); install_element(ENABLE_NODE, &vrf_label_cmd);