[ofa-general] [PATCH] infiniband-diags/scripts: Add ibcheckroutes to scripts

Hal Rosenstock hal.rosenstock at gmail.com
Mon Sep 14 07:58:10 PDT 2009


On Thu, Sep 10, 2009 at 7:56 AM, Doron Shoham <dorons at voltaire.com> wrote:

> ibcheckroutes validates route between all hosts in the fabric.
> This script finds all leaf switches (switches that are connected to HCAs)
> and runs ibtracert between them.
> When using various routing algorithms (e.g. up-down),
> if fabric topology is not suitable there will be no
> routes between some nodes.
> It reports when the route exists between source and destination LIDs.
>
> Signed-off-by: Doron Shoham <dorons at voltaire.com>
> ---
>  infiniband-diags/Makefile.am              |    4 +-
>  infiniband-diags/configure.in             |    1 +
>  infiniband-diags/man/ibcheckroutes.8      |   39 +++++++++++
>  infiniband-diags/scripts/ibcheckroutes.in |  101
> +++++++++++++++++++++++++++++
>  4 files changed, 143 insertions(+), 2 deletions(-)
>  create mode 100644 infiniband-diags/man/ibcheckroutes.8
>  create mode 100755 infiniband-diags/scripts/ibcheckroutes.in
>
> diff --git a/infiniband-diags/Makefile.am b/infiniband-diags/Makefile.am
> index 1cdb60e..57363c4 100644
> --- a/infiniband-diags/Makefile.am
> +++ b/infiniband-diags/Makefile.am
> @@ -33,7 +33,7 @@ sbin_SCRIPTS = scripts/ibcheckerrs scripts/ibchecknet
> scripts/ibchecknode \
>               scripts/iblinkinfo.pl scripts/ibprintswitch.pl \
>               scripts/ibprintca.pl scripts/ibprintrt.pl \
>               scripts/ibfindnodesusing.pl scripts/ibidsverify.pl \
> -              scripts/check_lft_balance.pl
> +              scripts/check_lft_balance.pl scripts/ibcheckroutes
>
>  noinst_LIBRARIES = libcommon.a
>
> @@ -76,7 +76,7 @@ man_MANS = man/ibaddr.8 man/ibcheckerrors.8
> man/ibcheckerrs.8 \
>        man/ibprintswitch.8 man/ibprintca.8 man/ibfindnodesusing.8 \
>        man/ibdatacounts.8 man/ibdatacounters.8 \
>        man/ibrouters.8 man/ibprintrt.8 man/ibidsverify.8 \
> -       man/check_lft_balance.8
> +       man/check_lft_balance.8 man/ibcheckroutes.8
>
>  BUILT_SOURCES = ibdiag_version
>  ibdiag_version:
> diff --git a/infiniband-diags/configure.in b/infiniband-diags/configure.in
> index 3ef35cc..aa178c5 100644
> --- a/infiniband-diags/configure.in
> +++ b/infiniband-diags/configure.in
> @@ -158,6 +158,7 @@ AC_CONFIG_FILES([\
>        scripts/ibcheckportwidth \
>        scripts/ibcheckstate \
>        scripts/ibcheckwidth \
> +       scripts/ibcheckroutes \
>        scripts/ibclearcounters \
>        scripts/ibclearerrors \
>        scripts/ibdatacounts \
> diff --git a/infiniband-diags/man/ibcheckroutes.8
> b/infiniband-diags/man/ibcheckroutes.8
> new file mode 100644
> index 0000000..a6a073f
> --- /dev/null
> +++ b/infiniband-diags/man/ibcheckroutes.8
> @@ -0,0 +1,39 @@
> +.TH IBCHECKPORT 8 "September 10, 2009" "OpenIB" "OpenIB Diagnostics"
> +
> +.SH NAME
> +ibcheckroutes \- validates routes between all hosts in fabric
> +
> +.SH SYNOPSIS
> +.B ibcheckroutes
> +[\-h] [\-N] [\-b] [\-e] [\-C ca_name] [\-P ca_port] [\-t(imeout)
> timeout_ms]
> +
> +.SH DESCRIPTION
> +.PP
> +ibcheckroutes is a script which uses a full topology file that was created
> by ibnetdiscover,
> +scans the network to validate routes between all hosts in the fabric.
>

Based on what has been discussed, this really isn't the case. It only
validates routes between leaf switches (at least currently).


> +
> +.SH OPTIONS
> +.PP
> +\-h  Show help.
> +.PP
> +\-N  Use mono rather than color mode.
> +.PP
> +\-b  Suppress output.
> +.PP
> +\-e  Show errors only.
> +.PP
> +\-C <ca_name>    Use the specified ca_name.
> +.PP
> +\-P <ca_port>    Use the specified ca_port.
> +.PP
> +\-t <timeout_ms> Override the default timeout for the solicited mads.
> +
> +.SH SEE ALSO
> +.BR ibnetdiscover(8),
> +.BR ibtracert(8),
> +.BR ibroute(8)
>

Is ibroute used ?


> +
> +.SH AUTHOR
> +.TP
> +Doron Shoham
> +.RI < dorons at voltaire.com >
> diff --git a/infiniband-diags/scripts/ibcheckroutes.inb/infiniband-diags/scripts/
> ibcheckroutes.in
> new file mode 100755
> index 0000000..eb3ad30
> --- /dev/null
> +++ b/infiniband-diags/scripts/ibcheckroutes.in
> @@ -0,0 +1,101 @@
> +#!/bin/sh
> +
> +IBPATH=${IBPATH:- at IBSCRIPTPATH@}
> +
> +function usage() {
> +       echo Usage: `basename $0` "[-h] [-N] [-b] [-e] [-C ca_name] [-P
> ca_port] [-t(imeout) timeout_ms]"
> +       echo -e "   validate routes between all hosts in fabric"
> +       echo -e " -h   - Show help"
> +       echo -e " -N   - Use mono rather than color mode"
> +       echo -e " -b   - Suppress output"
> +       echo -e " -e   - Show errors only"
> +       echo -e " -C   - Use the specified ca_name"
> +       echo -e " -P   - Use the specified ca_port"
> +       echo -e " -t   - Override the default timeout for the solicited"
>

add " mads" to the end of this


> +       exit -1
> +}
> +
> +function user_abort() {
> +       echo "Aborted"
> +       exit 1
> +}
> +
> +function green() {
> +       if [ "$bw" = "yes" ]; then
> +               printf "${res_col}[OK]\n" $1
> +               return
> +       fi
> +       printf "\033[1;032m${res_col}[OK]\033[0;39m\n" $1
> +}
> +
> +function red() {
> +       if [ "$bw" = "yes" ]; then
> +               printf "${res_col}[FAILED]\n" "$1"
> +               return
> +       fi
> +       printf "\033[31m${res_col}[FAILED]\033[0m\n" "$1"
> +}
> +
> +trap user_abort SIGINT SIGTERM
> +
> +bw=""
> +brief=0
> +error=0
> +ca_info=""
> +st=0
> +topofile=/tmp/net
> +res_col="%-20.20s"
> +
> +function get_opts() {
> +       while getopts P:C:t:beNh o; do
> +               case "$o" in
> +               h)
> +                       usage
> +                       ;;
> +               N)
> +                       bw="yes"
> +                       ;;
> +               b)
> +                       brief=1
> +                       ;;
> +               e)
> +                       error=1
> +                       ;;
> +               P | C | t | timeout)
> +                       ca_info="$ca_info -$o $OPTARG"
> +                       ;;
> +               *)
> +                       usage
> +                       ;;
> +               esac
> +       done
> +}
> +
> +get_opts $*
> +
> +$IBPATH/ibnetdiscover $ca_info > $topofile
>

