forked from Mirror/frr
lib: Add clear route-map counters [WORD]
command
This will allow the end-user to clear the counters associated with the route-map. Subsuquent `show route-map ..` commands will display counters since the last clear. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
67e42128db
commit
1fa305095a
|
@ -85,6 +85,23 @@ deny
|
||||||
cont
|
cont
|
||||||
goto next route-map entry
|
goto next route-map entry
|
||||||
|
|
||||||
|
.. _route-map-show-command:
|
||||||
|
|
||||||
|
.. index:: show route-map [WORD]
|
||||||
|
.. clicmd:: show route-map [WORD]
|
||||||
|
|
||||||
|
Display data about each daemons knowledge of individual route-maps.
|
||||||
|
If WORD is supplied narrow choice to that particular route-map.
|
||||||
|
|
||||||
|
.. _route-map-clear-counter-command:
|
||||||
|
|
||||||
|
.. index:: clear route-map counter [WORD]
|
||||||
|
.. clicmd:: clear route-map counter [WORD]
|
||||||
|
|
||||||
|
Clear counters that are being stored about the route-map utilization
|
||||||
|
so that subsuquent show commands will indicate since the last clear.
|
||||||
|
If WORD is specified clear just that particular route-map's counters.
|
||||||
|
|
||||||
.. _route-map-command:
|
.. _route-map-command:
|
||||||
|
|
||||||
Route Map Command
|
Route Map Command
|
||||||
|
@ -315,6 +332,7 @@ Route Map Exit Action Command
|
||||||
|
|
||||||
Proceed processing the route-map at the first entry whose order is >= N
|
Proceed processing the route-map at the first entry whose order is >= N
|
||||||
|
|
||||||
|
|
||||||
Route Map Examples
|
Route Map Examples
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
|
@ -960,12 +960,12 @@ static void vty_show_route_map_entry(struct vty *vty, struct route_map *map)
|
||||||
struct route_map_rule *rule;
|
struct route_map_rule *rule;
|
||||||
|
|
||||||
vty_out(vty, "route-map: %s Invoked: %" PRIu64 "\n",
|
vty_out(vty, "route-map: %s Invoked: %" PRIu64 "\n",
|
||||||
map->name, map->applied);
|
map->name, map->applied - map->applied_clear);
|
||||||
|
|
||||||
for (index = map->head; index; index = index->next) {
|
for (index = map->head; index; index = index->next) {
|
||||||
vty_out(vty, " %s, sequence %d Invoked %" PRIu64 "\n",
|
vty_out(vty, " %s, sequence %d Invoked %" PRIu64 "\n",
|
||||||
route_map_type_str(index->type), index->pref,
|
route_map_type_str(index->type), index->pref,
|
||||||
index->applied);
|
index->applied - index->applied_clear);
|
||||||
|
|
||||||
/* Description */
|
/* Description */
|
||||||
if (index->description)
|
if (index->description)
|
||||||
|
@ -2956,6 +2956,46 @@ DEFUN (no_rmap_continue,
|
||||||
return no_rmap_onmatch_goto(self, vty, argc, argv);
|
return no_rmap_onmatch_goto(self, vty, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clear_route_map_helper(struct route_map *map)
|
||||||
|
{
|
||||||
|
struct route_map_index *index;
|
||||||
|
|
||||||
|
map->applied_clear = map->applied;
|
||||||
|
for (index = map->head; index; index = index->next)
|
||||||
|
index->applied_clear = index->applied;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (rmap_clear_counters,
|
||||||
|
rmap_clear_counters_cmd,
|
||||||
|
"clear route-map counters [WORD]",
|
||||||
|
CLEAR_STR
|
||||||
|
"route-map information\n"
|
||||||
|
"counters associated with the specified route-map\n"
|
||||||
|
"route-map name\n")
|
||||||
|
{
|
||||||
|
int idx_word = 2;
|
||||||
|
struct route_map *map;
|
||||||
|
|
||||||
|
const char *name = (argc == 3 ) ? argv[idx_word]->arg : NULL;
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
map = route_map_lookup_by_name(name);
|
||||||
|
|
||||||
|
if (map)
|
||||||
|
clear_route_map_helper(map);
|
||||||
|
else {
|
||||||
|
vty_out(vty, "%s: 'route-map %s' not found\n",
|
||||||
|
frr_protonameinst, name);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (map = route_map_master.head; map; map = map->next)
|
||||||
|
clear_route_map_helper(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN (rmap_show_name,
|
DEFUN (rmap_show_name,
|
||||||
rmap_show_name_cmd,
|
rmap_show_name_cmd,
|
||||||
|
@ -3291,6 +3331,8 @@ void route_map_init(void)
|
||||||
install_element(RMAP_NODE, &no_rmap_description_cmd);
|
install_element(RMAP_NODE, &no_rmap_description_cmd);
|
||||||
|
|
||||||
/* Install show command */
|
/* Install show command */
|
||||||
|
install_element(ENABLE_NODE, &rmap_clear_counters_cmd);
|
||||||
|
|
||||||
install_element(ENABLE_NODE, &rmap_show_name_cmd);
|
install_element(ENABLE_NODE, &rmap_show_name_cmd);
|
||||||
install_element(ENABLE_NODE, &rmap_show_unused_cmd);
|
install_element(ENABLE_NODE, &rmap_show_unused_cmd);
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,7 @@ struct route_map_index {
|
||||||
|
|
||||||
/* Keep track how many times we've try to apply */
|
/* Keep track how many times we've try to apply */
|
||||||
uint64_t applied;
|
uint64_t applied;
|
||||||
|
uint64_t applied_clear;
|
||||||
|
|
||||||
QOBJ_FIELDS
|
QOBJ_FIELDS
|
||||||
};
|
};
|
||||||
|
@ -177,6 +178,7 @@ struct route_map {
|
||||||
|
|
||||||
/* How many times have we applied this route-map */
|
/* How many times have we applied this route-map */
|
||||||
uint64_t applied;
|
uint64_t applied;
|
||||||
|
uint64_t applied_clear;
|
||||||
|
|
||||||
/* Counter to track active usage of this route-map */
|
/* Counter to track active usage of this route-map */
|
||||||
uint16_t use_count;
|
uint16_t use_count;
|
||||||
|
|
Loading…
Reference in a new issue