sys.path.append("/usr/local/hen/lib/") for i in temp: sys.path.append(i) from henmanager import HenManager ########################################################################################### # Main execution ########################################################################################### print "Content-Type: text/xml" print "" print "" print "<row>" manager = HenManager("/usr/local/hen/etc/configs/config" ) racks = manager.getInfrastructures("rack") nodes = manager.getNodes("all", "all") rackNodes = {} for key in racks.keys(): rackNodes[key] = [] for nodeTypeDictionary in nodes.values(): for node in nodeTypeDictionary.values(): location = node.getPhysicalLocation() if (location != None): if rackNodes.has_key(location.getRackName()): s = '<node id="' + str(node.getNodeID()) s += '" type="physicallocation-' + str(node.getNodeType()) if (location.getRackStartUnit() != None):
#sys.path.append("/home/arkell/u0/adam/development/svn/hen_scripts/lib/") for i in temp: sys.path.append(i) #os.environ["PATH"] += ":/usr/local/bin:/usr/bin" from henmanager import HenManager ########################################################################################### # Main execution ########################################################################################### print "Content-Type: text/xml" print "" print "" print "<row>" manager = HenManager() racks = manager.getInfrastructures("rack") nodes = manager.getNodes("all") for key in racks.keys(): r = racks[key] print "<rack id=\""+str(r.getID())+ \ "\" rowposition=\""+str(r.getRowPosition())+ \ "\" height=\""+str(r.getPhysicalSize().getHeight())+ \ "\" width=\""+str(r.getPhysicalSize().getWidth())+ \ "\" numberunits=\""+str(r.getPhysicalSize().getNumberUnits())+ "\" >" for nodeTypeDictionary in nodes.values(): for node in nodeTypeDictionary.values(): location = node.getPhysicalLocation() if (location != None): if (location.getRackName() == r.getID()):
#sys.path.append("/usr/local/hen/lib/") for i in temp: sys.path.append(i) #os.environ["PATH"] += ":/usr/local/bin:/usr/bin" from henmanager import HenManager ########################################################################################### # Main execution ########################################################################################### print "Content-Type: text/xml" print "" print "" print "<row>" manager = HenManager("/usr/local/hen/etc/configs/config") racks = manager.getInfrastructures("rack", "all") nodes = manager.getNodes("all", "all") for key in racks.keys(): r = manager.getInfrastructures("rack")[key] s = '<rack id="' + str(r.getID()) + \ '" rowposition="' + str(r.getRowPosition()) + \ '" height="' + str(r.getPhysicalSize().getNumberUnits()) if (r.getPhysicalSize().getWidth() == "75"): s += '" width="wide" >' elif (r.getPhysicalSize().getWidth() == "60"): s += '" width="narrow" >' else: s += '" width="wide" >' print s
#! /usr/bin/env python from henmanager import HenManager from auxiliary.hen import Node, SensorNode manager = HenManager() manager.initLogging() infrastructures = manager.getInfrastructures("all") for infrastructureType in infrastructures.keys(): for infrastructure in infrastructures[infrastructureType].values(): #print infrastructure.getID() print str(infrastructure)