Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
db29029
init api code
Jun 26, 2020
eb2732a
Initialize get_status_led function for fan led.
pjaipakdee19 Jun 30, 2020
7bc13b8
Merge pull request #833 from pjaipakdee19/seastone2_get_fan_led
Jun 30, 2020
ceeb47c
[device/celestica]: update seastone_2 fan api to support common api
Jul 1, 2020
de5ecfb
Implement PSU API for Seastone2
pjaipakdee19 Jul 7, 2020
e5a03d5
Merge pull request #851 from pjaipakdee19/dev_seastone2_psu_api
Jul 7, 2020
f3d9655
[device/celestica]: update common api format
Jul 7, 2020
a6264b5
[device/celestica]: update seastone_2 psu and fan to support new comm…
Jul 8, 2020
72d53a7
Implement ThermalBase API
pjaipakdee19 Jul 13, 2020
0bf2b08
Update the get model,serial and status to get val from json.
pjaipakdee19 Jul 13, 2020
c336121
Update description on Thermal function.
pjaipakdee19 Jul 13, 2020
adeca8a
Merge pull request #870 from pjaipakdee19/dev_seastone2_api
Jul 13, 2020
0c8177f
[device/celestica-seastone2]: update chassis platform api
Jul 16, 2020
9967d77
Add common function to r/w value with sysfs.
pjaipakdee19 Jul 17, 2020
a806de5
Implement api for sfp section.
pjaipakdee19 Jul 17, 2020
4937830
Merge branch 'master_seastone2_api' into dev_seastone2_api
Jul 20, 2020
50b042d
Merge pull request #879 from pjaipakdee19/dev_seastone2_api
Jul 20, 2020
d4394eb
[device/celestica-seastone2]: add parts of component api
Jul 20, 2020
e28b262
[device/celestica-seastone2]: reformat api code
Jul 20, 2020
30489fa
[device/celestica-seastone2]: clean uncode component api code
Jul 21, 2020
78a6cc8
[device/celestica-seastone2]: fix thermalctld warning
Jul 21, 2020
06f573f
[device/celestica-seastone2]: clean fan api code
Jul 21, 2020
712eafa
[device/celestica-seastone2]: update sfp api format
Jul 29, 2020
2d30202
[device/celestica-seastone2]: upgrade sfp apis to support all sfp type
Jul 30, 2020
026d601
[device/celestica-seastone2]: clean api code
Jul 30, 2020
9392c1d
[platform/cel]: add install script for seastone2 api
Jul 31, 2020
3a2cc6d
[platform/cel]: fix invalid rule
Jul 31, 2020
9e183e6
[platform/cel]: clean seastone2 api code
Jul 31, 2020
8e86f6e
[platform/cel]: fix tlv path in seastone2 api config
Jul 31, 2020
438037e
[platform/cel]: fix sonic_platform catch Exception alerts
Aug 11, 2020
c44ebb9
[seastone2/switchboard] Code refactoring
pphuchar Aug 13, 2020
2a26c1e
[seastone2/switchboard] Add sysfs for XCVR interrupt event status
pphuchar Aug 13, 2020
634f845
[device/celestica-seastone2]: fix pmon error
Aug 14, 2020
243f9ea
[device/celestica-seastone2]: add wdt api
Aug 17, 2020
fb8d843
[device/celestica-seastone2]: fix lgtm error on wdt api
Aug 17, 2020
e5150d8
Merge pull request #936 from pphuchar/seastone2-add-xcvr-interrupt-st…
Aug 18, 2020
787ab35
[device/celestica-seastone2]: add sfp event api
Aug 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"skip_ledd": true,
"skip_xcvrd": false,
"skip_psud": false,
"skip_syseepromd": false
"skip_syseepromd": false,
"skip_fancontrol": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"eeprom": "/sys/class/i2c-adapter/i2c-0/0-0056/eeprom",
"get_reboot_cause": {
"output_source": "ipmitool",
"command": "ipmitool raw 0x3a 0x0c 0x0 0x2 0x06",
"output_translator": {
"00": "Hardware - Other",
"11": "Hardware - Other",
"22": "Non-Hardware",
"33": "Hardware - Other",
"44": "Non-Hardware",
"55": "Non-Hardware",
"77": "Watchdog",
"88": "Thermal Overload: CPU",
"99": "Thermal Overload: ASIC"
}
},
"get_reboot_description": {
"output_source": "ipmitool",
"command": "ipmitool raw 0x3a 0x0c 0x0 0x2 0x06",
"output_translator": {
"00": "The last reset is power cycle reset (set register 0xA164)",
"11": "The last reset is Power on reset",
"22": "The last reset is soft-set CPU warm reset",
"33": "The last reset is soft-set CPU cold reset",
"44": "The last reset is CPU warm reset",
"55": "The last reset is CPU cold reset",
"77": "The last reset is watchdog reset",
"88": "The last reset is CPU thermal overload",
"99": "The last reset is ASIC thermal overload"
}
},
"get_watchdog": {
"output_source": "class",
"host_path": "/usr/share/sonic/device/x86_64-cel_seastone_2-r0/sonic_platform_config/watchdog.py",
"pmon_path": "/usr/share/sonic/platform/sonic_platform_config/watchdog.py",
"class": "Watchdog"
},
"get_change_event": {
"output_source": "class",
"host_path": "/usr/share/sonic/device/x86_64-cel_seastone_2-r0/sonic_platform_config/event.py",
"pmon_path": "/usr/share/sonic/platform/sonic_platform_config/event.py",
"class": "SfpEvent"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"component_num": 5,
"get_name": {
"output_source": "value_list",
"value_list": [
"BIOS",
"CPLD_BASEBOARD",
"CPLD_SWITCHBOARD",
"FPGA",
"BMC"
]
},
"get_description": {
"output_source": "value_list",
"value_list": [
"Used to perform hardware initialization during the booting process",
"Used to control the system power & reset, Control FAN, UART Mux etc",
"Used for managing QSFP ports",
"Used for managing I2C, SPI, PCIe etc",
"Used for monitoring and managing whole system"
]
},
"get_firmware_version": {
"output_source": "function",
"function": [
"_get_bios_ver",
"_get_base_cpld_ver",
"_get_sw_cpld_ver",
"_get_fpga_ver",
"_get_bmc_ver"
]
},
"_get_bmc_ver": {
"output_source": "ipmitool",
"command": "ipmitool mc info | grep 'Firmware Revision'",
"output_translator": "'{}'.split(':')[-1].strip()"
},
"_get_bios_ver": {
"output_source": "txt_file",
"path": "/sys/class/dmi/id/bios_version"
},
"_get_base_cpld_ver": {
"output_source": "hex_version_file",
"num_of_points": 1,
"num_of_bits": 8,
"path": "/sys/devices/platform/baseboard/version"
},
"_get_sw_cpld_ver": {
"output_source": "hex_version_getreg",
"num_of_points": 1,
"num_of_bits": 8,
"reg_addr": "0x00",
"path": "/sys/devices/platform/switchboard/CPLD1/getreg"
},
"_get_fpga_ver": {
"output_source": "hex_version_getreg",
"num_of_points": 1,
"num_of_bits": 32,
"reg_addr": "0x00",
"path": "/sys/devices/platform/switchboard/FPGA/getreg"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env python

#############################################################################
# Celestica Seastone2
#
# SfpEvent contains an implementation of SONiC Platform Base API
#
#############################################################################
try:
import time
import os
from sonic_platform.common import Common
except ImportError as e:
raise ImportError(str(e) + "- required module not found")


PLATFORM_PATH = "/sys/devices/platform/"
SWITCH_BRD_PLATFORM = "switchboard"
POLL_INTERVAL = 1


class SfpEvent:
''' Listen to insert/remove sfp events '''

PORT_INFO_DIR = 'SFF'
PATH_INT_SYSFS = "{0}/{port_name}/{type_prefix}_isr_flags"
PATH_INTMASK_SYSFS = "{0}/{port_name}/{type_prefix}_isr_mask"
PATH_PRS_SYSFS = "{0}/{port_name}/{prs_file_name}"
PRESENT_EN = 0x01

def __init__(self, sfp_list):
self.num_sfp = len(sfp_list)
self._api_common = Common()
self._initialize_interrupts()

def _initialize_interrupts(self):
sfp_info_obj = {}
port_info_path = os.path.join(
PLATFORM_PATH, SWITCH_BRD_PLATFORM, self.PORT_INFO_DIR)

for index in range(self.num_sfp):
port_num = index + 1
port_name = "QSFP{}".format(port_num)
port_type = "qsfp"
sysfs_prs_file = "{}_modprs".format(port_type)

sfp_info_obj[index] = {}
sfp_info_obj[index]['intmask_sysfs'] = self.PATH_INTMASK_SYSFS.format(
port_info_path,
port_name=port_name,
type_prefix=port_type)

sfp_info_obj[index]['int_sysfs'] = self.PATH_INT_SYSFS.format(
port_info_path,
port_name=port_name,
type_prefix=port_type)

sfp_info_obj[index]['prs_sysfs'] = self.PATH_PRS_SYSFS.format(
port_info_path,
port_name=port_name,
prs_file_name=sysfs_prs_file)

self._api_common.write_txt_file(
sfp_info_obj[index]["intmask_sysfs"], hex(self.PRESENT_EN))

self.sfp_info_obj = sfp_info_obj

def _is_port_device_present(self, port_idx):
prs_path = self.sfp_info_obj[port_idx]["prs_sysfs"]
is_present = 1 - int(self._api_common.read_txt_file(prs_path))
return is_present

def _update_port_event_object(self, interrup_devices, port_dict):
for port_idx in interrup_devices:
device_id = str(port_idx + 1)
port_dict[device_id] = str(self._is_port_device_present(port_idx))
return port_dict

def _clear_event_flag(self, path):
self._api_common.write_txt_file(path, hex(0xff))
time.sleep(0.1)
self._api_common.write_txt_file(path, hex(0x0))

def _check_all_port_interrupt_event(self):
interrupt_devices = {}
for i in range(self.num_sfp):
int_sysfs = self.sfp_info_obj[i]["int_sysfs"]
interrupt_flags = self._api_common.read_txt_file(int_sysfs)
if interrupt_flags != '0x00':
interrupt_devices[i] = 1
self._clear_event_flag(int_sysfs)
return interrupt_devices

def get_event(self, timeout):
sleep_time = min(
timeout, POLL_INTERVAL) if timeout != 0 else POLL_INTERVAL
start_milli_time = int(round(time.time() * 1000))
int_sfp = {}

while True:
chk_sfp = self._check_all_port_interrupt_event()
int_sfp = self._update_port_event_object(
chk_sfp, int_sfp) if chk_sfp else int_sfp
current_milli_time = int(round(time.time() * 1000))
if (int_sfp) or \
(timeout != 0 and current_milli_time - start_milli_time > timeout):
break

time.sleep(sleep_time)

change_dict = dict()
change_dict['sfp'] = int_sfp

return True, change_dict
Loading