Skip to content

Commit

Permalink
[device/celestica]: Fix xcvrd error (sonic-net#3979) (sonic-net#4345)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
Wirut Getbamrung authored and tiantianlv committed Apr 24, 2020
1 parent d167a4b commit 4d525be
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 8 deletions.
3 changes: 3 additions & 0 deletions device/celestica/x86_64-cel_e1031-r0/pmon_daemon_control.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"skip_ledd": true
}
19 changes: 16 additions & 3 deletions device/celestica/x86_64-cel_e1031-r0/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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
Expand Down Expand Up @@ -54,7 +53,9 @@ def __init__(self):
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):
Expand All @@ -63,7 +64,6 @@ def __init__(self):
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):
Expand Down Expand Up @@ -134,3 +134,16 @@ def get_reboot_cause(self):
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
2 changes: 1 addition & 1 deletion device/celestica/x86_64-cel_e1031-r0/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"skip_ledd": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"skip_ledd": true
}
19 changes: 16 additions & 3 deletions device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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
Expand Down Expand Up @@ -56,14 +55,15 @@ def __init__(self):
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):
Expand Down Expand Up @@ -146,3 +146,16 @@ def get_reboot_cause(self):
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
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"skip_ledd": true
}

0 comments on commit 4d525be

Please sign in to comment.