]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isisd.c
isisd: Provide statistics about sent/received PDU count
[mirror_frr.git] / isisd / isisd.c
index ce45ba65ece61f764b38513d10ad501cac77f223..bf0ea0493a92addf2241c80a4e49868e55953bb6 100644 (file)
@@ -720,6 +720,9 @@ void print_debug(struct vty *vty, int flags, int onoff)
                vty_out(vty,
                        "IS-IS Adjacency related packets debugging is %s\n",
                        onoffs);
+       if (flags & DEBUG_TX_QUEUE)
+               vty_out(vty, "IS-IS TX queue debugging is %s\n",
+                       onoffs);
        if (flags & DEBUG_SNP_PACKETS)
                vty_out(vty, "IS-IS CSNP/PSNP packets debugging is %s\n",
                        onoffs);
@@ -738,8 +741,8 @@ void print_debug(struct vty *vty, int flags, int onoff)
                vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs);
        if (flags & DEBUG_LSP_SCHED)
                vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs);
-       if (flags & DEBUG_FABRICD_FLOODING)
-               vty_out(vty, "OpenFabric Flooding debugging is %s\n", onoffs);
+       if (flags & DEBUG_FLOODING)
+               vty_out(vty, "IS-IS Flooding debugging is %s\n", onoffs);
        if (flags & DEBUG_BFD)
                vty_out(vty, "IS-IS BFD debugging is %s\n", onoffs);
 }
@@ -771,6 +774,10 @@ static int config_write_debug(struct vty *vty)
                vty_out(vty, "debug " PROTO_NAME " adj-packets\n");
                write++;
        }
+       if (flags & DEBUG_TX_QUEUE) {
+               vty_out(vty, "debug " PROTO_NAME " tx-queue\n");
+               write++;
+       }
        if (flags & DEBUG_SNP_PACKETS) {
                vty_out(vty, "debug " PROTO_NAME " snp-packets\n");
                write++;
@@ -803,7 +810,7 @@ static int config_write_debug(struct vty *vty)
                vty_out(vty, "debug " PROTO_NAME " lsp-sched\n");
                write++;
        }
