def loadSgs(self):
        """Private:  Reloads the service group from the C layers (call load() instead)"""
        self.log("Loading SG config and status")
        sgs = asppycustom.GetConfiguredEntities(ServiceGroupType)
        for sg in sgs:
            name = sg[1]
            # Create the entity
            asg = AmfServiceGroup(name)
            config = asp.clAmsMgmtServiceGroupGetConfig(self.amf.hdl, name)
            asg.setConfig(config)
            state = asp.clAmsMgmtServiceGroupGetStatus(self.amf.hdl, name)
            asg.setState(state)

            # Allow it to be indexed by name
            self.sgs[name] = asg
            self.entities[name] = asg
            # Allow an iterator to hit only the SGs
            self.sgList.append(asg)
        self.sgList.sort()
    def loadNodes(self, oldObj=None):
        """Private:  Reloads the node information from the C layers (call load() instead)"""
        self.log("Loading node config and status")
        if fake: return
        nodes = asppycustom.GetConfiguredEntities(NodeType)

        self.log("Loading live node list")
        #livenodelist = asppycustom.GetRunningNodeList()
        livenodes = self.alive = self.amf.GetAllWorkAssignments()
        self.log("Loading live nodes complete")

        for node in nodes:
            name = node[1]

            liveInfo = livenodes.get(name, None)

            # Create the node
            if liveInfo: nodeSlot = liveInfo['slot']
            else: nodeSlot = 0
            n = AmfNode(name, nodeSlot)

            try:
                installInfo = asp.clAmsMgmtGetAspInstallInfo(
                    self.amf.hdl, name, 255)
                installInfo = dict(
                    [x.split("=") for x in installInfo.split(",")])
                n.setIntraclusterAccess(installInfo['interface'].split(":")[1],
                                        None, None,
                                        installInfo.get('dir', None))
                n.aspVersion = installInfo['version']
            except SystemError, e:
                pass

            # Add the configured info
            try:
                nsd = self.suppliedData.nodes[name]
            except KeyError:
                self.log(
                    "Supplied configuration does not contain blade definition [%s]"
                    % name)
                nsd = None
            except AttributeError:  # it doesn't even have .nodes
                self.log(
                    "Supplied configuration does not contain any blade definitions"
                )
                nsd = None

            # Add the AMF status and config
            config = asp.clAmsMgmtNodeGetConfig(self.amf.hdl, name)
            status = asp.clAmsMgmtNodeGetStatus(self.amf.hdl, name)
            n.setConfig(config)
            n.setStatus(status)

            if nsd:
                # Set Intracluster Access
                n.setIntraclusterAccess(nsd.ip, nsd.user, nsd.password,
                                        nsd.aspdir)
                # Allow it to be indexed by IP
                self.nodes[nsd.ip] = n

            if oldObj:
                oldnode = oldObj.entities.get(name, None)
                if oldnode:
                    n.copyLocalState(oldnode)

            # Allow it to be indexed by name
            self.nodes[name] = n
            self.entities[name] = n
            # Allow it to be indexed by slot (if it has one)
            if n.slot: self.nodes[n.slot] = n
            # Allow an iterator to hit only the nodes
            self.nodeList.append(n)
 def GetConfiguredEntities(self, *entityTypes):
     """Return a list of entities by name
    @param entityTypes integer types of the entities you want. For example, \ref aspAmfEntity.NodeType (preferred) or \ref asp.CL_AMS_ENTITY_TYPE_NODE
 """
     return asppycustom.GetConfiguredEntities(*entityTypes)
 def GetConfiguredServiceGroupNames(self):
     """Return a list of existing nodes where each node is a dictionary
 The \ref clusterinfo module provides a much more extensive API
 """
     return asppycustom.GetConfiguredEntities(ServiceGroupType)
 def GetConfiguredNodeNames(self):
     """Return a list of existing nodes as (type, name) pairs
 The \ref clusterinfo module provides a much more extensive API
 """
     return [x[1] for x in asppycustom.GetConfiguredEntities(NodeType)]