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 handleOtherIdentifyingInfo(self, arrayOfIdentificationInfoObject, hostObject): #HostSystemIdentificationInfo if arrayOfIdentificationInfoObject: identificationInfoArray = arrayOfIdentificationInfoObject.getHostSystemIdentificationInfo() if identificationInfoArray: for identificationInfo in identificationInfoArray: identifierValue = identificationInfo.getIdentifierValue() and identificationInfo.getIdentifierValue().strip() identifierKey = identificationInfo.getIdentifierType() and identificationInfo.getIdentifierType().getKey() identifierKey = identifierKey and identifierKey.strip() if identifierKey and identifierKey == "ServiceTag": if isServiceTagValid(identifierValue): hostObject.serviceTag = identifierValue
def handleOtherIdentifyingInfo(self, arrayOfIdentificationInfoObject, hostObject): #HostSystemIdentificationInfo if arrayOfIdentificationInfoObject: identificationInfoArray = arrayOfIdentificationInfoObject.getHostSystemIdentificationInfo( ) if identificationInfoArray: for identificationInfo in identificationInfoArray: identifierValue = identificationInfo.getIdentifierValue( ) and identificationInfo.getIdentifierValue().strip() identifierKey = identificationInfo.getIdentifierType( ) and identificationInfo.getIdentifierType().getKey() identifierKey = identifierKey and identifierKey.strip() if identifierKey and identifierKey == "ServiceTag": if isServiceTagValid(identifierValue): hostObject.serviceTag = identifierValue
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