]> git.puffer.fish Git - matthieu/frr.git/commitdiff
fabricd: add flooding algorithm debugging
authorChristian Franke <chris@opensourcerouting.org>
Wed, 25 Jul 2018 09:01:59 +0000 (11:01 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Wed, 5 Sep 2018 09:38:13 +0000 (11:38 +0200)
Add a command `debug openfabric flooding` to allow verification of
correct operation of the OpenFabric flooding optimization algorithm.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
isisd/fabricd.c
isisd/isis_spf.c
isisd/isis_spf.h
isisd/isis_spf_private.h
isisd/isis_vty_fabricd.c
isisd/isisd.c
isisd/isisd.h

index 95718f3bdd06f265caab439dc7da20cbc594ce8e..88ecdf2a7b08ea017874131d47c7a7a83ea56e0c 100644 (file)
@@ -491,6 +491,13 @@ static void move_to_dnr(struct isis_lsp *lsp, struct neighbor_entry *n)
        struct isis_adjacency *adj = listnode_head(n->vertex->Adj_N);
 
        n->present = false;
+
+       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               char buff[PREFIX2STR_BUFFER];
+               zlog_debug("OpenFabric: Adding %s to DNR",
+                          vid2string(n->vertex, buff, sizeof(buff)));
+       }
+
        if (adj) {
                isis_tx_queue_add(adj->circuit->tx_queue, lsp,
                                  TX_LSP_CIRCUIT_SCOPED);
@@ -502,6 +509,13 @@ static void move_to_rf(struct isis_lsp *lsp, struct neighbor_entry *n)
        struct isis_adjacency *adj = listnode_head(n->vertex->Adj_N);
 
        n->present = false;
+
+       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               char buff[PREFIX2STR_BUFFER];
+               zlog_debug("OpenFabric: Adding %s to RF",
+                          vid2string(n->vertex, buff, sizeof(buff)));
+       }
+
        if (adj) {
                isis_tx_queue_add(adj->circuit->tx_queue, lsp,
                                  TX_LSP_NORMAL);
@@ -524,12 +538,24 @@ static void handle_firsthops(struct hash_backet *backet, void *arg)
        struct neighbor_entry *n;
 
        n = neighbor_entry_lookup_list(f->neighbors, vertex->N.id);
-       if (n)
+       if (n) {
+               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                       char buff[PREFIX2STR_BUFFER];
+                       zlog_debug("Removing %s from NL as its in the reverse path",
+                                  vid2string(vertex, buff, sizeof(buff)));
+               }
                n->present = false;
+       }
 
        n = neighbor_entry_lookup_hash(f->neighbors_neighbors, vertex->N.id);
-       if (n)
+       if (n) {
+               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                       char buff[PREFIX2STR_BUFFER];
+                       zlog_debug("Removing %s from NN as its in the reverse path",
+                                  vid2string(vertex, buff, sizeof(buff)));
+               }
                n->present = false;
+       }
 }
 
 void fabricd_lsp_flood(struct isis_lsp *lsp)
@@ -540,6 +566,11 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
        void *cursor = NULL;
        struct neighbor_entry *n;
 
+       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               zlog_debug("OpenFabric: Flooding LSP %s",
+                          rawlspid_print(lsp->hdr.lsp_id));
+       }
+
        /* Mark all elements in NL as present and move T0s into DNR */
        while (!skiplist_next(f->neighbors, NULL, (void **)&n, &cursor)) {
                n->present = true;
@@ -552,6 +583,11 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                    || lsp->tlvs->spine_leaf->tier != 0)
                        continue;
 
+               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                       zlog_debug("Moving %s to DNR because it's T0",
+                                  rawlspid_print(lsp->hdr.lsp_id));
+               }
+
                move_to_dnr(lsp, n);
        }
 
@@ -575,10 +611,22 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
 
                struct isis_lsp *nlsp = lsp_for_vertex(f->spftree, n->vertex);
                if (!nlsp || !nlsp->tlvs) {
+                       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                               char buff[PREFIX2STR_BUFFER];
+                               zlog_debug("Moving %s to DNR as it has no LSP",
+                                          vid2string(n->vertex, buff, sizeof(buff)));
+                       }
+
                        move_to_dnr(lsp, n);
                        continue;
                }
 
+               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                       char buff[PREFIX2STR_BUFFER];
+                       zlog_debug("Considering %s from NL...",
+                                  vid2string(n->vertex, buff, sizeof(buff)));
+               }
+
                /* For all neighbors of the NL IS check whether they are present
                 * in NN. If yes, remove from NN and set need_reflood. */
                bool need_reflood = false;
