2 * Copyright (c) 2004-2008 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2007 Xsigo Systems Inc. All rights reserved.
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37 #endif /* HAVE_CONFIG_H */
50 #include <infiniband/common.h>
51 #include <infiniband/umad.h>
52 #include <infiniband/mad.h>
53 #include <infiniband/complib/cl_nodenamemap.h>
55 #include "ibnetdiscover.h"
57 #include "ibdiag_common.h"
59 static char *node_type_str[] = {
67 static char *linkwidth_str[] = {
79 static char *linkspeed_str[] = {
87 static int timeout = 2000; /* ms */
88 static int dumplevel = 0;
92 char *argv0 = "ibnetdiscover";
94 static char *node_name_map_file = NULL;
95 static nn_map_t *node_name_map = NULL;
97 Node *nodesdist[MAXHOPS+1]; /* last is Ca list */
99 int maxhops_discovered = 0;
101 struct ChassisList *chassis = NULL;
104 get_linkwidth_str(int linkwidth)
107 return linkwidth_str[0];
109 return linkwidth_str[linkwidth];
113 get_linkspeed_str(int linkspeed)
116 return linkspeed_str[0];
118 return linkspeed_str[linkspeed];
121 static inline const char*
122 node_type_str2(Node *node)
125 case SWITCH_NODE: return "SW";
126 case CA_NODE: return "CA";
127 case ROUTER_NODE: return "RT";
133 decode_port_info(void *pi, Port *port)
135 mad_decode_field(pi, IB_PORT_LID_F, &port->lid);
136 mad_decode_field(pi, IB_PORT_LMC_F, &port->lmc);
137 mad_decode_field(pi, IB_PORT_STATE_F, &port->state);
138 mad_decode_field(pi, IB_PORT_PHYS_STATE_F, &port->physstate);
139 mad_decode_field(pi, IB_PORT_LINK_WIDTH_ACTIVE_F, &port->linkwidth);
140 mad_decode_field(pi, IB_PORT_LINK_SPEED_ACTIVE_F, &port->linkspeed);
145 get_port(Port *port, int portnum, ib_portid_t *portid)
150 port->portnum = portnum;
152 if (!smp_query(pi, portid, IB_ATTR_PORT_INFO, portnum, timeout))
154 decode_port_info(pi, port);
156 DEBUG("portid %s portnum %d: lid %d state %d physstate %d %s %s",
157 portid2str(portid), portnum, port->lid, port->state, port->physstate, get_linkwidth_str(port->linkwidth), get_linkspeed_str(port->linkspeed));
161 * Returns 0 if non switch node is found, 1 if switch is found, -1 if error.
164 get_node(Node *node, Port *port, ib_portid_t *portid)
168 void *pi = portinfo, *ni = node->nodeinfo, *nd = node->nodedesc;
169 void *si = switchinfo;
171 if (!smp_query(ni, portid, IB_ATTR_NODE_INFO, 0, timeout))
174 mad_decode_field(ni, IB_NODE_GUID_F, &node->nodeguid);
175 mad_decode_field(ni, IB_NODE_TYPE_F, &node->type);
176 mad_decode_field(ni, IB_NODE_NPORTS_F, &node->numports);
177 mad_decode_field(ni, IB_NODE_DEVID_F, &node->devid);
178 mad_decode_field(ni, IB_NODE_VENDORID_F, &node->vendid);
179 mad_decode_field(ni, IB_NODE_SYSTEM_GUID_F, &node->sysimgguid);
180 mad_decode_field(ni, IB_NODE_PORT_GUID_F, &node->portguid);
181 mad_decode_field(ni, IB_NODE_LOCAL_PORT_F, &node->localport);
182 port->portnum = node->localport;
183 port->portguid = node->portguid;
185 if (!smp_query(nd, portid, IB_ATTR_NODE_DESC, 0, timeout))
188 if (!smp_query(pi, portid, IB_ATTR_PORT_INFO, 0, timeout))
190 decode_port_info(pi, port);
192 if (node->type != SWITCH_NODE)
195 node->smalid = port->lid;
196 node->smalmc = port->lmc;
198 /* after we have the sma information find out the real PortInfo for this port */
199 if (!smp_query(pi, portid, IB_ATTR_PORT_INFO, node->localport, timeout))
201 decode_port_info(pi, port);
203 if (!smp_query(si, portid, IB_ATTR_SWITCH_INFO, 0, timeout))
204 node->smaenhsp0 = 0; /* assume base SP0 */
206 mad_decode_field(si, IB_SW_ENHANCED_PORT0_F, &node->smaenhsp0);
208 DEBUG("portid %s: got switch node %" PRIx64 " '%s'",
209 portid2str(portid), node->nodeguid, node->nodedesc);
214 extend_dpath(ib_dr_path_t *path, int nextport)
216 if (path->cnt+2 >= sizeof(path->p))
219 if (path->cnt > maxhops_discovered)
220 maxhops_discovered = path->cnt;
221 path->p[path->cnt] = nextport;
226 dump_endnode(ib_portid_t *path, char *prompt, Node *node, Port *port)
231 fprintf(f, "%s -> %s %s {%016" PRIx64 "} portnum %d lid %d-%d\"%s\"\n",
232 portid2str(path), prompt,
233 (node->type <= IB_NODE_MAX ? node_type_str[node->type] : "???"),
234 node->nodeguid, node->type == SWITCH_NODE ? 0 : port->portnum,
235 port->lid, port->lid + (1 << port->lmc) - 1,
236 clean_nodedesc(node->nodedesc));
239 #define HASHGUID(guid) ((uint32_t)(((uint32_t)(guid) * 101) ^ ((uint32_t)((guid) >> 32) * 103)))
242 static Node *nodestbl[HTSZ];
247 int hash = HASHGUID(new->nodeguid) % HTSZ;
250 for (node = nodestbl[hash]; node; node = node->htnext)
251 if (node->nodeguid == new->nodeguid)
258 create_node(Node *temp, ib_portid_t *path, int dist)
261 int hash = HASHGUID(temp->nodeguid) % HTSZ;
263 node = malloc(sizeof(*node));
267 memcpy(node, temp, sizeof(*node));
271 node->htnext = nodestbl[hash];
272 nodestbl[hash] = node;
274 if (node->type != SWITCH_NODE)
275 dist = MAXHOPS; /* special Ca list */
277 node->dnext = nodesdist[dist];
278 nodesdist[dist] = node;
284 find_port(Node *node, Port *port)
288 for (old = node->ports; old; old = old->next)
289 if (old->portnum == port->portnum)
296 create_port(Node *node, Port *temp)
300 port = malloc(sizeof(*port));
304 memcpy(port, temp, sizeof(*port));
306 port->next = node->ports;
313 link_ports(Node *node, Port *port, Node *remotenode, Port *remoteport)
315 DEBUG("linking: 0x%" PRIx64 " %p->%p:%u and 0x%" PRIx64 " %p->%p:%u",
316 node->nodeguid, node, port, port->portnum,
317 remotenode->nodeguid, remotenode, remoteport, remoteport->portnum);
318 if (port->remoteport)
319 port->remoteport->remoteport = NULL;
320 if (remoteport->remoteport)
321 remoteport->remoteport->remoteport = NULL;
322 port->remoteport = remoteport;
323 remoteport->remoteport = port;
327 handle_port(Node *node, Port *port, ib_portid_t *path, int portnum, int dist)
331 Node *remotenode, *oldnode;
332 Port *remoteport, *oldport;
334 memset(&node_buf, 0, sizeof(node_buf));
335 memset(&port_buf, 0, sizeof(port_buf));
337 DEBUG("handle node %p port %p:%d dist %d", node, port, portnum, dist);
338 if (port->physstate != 5) /* LinkUp */
341 if (extend_dpath(&path->drpath, portnum) < 0)
344 if (get_node(&node_buf, &port_buf, path) < 0) {
345 IBWARN("NodeInfo on %s failed, skipping port",
347 path->drpath.cnt--; /* restore path */
351 oldnode = find_node(&node_buf);
353 remotenode = oldnode;
354 else if (!(remotenode = create_node(&node_buf, path, dist + 1)))
355 IBERROR("no memory");
357 oldport = find_port(remotenode, &port_buf);
359 remoteport = oldport;
360 if (node != remotenode || port != remoteport)
361 IBWARN("port moving...");
362 } else if (!(remoteport = create_port(remotenode, &port_buf)))
363 IBERROR("no memory");
365 dump_endnode(path, oldnode ? "known remote" : "new remote",
366 remotenode, remoteport);
368 link_ports(node, port, remotenode, remoteport);
370 path->drpath.cnt--; /* restore path */
375 * Return 1 if found, 0 if not, -1 on errors.
378 discover(ib_portid_t *from)
388 DEBUG("from %s", portid2str(from));
390 memset(&node_buf, 0, sizeof(node_buf));
391 memset(&port_buf, 0, sizeof(port_buf));
393 if (get_node(&node_buf, &port_buf, from) < 0) {
394 IBWARN("can't reach node %s", portid2str(from));
398 node = create_node(&node_buf, from, 0);
400 IBERROR("out of memory");
404 port = create_port(node, &port_buf);
406 IBERROR("out of memory");
408 if (node->type != SWITCH_NODE &&
409 handle_port(node, port, from, node->localport, 0) < 0)
412 for (dist = 0; dist < MAXHOPS; dist++) {
414 for (node = nodesdist[dist]; node; node = node->dnext) {
418 DEBUG("dist %d node %p", dist, node);
419 dump_endnode(path, "processing", node, port);
421 for (i = 1; i <= node->numports; i++) {
422 if (i == node->localport)
425 if (get_port(&port_buf, i, path) < 0) {
426 IBWARN("can't reach node %s port %d", portid2str(path), i);
430 port = find_port(node, &port_buf);
434 port = create_port(node, &port_buf);
436 IBERROR("out of memory");
438 /* If switch, set port GUID to node GUID */
439 if (node->type == SWITCH_NODE)
440 port->portguid = node->portguid;
442 handle_port(node, port, path, i, dist);
451 node_name(Node *node)
453 static char buf[256];
457 sprintf(buf, "\"%s", "S");
460 sprintf(buf, "\"%s", "H");
463 sprintf(buf, "\"%s", "R");
466 sprintf(buf, "\"%s", "?");
469 sprintf(buf+2, "-%016" PRIx64 "\"", node->nodeguid);
475 list_node(Node *node)
478 char *nodename = remap_node_name(node_name_map, node->nodeguid,
483 node_type = "Switch";
489 node_type = "Router";
495 fprintf(f, "%s\t : 0x%016" PRIx64 " ports %d devid 0x%x vendid 0x%x \"%s\"\n",
497 node->nodeguid, node->numports, node->devid, node->vendid,
504 out_ids(Node *node, int group, char *chname)
506 fprintf(f, "\nvendid=0x%x\ndevid=0x%x\n", node->vendid, node->devid);
507 if (node->sysimgguid)
508 fprintf(f, "sysimgguid=0x%" PRIx64, node->sysimgguid);
510 && node->chrecord && node->chrecord->chassisnum) {
511 fprintf(f, "\t\t# Chassis %d", node->chrecord->chassisnum);
513 fprintf(f, " (%s)", chname);
514 if (is_xsigo_tca(node->nodeguid) && node->ports->remoteport)
515 fprintf(f, " slot %d", node->ports->remoteport->portnum);
521 out_chassis(int chassisnum)
525 fprintf(f, "\nChassis %d", chassisnum);
526 guid = get_chassis_guid(chassisnum);
528 fprintf(f, " (guid 0x%" PRIx64 ")", guid);
534 out_switch(Node *node, int group, char *chname)
537 char *nodename = NULL;
539 out_ids(node, group, chname);
540 fprintf(f, "switchguid=0x%" PRIx64, node->nodeguid);
541 fprintf(f, "(%" PRIx64 ")", node->portguid);
542 /* Currently, only if Voltaire chassis */
544 && node->chrecord && node->chrecord->chassisnum
545 && node->vendid == VTR_VENDOR_ID) {
546 str = get_chassis_type(node->chrecord->chassistype);
548 fprintf(f, "%s ", str);
549 str = get_chassis_slot(node->chrecord->chassisslot);
551 fprintf(f, "%s ", str);
552 fprintf(f, "%d Chip %d", node->chrecord->slotnum, node->chrecord->anafanum);
555 nodename = remap_node_name(node_name_map, node->nodeguid,
558 fprintf(f, "\nSwitch\t%d %s\t\t# \"%s\" %s port 0 lid %d lmc %d\n",
559 node->numports, node_name(node),
561 node->smaenhsp0 ? "enhanced" : "base",
562 node->smalid, node->smalmc);
568 out_ca(Node *node, int group, char *chname)
572 char *nodename = remap_node_name(node_name_map, node->nodeguid,
575 out_ids(node, group, chname);
591 fprintf(f, "%sguid=0x%" PRIx64 "\n", node_type, node->nodeguid);
592 fprintf(f, "%s\t%d %s\t\t# \"%s\"",
593 node_type2, node->numports, node_name(node),
595 if (group && is_xsigo_hca(node->nodeguid))
596 fprintf(f, " (scp)");
603 out_ext_port(Port *port, int group)
607 /* Currently, only if Voltaire chassis */
609 && port->node->chrecord && port->node->vendid == VTR_VENDOR_ID)
610 str = portmapstring(port);
616 out_switch_port(Port *port, int group)
618 char *ext_port_str = NULL;
619 char *rem_nodename = NULL;
621 DEBUG("port %p:%d remoteport %p", port, port->portnum, port->remoteport);
622 fprintf(f, "[%d]", port->portnum);
624 ext_port_str = out_ext_port(port, group);
626 fprintf(f, "%s", ext_port_str);
628 rem_nodename = remap_node_name(node_name_map,
629 port->remoteport->node->nodeguid,
630 port->remoteport->node->nodedesc);
632 ext_port_str = out_ext_port(port->remoteport, group);
633 fprintf(f, "\t%s[%d]%s",
634 node_name(port->remoteport->node),
635 port->remoteport->portnum,
636 ext_port_str ? ext_port_str : "");
637 if (port->remoteport->node->type != SWITCH_NODE)
638 fprintf(f, "(%" PRIx64 ") ", port->remoteport->portguid);
639 fprintf(f, "\t\t# \"%s\" lid %d %s%s",
641 port->remoteport->node->type == SWITCH_NODE ? port->remoteport->node->smalid : port->remoteport->lid,
642 get_linkwidth_str(port->linkwidth),
643 get_linkspeed_str(port->linkspeed));
645 if (is_xsigo_tca(port->remoteport->portguid))
646 fprintf(f, " slot %d", port->portnum);
647 else if (is_xsigo_hca(port->remoteport->portguid))
648 fprintf(f, " (scp)");
655 out_ca_port(Port *port, int group)
658 char *rem_nodename = NULL;
660 fprintf(f, "[%d]", port->portnum);
661 if (port->node->type != SWITCH_NODE)
662 fprintf(f, "(%" PRIx64 ") ", port->portguid);
663 fprintf(f, "\t%s[%d]",
664 node_name(port->remoteport->node),
665 port->remoteport->portnum);
666 str = out_ext_port(port->remoteport, group);
668 fprintf(f, "%s", str);
669 if (port->remoteport->node->type != SWITCH_NODE)
670 fprintf(f, " (%" PRIx64 ") ", port->remoteport->portguid);
672 rem_nodename = remap_node_name(node_name_map,
673 port->remoteport->node->nodeguid,
674 port->remoteport->node->nodedesc);
676 fprintf(f, "\t\t# lid %d lmc %d \"%s\" lid %d %s%s\n",
677 port->lid, port->lmc, rem_nodename,
678 port->remoteport->node->type == SWITCH_NODE ? port->remoteport->node->smalid : port->remoteport->lid,
679 get_linkwidth_str(port->linkwidth),
680 get_linkspeed_str(port->linkspeed));
686 dump_topology(int listtype, int group)
696 fprintf(f, "#\n# Topology file: generated on %s#\n", ctime(&t));
697 fprintf(f, "# Max of %d hops discovered\n", maxhops_discovered);
698 fprintf(f, "# Initiated from node %016" PRIx64 " port %016" PRIx64 "\n", mynode->nodeguid, mynode->portguid);
701 /* Make pass on switches */
702 if (group && !listtype) {
703 ChassisList *ch = NULL;
705 /* Chassis based switches first */
706 for (ch = chassis; ch; ch = ch->next) {
711 chguid = out_chassis(ch->chassisnum);
715 if (is_xsigo_guid(chguid)) {
716 for (node = nodesdist[MAXHOPS]; node; node = node->dnext) {
717 if (!node->chrecord ||
718 !node->chrecord->chassisnum)
721 if (node->chrecord->chassisnum != ch->chassisnum)
724 if (is_xsigo_hca(node->nodeguid)) {
725 chname = remap_node_name(node_name_map,
728 fprintf(f, "Hostname: %s\n", chname);
733 fprintf(f, "\n# Spine Nodes");
734 for (n = 1; n <= (SPINES_MAX_NUM+1); n++) {
735 if (ch->spinenode[n]) {
736 out_switch(ch->spinenode[n], group, chname);
737 for (port = ch->spinenode[n]->ports; port; port = port->next, i++)
738 if (port->remoteport)
739 out_switch_port(port, group);
742 fprintf(f, "\n# Line Nodes");
743 for (n = 1; n <= (LINES_MAX_NUM+1); n++) {
744 if (ch->linenode[n]) {
745 out_switch(ch->linenode[n], group, chname);
746 for (port = ch->linenode[n]->ports; port; port = port->next, i++)
747 if (port->remoteport)
748 out_switch_port(port, group);
752 fprintf(f, "\n# Chassis Switches");
753 for (dist = 0; dist <= maxhops_discovered; dist++) {
755 for (node = nodesdist[dist]; node; node = node->dnext) {
757 /* Non Voltaire chassis */
758 if (node->vendid == VTR_VENDOR_ID)
760 if (!node->chrecord ||
761 !node->chrecord->chassisnum)
764 if (node->chrecord->chassisnum != ch->chassisnum)
767 out_switch(node, group, chname);
768 for (port = node->ports; port; port = port->next, i++)
769 if (port->remoteport)
770 out_switch_port(port, group);
776 fprintf(f, "\n# Chassis CAs");
777 for (node = nodesdist[MAXHOPS]; node; node = node->dnext) {
778 if (!node->chrecord ||
779 !node->chrecord->chassisnum)
782 if (node->chrecord->chassisnum != ch->chassisnum)
785 out_ca(node, group, chname);
786 for (port = node->ports; port; port = port->next, i++)
787 if (port->remoteport)
788 out_ca_port(port, group);
795 for (dist = 0; dist <= maxhops_discovered; dist++) {
797 for (node = nodesdist[dist]; node; node = node->dnext) {
799 DEBUG("SWITCH: dist %d node %p", dist, node);
801 out_switch(node, group, chname);
803 if (listtype & LIST_SWITCH_NODE)
808 for (port = node->ports; port; port = port->next, i++)
809 if (port->remoteport)
810 out_switch_port(port, group);
818 if (group && !listtype) {
820 fprintf(f, "\nNon-Chassis Nodes\n");
822 for (dist = 0; dist <= maxhops_discovered; dist++) {
824 for (node = nodesdist[dist]; node; node = node->dnext) {
826 DEBUG("SWITCH: dist %d node %p", dist, node);
827 /* Now, skip chassis based switches */
828 if (node->chrecord &&
829 node->chrecord->chassisnum)
831 out_switch(node, group, chname);
833 for (port = node->ports; port; port = port->next, i++)
834 if (port->remoteport)
835 out_switch_port(port, group);
842 /* Make pass on CAs */
843 for (node = nodesdist[MAXHOPS]; node; node = node->dnext) {
845 DEBUG("CA: dist %d node %p", dist, node);
847 /* Now, skip chassis based CAs */
848 if (group && node->chrecord &&
849 node->chrecord->chassisnum)
851 out_ca(node, group, chname);
853 if (((listtype & LIST_CA_NODE) && (node->type == CA_NODE)) ||
854 ((listtype & LIST_ROUTER_NODE) && (node->type == ROUTER_NODE)))
859 for (port = node->ports; port; port = port->next, i++)
860 if (port->remoteport)
861 out_ca_port(port, group);
870 void dump_ports_report ()
876 // If switch and LID == 0, search of other switch ports with
877 // valid LID and assign it to all ports of that switch
878 for (b = 0; b <= MAXHOPS; b++)
879 for (node = nodesdist[b]; node; node = node->dnext)
880 if (node->type == SWITCH_NODE) {
882 for (p = 0, port = node->ports;
883 p < node->numports && port && !swlid;
887 for (p = 0, port = node->ports;
888 p < node->numports && port;
893 for (b = 0; b <= MAXHOPS; b++)
894 for (node = nodesdist[b]; node; node = node->dnext) {
895 for (p = 0, port = node->ports;
896 p < node->numports && port;
897 p++, port = port->next) {
899 "%2s %5d %2d 0x%016" PRIx64 " %s %s",
900 node_type_str2(port->node), port->lid,
903 get_linkwidth_str(port->linkwidth),
904 get_linkspeed_str(port->linkspeed));
905 if (port->remoteport)
907 " - %2s %5d %2d 0x%016" PRIx64
908 " ( '%s' - '%s' )\n",
909 node_type_str2(port->remoteport->node),
910 port->remoteport->lid,
911 port->remoteport->portnum,
912 port->remoteport->portguid,
913 port->node->nodedesc,
914 port->remoteport->node->nodedesc);
916 fprintf(stdout, "%36s'%s'\n", "",
917 port->node->nodedesc);
926 fprintf(stderr, "Usage: %s [-d(ebug)] -e(rr_show) -v(erbose) -s(how) -l(ist) -g(rouping) -H(ca_list) -S(witch_list) -R(outer_list) -V(ersion) -C ca_name -P ca_port "
927 "-t(imeout) timeout_ms --node-name-map node-name-map] -p(orts) [<topology-file>]\n",
929 fprintf(stderr, " --node-name-map <node-name-map> specify a node name map file\n");
934 main(int argc, char **argv)
936 int mgmt_classes[2] = {IB_SMI_CLASS, IB_SMI_DIRECT_CLASS};
937 ib_portid_t my_portid = {0};
938 int udebug = 0, list = 0;
942 int ports_report = 0;
944 static char const str_opts[] = "C:P:t:devslgHSRpVhu";
945 static const struct option long_opts[] = {
948 { "debug", 0, 0, 'd'},
949 { "err_show", 0, 0, 'e'},
950 { "verbose", 0, 0, 'v'},
951 { "show", 0, 0, 's'},
952 { "list", 0, 0, 'l'},
953 { "grouping", 0, 0, 'g'},
954 { "Hca_list", 0, 0, 'H'},
955 { "Switch_list", 0, 0, 'S'},
956 { "Router_list", 0, 0, 'R'},
957 { "timeout", 1, 0, 't'},
958 { "node-name-map", 1, 0, 1},
959 { "ports", 0, 0, 'p'},
960 { "Version", 0, 0, 'V'},
961 { "help", 0, 0, 'h'},
962 { "usage", 0, 0, 'u'},
971 int ch = getopt_long(argc, argv, str_opts, long_opts, NULL);
976 node_name_map_file = strdup(optarg);
982 ca_port = strtoul(optarg, 0, 0);
986 madrpc_show_errors(1);
991 timeout = strtoul(optarg, 0, 0);
1001 madrpc_show_errors(1);
1004 list = LIST_CA_NODE | LIST_SWITCH_NODE | LIST_ROUTER_NODE;
1010 list = LIST_SWITCH_NODE;
1013 list = LIST_CA_NODE;
1016 list = LIST_ROUTER_NODE;
1019 fprintf(stderr, "%s %s\n", argv0, get_build_version() );
1032 if (argc && !(f = fopen(argv[0], "w")))
1033 IBERROR("can't open file %s for writing", argv[0]);
1035 madrpc_init(ca, ca_port, mgmt_classes, 2);
1036 node_name_map = open_node_name_map(node_name_map_file);
1038 if (discover(&my_portid) < 0)
1039 IBERROR("discover");
1042 chassis = group_nodes();
1045 dump_ports_report();
1047 dump_topology(list, group);
1049 close_node_name_map(node_name_map);