isisd: cleanup output of show isis topology

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2017-09-01 00:57:57 +02:00
parent ff228d2948
commit af88c591d1

View File

@ -1440,9 +1440,7 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue,
u_char *root_sysid) u_char *root_sysid)
{ {
struct listnode *node; struct listnode *node;
struct listnode *anode;
struct isis_vertex *vertex; struct isis_vertex *vertex;
struct isis_adjacency *adj;
char buff[PREFIX2STR_BUFFER]; char buff[PREFIX2STR_BUFFER];
vty_out(vty, vty_out(vty,
@ -1452,50 +1450,59 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue,
if (memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) { if (memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) {
vty_out(vty, "%-20s %-12s %-6s", vty_out(vty, "%-20s %-12s %-6s",
print_sys_hostname(root_sysid), "", ""); print_sys_hostname(root_sysid), "", "");
vty_out(vty, "%-30s", ""); vty_out(vty, "%-30s\n", "");
} else { continue;
int rows = 0;
vty_out(vty, "%-20s %-12s %-6u ",
vid2string(vertex, buff, sizeof(buff)),
vtype2string(vertex->type), vertex->d_N);
for (ALL_LIST_ELEMENTS_RO(vertex->Adj_N, anode, adj)) {
if (adj) {
if (rows) {
vty_out(vty, "\n");
vty_out(vty,
"%-20s %-12s %-6s ", "",
"", "");
}
vty_out(vty, "%-20s %-9s ",
print_sys_hostname(adj->sysid),
adj->circuit->interface->name);
++rows;
}
}
if (rows == 0)
vty_out(vty, "%-30s ", "");
} }
/* Print list of parents for the ECMP DAG */ int rows = 0;
if (listcount(vertex->parents) > 0) { struct listnode *anode = listhead(vertex->Adj_N);
struct listnode *pnode; struct listnode *pnode = listhead(vertex->parents);
struct isis_vertex *pvertex; struct isis_adjacency *adj;
int rows = 0; struct isis_vertex *pvertex;
for (ALL_LIST_ELEMENTS_RO(vertex->parents, pnode,
pvertex)) { vty_out(vty, "%-20s %-12s %-6u ",
if (rows) { vid2string(vertex, buff, sizeof(buff)),
vty_out(vty, "\n"); vtype2string(vertex->type), vertex->d_N);
vty_out(vty, "%-72s", ""); for (unsigned int i = 0;
} i < MAX(listcount(vertex->Adj_N),
listcount(vertex->parents)); i++) {
if (anode) {
adj = listgetdata(anode);
anode = anode->next;
} else {
adj = NULL;
}
if (pnode) {
pvertex = listgetdata(pnode);
pnode = pnode->next;
} else {
pvertex = NULL;
}
if (rows) {
vty_out(vty, "\n");
vty_out(vty, "%-20s %-12s %-6s ", "", "", "");
}
if (adj) {
vty_out(vty, "%-20s %-9s ",
print_sys_hostname(adj->sysid),
adj->circuit->interface->name);
}
if (pvertex) {
if (!adj)
vty_out(vty, "%-20s %-9s ", "", "");
vty_out(vty, "%s(%d)", vty_out(vty, "%s(%d)",
vid2string(pvertex, buff, sizeof(buff)), vid2string(pvertex, buff,
sizeof(buff)),
pvertex->type); pvertex->type);
++rows;
} }
} else {
vty_out(vty, " NULL ");
}
++rows;
}
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
} }