def findTopology(): #sys.stderr.write( sys.argv[0] + ': Info: reading ibnetdiscover file.\n' ) switchTree, blah, lidPortHost, blah = parseIbnetdiscover() #print 'switchTree (len', len(switchTree), ')' # , switchTree # by switch LID s = {} sOld = {} keys = {} cmd = {} lp = {} for t in chipTypes: s[t] = {} sOld[t] = {} keys[t] = findLidsByType( switchTree, t ) cmd[t], cnt, lp[t] = buildIbCmd( switchTree, keys[t] ) #print 'cmd', t, cmd[t] #print 'lp', t, lp[t] #for l,p in lp[t]: # print t,l,switchTree[l][0],p #sys.exit(1) return s, sOld, cmd, lp
if pick >= len(pairs): print 'sorry. there aren\'t that many sets of IB files. max', len(pairs), 'pick', pick sys.exit(1) elif pick < 0: print 'IB file set number must be >0' sys.exit(1) pair = p0, p1 = pairs[-pick] grp0 = groups[p0] grp1 = groups[p1] if debug: print 'pick', pick, 'using', pair, 'grp0', grp0, 'grp1', grp1 ibNetFile = grp1['ibnetdiscover'][1] switchTree, byName, lph, rates = parseIbnetdiscover( ibNetFile=ibNetFile ) #print 'switchTree (len', len(switchTree), ')' # , switchTree # by switch LID #print 'byName (len', len(byName), ')' # , byName # by hostname #print 'lph (len', len(lph), ')' # , lph # swlid, swport, lid, host #print 'rates (len', len(rates), ')', rates # swlid, swport, lid, host errs = parseIbcheckerrors( allErrs, grp1['ibcheckerrors'][1] ) #print 'errs', errs # by (lid, port), but hostname in 'name' field for hosts if 'rebooted' in grp1.keys(): # use rebooted file... f = open( ibDir + '/' + grp1['rebooted'][1], 'r' ) ff = f.readlines() f.close() ignore = [] for i in ff:
sys.exit(1) if sys.argv[1] == "--host": hostMode = "host" elif sys.argv[1] == "--switch": hostMode = "switch" else: print "needs --host or --switch" sys.exit(1) if __name__ == "__main__": first = 1 parseArgs() blah, blah, lidPortHost, blah = parseIbnetdiscover() # print lidPortHost, len(lidPortHost) sOld = {} while 1: if not first: time.sleep(sleepTime) up = listOfUpHosts(aliveTime) # hack -> # up = [] # for i in range(1033,1152+1): # up.append( 'v%d' % i ) # if first: # print 'up', up
def parseArgs(): global dumpFile try: opts, args = getopt.getopt( sys.argv[1:], 'h', ['help' ] ) except getopt.GetoptError: usage() # print help information and exit for o, a in opts: if o in ('-h', '--help'): usage() if len(args) != 1: usage() dumpFile = sys.argv[1] if __name__ == '__main__': parseArgs() switchTree, byName, lidPortHost, r = parseIbnetdiscover( ibDir=ibDir ) #print 'switchTree (len', len(switchTree), ')' # , switchTree # by switch LID #print 'byName (len', len(byName), ')' # , byName # by hostname #print 'lph (len', len(lidPortHost), ')' # , lidPortHost # swlid, swport, lid, host lpn, hCnt, swCnt = lidPorts( lidPortHost, switchTree ) #print 'hCnt', hCnt, 'swCnt', swCnt, 'len(lpn)', len(lpn) #, 'lpn', lpn s = runChunkedIbperfs( lpn ) dumpStats( s )
sys.argv.remove('-q') qnemTraces=1 def usage(): print 'usage:', sys.argv[0], '[-v] [-q] switchName1 switchName2' print ' output is lid,port\'s on switchName1 that connect to switchName2' print ' -v will print name,lid,port at both ends' print ' -q will print qnem<->qnem traces as well as cabled connections' print ' eg.', sys.argv[0], 'qnem-07-4a M9-4-LC-0c' sys.exit(1) if len(sys.argv) > 3: usage() if __name__ == '__main__': switchTree, byName, lph, r = parseIbnetdiscover( ibDir=ibDir ) #print 'switchTree (len', len(switchTree), ')' # , switchTree # by switch LID #print 'byName (len', len(byName), ')' # , byName # by hostname #print 'lph (len', len(lph), ')' # , lph # swlid, swport, lid, host s1 = sys.argv[1] s2 = sys.argv[2] if lidType(s2) == 'qnem' and lidType(s1) != 'qnem': # swap them to put the qnem first s = s1 s1 = s2 s2 = s l1 = findLidByName( switchTree, lph, s1 ) if l1 == None: print 'Error: could not find s1', s1, 'in switchTree. please check switch name'
return s def m9number( name ): # convert eg. M9-4-LC-1c to '4' return int(name.split('-')[1]) def lcChipName( name ): # convert eg. M9-4-LC-1c to '1c' return name.split('-')[3] def isM2( name ): return ( name[:2] == 'M2' ) if __name__ == '__main__': if len(sys.argv) == 2: switchTree, byName, lph, r = parseIbnetdiscover( ibNetFile=sys.argv[1] ) else: switchTree, byName, lph, r = parseIbnetdiscover( ibDir=ibDir ) print 'switchTree (len', len(switchTree), ')' # , switchTree # by switch LID print 'byName (len', len(byName), ')' # , byName # by hostname print 'lph (len', len(lph), ')' # , lph # swlid, swport, lid, host chipPorts = 36 lcFcLinks = chipPorts/2 # full fat tree lcQnemLinks = chipPorts/2 # full fat tree lcM2Links = 12 m9s = ( 1,2,3,4 ) qnemLcLinks = 12 # 12 to nodes, 12 to LC, 12 to other qnem ioLC = ( 'M9-1-LC-5d', 'M9-2-LC-5d', 'M9-3-LC-5d', 'M9-4-LC-5d' ) partialLC = ( 'M9-1-LC-4c', 'M9-2-LC-4c', 'M9-3-LC-4c', 'M9-4-LC-4c', 'M9-1-LC-5c', 'M9-2-LC-5c', 'M9-3-LC-5c', 'M9-4-LC-5c', 'M9-1-LC-5d', 'M9-2-LC-5d', 'M9-3-LC-5d', 'M9-4-LC-5d' )