DellEMC: Fix API2.0 initialization issue (#15687)
Why I did it To fix sonic-net/sonic-mgmt#8786 How I did it Modified Fan API to check whether the data retrieved is valid or not and return accordingly How to verify it Verify whether API 2.0 is loaded properly or not. Execute CLI's like "show version", "show interface status", "show platform psustatus" etc..
This commit is contained in:
parent
05314f9e5b
commit
2de5abdaf4
@ -71,8 +71,7 @@ class Fan(FanBase):
|
||||
self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex])
|
||||
self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET
|
||||
self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
self.max_speed = 0
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
@ -163,11 +162,14 @@ class Fan(FanBase):
|
||||
int: percentage of the max fan speed
|
||||
"""
|
||||
if self.max_speed == 0:
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2)
|
||||
if not is_valid:
|
||||
return 0
|
||||
self.max_speed = max_speed[1]
|
||||
self.max_speed = max_speed[1] << 8 | max_speed[0]
|
||||
is_valid, fan_speed = self.speed_sensor.get_reading()
|
||||
if not is_valid or self.max_speed == 0:
|
||||
return None
|
||||
speed = 0
|
||||
else:
|
||||
speed = (100 * fan_speed)//self.max_speed
|
||||
return speed
|
||||
|
@ -69,8 +69,7 @@ class Fan(FanBase):
|
||||
self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex])
|
||||
self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET
|
||||
self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
self.max_speed = 0
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
@ -163,8 +162,11 @@ class Fan(FanBase):
|
||||
int: percentage of the max fan speed
|
||||
"""
|
||||
if self.max_speed == 0:
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2)
|
||||
if not is_valid:
|
||||
return 0
|
||||
self.max_speed = max_speed[1]
|
||||
self.max_speed = max_speed[1] << 8 | max_speed[0]
|
||||
is_valid, fan_speed = self.speed_sensor.get_reading()
|
||||
if not is_valid or self.max_speed == 0:
|
||||
speed = 0
|
||||
|
@ -71,8 +71,7 @@ class Fan(FanBase):
|
||||
self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex])
|
||||
self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET
|
||||
self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
self.max_speed = 0
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
@ -165,11 +164,14 @@ class Fan(FanBase):
|
||||
int: percentage of the max fan speed
|
||||
"""
|
||||
if self.max_speed == 0:
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2)
|
||||
if not is_valid:
|
||||
return 0
|
||||
self.max_speed = max_speed[1]
|
||||
self.max_speed = max_speed[1] << 8 | max_speed[0]
|
||||
is_valid, fan_speed = self.speed_sensor.get_reading()
|
||||
if not is_valid or self.max_speed == 0:
|
||||
return None
|
||||
speed = 0
|
||||
else:
|
||||
speed = (100 * fan_speed)//self.max_speed
|
||||
return speed
|
||||
|
@ -71,8 +71,7 @@ class Fan(FanBase):
|
||||
self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex])
|
||||
self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET
|
||||
self.fan_direction_offset = PSU_FAN_DIRECTION_OFFSET
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
self.max_speed = 0
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
@ -165,8 +164,11 @@ class Fan(FanBase):
|
||||
int: percentage of the max fan speed
|
||||
"""
|
||||
if self.max_speed == 0:
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset,2)
|
||||
if not is_valid:
|
||||
return 0
|
||||
self.max_speed = max_speed[1]
|
||||
self.max_speed = max_speed[1] << 8 | max_speed[0]
|
||||
is_valid, fan_speed = self.speed_sensor.get_reading()
|
||||
if not is_valid or self.max_speed == 0:
|
||||
speed = 0
|
||||
|
@ -165,8 +165,11 @@ class Fan(FanBase):
|
||||
int: percentage of the max fan speed
|
||||
"""
|
||||
if self.max_speed == 0:
|
||||
self.max_speed = self.fru.get_fru_data(self.max_speed_offset, 2)[1]
|
||||
self.max_speed = self.max_speed[1] << 8 | self.max_speed[0]
|
||||
is_valid, max_speed = self.fru.get_fru_data(self.max_speed_offset, 2)
|
||||
if not is_valid:
|
||||
return 0
|
||||
self.max_speed = max_speed[1]
|
||||
self.max_speed = max_speed[1] << 8 | max_speed[0]
|
||||
is_valid, fan_speed = self.speed_sensor.get_reading()
|
||||
if not is_valid or self.max_speed == 0:
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user