Codebase list ibutils / 6d60b35d-a030-4561-b9a9-71fb66f0c0a9/main ibdiag / demo / faulty-links.check.tcl
6d60b35d-a030-4561-b9a9-71fb66f0c0a9/main

Tree @6d60b35d-a030-4561-b9a9-71fb66f0c0a9/main (Download .tar.gz)

faulty-links.check.tcl @6d60b35d-a030-4561-b9a9-71fb66f0c0a9/mainraw · history · blame

#--
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
# This software is available to you under a choice of one of two
# licenses.  You may choose to be licensed under the terms of the GNU
# General Public License (GPL) Version 2, available from the file
# COPYING in the main directory of this source tree, or the
# OpenIB.org BSD license below:
#
#     Redistribution and use in source and binary forms, with or
#     without modification, are permitted provided that the following
#     conditions are met:
#
#      - Redistributions of source code must retain the above
#        copyright notice, this list of conditions and the following
#        disclaimer.
#
#      - Redistributions in binary form must reproduce the above
#        copyright notice, this list of conditions and the following
#        disclaimer in the documentation and/or other materials
#        provided with the distribution.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#--

# This is the checker for faulty links flow

##############################################################################
#
# Start up the test applications
# This is the default flow that will start OpenSM only in 0x43 verbosity
# Return a list of process ids it started (to be killed on exit)
#
proc runner {simDir osmPath osmPortGuid} {
   global simCtrlSock
   global env
   global nodePortGroupList
	global GROUP_HOSTS

   set osmStdOutLog [file join $simDir osm.stdout.log]
   set osmLog [file join $simDir osm.log]

   fconfigure $simCtrlSock -blocking 1 -buffering line

	puts "---------------------------------------------------------------------"
	puts " Assigning some ports with drop rates > 0"
	puts $simCtrlSock "setNodePortErrProfile \$fabric H-3/U1 1 0.05"
   puts "SIM: [gets $simCtrlSock]"
	puts $simCtrlSock "setNodePortErrProfile \$fabric H-23/U1 1 0.02"
   puts "SIM: [gets $simCtrlSock]"
	puts $simCtrlSock "setNodePortErrProfile \$fabric SL2-2/U1 4 0.01"
   puts "SIM: [gets $simCtrlSock]"
	puts $simCtrlSock "setNodePortErrProfile \$fabric SL1-4/U1 1 0.05"
   puts "SIM: [gets $simCtrlSock]"

   # start the SM
	puts "---------------------------------------------------------------------"
	puts " Starting the SM\n"
   set valgrind "/usr/bin/valgrind --tool=memcheck"
   set osmCmd "$osmPath  -D 0x43 -d2 -f $osmLog -g $osmPortGuid"
   puts "-I- Starting: $osmCmd"
   set osmPid [eval "exec $osmCmd > $osmStdOutLog &"]

   # start a tracker on the log file and process:
   startOsmLogAnalyzer $osmLog

   return $osmPid
}

##############################################################################
#
# Check for the test results
# Return the exit code
proc checker {simDir osmPath osmPortGuid} {
   global env
   global simCtrlSock
   global nodePortGroupList
	global GROUP_HOSTS

   # wait for the SM up or dead
   set osmLog [file join $simDir osm.log]
   if {[osmWaitForUpOrDead $osmLog]} {
      return 1
   }

	# make sure /proc is updated ...
	puts $simCtrlSock "updateProcFSForNode \$fabric $simDir H-1/U1 H-1/U1 1"
   set res [gets $simCtrlSock]
   puts "SIM: Updated H-1 proc file:$res"

	puts "---------------------------------------------------------------------"
	puts " OpemSM brought up the network"
	puts "---------------------------------------------------------------------"
	puts " SUBNET READY FOR DIAGNOSTICS"
	puts "\nCut and paste the following in a new window then run ibdiagnet:"
	puts "cd $simDir"
	puts "setenv IBMGTSIM_DIR  $simDir"
	puts "setenv OSM_CACHE_DIR $simDir"
	puts "setenv OSM_TMP_DIR   $simDir"
	puts " "
	puts "---------------------------------------------------------------------"
	puts " See what ibdiagnet is able to report with no further traffic\n"
	puts " Run: ibdiagnet"
	puts " press Enter when done"
	gets stdin
	puts "---------------------------------------------------------------------"
	puts " Run all to all communication "
	puts $simCtrlSock "startAllToAllTraffic \$fabric"
   puts "SIM: [gets $simCtrlSock]\n"
	puts " See what ibdiagnet is able to report NOW\n"
	puts " Run: ibdiagnet"
	puts " press Enter when done"
	gets stdin
   return 0
}