diff options
Diffstat (limited to 'isisd/isis_vty_fabricd.c')
-rw-r--r-- | isisd/isis_vty_fabricd.c | 85 |
1 files changed, 81 insertions, 4 deletions
diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c index 5ef3af0f1..72ee2ac92 100644 --- a/isisd/isis_vty_fabricd.c +++ b/isisd/isis_vty_fabricd.c @@ -23,10 +23,12 @@ #include "command.h" -#include "isisd.h" -#include "isis_vty_common.h" -#include "fabricd.h" -#include "isis_tlvs.h" +#include "isisd/isisd.h" +#include "isisd/isis_vty_common.h" +#include "isisd/fabricd.h" +#include "isisd/isis_tlvs.h" +#include "isisd/isis_misc.h" +#include "isisd/isis_lsp.h" DEFUN (fabric_tier, fabric_tier_cmd, @@ -55,8 +57,83 @@ DEFUN (no_fabric_tier, return CMD_SUCCESS; } +static void lsp_print_flooding(struct vty *vty, struct isis_lsp *lsp) +{ + char lspid[255]; + + lspid_print(lsp->hdr.lsp_id, lspid, true, true); + vty_out(vty, "Flooding information for %s\n", lspid); + + if (!lsp->flooding_neighbors[TX_LSP_NORMAL]) { + vty_out(vty, " Never flooded.\n"); + return; + } + + vty_out(vty, " Last received on: %s\n", + lsp->flooding_interface ? + lsp->flooding_interface : "(null)"); + + for (enum isis_tx_type type = TX_LSP_NORMAL; + type <= TX_LSP_CIRCUIT_SCOPED; type++) { + struct listnode *node; + uint8_t *neighbor_id; + + vty_out(vty, " %s:\n", + (type == TX_LSP_NORMAL) ? "RF" : "DNR"); + for (ALL_LIST_ELEMENTS_RO(lsp->flooding_neighbors[type], + node, neighbor_id)) { + vty_out(vty, " %s\n", + print_sys_hostname(neighbor_id)); + } + } +} + +DEFUN (show_lsp_flooding, + show_lsp_flooding_cmd, + "show openfabric flooding [WORD]", + SHOW_STR + PROTO_HELP + "Flooding information\n" + "LSP ID\n") +{ + const char *lspid = NULL; + + if (argc == 4) { + lspid = argv[3]->arg; + } + + struct listnode *node; + struct isis_area *area; + + for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { + dict_t *lspdb = area->lspdb[ISIS_LEVEL2 - 1]; + + vty_out(vty, "Area %s:\n", area->area_tag ? + area->area_tag : "null"); + + if (lspid) { + struct isis_lsp *lsp = lsp_for_arg(lspid, lspdb); + + if (lsp) + lsp_print_flooding(vty, lsp); + + continue; + } + + for (dnode_t *dnode = dict_first(lspdb); dnode; + dnode = dict_next(lspdb, dnode)) { + lsp_print_flooding(vty, dnode_get(dnode)); + vty_out(vty, "\n"); + } + } + + return CMD_SUCCESS; +} + void isis_vty_daemon_init(void) { install_element(ROUTER_NODE, &fabric_tier_cmd); install_element(ROUTER_NODE, &no_fabric_tier_cmd); + + install_element(ENABLE_NODE, &show_lsp_flooding_cmd); } |