diff --git a/sonic_platform_base/chassis_base.py b/sonic_platform_base/chassis_base.py index 4e1762699..eb1e089b5 100644 --- a/sonic_platform_base/chassis_base.py +++ b/sonic_platform_base/chassis_base.py @@ -28,27 +28,27 @@ class ChassisBase(device_base.DeviceBase): # List of ComponentBase-derived objects representing all components # available on the chassis - _component_list = [] + _component_list = None # List of ModuleBase-derived objects representing all modules # available on the chassis (for use with modular chassis) - _module_list = [] + _module_list = None # List of FanBase-derived objects representing all fans # available on the chassis - _fan_list = [] + _fan_list = None # List of PsuBase-derived objects representing all power supply units # available on the chassis - _psu_list = [] + _psu_list = None # List of ThermalBase-derived objects representing all thermals # available on the chassis - _thermal_list = [] + _thermal_list = None # List of SfpBase-derived objects representing all sfps # available on the chassis - _sfp_list = [] + _sfp_list = None # Object derived from WatchdogBase for interacting with hardware watchdog _watchdog = None @@ -56,6 +56,14 @@ class ChassisBase(device_base.DeviceBase): # Object derived from eeprom_tlvinfo.TlvInfoDecoder indicating the eeprom on the chassis _eeprom = None + def __init__(self): + self._component_list = [] + self._module_list = [] + self._fan_list = [] + self._psu_list = [] + self._thermal_list = [] + self._sfp_list = [] + def get_base_mac(self): """ Retrieves the base MAC address for the chassis diff --git a/sonic_platform_base/module_base.py b/sonic_platform_base/module_base.py index b4f8ac451..6a7d2a7d5 100644 --- a/sonic_platform_base/module_base.py +++ b/sonic_platform_base/module_base.py @@ -19,23 +19,30 @@ class ModuleBase(device_base.DeviceBase): # List of ComponentBase-derived objects representing all components # available on the module - _component_list = [] + _component_list = None # List of FanBase-derived objects representing all fans # available on the module - _fan_list = [] + _fan_list = None # List of PsuBase-derived objects representing all power supply units # available on the module - _psu_list = [] + _psu_list = None # List of ThermalBase-derived objects representing all thermals # available on the module - _thermal_list = [] + _thermal_list = None # List of SfpBase-derived objects representing all sfps # available on the module - _sfp_list = [] + _sfp_list = None + + def __init__(self): + self._component_list = [] + self._fan_list = [] + self._psu_list = [] + self._thermal_list = [] + self._sfp_list = [] def get_base_mac(self): """ diff --git a/sonic_platform_base/psu_base.py b/sonic_platform_base/psu_base.py index adb1a6051..0341a50e0 100644 --- a/sonic_platform_base/psu_base.py +++ b/sonic_platform_base/psu_base.py @@ -23,7 +23,10 @@ class PsuBase(device_base.DeviceBase): # List of FanBase-derived objects representing all fans # available on the PSU - _fan_list = [] + _fan_list = None + + def __init__(self): + self._fan_list = [] def get_num_fans(self): """