How about allowing an already saved ibnetdiscover file to be used as well as
a "fresh" ibnetdiscover output ?


> +
> +# find all leaf switches LIDs
> +LIDS=($(awk  '/# lid /{a[$(NF-1)]=$(NF-1)} END{for(v in a) print v}'
> $topofile))
> +N=${#LIDS[@]}
> +
> +if [ $N -lt 2 ]; then
> +       echo "Fabric contains only one switch"


one leaf switch ?


> +       exit 0
> +fi
> +
> +# check routes between all switches in fabric
>

all leaf switches ?


> +[ $brief -eq 0 ] && echo -e "Checking route between:\nSource lid -->
> Destination lid"
> +for((s=0; s<N-1; s++)); do
> +       for ((d=s+1; d<N; d++)); do
> +               $IBPATH/ibtracert $ca_info ${LIDS[$s]} ${LIDS[$d]} >
> /dev/null
>

Is LMC > 0 handled ?

-- Hal


> +               if [ $? -eq 0 ]; then
> +                       [ $brief -eq 0 ] && [ $error -eq 0 ] && green
> "${LIDS[$s]}-->${LIDS[$d]}"
> +               else
> +                       [ $brief -eq 0 ] && red "${LIDS[$s]}-->${LIDS[$d]}"
> +                       st=1
> +               fi
> +       done
> +done
> +
> +exit $st
> --
> 1.5.4
>
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit
> http://openib.org/mailman/listinfo/openib-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20090914/22b4fa34/attachment.html>


More information about the general mailing list