def getVmwareEsxComputerSystems(client): ''' CimClient -> list(EsxComputerSystem) ''' esxInstances = client.getInstances("VMWARE_ESXComputerSystem") esxList = [] for esxInstance in esxInstances: esx = EsxComputerSystem() esx.setObjectPath(esxInstance.getObjectPath()) esx.name = cim_discover.cleanString(_getCimInstanceProperty(esxInstance, 'Name')) esx.elementName = cim_discover.cleanString(_getCimInstanceProperty(esxInstance, 'ElementName')) identifyingDescriptions = _getCimInstanceProperty(esxInstance, 'IdentifyingDescriptions') identifyingDescriptions = map(cim_discover.cleanString, identifyingDescriptions) otherIdentifyingInfo = _getCimInstanceProperty(esxInstance, 'OtherIdentifyingInfo') otherIdentifyingInfo = map(cim_discover.cleanString, otherIdentifyingInfo) customProperties = _dictionaryFromCrossCollections(identifyingDescriptions, otherIdentifyingInfo) esx.biosUuid = customProperties.get("BIOS UUID") esxList.append(esx) return esxList
def getHypervisorSoftwareIdentityByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> VmwareHypervisorSoftwareIdentity or None ''' softwareIdentityInstances = cim_discover.getAssociatorsWithTypeEnforcement(client, unitaryComputerSystem.getObjectPath(), "VMware_InstalledSoftwareIdentity", "VMware_HypervisorSoftwareIdentity") hypervisorInstance = softwareIdentityInstances and softwareIdentityInstances[0] or None if hypervisorInstance is not None: hypervisorSoftwareIdentity = VmwareHypervisorSoftwareIdentity() hypervisorSoftwareIdentity.setObjectPath(hypervisorInstance.getObjectPath()) hypervisorSoftwareIdentity.name = cim_discover.cleanString(_getCimInstanceProperty(hypervisorInstance, 'Name')) hypervisorSoftwareIdentity.elementName = cim_discover.cleanString(_getCimInstanceProperty(hypervisorInstance, 'ElementName')) hypervisorSoftwareIdentity.versionString = cim_discover.cleanString(_getCimInstanceProperty(hypervisorInstance, 'VersionString')) majorVersion = _getCimInstanceProperty(hypervisorInstance, 'MajorVersion') hypervisorSoftwareIdentity.majorVersion = cim_discover.getIntFromCimInt(majorVersion) minorVersion = _getCimInstanceProperty(hypervisorInstance, 'MinorVersion') hypervisorSoftwareIdentity.minorVersion = cim_discover.getIntFromCimInt(minorVersion) revisionNumber = _getCimInstanceProperty(hypervisorInstance, 'RevisionNumber') hypervisorSoftwareIdentity.revisionNumber = cim_discover.getIntFromCimInt(revisionNumber) largeBuildNumber = _getCimInstanceProperty(hypervisorInstance, 'LargeBuildNumber') hypervisorSoftwareIdentity.largeBuildNumber = cim_discover.getIntFromCimInt(largeBuildNumber) lastStartTime = _getCimInstanceProperty(hypervisorInstance, 'LastStartTime') hypervisorSoftwareIdentity.lastStartTime = cim_discover.getDateFromCimDate(lastStartTime) return hypervisorSoftwareIdentity
def getProcessorsByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> list(Processor) Get Processors by UnitaryComputerSystem ''' processorInstances = client.getInstances("OMC_Processor") processors = [] ignoredProcessorsCount = 0 for processorInstace in processorInstances: systemName = cim_discover.cleanString(_getCimInstanceProperty(processorInstace, 'SystemName')) # uuid of cpu should match uuid of ESX, safe check if unitaryComputerSystem.name == systemName: processor = Processor() processor.setObjectPath(processorInstace.getObjectPath()) processor.systemName = systemName processor.cpuStatus = cim_discover.getIntFromCimInt(_getCimInstanceProperty(processorInstace, 'CPUStatus')) processor.elementName = cim_discover.cleanString(_getCimInstanceProperty(processorInstace, 'ElementName')) modelName = cim_discover.cleanString(_getCimInstanceProperty(processorInstace, 'ModelName')) processor.modelName = modelName and re.sub(r"\s+", " ", modelName) processor.currentClockSpeed = cim_discover.getIntFromCimInt(_getCimInstanceProperty(processorInstace, 'CurrentClockSpeed')) processor.numberOfEnabledCores = cim_discover.getIntFromCimInt(_getCimInstanceProperty(processorInstace, 'NumberOfEnabledCores')) processor.enabledState = cim_discover.getIntFromCimInt(_getCimInstanceProperty(processorInstace, 'EnabledState')) processors.append(processor) else: ignoredProcessorsCount += 1 if ignoredProcessorsCount > 0: logger.warn("Ignored %s processors due to mismatching UUID or being disabled" % ignoredProcessorsCount) return processors
def getVmwareEsxComputerSystems(client): ''' CimClient -> list(EsxComputerSystem) ''' esxInstances = client.getInstances("VMWARE_ESXComputerSystem") esxList = [] for esxInstance in esxInstances: esx = EsxComputerSystem() esx.setObjectPath(esxInstance.getObjectPath()) esx.name = cim_discover.cleanString( _getCimInstanceProperty(esxInstance, 'Name')) esx.elementName = cim_discover.cleanString( _getCimInstanceProperty(esxInstance, 'ElementName')) identifyingDescriptions = _getCimInstanceProperty( esxInstance, 'IdentifyingDescriptions') identifyingDescriptions = map(cim_discover.cleanString, identifyingDescriptions) otherIdentifyingInfo = _getCimInstanceProperty(esxInstance, 'OtherIdentifyingInfo') otherIdentifyingInfo = map(cim_discover.cleanString, otherIdentifyingInfo) customProperties = _dictionaryFromCrossCollections( identifyingDescriptions, otherIdentifyingInfo) esx.biosUuid = customProperties.get("BIOS UUID") esxList.append(esx) return esxList
def getVmwareEthernetPortsByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> list[VmwareEthernetPort] ''' # instead of querying by associations query directly and compare key attributes # associations currently return all possible classes, cannot filter by class name portInstances = client.getInstances("VMware_EthernetPort") ports = [] for portInstance in portInstances: port = VmwareEthernetPort() port.setObjectPath(portInstance.getObjectPath()) port.systemName = cim_discover.cleanString( _getCimInstanceProperty(portInstance, 'SystemName')) port.name = cim_discover.cleanString( _getCimInstanceProperty(portInstance, 'Name')) port.elementName = cim_discover.cleanString( _getCimInstanceProperty(portInstance, 'ElementName')) permanentAddress = _getCimInstanceProperty(portInstance, 'PermanentAddress') if netutils.isValidMac(permanentAddress): port.permanentAddress = netutils.parseMac(permanentAddress) if port.systemName == unitaryComputerSystem.name and port.permanentAddress: ports.append(port) return ports
def getChassisByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> Chassis or None ''' chassisInstances = cim_discover.getAssociatorsWithTypeEnforcement( client, unitaryComputerSystem.getObjectPath(), "OMC_ComputerSystemPackage", "OMC_Chassis") chassisInstance = chassisInstances and chassisInstances[0] or None if chassisInstance is not None: chassis = Chassis() chassis.setObjectPath(chassisInstance.getObjectPath()) chassis.manufacturer = cim_discover.cleanString( _getCimInstanceProperty(chassisInstance, 'Manufacturer')) chassis.model = cim_discover.cleanString( _getCimInstanceProperty(chassisInstance, 'Model')) chassis.oemSpecificStrings = _getCimInstanceProperty( chassisInstance, 'OEMSpecificStrings') serialNumber = cim_discover.cleanString( _getCimInstanceProperty(chassisInstance, 'SerialNumber')) if host_discoverer.isServiceTagValid(serialNumber): chassis.serialNumber = serialNumber chassis.uuid = cim_discover.cleanString( _getCimInstanceProperty(chassisInstance, 'uuid')) return chassis
def getVmwareEthernetPortsByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> list[VmwareEthernetPort] ''' # instead of querying by associations query directly and compare key attributes # associations currently return all possible classes, cannot filter by class name portInstances = client.getInstances("VMware_EthernetPort") ports = [] for portInstance in portInstances: port = VmwareEthernetPort() port.setObjectPath(portInstance.getObjectPath()) port.systemName = cim_discover.cleanString(_getCimInstanceProperty(portInstance, 'SystemName')) port.name = cim_discover.cleanString(_getCimInstanceProperty(portInstance, 'Name')) port.elementName = cim_discover.cleanString(_getCimInstanceProperty(portInstance, 'ElementName')) permanentAddress = _getCimInstanceProperty(portInstance, 'PermanentAddress') if netutils.isValidMac(permanentAddress): port.permanentAddress = netutils.parseMac(permanentAddress) if port.systemName == unitaryComputerSystem.name and port.permanentAddress: ports.append(port) return ports
def getVirtualMachinesByEsx(client, esxInstance): ''' CimClient -> list(VmComputerSystem) ''' vmInstances = cim_discover.getAssociatorsWithTypeEnforcement( client, esxInstance.getObjectPath(), "VMWARE_HostedDependency", "VMWARE_VMComputerSystem") vmList = [] for vmInstance in vmInstances: vm = VmComputerSystem() vm.setObjectPath(vmInstance.getObjectPath()) vm.name = cim_discover.cleanString( _getCimInstanceProperty(vmInstance, "Name")) elementName = _getCimInstanceProperty(vmInstance, "ElementName") elementName = cim_discover.cleanString(elementName) # html unescape : & -> & elementName = cim_discover.htmlUnescape(elementName) # url unescape: %25 -> % # vmware escapes 3 characters, both slashes and % elementName = urllib.unquote(elementName) vm.elementName = elementName description = _getCimInstanceProperty(vmInstance, "Description") description = cim_discover.cleanString(description) vm.description = cim_discover.htmlUnescape(description) identifyingDescriptions = _getCimInstanceProperty( vmInstance, 'IdentifyingDescriptions') identifyingDescriptions = map(cim_discover.cleanString, identifyingDescriptions) otherIdentifyingInfo = _getCimInstanceProperty(vmInstance, 'OtherIdentifyingInfo') otherIdentifyingInfo = map(cim_discover.cleanString, otherIdentifyingInfo) customProperties = _dictionaryFromCrossCollections( identifyingDescriptions, otherIdentifyingInfo) vm.biosUuid = customProperties.get("BIOS UUID") vm.hostName = customProperties.get("Hostname") primaryIpAddress = customProperties.get("Primary IP Address") if netutils.isValidIp( primaryIpAddress) and not netutils.isLocalIp(primaryIpAddress): vm.primaryIpAddress = primaryIpAddress operationalStatusArray = _getCimInstanceProperty( vmInstance, 'OperationalStatus') if operationalStatusArray is not None: for statusValue in operationalStatusArray: if statusValue is not None: statusValueInt = cim_discover.getIntFromCimInt(statusValue) vm.operationalStatus.add(statusValueInt) vmList.append(vm) return vmList
def getVirtualMachinesByEsx(client, esxInstance): ''' CimClient -> list(VmComputerSystem) ''' vmInstances = cim_discover.getAssociatorsWithTypeEnforcement(client, esxInstance.getObjectPath(), "VMWARE_HostedDependency", "VMWARE_VMComputerSystem") vmList = [] for vmInstance in vmInstances: vm = VmComputerSystem() vm.setObjectPath(vmInstance.getObjectPath()) vm.name = cim_discover.cleanString(_getCimInstanceProperty(vmInstance, "Name")) elementName = _getCimInstanceProperty(vmInstance, "ElementName") elementName = cim_discover.cleanString(elementName) # html unescape : & -> & elementName = cim_discover.htmlUnescape(elementName) # url unescape: %25 -> % # vmware escapes 3 characters, both slashes and % elementName = urllib.unquote(elementName) vm.elementName = elementName description = _getCimInstanceProperty(vmInstance, "Description") description = cim_discover.cleanString(description) vm.description = cim_discover.htmlUnescape(description) identifyingDescriptions = _getCimInstanceProperty(vmInstance, 'IdentifyingDescriptions') identifyingDescriptions = map(cim_discover.cleanString, identifyingDescriptions) otherIdentifyingInfo = _getCimInstanceProperty(vmInstance, 'OtherIdentifyingInfo') otherIdentifyingInfo = map(cim_discover.cleanString, otherIdentifyingInfo) customProperties = _dictionaryFromCrossCollections(identifyingDescriptions, otherIdentifyingInfo) vm.biosUuid = customProperties.get("BIOS UUID") vm.hostName = customProperties.get("Hostname") primaryIpAddress = customProperties.get("Primary IP Address") if netutils.isValidIp(primaryIpAddress) and not netutils.isLocalIp(primaryIpAddress): vm.primaryIpAddress = primaryIpAddress operationalStatusArray = _getCimInstanceProperty(vmInstance, 'OperationalStatus') if operationalStatusArray is not None: for statusValue in operationalStatusArray: if statusValue is not None: statusValueInt = cim_discover.getIntFromCimInt(statusValue) vm.operationalStatus.add(statusValueInt) vmList.append(vm) return vmList
def getMemoryByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> list(Memory) Get Memory by UnitaryComputerSystem ''' memoryInstances = client.getInstances("OMC_Memory") memoryList = [] ignoredMemoryCount = 0 for memoryInstance in memoryInstances: systemName = cim_discover.cleanString( _getCimInstanceProperty(memoryInstance, 'SystemName')) # uuid of memory should match uuid of ESX, safe check if unitaryComputerSystem.name == systemName: memory = Memory() memory.setObjectPath(memoryInstance.getObjectPath()) memory.systemName = systemName memory.numberOfBlocks = cim_discover.getIntFromCimInt( _getCimInstanceProperty(memoryInstance, "NumberOfBlocks")) memory.blockSize = cim_discover.getIntFromCimInt( _getCimInstanceProperty(memoryInstance, "BlockSize")) memoryList.append(memory) else: ignoredMemoryCount += 1 if ignoredMemoryCount > 0: logger.warn("Ignored %s memory instances due to mismatching UUID") return memoryList
def getMemoryByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> list(Memory) Get Memory by UnitaryComputerSystem ''' memoryInstances = client.getInstances("OMC_Memory") memoryList = [] ignoredMemoryCount = 0 for memoryInstance in memoryInstances: systemName = cim_discover.cleanString(_getCimInstanceProperty(memoryInstance, 'SystemName')) # uuid of memory should match uuid of ESX, safe check if unitaryComputerSystem.name == systemName: memory = Memory() memory.setObjectPath(memoryInstance.getObjectPath()) memory.systemName = systemName memory.numberOfBlocks = cim_discover.getIntFromCimInt(_getCimInstanceProperty(memoryInstance, "NumberOfBlocks")) memory.blockSize = cim_discover.getIntFromCimInt(_getCimInstanceProperty(memoryInstance, "BlockSize")) memoryList.append(memory) else: ignoredMemoryCount += 1 if ignoredMemoryCount > 0: logger.warn("Ignored %s memory instances due to mismatching UUID") return memoryList
def getHypervisorSoftwareIdentityByUnitaryComputerSystem( client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> VmwareHypervisorSoftwareIdentity or None ''' softwareIdentityInstances = cim_discover.getAssociatorsWithTypeEnforcement( client, unitaryComputerSystem.getObjectPath(), "VMware_InstalledSoftwareIdentity", "VMware_HypervisorSoftwareIdentity") hypervisorInstance = softwareIdentityInstances and softwareIdentityInstances[ 0] or None if hypervisorInstance is not None: hypervisorSoftwareIdentity = VmwareHypervisorSoftwareIdentity() hypervisorSoftwareIdentity.setObjectPath( hypervisorInstance.getObjectPath()) hypervisorSoftwareIdentity.name = cim_discover.cleanString( _getCimInstanceProperty(hypervisorInstance, 'Name')) hypervisorSoftwareIdentity.elementName = cim_discover.cleanString( _getCimInstanceProperty(hypervisorInstance, 'ElementName')) hypervisorSoftwareIdentity.versionString = cim_discover.cleanString( _getCimInstanceProperty(hypervisorInstance, 'VersionString')) majorVersion = _getCimInstanceProperty(hypervisorInstance, 'MajorVersion') hypervisorSoftwareIdentity.majorVersion = cim_discover.getIntFromCimInt( majorVersion) minorVersion = _getCimInstanceProperty(hypervisorInstance, 'MinorVersion') hypervisorSoftwareIdentity.minorVersion = cim_discover.getIntFromCimInt( minorVersion) revisionNumber = _getCimInstanceProperty(hypervisorInstance, 'RevisionNumber') hypervisorSoftwareIdentity.revisionNumber = cim_discover.getIntFromCimInt( revisionNumber) largeBuildNumber = _getCimInstanceProperty(hypervisorInstance, 'LargeBuildNumber') hypervisorSoftwareIdentity.largeBuildNumber = cim_discover.getIntFromCimInt( largeBuildNumber) lastStartTime = _getCimInstanceProperty(hypervisorInstance, 'LastStartTime') hypervisorSoftwareIdentity.lastStartTime = cim_discover.getDateFromCimDate( lastStartTime) return hypervisorSoftwareIdentity
def getUnitaryComputerSystemByBaseServerProfile(client, baseServerProfile): ''' CimClient, Profile -> UnitaryComputerSystem or None Get UnitaryComputerSystem associated with base server profiles provided ''' elements = cim_discover.getAssociatorsWithTypeEnforcement(client, baseServerProfile.getObjectPath(), "OMC_ElementConformsToBaseServerProfile", "OMC_UnitaryComputerSystem") unitaryComputerSystemInstance = elements and elements[0] or None if unitaryComputerSystemInstance is not None: unitaryComputerSystem = UnitaryComputerSystem() unitaryComputerSystem.setObjectPath(unitaryComputerSystemInstance.getObjectPath()) unitaryComputerSystem.name = cim_discover.cleanString(_getCimInstanceProperty(unitaryComputerSystemInstance, 'Name')) unitaryComputerSystem.elementName = cim_discover.cleanString(_getCimInstanceProperty(unitaryComputerSystemInstance, 'ElementName')) if unitaryComputerSystem.name: return unitaryComputerSystem
def getProfiles(client): ''' CimClient -> list[Profile] Get profiles ''' profiles = client.getInstances("CIM_RegisteredProfile") resultProfiles = [] for profileInstance in profiles: profile = Profile() profile.setObjectPath(profileInstance.getObjectPath()) profile.registeredVersion = cim_discover.cleanString(_getCimInstanceProperty(profileInstance, 'RegisteredVersion')) profile.registeredName = cim_discover.cleanString(_getCimInstanceProperty(profileInstance, 'RegisteredName')) resultProfiles.append(profile) return resultProfiles
def getUnitaryComputerSystemByUuid(client, uuid): ''' CimClient, string -> UnitaryComputerSystem or None Get UnitaryComputerSystem by UUID ''' objectFactory = client.getFactory() objectPath = _createUnitaryComputerSystemObjectPathByUuid(objectFactory, uuid) unitaryComputerSystemInstance = client.getInstance(objectPath) if unitaryComputerSystemInstance is not None: unitaryComputerSystem = UnitaryComputerSystem() unitaryComputerSystem.setObjectPath(unitaryComputerSystemInstance.getObjectPath()) unitaryComputerSystem.name = cim_discover.cleanString(_getCimInstanceProperty(unitaryComputerSystemInstance, 'Name')) unitaryComputerSystem.elementName = cim_discover.cleanString(_getCimInstanceProperty(unitaryComputerSystemInstance, 'ElementName')) if unitaryComputerSystem.name: return unitaryComputerSystem
def getProfiles(client): ''' CimClient -> list[Profile] Get profiles ''' profiles = client.getInstances("CIM_RegisteredProfile") resultProfiles = [] for profileInstance in profiles: profile = Profile() profile.setObjectPath(profileInstance.getObjectPath()) profile.registeredVersion = cim_discover.cleanString( _getCimInstanceProperty(profileInstance, 'RegisteredVersion')) profile.registeredName = cim_discover.cleanString( _getCimInstanceProperty(profileInstance, 'RegisteredName')) resultProfiles.append(profile) return resultProfiles
def getChassisByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> Chassis or None ''' chassisInstances = cim_discover.getAssociatorsWithTypeEnforcement(client, unitaryComputerSystem.getObjectPath(), "OMC_ComputerSystemPackage", "OMC_Chassis") chassisInstance = chassisInstances and chassisInstances[0] or None if chassisInstance is not None: chassis = Chassis() chassis.setObjectPath(chassisInstance.getObjectPath()) chassis.manufacturer = cim_discover.cleanString(_getCimInstanceProperty(chassisInstance, 'Manufacturer')) chassis.model = cim_discover.cleanString(_getCimInstanceProperty(chassisInstance, 'Model')) chassis.oemSpecificStrings = _getCimInstanceProperty(chassisInstance, 'OEMSpecificStrings') serialNumber = cim_discover.cleanString(_getCimInstanceProperty(chassisInstance, 'SerialNumber')) if host_discoverer.isServiceTagValid(serialNumber): chassis.serialNumber = serialNumber chassis.uuid = cim_discover.cleanString(_getCimInstanceProperty(chassisInstance, 'uuid')) return chassis
def getProcessorsByUnitaryComputerSystem(client, unitaryComputerSystem): ''' CimClient, UnitaryComputerSystem -> list(Processor) Get Processors by UnitaryComputerSystem ''' processorInstances = client.getInstances("OMC_Processor") processors = [] ignoredProcessorsCount = 0 for processorInstace in processorInstances: systemName = cim_discover.cleanString( _getCimInstanceProperty(processorInstace, 'SystemName')) # uuid of cpu should match uuid of ESX, safe check if unitaryComputerSystem.name == systemName: processor = Processor() processor.setObjectPath(processorInstace.getObjectPath()) processor.systemName = systemName processor.cpuStatus = cim_discover.getIntFromCimInt( _getCimInstanceProperty(processorInstace, 'CPUStatus')) processor.elementName = cim_discover.cleanString( _getCimInstanceProperty(processorInstace, 'ElementName')) modelName = cim_discover.cleanString( _getCimInstanceProperty(processorInstace, 'ModelName')) processor.modelName = modelName and re.sub(r"\s+", " ", modelName) processor.currentClockSpeed = cim_discover.getIntFromCimInt( _getCimInstanceProperty(processorInstace, 'CurrentClockSpeed')) processor.numberOfEnabledCores = cim_discover.getIntFromCimInt( _getCimInstanceProperty(processorInstace, 'NumberOfEnabledCores')) processor.enabledState = cim_discover.getIntFromCimInt( _getCimInstanceProperty(processorInstace, 'EnabledState')) processors.append(processor) else: ignoredProcessorsCount += 1 if ignoredProcessorsCount > 0: logger.warn( "Ignored %s processors due to mismatching UUID or being disabled" % ignoredProcessorsCount) return processors
def getUnitaryComputerSystemByUuid(client, uuid): ''' CimClient, string -> UnitaryComputerSystem or None Get UnitaryComputerSystem by UUID ''' objectFactory = client.getFactory() objectPath = _createUnitaryComputerSystemObjectPathByUuid( objectFactory, uuid) unitaryComputerSystemInstance = client.getInstance(objectPath) if unitaryComputerSystemInstance is not None: unitaryComputerSystem = UnitaryComputerSystem() unitaryComputerSystem.setObjectPath( unitaryComputerSystemInstance.getObjectPath()) unitaryComputerSystem.name = cim_discover.cleanString( _getCimInstanceProperty(unitaryComputerSystemInstance, 'Name')) unitaryComputerSystem.elementName = cim_discover.cleanString( _getCimInstanceProperty(unitaryComputerSystemInstance, 'ElementName')) if unitaryComputerSystem.name: return unitaryComputerSystem
def getUnitaryComputerSystemByBaseServerProfile(client, baseServerProfile): ''' CimClient, Profile -> UnitaryComputerSystem or None Get UnitaryComputerSystem associated with base server profiles provided ''' elements = cim_discover.getAssociatorsWithTypeEnforcement( client, baseServerProfile.getObjectPath(), "OMC_ElementConformsToBaseServerProfile", "OMC_UnitaryComputerSystem") unitaryComputerSystemInstance = elements and elements[0] or None if unitaryComputerSystemInstance is not None: unitaryComputerSystem = UnitaryComputerSystem() unitaryComputerSystem.setObjectPath( unitaryComputerSystemInstance.getObjectPath()) unitaryComputerSystem.name = cim_discover.cleanString( _getCimInstanceProperty(unitaryComputerSystemInstance, 'Name')) unitaryComputerSystem.elementName = cim_discover.cleanString( _getCimInstanceProperty(unitaryComputerSystemInstance, 'ElementName')) if unitaryComputerSystem.name: return unitaryComputerSystem