Esempio n. 1
0
            if id in self.sensors:
                raise exc.BmcErrorException("Duplicate sensor number " + id)
            self.sensors[id] = newent
        elif newent.sdrtype == TYPE_FRU:
            id = newent.fru_number
            if id in self.fru:
                raise exc.BmcErrorException("Duplicate FRU identifier " + id)
            self.fru[id] = newent

    def decode_aux(self, auxdata):
        # This is where manufacturers can add their own
        # decode information
        return "".join(hex(x) for x in auxdata)

if __name__ == "__main__":  # test code
    import os
    import pyghmi.ipmi.command as ipmicmd
    import sys
    password = os.environ['IPMIPASSWORD']
    bmc = sys.argv[1]
    user = sys.argv[2]
    ipmicmd = ipmicmd.Command(bmc=bmc, userid=user, password=password)
    sdr = SDR(ipmicmd)
    for number in sdr.get_sensor_numbers():
        rsp = ipmicmd.raw_command(command=0x2d, netfn=4, data=(number,))
        if 'error' in rsp:
            continue
        reading = sdr.sensors[number].decode_sensor_reading(rsp['data'])
        if reading is not None:
            print repr(reading)
Esempio n. 2
0
            self.sensors[id] = newent
        elif newent.sdrtype == TYPE_FRU:
            id = newent.fru_number
            if id in self.fru:
                self.broken_sensor_ids[id] = True
                return
            self.fru[id] = newent

    def decode_aux(self, auxdata):
        # This is where manufacturers can add their own
        # decode information
        return "".join(hex(x) for x in auxdata)


if __name__ == "__main__":  # test code
    import os
    import pyghmi.ipmi.command as ipmicmd
    import sys
    password = os.environ['IPMIPASSWORD']
    bmc = sys.argv[1]
    user = sys.argv[2]
    ipmicmd = ipmicmd.Command(bmc=bmc, userid=user, password=password)
    sdr = SDR(ipmicmd)
    for number in sdr.get_sensor_numbers():
        rsp = ipmicmd.raw_command(command=0x2d, netfn=4, data=(number, ))
        if 'error' in rsp:
            continue
        reading = sdr.sensors[number].decode_sensor_reading(rsp['data'])
        if reading is not None:
            print(repr(reading))