2
puts "FLOW: have some multicats groups with some partial connectivity too"
4
# get a random order of all the fabric HCA endports:
5
# a list of {node port-num random}
6
proc getEndPortsByRandomOrder {fabric} {
8
set nodesByName [IBFabric_NodeByName_get $fabric]
11
foreach nodeNameNId [IBFabric_NodeByName_get $fabric] {
12
set node [lindex $nodeNameNId 1]
14
if {[IBNode_type_get $node] != 1} {
15
# only connected ports please:
16
set numPorts [IBNode_numPorts_get $node]
17
for {set pn 1} {$pn <= $numPorts} {incr pn} {
18
set port [IBNode_getPort $node $pn]
19
if {($port != "") && ([IBPort_p_remotePort_get $port] != "")} {
20
lappend portNOrderLIst [list $port [rmRand]]
27
foreach portNRnd [lsort -index 1 -real $portNOrderLIst] {
28
lappend randPorts [lrange $portNRnd 0 1]
33
# get random list of switch nodes:
34
proc getRandomSwitchNodesList {fabric} {
35
# get number of nodes:
36
set nodesByName [IBFabric_NodeByName_get $fabric]
39
foreach nodeNameNId [IBFabric_NodeByName_get $fabric] {
40
set node [lindex $nodeNameNId 1]
42
# only switches please
43
if {[IBNode_type_get $node] == 1} {
44
lappend nodeNOrderList [list $node [rmRand]]
49
foreach nodeNRnd [lsort -index 1 -real $nodeNOrderList] {
50
lappend randNodes [lindex $nodeNRnd 0]
55
# send a single port join request
56
proc sendJoinForPort {mgid port} {
57
puts "-I- Joining port $port"
58
# allocate a new mc member record:
59
set mcm [new_madMcMemberRec]
61
# join the IPoIB broadcast gid:
62
madMcMemberRec_mgid_set $mcm $mgid
64
# we must provide our own port gid
65
madMcMemberRec_port_gid_set $mcm \
66
"0xfe80000000000000:[string range [IBPort_guid_get $port] 2 end]"
68
# must require full membership:
69
madMcMemberRec_scope_state_set $mcm 0x1
71
# we need port number and sim node for the mad send:
72
set portNum [IBPort_num_get $port]
73
set node [IBPort_p_node_get $port]
75
# we need the comp_mask to include the mgid, port gid and join state:
76
set compMask "0x00000000000130c7"
78
# send it assuming the SM_LID is always 1:
79
madMcMemberRec_send_set $mcm sim$node $portNum 1 $compMask
82
delete_madMcMemberRec $mcm
87
# scan the switches (randomly) for a MFT entry which is not zero
88
# delete the first entry foudn and return
89
proc removeMCastRouteEntry {fabric} {
90
set nodes [getRandomSwitchNodesList $fabric]
92
while {[llength $nodes]} {
93
set node [lindex $nodes 0]
95
set mftBlock [IBMSNode_getMFTBlock sim$node 0 0]
96
if {[llength $mftBlock] == 32} {
97
set idx [lsearch -regexp $mftBlock {0x0*[1-9a-fA-F]+0*}]
100
set newMftBlock [lreplace $mftBlock $idx $idx 0x0000]
101
puts "-I- Replacing MFT block $node 0 0"
102
puts " from:$mftBlock"
103
puts " to: $newMftBlock"
104
IBMSNode_setMFTBlock sim$node 0 0 $newMftBlock
108
set nodes [lrange $nodes 1 end]
113
# setup post SM run changes:
114
proc postSmSettings {fabric} {
117
puts "-I- Joining MGRPS and Disconnecting some MFT routes..."
118
set endPorts [getEndPortsByRandomOrder $fabric]
120
# now we need several mgrps:
122
0xff12401bffff0000:00000000ffffffff
123
0xff12401bffff0000:0000000000000001
124
0xff12401bffff0000:0000000000000002
127
# go one port at a time and join:
130
foreach port $endPorts {
131
set mgid [lindex $mgids $idx]
134
if {$idx > 2} {set idx 0}
136
set portName [IBPort_getName $port]
137
if {[catch {sendJoinForPort $mgid $port} e]} {
138
puts "-E- Fail to join $portName to $mgid : $e $errorInfo"
140
puts "-I- Port $portName joined $mgid"
151
# now go and delete some switch MC entries...
152
for {set i 0} {$i < 3} {incr i} {
154
if {![removeMCastRouteEntry $fabric]} {
162
return "-I- Joined $nPorts Disconnected $nDisconencted"
165
# make sure ibdiagnet reported the bad links
166
proc verifyDiagRes {fabric logFile} {
167
return "Could not figure out if OK yet"
170
set fabric [IBMgtSimulator getFabric]