示例#1
0
 def from_ctype(self, s):
     BaseHpiObject.from_ctype(self, s)
     self.record_id = s.RecordId
     self.rdr_type = s.RdrType.value
     self.entity = EntityPath().from_ctype(s.Entity)
     self.is_fru = bool(s.IsFru)
     self.id_string = TextBuffer().from_ctype(s.IdString)
示例#2
0
 def from_ctype(self, s):
     BaseHpiObject.from_ctype(self, s)
     self.source = s.Source
     self.event_type = s.EventType.value
     self.timestamp = \
         datetime.datetime.fromtimestamp(s.Timestamp/1000000000)
     self.severity = s.Severity.value
示例#3
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)
        self.name = array.array('B', s.ParamName).tostring().rstrip('\x00')
        self.info = TextBuffer().from_ctype(s.ParamInfo)
        self.type = s.ParamType.value

        self.min = None
        self.max = None
        if self.type == SAHPI_DIMITEST_PARAM_TYPE_BOOLEAN:
            self.default = bool(s.DefaultParam.parambool)
        elif self.type == SAHPI_DIMITEST_PARAM_TYPE_INT32:
            self.min = int(s.MinValue.IntValue)
            self.max = int(s.MaxValue.IntValue)
            self.default = int(s.DefaultParam.paramint)
        elif self.type == SAHPI_DIMITEST_PARAM_TYPE_FLOAT64:
            self.min = int(s.MinValue.FloatValue)
            self.max = int(s.MaxValue.FloatValue)
            self.default = float(s.DefaultParam.paramfloat)
        elif self.type == SAHPI_DIMITEST_PARAM_TYPE_TEXT:
            self.default = TextBuffer().from_ctype(s.DefaultParam.paramtext)
        else:
            raise DecodingError("Unknown DIMI test parameter type %d" %
                    self.type)

        return self
示例#4
0
    def from_ctype(self, s):
        """Fills this Entity from a SaHpiEntityT C-structure."""
        BaseHpiObject.from_ctype(self, s)
        self.type = s.EntityType.value
        self.location = s.EntityLocation

        return self
示例#5
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)

        self.timestamp = \
            datetime.datetime.fromtimestamp(s.ResultTimeStamp/1000000000)
        self.run_duration = \
            datetime.timedelta(microseconds=s.RunDuration/1000)
        self.last_run_status = s.LastRunStatus.value
        self.error_code = s.TestErrorCode.value
        self.result = TextBuffer().from_ctype(s.TestResultString)

        return self
示例#6
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)

        self.is_present = bool(s.InstancePresent)
        self.identifier = TextBuffer().from_ctype(s.Identifier)
        self.description = TextBuffer().from_ctype(s.Description)
        self.date_time = TextBuffer().from_ctype(s.DateTime)
        self.major_version = s.MajorVersion
        self.minor_version = s.MinorVersion
        self.aux_version = s.AuxVersion

        return self
示例#7
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)
        self.source_uri = TextBuffer().from_ctype(s.SourceUri)
        self.source_status = SaHpiFumiSourceStatusT(s.SourceStatus.value)
        self.identifier = TextBuffer().from_ctype(s.Identifier)
        self.description = TextBuffer().from_ctype(s.Description)
        self.date_time = TextBuffer().from_ctype(s.DateTime)
        self.major_version = s.MajorVersion
        self.minor_version = s.MinorVersion
        self.aux_version = s.AuxVersion

        return self
示例#8
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)
        self.resource_revision = s.ResourceRev
        self.specific_version = s.SpecificVer
        self.device_support = s.DeviceSupport
        self.manufacturer_id = s.ManufacturerId
        self.product_id = s.ProductId
        self.firmware_major_revision = s.FirmwareMajorRev
        self.firmware_minor_revision = s.FirmwareMinorRev
        self.aux_firmware_revision = s.AuxFirmwareRev
        self.guid = Guid().from_ctype(s.Guid)

        return self
示例#9
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)

        self.entries = list()
        num_entries = 0
        for i in xrange(SAHPI_MAX_ENTITY_PATH):
            if s.Entry[i].EntityType.value == SAHPI_ENT_ROOT:
                num_entries = i+1
                break
        for i in xrange(num_entries):
            self.entries.append(Entity().from_ctype(s.Entry[i]))

        return self
示例#10
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)
        self.entry_id = s.EntryId
        self.resource_id = s.ResourceId
        self.resource_info = ResourceInfo().from_ctype(s.ResourceInfo)
        self.entity_path = EntityPath().from_ctype(s.ResourceEntity)
        self.resource_capabilities = \
                ResourceCapabilities(s.ResourceCapabilities)
        self.hotswap_capabilities = s.HotSwapCapabilities
        self.resource_severity = s.ResourceSeverity.value
        self.resource_failed = s.ResourceFailed
        self.resource_tag = TextBuffer().from_ctype(s.ResourceTag)

        return self
示例#11
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)

        self.id = s.BankId
        self.size = s.BankSize
        self.position = s.Position
        self.state = s.BankState.value
        self.identifier = TextBuffer().from_ctype(s.Identifier)
        self.description = TextBuffer().from_ctype(s.Description)
        self.date_time = TextBuffer().from_ctype(s.DateTime)
        self.major_version = s.MajorVersion
        self.minor_version = s.MinorVersion
        self.aux_version = s.AuxVersion

        return self
示例#12
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)

        self.fw_persistent_location_count = s.FirmwarePersistentLocationCount
        self.state = s.BankStateFlags
        self.pending_instance = \
                FirmwareInstance().from_ctype(s.PendingFwInstance)
        self.rollback_instance = \
                FirmwareInstance().from_ctype(s.RollbackFwInstance)

        # remove instances which are not present
        if not self.pending_instance.is_present:
            self.pending_instance = None
        if not self.rollback_instance.is_present:
            self.rollback_instance = None

        return self
示例#13
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)

        self.name = TextBuffer().from_ctype(s.TestName)
        self.service_impact = s.ServiceImpact.value
        #self.impacted_entities = s.EntitiesImpacted
        self.service_os_needed = bool(s.NeedServiceOS)
        self.expected_run_duration = \
                datetime.timedelta(microseconds=s.ExpectedRunDuration/1000)
        self.capabilities = s.TestCapabilities
        self.parameters = list()
        for param in s.TestParameters:
            # design flaw: there is no indication how many parameters are in
            # use.
            if param.ParamName[0] == 0:
                break
            self.parameters.append(DimiTestParameterDefinition().from_ctype(param))

        return self
示例#14
0
    def from_ctype(self, s):
        BaseHpiObject.from_ctype(self, s)
        self.num_tests = s.NumberOfTests
        self.update_counter = s.TestNumUpdateCounter

        return self
示例#15
0
 def __init__(self):
     BaseHpiObject.__init__(self)
     self._is_string_ = True