예제 #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
파일: event.py 프로젝트: kontron/python-hpi
 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
파일: dimi.py 프로젝트: kontron/python-hpi
    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
파일: dimi.py 프로젝트: kontron/python-hpi
    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
파일: fumi.py 프로젝트: kontron/python-hpi
    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
파일: fumi.py 프로젝트: kontron/python-hpi
    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
파일: fumi.py 프로젝트: kontron/python-hpi
    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
파일: fumi.py 프로젝트: kontron/python-hpi
    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
파일: dimi.py 프로젝트: kontron/python-hpi
    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
파일: dimi.py 프로젝트: kontron/python-hpi
    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