* @param area IS-IS area
* @param level IS-IS level
*/
-static void show_node(struct vty *vty, struct isis_area *area, int level)
+static void show_node(struct vty *vty, struct isis_area *area, int level,
+ uint8_t algo)
{
struct isis_lsp *lsp;
struct ttable *tt;
+ char buf[128];
vty_out(vty, " IS-IS %s SR-Nodes:\n\n", circuit_t2string(level));
cap = lsp->tlvs->router_cap;
if (!cap)
continue;
+ if (cap->algo[algo] == SR_ALGORITHM_UNSET)
+ continue;
+
+ if (cap->algo[algo] == SR_ALGORITHM_SPF)
+ snprintf(buf, sizeof(buf), "SPF");
+ else if (cap->algo[algo] == SR_ALGORITHM_STRICT_SPF)
+ snprintf(buf, sizeof(buf), "S-SPF");
+#ifndef FABRICD
+ else
+ snprintf(buf, sizeof(buf), "Flex-Algo %d", algo);
+#endif /* ifndef FABRICD */
ttable_add_row(tt, "%pSY|%u - %u|%u - %u|%s|%u",
lsp->hdr.lsp_id, cap->srgb.lower_bound,
cap->srgb.lower_bound + cap->srgb.range_size - 1,
cap->srlb.lower_bound,
cap->srlb.lower_bound + cap->srlb.range_size - 1,
- cap->algo[0] == SR_ALGORITHM_SPF ? "SPF"
- : "S-SPF",
- cap->msd);
+ buf, cap->msd);
}
/* Dump the generated table. */
}
DEFUN(show_sr_node, show_sr_node_cmd,
- "show " PROTO_NAME " segment-routing node",
- SHOW_STR
- PROTO_HELP
+ "show " PROTO_NAME
+ " segment-routing node"
+#ifndef FABRICD
+ " [algorithm (128-255)]"
+#endif /* ifndef FABRICD */
+ ,
+ SHOW_STR PROTO_HELP
"Segment-Routing\n"
- "Segment-Routing node\n")
+ "Segment-Routing node\n"
+#ifndef FABRICD
+ "Show Flex-algo nodes\n"
+ "Algorithm number\n"
+#endif /* ifndef FABRICD */
+)
{
struct listnode *node, *inode;
struct isis_area *area;
+ uint8_t algorithm = SR_ALGORITHM_SPF;
struct isis *isis;
+#ifndef FABRICD
+ int idx = 0;
+
+ if (argv_find(argv, argc, "algorithm", &idx))
+ algorithm = (uint8_t)strtoul(argv[idx + 1]->arg, NULL, 10);
+#endif /* ifndef FABRICD */
for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) {
for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
}
for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS;
level++)
- show_node(vty, area, level);
+ show_node(vty, area, level, algorithm);
}
}