diff --git a/sonic_platform_base/fan_drawer_base.py b/sonic_platform_base/fan_drawer_base.py index 95c121852f8b..3a0ec7fcfdaf 100644 --- a/sonic_platform_base/fan_drawer_base.py +++ b/sonic_platform_base/fan_drawer_base.py @@ -37,6 +37,29 @@ def get_all_fans(self): """ return self._fan_list + def get_fan(self, index): + """ + Retrieves fan module represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the fan module to + retrieve + + Returns: + An object dervied from FanBase representing the specified fan + module + """ + fan = None + + try: + fan = self._fan_list[index] + except IndexError: + sys.stderr.write("Fan index {} out of range (0-{})\n".format( + index, len(self._fan_list)-1)) + + return fan + + def set_status_led(self, color): """ Sets the state of the fan drawer status LED