[DellEMC] Ensure concrete platform API classes call base class initializer (#6853)
In preparation for the merging of Azure/sonic-platform-common#173, which properly defines class and instance members in the Platform API base classes. It is proper object-oriented methodology to call the base class initializer, even if it is only the default initializer. This also future-proofs the potential addition of custom initializers in the base classes down the road.
This commit is contained in:
parent
516ff8bfff
commit
ac15a42c57
@ -82,6 +82,7 @@ class Component(ComponentBase):
|
||||
]
|
||||
|
||||
def __init__(self, component_index = 0):
|
||||
ComponentBase.__init__(self)
|
||||
self.index = component_index
|
||||
self.name = self.CHASSIS_COMPONENTS[self.index][0]
|
||||
self.description = self.CHASSIS_COMPONENTS[self.index][1]
|
||||
|
@ -41,6 +41,7 @@ class Fan(FanBase):
|
||||
|
||||
def __init__(self, fantray_index=1, fan_index=1, psu_fan=False,
|
||||
dependency=None):
|
||||
FanBase.__init__(self)
|
||||
self.is_psu_fan = psu_fan
|
||||
if not self.is_psu_fan:
|
||||
# API index is starting from 0, DellEMC platform index is
|
||||
|
@ -36,6 +36,7 @@ class Watchdog(WatchdogBase):
|
||||
CLOCK_MONOTONIC = 1
|
||||
|
||||
def __init__(self):
|
||||
WatchdogBase.__init__(self)
|
||||
self._librt = ctypes.CDLL('librt.so.1', use_errno=True)
|
||||
self._clock_gettime = self._librt.clock_gettime
|
||||
self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)]
|
||||
|
@ -34,6 +34,7 @@ class Component(ComponentBase):
|
||||
]
|
||||
|
||||
def __init__(self, component_index):
|
||||
ComponentBase.__init__(self)
|
||||
self.index = component_index
|
||||
self.name = self.CHASSIS_COMPONENTS[self.index][0]
|
||||
self.description = self.CHASSIS_COMPONENTS[self.index][1]
|
||||
|
@ -33,6 +33,7 @@ class Fan(FanBase):
|
||||
|
||||
def __init__(self, fantray_index=1, fan_index=1,
|
||||
psu_index=1, psu_fan=False, dependency=None):
|
||||
FanBase.__init__(self)
|
||||
self.is_psu_fan = psu_fan
|
||||
self.is_driver_initialized = True
|
||||
|
||||
|
@ -35,6 +35,7 @@ class Thermal(ThermalBase):
|
||||
|
||||
def __init__(self, thermal_index,
|
||||
psu_index=1, psu_thermal=False, dependency=None):
|
||||
ThermalBase.__init__(self)
|
||||
self.is_psu_thermal = psu_thermal
|
||||
self.dependency = dependency
|
||||
self.is_driver_initialized = True
|
||||
|
@ -41,6 +41,7 @@ class Component(ComponentBase):
|
||||
def __init__(self, component_index=0,
|
||||
is_module=False, iom_index=0, i2c_line=0, dependency=None):
|
||||
|
||||
ComponentBase.__init__(self)
|
||||
self.is_module_component = is_module
|
||||
self.dependency = dependency
|
||||
|
||||
|
@ -27,6 +27,7 @@ class Fan(FanBase):
|
||||
MAILBOX_DIR = HWMON_DIR + HWMON_NODE
|
||||
|
||||
def __init__(self, fantray_index=1, psu_index=1, psu_fan=False, dependency=None):
|
||||
FanBase.__init__(self)
|
||||
self.is_psu_fan = psu_fan
|
||||
if not self.is_psu_fan:
|
||||
self.fantrayindex = fantray_index
|
||||
|
@ -26,6 +26,7 @@ class Thermal(ThermalBase):
|
||||
)
|
||||
|
||||
def __init__(self, thermal_index):
|
||||
ThermalBase.__init__(self)
|
||||
self.is_cpu_thermal = False
|
||||
self.index = thermal_index + 1
|
||||
|
||||
|
@ -41,6 +41,7 @@ class Watchdog(WatchdogBase):
|
||||
CLOCK_MONOTONIC = 1
|
||||
|
||||
def __init__(self):
|
||||
WatchdogBase.__init__(self)
|
||||
self._librt = ctypes.CDLL('librt.so.1', use_errno=True)
|
||||
self._clock_gettime = self._librt.clock_gettime
|
||||
self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)]
|
||||
|
@ -39,6 +39,7 @@ class Component(ComponentBase):
|
||||
]
|
||||
|
||||
def __init__(self, component_index=0):
|
||||
ComponentBase.__init__(self)
|
||||
self.index = component_index
|
||||
self.name = self.CHASSIS_COMPONENTS[self.index][0]
|
||||
self.description = self.CHASSIS_COMPONENTS[self.index][1]
|
||||
|
@ -27,6 +27,7 @@ class Fan(FanBase):
|
||||
MAILBOX_DIR = HWMON_DIR + HWMON_NODE
|
||||
|
||||
def __init__(self, fantray_index=1, fan_index=1, psu_fan=False):
|
||||
FanBase.__init__(self)
|
||||
self.is_psu_fan = psu_fan
|
||||
if not self.is_psu_fan:
|
||||
# API index is starting from 0, DellEMC platform index is starting
|
||||
|
@ -25,6 +25,7 @@ class Psu(PsuBase):
|
||||
MAILBOX_DIR = HWMON_DIR + HWMON_NODE
|
||||
|
||||
def __init__(self, psu_index):
|
||||
PsuBase.__init__(self)
|
||||
# PSU is 1-based in DellEMC platforms
|
||||
self.index = psu_index + 1
|
||||
self.psu_presence_reg = "psu{}_presence".format(self.index)
|
||||
|
@ -26,6 +26,7 @@ class Thermal(ThermalBase):
|
||||
)
|
||||
|
||||
def __init__(self, thermal_index):
|
||||
ThermalBase.__init__(self)
|
||||
self.is_cpu_thermal = False
|
||||
self.index = thermal_index + 1
|
||||
|
||||
|
@ -36,6 +36,7 @@ class Component(ComponentBase):
|
||||
]
|
||||
|
||||
def __init__(self, component_index=0):
|
||||
ComponentBase.__init__(self)
|
||||
self.index = component_index
|
||||
self.name = self.CHASSIS_COMPONENTS[self.index][0]
|
||||
self.description = self.CHASSIS_COMPONENTS[self.index][1]
|
||||
|
@ -43,6 +43,7 @@ class Fan(FanBase):
|
||||
|
||||
def __init__(self, fantray_index=1, fan_index=1, psu_fan=False,
|
||||
dependency=None):
|
||||
FanBase.__init__(self)
|
||||
self.is_psu_fan = psu_fan
|
||||
if not self.is_psu_fan:
|
||||
# API index is starting from 0, DellEMC platform index is
|
||||
|
@ -36,6 +36,7 @@ class Watchdog(WatchdogBase):
|
||||
CLOCK_MONOTONIC = 1
|
||||
|
||||
def __init__(self):
|
||||
WatchdogBase.__init__(self)
|
||||
self._librt = ctypes.CDLL('librt.so.1', use_errno=True)
|
||||
self._clock_gettime = self._librt.clock_gettime
|
||||
self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)]
|
||||
|
@ -81,6 +81,7 @@ class Component(ComponentBase):
|
||||
]
|
||||
|
||||
def __init__(self, component_index = 0):
|
||||
ComponentBase.__init__(self)
|
||||
self.index = component_index
|
||||
self.name = self.CHASSIS_COMPONENTS[self.index][0]
|
||||
self.description = self.CHASSIS_COMPONENTS[self.index][1]
|
||||
|
@ -38,6 +38,7 @@ class Fan(FanBase):
|
||||
PSU_FRU_MAPPING = { 1: 3, 2: 4 }
|
||||
|
||||
def __init__(self, fantray_index=1, fan_index=1, psu_fan=False, dependency=None):
|
||||
FanBase.__init__(self)
|
||||
self.is_psu_fan = psu_fan
|
||||
if not self.is_psu_fan:
|
||||
# API index is starting from 0, DellEMC platform index is
|
||||
|
@ -36,6 +36,7 @@ class Watchdog(WatchdogBase):
|
||||
CLOCK_MONOTONIC = 1
|
||||
|
||||
def __init__(self):
|
||||
WatchdogBase.__init__(self)
|
||||
self._librt = ctypes.CDLL('librt.so.1', use_errno=True)
|
||||
self._clock_gettime = self._librt.clock_gettime
|
||||
self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)]
|
||||
|
Loading…
Reference in New Issue
Block a user