File: ibdiag-dup-node-guid.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 (59 lines) | stat: -rw-r--r-- 1,637 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

puts "FLOW: duplicate some node guid"

# duplicate the node guid from the source to the dest
proc dupNodeGuid {fromNode toNode} {
   global errorInfo
   set newGuid [IBNode_guid_get $fromNode]
   set toNodeName [IBNode_name_get $toNode]
   set fromNodeName [IBNode_name_get $fromNode]
   puts "-I- Overriding node:$toNodeName guid to $newGuid (dup of $fromNodeName)"

   # IBDM ...
   IBNode_guid_set $toNode $newGuid

   # But we need to deal with the SIMNODE too:
   set simNode "sim$toNode"
   set ni [IBMSNode_getNodeInfo $simNode]
   ib_node_info_t_node_guid_set $ni $newGuid
}

# get a random order of all the fabric nodes:
proc getNodesByRandomOreder {fabric} {
   # get number of nodes:
   set nodesByName [IBFabric_NodeByName_get $fabric]

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

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

# setup post SM run changes:
proc postSmSettings {fabric} {
   return "-I- Nothing to be done post SM"
}

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

set fabric [IBMgtSimulator getFabric]

# get a random order of the end ports:
set randNodes [getNodesByRandomOreder $fabric]
set numNodes [llength $randNodes]
set idx [expr int([rmRand]*$numNodes)]

set fromNode [lindex $randNodes $idx]
set toNode [lindex $randNodes [expr $idx+1]]

dupNodeGuid $fromNode $toNode