Skip to content

Commit

Permalink
zebra: dump label table information
Browse files Browse the repository at this point in the history
Add the new command "show debugging labeltable" to show allocated label
chunks in the lablel table managed with label_manager.c

Signed-off-by: Farid Mihoub <[email protected]>
  • Loading branch information
FRIDM636 committed Dec 2, 2022
1 parent 3056025 commit 87ddd3c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions zebra/label_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "lib/stream.h"
#include "lib/zclient.h"
#include "lib/libfrr.h"
#include "lib/vty.h"

//#include "zebra/zserv.h"
#include "zebra/zebra_router.h"
Expand Down Expand Up @@ -158,6 +159,21 @@ void lm_hooks_unregister(void)
hook_unregister(lm_release_chunk, label_manager_release_label_chunk);
}

DEFUN(show_label_table, show_label_table_cmd, "show debugging labeltable",
SHOW_STR DEBUG_STR "Display LABLE Chunks allocated\n")
{
struct label_manager_chunk *lmc;
struct listnode *node;

for (ALL_LIST_ELEMENTS_RO(lbl_mgr.lc_list, node, lmc)) {
vty_out(vty, "Proto %s: [%u/%u]\n",
zebra_route_string(lmc->proto), lmc->start, lmc->end);
}

return CMD_SUCCESS;
}


/**
* Init label manager (or proxy to an external one)
*/
Expand All @@ -172,6 +188,8 @@ void label_manager_init(void)

/* notify any external module that we are done */
hook_call(lm_cbs_inited);

install_element(VIEW_NODE, &show_label_table_cmd);
}

/* alloc and fill a label chunk */
Expand Down
1 change: 1 addition & 0 deletions zebra/subdir.am
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ clippy_scan += \
zebra/zebra_srv6_vty.c \
zebra/zebra_vrf.c \
zebra/dpdk/zebra_dplane_dpdk_vty.c \
zebra/label_manager.c \
# end

noinst_HEADERS += \
Expand Down

0 comments on commit 87ddd3c

Please sign in to comment.