3 IBPATH=${IBPATH:-@IBSCRIPTPATH@}
6 echo Usage: `basename $0` "[-h] [-v] [-N | -nocolor]" \
7 "[<topology-file> | -C ca_name -P ca_port -t(imeout) timeout_ms]"
11 function user_abort() {
16 trap user_abort SIGINT
39 -P | -C | -t | -timeout)
48 ca_info="$ca_info $1 $2"
55 if [ "$topofile" ]; then
64 if [ "$topofile" ]; then
65 netcmd="cat $topofile"
67 netcmd="$IBPATH/ibnetdiscover $ca_info"
77 function check_node(lid)
80 if (system("'$IBPATH'/ibchecknode'"$ca_info"' '$gflags' '$verbose' " lid)) {
87 /^Ca/ || /^Switch/ || /^Rt/ {
89 ntype=$1; nodeguid=substr($3, 4, 16); ports=$2
91 print "\n# Checking " ntype ": nodeguid 0x" nodeguid
95 if (ntype != "Switch")
98 lid = substr($0, index($0, "port 0 lid ") + 11)
99 lid = substr(lid, 1, index(lid, " ") - 1)
106 lid = substr($0, index($0, " lid ") + 5)
107 lid = substr(lid, 1, index(lid, " ") - 1)
111 print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
114 sub("\\(.*\\)", "", port)
115 gsub("[\\[\\]]", "", port)
116 if (system("'$IBPATH'/ibcheckportstate'"$ca_info"' '$gflags' '$verbose' " lid " " port)) {
117 if (!'$v' && oldlid != lid) {
118 print "# Checked " ntype ": nodeguid 0x" nodeguid " with failure"
125 /^ib/ {print $0; next}
126 /ibpanic:/ {print $0}
128 /iberror:/ {print $0}
131 printf "\n## Summary: %d nodes checked, %d bad nodes found\n", nnodes, ne
132 printf "## %d ports checked, %d ports with bad state found\n", nports, pe