6 open(MAP, "< ibdiscover.map");
9 ($pre, $port, $desc) = split /\|/;
11 # print "Ack1 - $pre - $port - $desc\n";
16 # Read old topo map in
18 open(TOPO, "< ibdiscover.topo");
23 ($localPort, $localGuid, $remotePort, $remoteGuid) = split /\|/;
25 $var = sprintf("%s|%2s|%2s|%s", $localGuid, $localPort, $remotePort,
29 # print "Ack1 - $pre - $port - $desc\n";
34 # Read stdin and output enhanced output
36 # Search and replace =0x???? with value
37 # Search and replace -000???? with value
39 open(TOPO2, " >ibdiscover.topo.new");
41 ($a, $b, $local, $d) = /([sh])([\s\S]*)=0x([a-f\d]*)([\s\S]*)/;
45 ($a eq "s" ? "Switch" : "Host"),
51 ($localPort, $type, $remoteGuid, $remotePort) =
52 /([\s\S]*)"([SH])\-000([a-f\d]*)"([\s\S]*)\n/;
53 ($localPort) = $localPort =~ /\[(\d*)]/;
54 ($remotePort) = $remotePort =~ /\[(\d*)]/;
55 if ($remoteGuid ne "" && $localPort ne "") {
56 printf(TOPO2 "%d|%s|%d|%s\n",
57 $localPort, $localGuid, $remotePort, $remoteGuid);
58 $var = sprintf("%s|%2s|%2s|%s",
59 $localGuid, $localPort, $remotePort, $remoteGuid);
62 "Local: %2s Remote: %2s %7s GUID: %s Location: %s\n",
65 ($type eq "H" ? "Host" : "Switch"),
67 ($val{$remoteGuid} ne "" ? $val{$remoteGuid} : $remoteGuid)
75 printf("\nDelta change in topo (change between successive runs)\n\n");
77 foreach $el (keys %topo) {
78 if ($topo{$el} < 2 || $topomap == 0) {
79 ($lg, $lp, $rp, $rg) = split(/\|/, $el);
81 "Link change: Local/Remote Port %2d/%2d Local/Remote GUID: %s/%s\n",
83 printf("\tLocations: Local/Remote\n\t\t%s\n\t\t%s\n\n",
84 $val{$lg}, $val{$rg});