def importTargetList(self): xmlparse = XMLParse(xml_file_path=DEPLOY_DESIGN_FILE_URL['Target']) for target in xmlparse.query('Target'): targetProviderList = [] componentName = target.attrib['SpecName'] componentVersion = target.attrib['specVersion'] runtime_type = target._children[0]._children[0]._children[1].\ _children[1]._children[0].attrib['Type'] for element in target._children: if element.tag == 'TargetProvider': targetProviderList.append(element) targetProvider = targetProviderList self.targetList.append(DeployTarget(componentName = componentName, componentVersion = componentVersion, runtime_type = runtime_type, targetProvider = targetProvider))
def loadDeploySchema(self): xmlparse = XMLParse( xml_file_path=DEPLOY_DESIGN_FILE_URL['DeploySchema']) deploySchema = xmlparse.query('DeploySchema') for schema in deploySchema: targetInstanceList = schema[0]._children containerInstanceList = schema[1]._children targetInstanceContainerInstanceMapping = schema[2]._children self.deploySchemaList.append( DeploySchema(targetInstList=targetInstanceList, containerInstList=containerInstanceList, targetRoleMapping=self.loadTargetRoleMapping(), targetInstContainerMapping= targetInstanceContainerInstanceMapping, schema_name=self.xmlcmdbobserver.getDataCenter() [0].attrib['name'])) return
def getTargetNameByUID(self, UID): xmlparse = XMLParse(xml_file_path=DEPLOY_DESIGN_FILE_URL['Target']) for target in xmlparse.query('Target'): if UID == target.attrib['TargetUID']: return target.attrib['SpecName']
def loadRole2Devices(self): xmlparse = XMLParse( xml_file_path=DEPLOY_DESIGN_FILE_URL['Role2DeviceMapping']) return xmlparse.query('MappingItem')
def load_roles(self): xmlparse = XMLParse(xml_file_path=DEPLOY_DESIGN_FILE_URL['Role']) return xmlparse.query('Role')
def __init__(self): self.xmlparse = XMLParse( xml_file_path=DEPLOY_DESIGN_FILE_URL['EnvResource'])
def loadTargetRoleMapping(self): xmlparse = XMLParse( xml_file_path=DEPLOY_DESIGN_FILE_URL['TargetRoleMapping']) targetRoleMapping = xmlparse.query('TargetToRoleMapping') return targetRoleMapping[0]._children