Skip to content

Commit

Permalink
modify RA 6510-48 ssdhealth
Browse files Browse the repository at this point in the history
fix psu get_model
fix show platform fan/psustatus
Signed-off-by: pettershao-ragilenetworks <pettershao@ragilenetworks.com>
  • Loading branch information
pettershao-ragilenetworks committed Feb 24, 2023
1 parent 582ebd0 commit 1b0de15
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, diskdev):
self.model_attr = {
"ER2-GD" : { "temperature" : "\n190\s+(.+?)\n", "remainingLife" : "\n202\s+(.+?)\n" },
"AF2MA31DTDLT" : { "temperature" : "\n194\s+(.+?)\n", "remainingLife" : "\n202\s+(.+?)\n" },
"SSDSCKKB" : { "temperature" : "\n194\s+(.+?)\n", "remainingLife" : "\n233\s+(.+?)\n" },
"SSDSCK" : { "temperature" : "\n194\s+(.+?)\n", "remainingLife" : "\n233\s+(.+?)\n" },
"SM619GXC" : { "temperature" : "\n194\s+(.+?)\n", "remainingLife" : "\n169\s+(.+?)\n" },
"MZNLH" : { "temperature" : "\n190\s+(.+?)\n", "remainingLife" : "\n245\s+(.+?)\n" },
"IM2S3134N" : { "temperature" : "\n194\s+(.+?)\n", "remainingLife" : "\n231\s+(.+?)\n" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ def get_direction(self):
"""
return self.FAN_DIRECTION_EXHAUST

def get_presence(self):
if not self.is_psu_fan:
return super().get_presence()
# psu-fan get_presence
status = 0
device = "PSU{}".format(self.fans_psu_index)
output = self.pddf_obj.get_attr_name_output(device, "psu_present")
if not output:
return False

mode = output['mode']
status = output['status']

vmap = self.plugin_data['PSU']['psu_present'][mode]['valmap']

if status.rstrip('\n') in vmap:
return vmap[status.rstrip('\n')]
else:
return False


def get_speed_rpm(self):
if self.is_psu_fan:
return super().get_speed_rpm()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def get_model(self):
Returns:
string: Model/part number of device
"""
if self.get_presence() is False:
return "N/A"

model = super().get_model()

psu_model_map = {
Expand All @@ -63,12 +66,12 @@ def runcmd(self, cmd):
while time_retry:
try:
val, result_msg = subprocess.getstatusoutput(cmd)
if val is False:
if val != 0:
time_retry -=1
time.sleep(time_delay)
continue
else:
return val, result_msg
return True, result_msg
except Exception as e:
time_retry -= 1
result_msg = str(e)
Expand Down Expand Up @@ -126,13 +129,29 @@ def get_voltage(self):

return float(v_out)/1000


def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
if self.get_presence() is False:
return "N/A"

return super().get_serial()


def get_revision(self):
"""
Retrieves the hardware revision of the device
Returns:
string: Revision value of device
"""
if self.get_presence() is False:
return "N/A"
device_eeprom = "PSU{}-EEPROM".format(self.psu_index)
pddf_obj_data = self.pddf_obj.data

Expand Down

0 comments on commit 1b0de15

Please sign in to comment.