[openib-general] [PATCH 4/4] diags: ucast routing dump file generator example - dump_lfts.sh

Sasha Khapyorsky sashak at voltaire.com
Sat Jun 10 17:32:45 PDT 2006


New simple script - dump_lfts.sh, may be used for ucast dump file
generation.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---

 diags/Makefile.am          |    2 +-
 diags/scripts/dump_lfts.sh |   41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/diags/Makefile.am b/diags/Makefile.am
index bf0c077..9654675 100644
--- a/diags/Makefile.am
+++ b/diags/Makefile.am
@@ -24,7 +24,7 @@ bin_SCRIPTS = scripts/ibcheckerrs script
 	      scripts/ibcheckstate scripts/ibcheckportstate \
 	      scripts/ibcheckerrors scripts/ibclearerrors \
 	      scripts/ibclearcounters scripts/discover.pl \
-	      scripts/set_mthca_nodedesc.sh
+	      scripts/set_mthca_nodedesc.sh scripts/dump_lfts.sh
 
 src_ibaddr_SOURCES = src/ibaddr.c
 src_ibaddr_CFLAGS = -Wall $(DBGFLAGS)
diff --git a/diags/scripts/dump_lfts.sh b/diags/scripts/dump_lfts.sh
new file mode 100755
index 0000000..bed4778
--- /dev/null
+++ b/diags/scripts/dump_lfts.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# This simple script will collect outputs of ibroute for all switches
+# on the subnet and drop it on stdout. May be used for LFTs dump
+# generation.
+#
+
+usage ()
+{
+	echo "usage: $0 [-D]"
+	exit 2
+}
+
+dump_by_lid ()
+{
+for sw_lid in `ibswitches \
+		| sed -ne 's/^.* lid \([1-9a-f]*\) .*$/\1/p'` ; do
+	ibroute $sw_lid
+done
+}
+
+dump_by_dr_path ()
+{
+for sw_dr in `ibnetdiscover -v \
+		| sed -ne '/^DR path .* switch /s/^DR path \[\(.*\)\].*$/\1/p' \
+		| sed -e 's/\]\[/,/g' \
+		| sort -u` ; do
+	ibroute -D ${sw_dr}
+done
+}
+
+
+if [ "$1" = "-D" ] ; then
+	dump_by_dr_path
+elif [ -z "$1" ] ; then
+	dump_by_lid
+else
+	usage
+fi
+
+exit




More information about the general mailing list