@@ -591,6 +639,12 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                                                        er->id);
 
                        if (nn) {
+                               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                                       char buff[PREFIX2STR_BUFFER];
+                                       zlog_debug("Found neighbor %s in NN, removing it from NN and setting reflood.",
+                                                  vid2string(nn->vertex, buff, sizeof(buff)));
+                               }
+
                                nn->present = false;
                                need_reflood = true;
                        }
@@ -601,4 +655,8 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                else
                        move_to_dnr(lsp, n);
        }
+
+       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               zlog_debug("OpenFabric: Flooding algorithm complete.");
+       }
 }
index 225ef22ec10a25678cefd4e6431fdf7db8dbf8c6..25e2d43cea760e8e1c5cece2192096688ae8bd8e 100644 (file)
@@ -162,8 +162,7 @@ static const char *vtype2string(enum vertextype vtype)
        return NULL; /* Not reached */
 }
 
-#define VID2STR_BUFFER SRCDEST2STR_BUFFER
-static const char *vid2string(struct isis_vertex *vertex, char *buff, int size)
+const char *vid2string(struct isis_vertex *vertex, char *buff, int size)
 {
        if (VTYPE_IS(vertex->type) || VTYPE_ES(vertex->type)) {
                return print_sys_hostname(vertex->N.id);
index 0532bd5465fe8c4f680f9cc4b131561869275b32..f4db98cfed532af958e56671be8aba600e97ca07 100644 (file)
@@ -40,5 +40,4 @@ void isis_spf_print(struct isis_spftree *spftree, struct vty *vty);
 struct isis_spftree *isis_run_hopcount_spf(struct isis_area *area,
                                           uint8_t *sysid,
                                           struct isis_spftree *spftree);
-
 #endif /* _ZEBRA_ISIS_SPF_H */
index 2c6514d470b48a4c3cf7f3617d188196acbf4e2b..2e33367e21d366a8aa2b69e10adf94a4c3f0cb96 100644 (file)
@@ -354,4 +354,7 @@ static struct isis_lsp *lsp_for_vertex(struct isis_spftree *spftree,
        return NULL;
 }
 
+#define VID2STR_BUFFER SRCDEST2STR_BUFFER
+const char *vid2string(struct isis_vertex *vertex, char *buff, int size);
+
 #endif
index 5ef3af0f19d204d33f2147ba42034fa17178351c..95ebe0de81dd23b3a478d0de61b0b8408424647d 100644 (file)
@@ -55,8 +55,40 @@ DEFUN (no_fabric_tier,
        return CMD_SUCCESS;
 }
 
+DEFUN (debug_fabric_flooding,
+       debug_fabric_flooding_cmd,
+       "debug openfabric flooding",
+       DEBUG_STR
+       PROTO_HELP
+       "Flooding optimization algorithm\n")
+{
+       isis->debugs |= DEBUG_FABRICD_FLOODING;
+       print_debug(vty, DEBUG_FABRICD_FLOODING, 1);
+
+       return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_fabric_flooding,
+       no_debug_fabric_flooding_cmd,
+       "no debug openfabric flooding",
+       NO_STR
+       UNDEBUG_STR
+       PROTO_HELP
+       "Flooding optimization algorithm\n")
+{
+       isis->debugs &= ~DEBUG_FABRICD_FLOODING;
+       print_debug(vty, DEBUG_FABRICD_FLOODING, 0);
+
+       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, &debug_fabric_flooding_cmd);
+       install_element(ENABLE_NODE, &no_debug_fabric_flooding_cmd);
+       install_element(CONFIG_NODE, &debug_fabric_flooding_cmd);
+       install_element(CONFIG_NODE, &no_debug_fabric_flooding_cmd);
 }
index 84f44b1648b985c3246d64cd8eba5fd314df1bce..640bd69ce4536c4c14786130aea77e5756f0c43d 100644 (file)
@@ -744,6 +744,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);
 }
 
 DEFUN_NOSH (show_debugging,
@@ -825,6 +827,10 @@ static int config_write_debug(struct vty *vty)
                vty_out(vty, "debug " PROTO_NAME " lsp-sched\n");
                write++;
        }
+       if (flags & DEBUG_FABRICD_FLOODING) {
+               vty_out(vty, "debug " PROTO_NAME " flooding\n");
+               write++;
+       }
        write += spf_backoff_write_config(vty);
 
        return write;
index 0e75b870a5e03d2f6a4213895f4de3aeda16a1ee..cc5def8f56f2a048bed160f68f2f8fa59f793308 100644 (file)
@@ -209,6 +209,7 @@ extern struct thread_master *master;
 #define DEBUG_PACKET_DUMP                (1<<12)
 #define DEBUG_LSP_GEN                    (1<<13)
 #define DEBUG_LSP_SCHED                  (1<<14)
+#define DEBUG_FABRICD_FLOODING           (1<<15)
 
 #define lsp_debug(...)                                                         \
        do {                                                                   \