[device/celestica]: Fix xcvrd error (#3979)

* [device/celestica]: add pmon_daemon_control config

* [device/celestica]:  update sfp index follow port_config

* [device/celestica]:  update get_watchdog to avoid multiple daemon try opening watchdog
This commit is contained in:
Wirut Getbamrung 2020-01-11 03:50:51 +07:00 committed by lguohan
parent 856b4b64eb
commit bac6615bf5
8 changed files with 46 additions and 8 deletions

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}

View File

@ -19,7 +19,6 @@ try:
from sonic_platform.fan import Fan
from sonic_platform.psu import Psu
from sonic_platform.component import Component
from sonic_platform.watchdog import Watchdog
from sonic_platform.thermal import Thermal
from sonic_platform.sfp import Sfp
from sonic_platform.eeprom import Tlv
@ -54,7 +53,9 @@ class Chassis(ChassisBase):
for index in range(0, NUM_THERMAL):
thermal = Thermal(index)
self._thermal_list.append(thermal)
for index in range(0, NUM_SFP):
# sfp index start from 1
self._sfp_list.append(None)
for index in range(1, NUM_SFP+1):
sfp = Sfp(index)
self._sfp_list.append(sfp)
for index in range(0, NUM_COMPONENT):
@ -63,7 +64,6 @@ class Chassis(ChassisBase):
self._reboot_cause_path = HOST_REBOOT_CAUSE_PATH if self.__is_host(
) else PMON_REBOOT_CAUSE_PATH
self._watchdog = Watchdog()
self._eeprom = Tlv()
def __is_host(self):
@ -134,3 +134,16 @@ class Chassis(ChassisBase):
description = 'Unknown reason'
return (reboot_cause, description)
def get_watchdog(self):
"""
Retreives hardware watchdog device on this chassis
Returns:
An object derived from WatchdogBase representing the hardware
watchdog device
"""
if self._watchdog is None:
from sonic_platform.watchdog import Watchdog
self._watchdog = Watchdog()
return self._watchdog

View File

@ -94,7 +94,7 @@ class Sfp(SfpBase):
def __init__(self, sfp_index):
# Init index
self.index = sfp_index
self.port_num = self.index + 1
self.port_num = self.index
# Init eeprom path
eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom'

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}

View File

@ -19,7 +19,6 @@ try:
from sonic_platform.fan import Fan
from sonic_platform.psu import Psu
from sonic_platform.component import Component
from sonic_platform.watchdog import Watchdog
from sonic_platform.thermal import Thermal
from sonic_platform.sfp import Sfp
from sonic_platform.eeprom import Tlv
@ -56,14 +55,15 @@ class Chassis(ChassisBase):
for index in range(0, NUM_THERMAL):
thermal = Thermal(index)
self._thermal_list.append(thermal)
for index in range(0, NUM_SFP):
# sfp index start from 1
self._sfp_list.append(None)
for index in range(1, NUM_SFP+1):
sfp = Sfp(index)
self._sfp_list.append(sfp)
for index in range(0, NUM_COMPONENT):
component = Component(index)
self._component_list.append(component)
self._watchdog = Watchdog()
self._eeprom = Tlv()
def __is_host(self):
@ -146,3 +146,16 @@ class Chassis(ChassisBase):
description = 'Unknown reason'
return (reboot_cause, description)
def get_watchdog(self):
"""
Retreives hardware watchdog device on this chassis
Returns:
An object derived from WatchdogBase representing the hardware
watchdog device
"""
if self._watchdog is None:
from sonic_platform.watchdog import Watchdog
self._watchdog = Watchdog()
return self._watchdog

View File

@ -100,7 +100,7 @@ class Sfp(SfpBase):
def __init__(self, sfp_index):
# Init index
self.index = sfp_index
self.port_num = self.index + 1 if self.PORT_START == 1 else index
self.port_num = self.index
# Init eeprom path
eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom'

View File

@ -0,0 +1,3 @@
{
"skip_ledd": true
}