]> git.puffer.fish Git - matthieu/frr.git/commitdiff
sharpd: Add 'sharp data route" dump command
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 7 Feb 2019 14:07:32 +0000 (09:07 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 7 Feb 2019 15:14:17 +0000 (10:14 -0500)
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 <sharpd@cumulusnetworks.com>
doc/user/sharp.rst
sharpd/sharp_globals.h
sharpd/sharp_vty.c

index c2d32a718e59dd6329332b68987498c7db3dc8fe..a0da6af4d463b4e98c1b0001da91c4fa17547dbc 100644 (file)
@@ -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 <ipv4|ipv6> vrf NAME label (0-1000000)
 
index d3c802af43ad87ffeb6feef7c89b018705910099..b0d35a91f2d1e20f3d94f8067c994663118fac2d 100644 (file)
@@ -42,6 +42,7 @@ struct sharp_routes {
 };
 
 struct sharp_global {
+       /* Global data about route install/deletions */
        struct sharp_routes r;
 };
 
index a8819932e95c96ed581eca05d2a1bf0bfe822a7c..36455a226d739bf4adf7b2b3dd6e643b0709c18a 100644 (file)
@@ -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 <A.B.C.D$start4|X:X::X:X$start6> <nexthop <A.B.C.D$nexthop4|X:X::X:X$nexthop6>|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);