File: ibdiag-ucast.sim.tcl

package info (click to toggle)
ibutils 1.2-OFED-1.4.2-1.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 23,616 kB
  • sloc: cpp: 153,349; ansic: 77,237; tcl: 13,447; sh: 11,852; makefile: 494; yacc: 333; lex: 169; awk: 53
file content (80 lines) | stat: -rw-r--r-- 2,249 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

puts "FLOW: set some unicast partial connectivity"

# get random list of switch nodes:
proc getRandomSwitchNodesList {fabric} {
   # get number of nodes:
   set nodesByName [IBFabric_NodeByName_get $fabric]

   set nodeNOrderList {}
   foreach nodeNameNId [IBFabric_NodeByName_get $fabric] {
      set node [lindex $nodeNameNId 1]

      # only switches please
      if {[IBNode_type_get $node] == 1} {
         lappend nodeNOrderList [list $node [rmRand]]
      }
   }

   set randNodes {}
   foreach nodeNRnd [lsort -index 1 -real $nodeNOrderList] {
      lappend randNodes [lindex $nodeNRnd 0]
   }
   return $randNodes
}

# scan the switches (randomly) for a LFT entry which is not zero
# delete one entry ...
proc removeUCastRouteEntry {fabric} {
   set nodes [getRandomSwitchNodesList $fabric]

   while {[llength $nodes]} {
      set node [lindex $nodes 0]
      set nodeName [IBNode_name_get $node]
      set lft [IBNode_LFT_get $node]

      # convert to LID Port list
      set lidPortList {}
      for {set lid 0 } {$lid < [llength $lft]} {incr lid} {
         set outPort [lindex $lft $lid]
         if {($outPort != 0xff) && ($outPort != 0) } {
            lappend lidPortList [list $lid $outPort]
         }
      }

      # select a random entry
      if {[llength $lidPortList]} {
         set badLidIdx [expr int([rmRand]*[llength $lidPortList])]
         set badLidNPort [lindex $lidPortList $badLidIdx]
         set badLid [lindex $badLidNPort 0]
         set wasPort [lindex $badLidNPort 1]
         puts "-I- Deleting LFT on $nodeName lid:$badLid (was $wasPort)"
         IBNode_setLFTPortForLid $node $badLid 0xff
         return 0
      }
      set nodes [lrange $nodes 1 end]
   }
   return 1
}

# setup post SM run changes:
proc postSmSettings {fabric} {
   global errorInfo
   set nDisconencted 0
   # now go and delete some switch MC entries...
   for {set i 0} {$i < 3} {incr i} {
      # delete one entry
      if {![removeUCastRouteEntry $fabric]} {
         incr nDisconencted
      }
   }
   return "-I- Disconnected $nDisconencted LFT Entries"
}

# make sure ibdiagnet reported the bad links
proc verifyDiagRes {fabric logFile} {
   return "Could not figure out if OK yet"
}

set fabric [IBMgtSimulator getFabric]