summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorSumitAgarwal123 <sumit.agarwal@broadcom.com>2019-09-19 09:20:31 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-12-04 03:14:36 +0100
commitd67900330864165f7d340b29131b87795a3713e3 (patch)
tree5cece19256f7f904dc9ec6310d7fb1ddd2b4a841 /bfdd
parentbfdd: Adding new fields to display show bfd peer (diff)
downloadfrr-d67900330864165f7d340b29131b87795a3713e3.tar.xz
frr-d67900330864165f7d340b29131b87795a3713e3.zip
bfdd: Adding new cli, clear bfd counters
Adding new CLI clear bfd counters, This CLI wil only reset Rx/Tx counters, it will not reset session UP/DOWN and Zebra event count Signed-off-by: Sayed Mohd Saquib <sayed.saquib@broadcom.com>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfdd_vty.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c
index 9f6265bcc..ed48e3782 100644
--- a/bfdd/bfdd_vty.c
+++ b/bfdd/bfdd_vty.c
@@ -441,6 +441,16 @@ static void _display_peers_counter(struct vty *vty, char *vrfname, bool use_json
json_object_free(jo);
}
+static void _clear_peer_counter(struct bfd_session *bs)
+{
+ /* Clear only pkt stats, intention is not to loose system
+ events counters */
+ bs->stats.rx_ctrl_pkt = 0;
+ bs->stats.tx_ctrl_pkt = 0;
+ bs->stats.rx_echo_pkt = 0;
+ bs->stats.tx_echo_pkt = 0;
+}
+
static struct bfd_session *
_find_peer_or_error(struct vty *vty, int argc, struct cmd_token **argv,
const char *label, const char *peer_str,
@@ -602,6 +612,35 @@ DEFPY(bfd_show_peers_counters, bfd_show_peers_counters_cmd,
return CMD_SUCCESS;
}
+DEFPY(bfd_clear_peer_counters, bfd_clear_peer_counters_cmd,
+ "clear bfd [vrf <NAME$vrfname>] peer <WORD$label|<A.B.C.D|X:X::X:X>$peer [{multihop|local-address <A.B.C.D|X:X::X:X>$local|interface IFNAME$ifname}]> counters",
+ SHOW_STR
+ "Bidirection Forwarding Detection\n"
+ VRF_CMD_HELP_STR
+ "BFD peers status\n"
+ "Peer label\n"
+ PEER_IPV4_STR
+ PEER_IPV6_STR
+ MHOP_STR
+ LOCAL_STR
+ LOCAL_IPV4_STR
+ LOCAL_IPV6_STR
+ INTERFACE_STR
+ LOCAL_INTF_STR
+ "clear BFD peer counters information\n")
+{
+ struct bfd_session *bs;
+
+ /* Look up the BFD peer. */
+ bs = _find_peer_or_error(vty, argc, argv, label, peer_str, local_str,
+ ifname, vrfname);
+ if (bs == NULL)
+ return CMD_WARNING_CONFIG_FAILED;
+
+ _clear_peer_counter(bs);
+
+ return CMD_SUCCESS;
+}
/*
* Function definitions.
@@ -741,6 +780,7 @@ void bfdd_vty_init(void)
{
install_element(ENABLE_NODE, &bfd_show_peers_counters_cmd);
install_element(ENABLE_NODE, &bfd_show_peer_counters_cmd);
+ install_element(ENABLE_NODE, &bfd_clear_peer_counters_cmd);
install_element(ENABLE_NODE, &bfd_show_peers_cmd);
install_element(ENABLE_NODE, &bfd_show_peer_cmd);
install_element(ENABLE_NODE, &show_debugging_bfd_cmd);