def loadComps(self, comps2Load=None):
        s = self.amf
        self.log("Loading Component config and status")
        if not comps2Load: compEntRefs = s.GetConfiguredEntities(ComponentType)
        else: compEntRefs = [(ComponentType, x.name) for x in comps2Load]

        for comp in compEntRefs:
            config = asp.clAmsMgmtCompGetConfig(s.hdl, comp[1])
            status = asp.clAmsMgmtCompGetStatus(s.hdl, comp[1])
            acomp = AmfComponent(comp[1])
            acomp.setConfig(config)
            acomp.setStatus(status)

            self.compList.append(acomp)
            self.comps[comp[1]] = acomp
            self.entities[comp[1]] = acomp
        self.compList.sort()
  def loadComps(self, comps2Load=None):
    s = self.amf
    self.log("Loading Component config and status")
    if not comps2Load: compEntRefs = s.GetConfiguredEntities(ComponentType)
    else: compEntRefs = [(ComponentType,x.name) for x in comps2Load]

    for comp in compEntRefs:
      config = asp.clAmsMgmtCompGetConfig(s.hdl,comp[1])
      status = asp.clAmsMgmtCompGetStatus(s.hdl,comp[1])
      acomp = AmfComponent(comp[1])
      acomp.setConfig(config)
      acomp.setStatus(status)

      self.compList.append(acomp)
      self.comps[comp[1]] = acomp
      self.entities[comp[1]] = acomp
    self.compList.sort()
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