From 17292e4dae0ce090da7429555fd969d5a73b1f80 Mon Sep 17 00:00:00 2001 From: fk410167 <51665572+fk410167@users.noreply.github.com> Date: Tue, 7 Jul 2020 22:54:58 +0530 Subject: [PATCH] Changes in fan and psu base classes (1.0 platform API) related to pddf_2.0 (#92) Small changes in 1.0 platform plugins psu_base.py and fan_base.py. Changes are related to PDDF 2.0 changes. psu_base.py: - psu_fan speed API name change - Changing the voltage, current and power units to fan_base.py: - Individual fans are counted instead of fantrays units - get_speed_rear() is not required --- sonic_fan/fan_base.py | 12 +----------- sonic_psu/psu_base.py | 14 +++++++------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/sonic_fan/fan_base.py b/sonic_fan/fan_base.py index aced373ddafc..20f3b8e025e1 100644 --- a/sonic_fan/fan_base.py +++ b/sonic_fan/fan_base.py @@ -61,7 +61,7 @@ def get_direction(self, index): def get_speed(self, index): """ - Retrieves the speed of a Front FAN in the tray in revolutions per minute defined + Retrieves the speed of a FAN in the tray in revolutions per minute defined by 1-based index :param index: An integer, 1-based index of the FAN of which to query speed @@ -69,16 +69,6 @@ def get_speed(self, index): """ return 0 - def get_speed_rear(self, index): - """ - Retrieves the speed of a rear FAN in the tray (applicable only for 2-fan tray) - in revolutions per minute defined by 1-based index - - :param index: An integer, 1-based index of the FAN of which to query speed - :return: integer, denoting rear FAN speed - """ - return 0 - def set_speed(self, val): """ Sets the speed of all the FANs to a value denoted by the duty-cycle percentage val diff --git a/sonic_psu/psu_base.py b/sonic_psu/psu_base.py index ee21d35ee192..42a65d251b6d 100644 --- a/sonic_psu/psu_base.py +++ b/sonic_psu/psu_base.py @@ -88,29 +88,29 @@ def get_output_voltage(self, idx): Retrieves the ouput volatage in milli volts of a power supply unit (PSU) defined by 1-based index :param idx: An integer, 1-based index of the PSU of which to query o/p volatge - :return: An integer, value of o/p voltage in mV if PSU is good, else zero + :return: A float, value of o/p voltage in Volts if PSU is good, else zero """ - return 0 + return 0.0 def get_output_current(self, idx): """ Retrieves the output current in milli amperes of a power supply unit (PSU) defined by 1-based index :param idx: An integer, 1-based index of the PSU of which to query o/p current - :return: An integer, value of o/p current in mA if PSU is good, else zero + :return: A float, value of o/p current in Amps if PSU is good, else zero """ - return 0 + return 0.0 def get_output_power(self, idx): """ Retrieves the output power in micro watts of a power supply unit (PSU) defined by 1-based index :param idx: An integer, 1-based index of the PSU of which to query o/p power - :return: An integer, value of o/p power in micro Watts if PSU is good, else zero + :return: A float, value of o/p power in Watts if PSU is good, else zero """ - return 0 + return 0.0 - def get_fan_speed(self, idx, fan_idx): + def get_fan_rpm(self, idx, fan_idx): """ Retrieves the speed of fan, in rpm, denoted by 1-based of a power supply unit (PSU) defined by 1-based index