-       if (flags & DEBUG_FABRICD_FLOODING) {
+       if (flags & DEBUG_FLOODING) {
                vty_out(vty, "debug " PROTO_NAME " flooding\n");
                write++;
        }
@@ -843,6 +850,60 @@ DEFUN (no_debug_isis_adj,
        return CMD_SUCCESS;
 }
 
+DEFUN (debug_isis_tx_queue,
+       debug_isis_tx_queue_cmd,
+       "debug " PROTO_NAME " tx-queue",
+       DEBUG_STR
+       PROTO_HELP
+       "IS-IS TX queues\n")
+{
+       isis->debugs |= DEBUG_TX_QUEUE;
+       print_debug(vty, DEBUG_TX_QUEUE, 1);
+
+       return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_isis_tx_queue,
+       no_debug_isis_tx_queue_cmd,
+       "no debug " PROTO_NAME " tx-queue",
+       NO_STR
+       UNDEBUG_STR
+       PROTO_HELP
+       "IS-IS TX queues\n")
+{
+       isis->debugs &= ~DEBUG_TX_QUEUE;
+       print_debug(vty, DEBUG_TX_QUEUE, 0);
+
+       return CMD_SUCCESS;
+}
+
+DEFUN (debug_isis_flooding,
+       debug_isis_flooding_cmd,
+       "debug " PROTO_NAME " flooding",
+       DEBUG_STR
+       PROTO_HELP
+       "Flooding algorithm\n")
+{
+       isis->debugs |= DEBUG_FLOODING;
+       print_debug(vty, DEBUG_FLOODING, 1);
+
+       return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_isis_flooding,
+       no_debug_isis_flooding_cmd,
+       "no debug " PROTO_NAME " flooding",
+       NO_STR
+       UNDEBUG_STR
+       PROTO_HELP
+       "Flooding algorithm\n")
+{
+       isis->debugs &= ~DEBUG_FLOODING;
+       print_debug(vty, DEBUG_FLOODING, 0);
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (debug_isis_snp,
        debug_isis_snp_cmd,
        "debug " PROTO_NAME " snp-packets",
@@ -1197,6 +1258,11 @@ DEFUN (show_isis_summary,
                        }
                }
 
+               vty_out(vty, "  TX counters per PDU type:\n");
+               pdu_counter_print(vty, "    ", area->pdu_tx_counters);
+               vty_out(vty, "  RX counters per PDU type:\n");
+               pdu_counter_print(vty, "    ", area->pdu_rx_counters);
+
                for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
                        if ((area->is_type & level) == 0)
                                continue;
@@ -1232,39 +1298,17 @@ DEFUN (show_isis_summary,
        return CMD_SUCCESS;
 }
 
-/*
- * This function supports following display options:
- * [ show isis database [detail] ]
- * [ show isis database <sysid> [detail] ]
- * [ show isis database <hostname> [detail] ]
- * [ show isis database <sysid>.<pseudo-id> [detail] ]
- * [ show isis database <hostname>.<pseudo-id> [detail] ]
- * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
- * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
- * [ show isis database detail <sysid> ]
- * [ show isis database detail <hostname> ]
- * [ show isis database detail <sysid>.<pseudo-id> ]
- * [ show isis database detail <hostname>.<pseudo-id> ]
- * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
- * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
- */
-static int show_isis_database(struct vty *vty, const char *argv, int ui_level)
+struct isis_lsp *lsp_for_arg(const char *argv, dict_t *lspdb)
 {
-       struct listnode *node;
-       struct isis_area *area;
-       struct isis_lsp *lsp;
-       struct isis_dynhn *dynhn;
-       const char *pos;
-       uint8_t lspid[ISIS_SYS_ID_LEN + 2];
-       char sysid[255];
+       char sysid[255] = {0};
        uint8_t number[3];
-       int level, lsp_count;
-
-       if (isis->area_list->count == 0)
-               return CMD_SUCCESS;
+       const char *pos;
+       uint8_t lspid[ISIS_SYS_ID_LEN + 2] = {0};
+       struct isis_dynhn *dynhn;
+       struct isis_lsp *lsp = NULL;
 
-       memset(&lspid, 0, ISIS_SYS_ID_LEN);
-       memset(&sysid, 0, 255);
+       if (!argv)
+               return NULL;
 
        /*
         * extract fragment and pseudo id from the string argv
@@ -1285,7 +1329,7 @@ static int show_isis_database(struct vty *vty, const char *argv, int ui_level)
                                (uint8_t)strtol((char *)number, NULL, 16);
                        pos -= 4;
                        if (strncmp(pos, ".", 1) != 0)
-                               return CMD_WARNING;
+                               return NULL;
                }
                if (strncmp(pos, ".", 1) == 0) {
                        memcpy(number, ++pos, 2);
@@ -1295,6 +1339,51 @@ static int show_isis_database(struct vty *vty, const char *argv, int ui_level)
                }
        }
 
+       /*
+        * Try to find the lsp-id if the argv
+        * string is in
+        * the form
+        * hostname.<pseudo-id>-<fragment>
+        */
+       if (sysid2buff(lspid, sysid)) {
+               lsp = lsp_search(lspid, lspdb);
+       } else if ((dynhn = dynhn_find_by_name(sysid))) {
+               memcpy(lspid, dynhn->id, ISIS_SYS_ID_LEN);
+               lsp = lsp_search(lspid, lspdb);
+       } else if (strncmp(cmd_hostname_get(), sysid, 15) == 0) {
+               memcpy(lspid, isis->sysid, ISIS_SYS_ID_LEN);
+               lsp = lsp_search(lspid, lspdb);
+       }
+
+       return lsp;
+}
+
+/*
+ * This function supports following display options:
+ * [ show isis database [detail] ]
+ * [ show isis database <sysid> [detail] ]
+ * [ show isis database <hostname> [detail] ]
+ * [ show isis database <sysid>.<pseudo-id> [detail] ]
+ * [ show isis database <hostname>.<pseudo-id> [detail] ]
+ * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
+ * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
+ * [ show isis database detail <sysid> ]
+ * [ show isis database detail <hostname> ]
+ * [ show isis database detail <sysid>.<pseudo-id> ]
+ * [ show isis database detail <hostname>.<pseudo-id> ]
+ * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
+ * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
+ */
+static int show_isis_database(struct vty *vty, const char *argv, int ui_level)
+{
+       struct listnode *node;
+       struct isis_area *area;
+       struct isis_lsp *lsp;
+       int level, lsp_count;
+
+       if (isis->area_list->count == 0)
+               return CMD_SUCCESS;
+
        for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
                vty_out(vty, "Area %s:\n",
                        area->area_tag ? area->area_tag : "null");
@@ -1302,35 +1391,7 @@ static int show_isis_database(struct vty *vty, const char *argv, int ui_level)
                for (level = 0; level < ISIS_LEVELS; level++) {
                        if (area->lspdb[level]
                            && dict_count(area->lspdb[level]) > 0) {
-                               lsp = NULL;
-                               if (argv != NULL) {
-                                       /*
-                                        * Try to find the lsp-id if the argv
-                                        * string is in
-                                        * the form
-                                        * hostname.<pseudo-id>-<fragment>
-                                        */
-                                       if (sysid2buff(lspid, sysid)) {
-                                               lsp = lsp_search(
-                                                       lspid,
-                                                       area->lspdb[level]);
-                                       } else if ((dynhn = dynhn_find_by_name(
-                                                           sysid))) {
-                                               memcpy(lspid, dynhn->id,
-                                                      ISIS_SYS_ID_LEN);
-                                               lsp = lsp_search(
-                                                       lspid,
-                                                       area->lspdb[level]);
-                                       } else if (strncmp(cmd_hostname_get(),
-                                                          sysid, 15)
-                                                  == 0) {
-                                               memcpy(lspid, isis->sysid,
-                                                      ISIS_SYS_ID_LEN);
-                                               lsp = lsp_search(
-                                                       lspid,
-                                                       area->lspdb[level]);
-                                       }
-                               }
+                               lsp = lsp_for_arg(argv, area->lspdb[level]);
 
                                if (lsp != NULL || argv == NULL) {
                                        vty_out(vty,
@@ -2061,6 +2122,10 @@ void isis_init()
 
        install_element(ENABLE_NODE, &debug_isis_adj_cmd);
        install_element(ENABLE_NODE, &no_debug_isis_adj_cmd);
+       install_element(ENABLE_NODE, &debug_isis_tx_queue_cmd);
+       install_element(ENABLE_NODE, &no_debug_isis_tx_queue_cmd);
+       install_element(ENABLE_NODE, &debug_isis_flooding_cmd);
+       install_element(ENABLE_NODE, &no_debug_isis_flooding_cmd);
        install_element(ENABLE_NODE, &debug_isis_snp_cmd);
        install_element(ENABLE_NODE, &no_debug_isis_snp_cmd);
        install_element(ENABLE_NODE, &debug_isis_upd_cmd);
@@ -2082,6 +2147,10 @@ void isis_init()
 
        install_element(CONFIG_NODE, &debug_isis_adj_cmd);
        install_element(CONFIG_NODE, &no_debug_isis_adj_cmd);
+       install_element(CONFIG_NODE, &debug_isis_tx_queue_cmd);
+       install_element(CONFIG_NODE, &no_debug_isis_tx_queue_cmd);
+       install_element(CONFIG_NODE, &debug_isis_flooding_cmd);
+       install_element(CONFIG_NODE, &no_debug_isis_flooding_cmd);
        install_element(CONFIG_NODE, &debug_isis_snp_cmd);
        install_element(CONFIG_NODE, &no_debug_isis_snp_cmd);
        install_element(CONFIG_NODE, &debug_isis_upd_cmd);