~ubuntu-branches/ubuntu/raring/ibutils/raring-proposed

« back to all changes in this revision

Viewing changes to ibmgtsim/tests/duplicateGuid.sim.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Benoit Mortier
  • Date: 2010-01-11 22:22:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100111222200-53kum2et5nh13rv3
Tags: upstream-1.2-OFED-1.4.2
ImportĀ upstreamĀ versionĀ 1.2-OFED-1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
puts "Randomally Set Duplicated Port Guid (do not touch the SM port)"
 
3
 
 
4
proc duplicatePortGuid {fromPort toPort } {
 
5
   IBPort_guid_set $toPort [IBPort_guid_get $fromPort]
 
6
}
 
7
 
 
8
# get a random order of all the fabric nodes:
 
9
proc getNodesByRandomOreder {fabric} {
 
10
   # get number of nodes:
 
11
   set nodesByName [IBFabric_NodeByName_get $fabric]
 
12
 
 
13
   set nodeNameNOrderList {}
 
14
   foreach nodeNameNId [IBFabric_NodeByName_get $fabric] {
 
15
      lappend nodeNameNOrderList [list [lindex $nodeNameNId 1] [rmRand]]
 
16
   }
 
17
 
 
18
   set randNodes {}
 
19
   foreach nodeNameNOrder [lsort -index 1 -real $nodeNameNOrderList] {
 
20
      lappend randNodes [lindex $nodeNameNOrder 0]
 
21
   }
 
22
   return $randNodes
 
23
}
 
24
 
 
25
set fabric [IBMgtSimulator getFabric]
 
26
 
 
27
# get a random order of the nodes:
 
28
set randNodes [getNodesByRandomOreder $fabric]
 
29
set numNodes [llength $randNodes]
 
30
 
 
31
# now get the first N nodes for err profile ...
 
32
set numNodesUsed 0
 
33
set idx 0
 
34
while {($numNodesUsed < $numNodes / 10) && ($numNodesUsed < 12) && ($idx < $numNodes)} {
 
35
   set node [lindex $randNodes $idx]
 
36
   # ignore the root node:
 
37
   if {[IBNode_name_get $node] != "H-1/U1"} {
 
38
      if {[IBNode_type_get $node] != 1} {
 
39
         setNodePortErrProfile $node
 
40
         incr numNodesUsed
 
41
      }
 
42
   }
 
43
   incr idx
 
44
}