def TestGetConfig(): """Internal module unit test""" s = Session() nodes = s.GetConfiguredNodeNames() config = asp.ClAmsNodeConfigT() print "Nodes: ", nodes for n in nodes: config = asp.clAmsMgmtNodeGetConfig(s.hdl,n[1]) print config sgs = s.GetConfiguredEntities(ServiceGroupType) print sgs for sg in sgs: config = asp.clAmsMgmtServiceGroupGetConfig(s.hdl,sg[1]) print config sus = s.GetConfiguredEntities(ServiceUnitType) print sus for su in sgs: config = asp.clAmsMgmtServiceUnitGetConfig(s.hdl,su[1]) print config sis = s.GetConfiguredEntities(WorkAssignmentType) print "SIs: ", sis for si in sis: config = asp.clAmsMgmtServiceInstanceGetConfig(s.hdl,si[1]) print config csis = s.GetConfiguredEntities(ComponentWorkAssignmentType) print "CSIs: ", csis for csi in csis: config = asp.clAmsMgmtCompServiceInstanceGetConfig(s.hdl,csi[1]) print config comps = s.GetConfiguredEntities(ComponentType) print "comps: ", comps for comp in comps: config = asp.clAmsMgmtCompGetConfig(s.hdl,comp[1]) print config
def TestGetConfig(): """Internal module unit test""" s = Session() nodes = s.GetConfiguredNodeNames() config = asp.ClAmsNodeConfigT() print "Nodes: ", nodes for n in nodes: config = asp.clAmsMgmtNodeGetConfig(s.hdl, n[1]) print config sgs = s.GetConfiguredEntities(ServiceGroupType) print sgs for sg in sgs: config = asp.clAmsMgmtServiceGroupGetConfig(s.hdl, sg[1]) print config sus = s.GetConfiguredEntities(ServiceUnitType) print sus for su in sgs: config = asp.clAmsMgmtServiceUnitGetConfig(s.hdl, su[1]) print config sis = s.GetConfiguredEntities(WorkAssignmentType) print "SIs: ", sis for si in sis: config = asp.clAmsMgmtServiceInstanceGetConfig(s.hdl, si[1]) print config csis = s.GetConfiguredEntities(ComponentWorkAssignmentType) print "CSIs: ", csis for csi in csis: config = asp.clAmsMgmtCompServiceInstanceGetConfig(s.hdl, csi[1]) print config comps = s.GetConfiguredEntities(ComponentType) print "comps: ", comps for comp in comps: config = asp.clAmsMgmtCompGetConfig(s.hdl, comp[1]) print config
def load(self, oldObj=None): """Load or re-load the AMF database into Python objects """ self.clear() # Blow away any old objects if fake: return s = self.amf self.loadNodes( oldObj ) # Nodes pull data from a variety of sources and so are more complex self.loadSgs() self.log("Loading SU config and status") suEntRefs = s.GetConfiguredEntities(ServiceUnitType) for su in suEntRefs: config = asp.clAmsMgmtServiceUnitGetConfig(s.hdl, su[1]) status = asp.clAmsMgmtServiceUnitGetStatus(s.hdl, su[1]) asu = AmfServiceUnit(su[1], None, None) asu.setConfig(config) asu.setStatus(status) self.suList.append(asu) self.sus[su[1]] = asu self.entities[su[1]] = asu self.suList.sort() self.log("Loading SI config and status") siEntRefs = s.GetConfiguredEntities(WorkAssignmentType) for si in siEntRefs: config = asp.clAmsMgmtServiceInstanceGetConfig(s.hdl, si[1]) status = asp.clAmsMgmtServiceInstanceGetStatus(s.hdl, si[1]) asi = AmfServiceInstance(si[1]) asi.setConfig(config) asi.setStatus(status) self.siList.append(asi) self.sis[si[1]] = asi self.entities[si[1]] = asi self.siList.sort() self.log("Loading CSI config and status") csiEntRefs = s.GetConfiguredEntities(ComponentWorkAssignmentType) nvbuf = asp.ClAmsCSINVPBufferT() for csi in csiEntRefs: config = asp.clAmsMgmtCompServiceInstanceGetConfig(s.hdl, csi[1]) status = asp.clAmsMgmtCompServiceInstanceGetStatus(s.hdl, csi[1]) SetCEntity(s.entity, csi) asp.clAmsMgmtGetCSINVPList(s.hdl, s.entity, nvbuf) nvdict = {} for i in range(0, nvbuf.count): t = asp.ClAmsCSINameValuePairT_array_getitem(nvbuf.nvp, i) nvdict[t.paramName.value] = t.paramValue.value acsi = AmfComponentServiceInstance(csi[1], nvdict) acsi.setConfig(config) acsi.setStatus(status) acsi.csiType = config.type.value self.csiList.append(acsi) self.csis[csi[1]] = acsi self.entities[csi[1]] = acsi self.csiList.sort() self.loadComps() self.log("Establishing entity parent-child relationships") self.connectEntities() self.log("Loading entity associated data") self.loadAssociatedData() self.log("Loading controller nodes information") #Create controllers list self.controllers = [] for node in self.nodeList: if node.safClass() == 'Controller': self.controllers.append(node.slot) #Load the master and deputy information master = s.GetMasterNode() self.master = master #find the deputy if len(self.controllers) < 2: self.deputy = -1 else: if self.controllers[0] == self.master: self.deputy = self.controllers[1] else: self.deputy = self.controllers[0] self.log("Clusterinfo load complete")
def load(self,oldObj=None): """Load or re-load the AMF database into Python objects """ self.clear() # Blow away any old objects if fake: return s = self.amf self.loadNodes(oldObj) # Nodes pull data from a variety of sources and so are more complex self.loadSgs() self.log("Loading SU config and status") suEntRefs = s.GetConfiguredEntities(ServiceUnitType) for su in suEntRefs: config = asp.clAmsMgmtServiceUnitGetConfig(s.hdl,su[1]) status = asp.clAmsMgmtServiceUnitGetStatus(s.hdl,su[1]) asu = AmfServiceUnit(su[1],None,None) asu.setConfig(config) asu.setStatus(status) self.suList.append(asu) self.sus[su[1]] = asu self.entities[su[1]] = asu self.suList.sort() self.log("Loading SI config and status") siEntRefs = s.GetConfiguredEntities(WorkAssignmentType) for si in siEntRefs: config = asp.clAmsMgmtServiceInstanceGetConfig(s.hdl,si[1]) status = asp.clAmsMgmtServiceInstanceGetStatus(s.hdl,si[1]) asi = AmfServiceInstance(si[1]) asi.setConfig(config) asi.setStatus(status) self.siList.append(asi) self.sis[si[1]] = asi self.entities[si[1]] = asi self.siList.sort() self.log("Loading CSI config and status") csiEntRefs = s.GetConfiguredEntities(ComponentWorkAssignmentType) nvbuf = asp.ClAmsCSINVPBufferT() for csi in csiEntRefs: config = asp.clAmsMgmtCompServiceInstanceGetConfig(s.hdl,csi[1]) status = asp.clAmsMgmtCompServiceInstanceGetStatus(s.hdl,csi[1]) SetCEntity(s.entity,csi) asp.clAmsMgmtGetCSINVPList(s.hdl,s.entity,nvbuf) nvdict = {} for i in range(0,nvbuf.count): t = asp.ClAmsCSINameValuePairT_array_getitem(nvbuf.nvp,i) nvdict[t.paramName.value] = t.paramValue.value acsi = AmfComponentServiceInstance(csi[1],nvdict) acsi.setConfig(config) acsi.setStatus(status) acsi.csiType = config.type.value self.csiList.append(acsi) self.csis[csi[1]] = acsi self.entities[csi[1]] = acsi self.csiList.sort() self.loadComps() self.log("Establishing entity parent-child relationships") self.connectEntities() self.log("Loading entity associated data") self.loadAssociatedData() self.log("Loading controller nodes information") #Create controllers list self.controllers = [] for node in self.nodeList: if node.safClass() == 'Controller': self.controllers.append(node.slot) #Load the master and deputy information master = s.GetMasterNode(); self.master = master #find the deputy if len(self.controllers) < 2: self.deputy=-1 else: if self.controllers[0] == self.master: self.deputy=self.controllers[1] else: self.deputy=self.controllers[0] self.log("Clusterinfo load complete")