mirror of
https://opendev.org/x/pyghmi
synced 2024-12-25 12:41:37 +00:00
Revert to using the sensor reading
The senser event status is optional, so instead apply the assertion mask to the reading as a means of letting assertion mask hide "don't care" threshold crossing. Change-Id: I23eb741bc4d9edfbdeba5bcf2e2f970959c4fc8d
This commit is contained in:
parent
eb10ef736f
commit
e00036252b
@ -532,46 +532,30 @@ class SDREntry(object):
|
||||
output['state_ids'].append(
|
||||
self.assert_trap_value(state + 8))
|
||||
else:
|
||||
# get the event status for threshold sensor
|
||||
rsp = ipmicmd.xraw_command(netfn=4,
|
||||
command=0x2b,
|
||||
data=(self.sensor_number,))
|
||||
rsp['data'] = bytearray(rsp['data'])
|
||||
for offset in range(8):
|
||||
if rsp['data'][1] & (0b1 << offset) & \
|
||||
self.assertion_reading_mask[0]:
|
||||
output['state_ids'].append(self.assert_trap_value(offset))
|
||||
if len(rsp['data']) >= 3:
|
||||
for offset in range(4):
|
||||
if rsp['data'][2] & (0b1 << offset) & \
|
||||
self.assertion_reading_mask[1]:
|
||||
output['state_ids'].append(
|
||||
self.assert_trap_value(offset + 8))
|
||||
|
||||
# if the sensor trigger the event, then read the status and health
|
||||
if len(output['state_ids']) > 0:
|
||||
if reading[2] & 0b1:
|
||||
output['health'] |= const.Health.Warning
|
||||
output['states'].append(lower + " non-critical threshold")
|
||||
if reading[2] & 0b10:
|
||||
output['health'] |= const.Health.Critical
|
||||
output['states'].append(lower + " critical threshold")
|
||||
if reading[2] & 0b100:
|
||||
output['health'] |= const.Health.Failed
|
||||
output['states'].append(lower
|
||||
+ " non-recoverable threshold")
|
||||
if reading[2] & 0b1000:
|
||||
output['health'] |= const.Health.Warning
|
||||
output['states'].append(upper
|
||||
+ " non-critical threshold")
|
||||
if reading[2] & 0b10000:
|
||||
output['health'] |= const.Health.Critical
|
||||
output['states'].append(upper + " critical threshold")
|
||||
if reading[2] & 0b100000:
|
||||
output['health'] |= const.Health.Failed
|
||||
output['states'].append(upper
|
||||
+ " non-recoverable threshold")
|
||||
|
||||
if reading[2] & 0b1 & self.assertion_reading_mask[0]:
|
||||
output['health'] |= const.Health.Warning
|
||||
output['states'].append(lower + " non-critical threshold")
|
||||
output['state_ids'].append(self.assert_trap_value(1))
|
||||
if reading[2] & 0b10 & self.assertion_reading_mask[0]:
|
||||
output['health'] |= const.Health.Critical
|
||||
output['states'].append(lower + " critical threshold")
|
||||
output['state_ids'].append(self.assert_trap_value(2))
|
||||
if reading[2] & 0b100 & self.assertion_reading_mask[0]:
|
||||
output['health'] |= const.Health.Failed
|
||||
output['states'].append(lower + " non-recoverable threshold")
|
||||
output['state_ids'].append(self.assert_trap_value(3))
|
||||
if reading[2] & 0b1000 & self.assertion_reading_mask[0]:
|
||||
output['health'] |= const.Health.Warning
|
||||
output['states'].append(upper + " non-critical threshold")
|
||||
output['state_ids'].append(self.assert_trap_value(4))
|
||||
if reading[2] & 0b10000 & self.assertion_reading_mask[0]:
|
||||
output['health'] |= const.Health.Critical
|
||||
output['states'].append(upper + " critical threshold")
|
||||
output['state_ids'].append(self.assert_trap_value(5))
|
||||
if reading[2] & 0b100000 & self.assertion_reading_mask[0]:
|
||||
output['health'] |= const.Health.Failed
|
||||
output['states'].append(upper + " non-recoverable threshold")
|
||||
output['state_ids'].append(self.assert_trap_value(6))
|
||||
return SensorReading(output, self.unit_suffix)
|
||||
|
||||
def _set_tmp_formula(self, ipmicmd, value):
|
||||
|
Loading…
Reference in New Issue
Block a user