From f9a29ef0562f8b35b107563c0b810e6f9fe7b735 Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Fri, 11 Feb 2022 00:39:05 +0800 Subject: [PATCH] [AS4630-54PE] Add to support PDDF (#8014) * [AS4630-54PE] Add to support PDDF Signed-off-by: Jostar Yang * Fix LGTM alerts * Fix LGTM alerts * Fix LGTM alerts * Add post_device.sh to turn off stk led * Add to support system_health * Correct the wait and timeout mechanism for better CPU usage * Add event.c to support port evt change Co-authored-by: Jostar Yang --- .../pddf/pd-plugin.json | 66 ++ .../pddf/pddf-device.json | 638 ++++++++++++++++++ .../x86_64-accton_as4630_54pe-r0/pddf_support | 0 .../pmon_daemon_control.json | 2 +- .../system_health_monitoring_config.json | 17 + .../as4630-54pe-pddf-platform-monitor.service | 16 + .../service/pddf-platform-init.service | 1 + .../as4630-54pe/sonic_platform/__init__.py | 3 + .../as4630-54pe/sonic_platform/chassis.py | 70 ++ .../as4630-54pe/sonic_platform/component.py | 85 +++ .../as4630-54pe/sonic_platform/eeprom.py | 14 + .../as4630-54pe/sonic_platform/event.py | 60 ++ .../as4630-54pe/sonic_platform/fan.py | 48 ++ .../as4630-54pe/sonic_platform/platform.py | 25 + .../as4630-54pe/sonic_platform/psu.py | 51 ++ .../as4630-54pe/sonic_platform/sfp.py | 20 + .../as4630-54pe/sonic_platform/thermal.py | 17 + .../as4630-54pe/sonic_platform/watchdog.py | 24 + .../as4630-54pe/sonic_platform_setup.py | 25 + .../utils/accton_as4630_54pe_pddf_monitor.py | 332 +++++++++ .../utils/pddf_post_device_create.sh | 14 + .../as4630-54pe/utils/pddf_switch_svc.py | 118 ++++ .../sonic-platform-accton-as4630-54pe.install | 1 + ...sonic-platform-accton-as4630-54pe.postinst | 8 + 24 files changed, 1654 insertions(+), 1 deletion(-) create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/pddf_support create mode 100644 device/accton/x86_64-accton_as4630_54pe-r0/system_health_monitoring_config.json create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service create mode 120000 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/__init__.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/chassis.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/eeprom.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/event.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/platform.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/psu.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/sfp.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/thermal.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/watchdog.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py create mode 100755 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_post_device_create.sh create mode 100755 platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install create mode 100644 platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json new file mode 100644 index 000000000000..0abf66aab7a5 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json @@ -0,0 +1,66 @@ +{ + "XCVR": + { + "xcvr_present": + { + "i2c": + { + "valmap-SFP28": {"1":true, "0":false }, + "valmap-QSFP28": {"1":true, "0":false} + } + } + }, + + "PSU": + { + "psu_present": + { + "i2c": + { + "valmap": { "1":true, "0":false } + } + }, + + "psu_power_good": + { + "i2c": + { + "valmap": { "1": true, "0":false } + } + }, + + "psu_fan_dir": + { + "i2c": + { + "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } + } + }, + + "PSU_FAN_MAX_SPEED":"18000" + }, + + "FAN": + { + "direction": + { + "i2c": + { + "valmap": {"1":"EXHAUST", "0":"INTAKE"} + } + }, + + "present": + { + "i2c": + { + "valmap": {"1":true, "0":false} + } + }, + + "duty_cycle_to_pwm": "lambda dc: ((dc*100.0)/625)", + + "pwm_to_duty_cycle": "lambda pwm: ((pwm*625.0)/100)" + } + +} diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json new file mode 100644 index 000000000000..b48506f9054d --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json @@ -0,0 +1,638 @@ +{ + "PLATFORM": + { + "num_psus":2, + "num_fantrays":3, + "num_fans_pertray":1, + "num_ports":54, + "num_temps": 3, + "pddf_dev_types": + { + "description":"AS4630 - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", + "CPLD": + [ + "i2c_cpld" + ], + "PSU": + [ + "psu_eeprom", + "psu_pmbus" + ], + "FAN": + [ + "fan_ctrl", + "fan_eeprom", + "fan_cpld" + ], + "PORT_MODULE": + [ + "pddf_xcvr" + ] + + }, + "std_kos": + [ + "i2c_dev", + "i2c_mux_pca954x force_deselect_on_exit=1", + "optoe" + ], + "description":"kernel modules are loaded while moving to pdf mode, but they should not be unloaded while moving to nonpddf mode.", + "std_perm_kos": + [ + "i2c-i801", + "i2c-ismt" + ], + + "pddf_kos": + [ + "pddf_client_module", + "pddf_cpld_module", + "pddf_cpld_driver", + "pddf_mux_module", + "pddf_xcvr_module", + "pddf_xcvr_driver_module", + "pddf_psu_driver_module", + "pddf_psu_module", + "pddf_fan_driver_module", + "pddf_fan_module", + "pddf_led_module" + ] + }, + + "SYSTEM": + { + "dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null}, + "i2c": + { + "CONTROLLERS": + [ + { "dev_name":"i2c-1", "dev":"SMBUS1" } + ] + } + }, + + "SMBUS1": + { + "dev_info": {"device_type": "SMBUS", "device_name": "SMBUS1", "device_parent": "SYSTEM"}, + "i2c": + { + "topo_info": {"dev_addr": "0x1"}, + "DEVICES": + [ + {"dev": "EEPROM1"}, + {"dev": "MUX1"} + ] + } + }, + + + "EEPROM1": + { + "dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS1"}, + "i2c": + { + "topo_info": {"parent_bus": "0x1", "dev_addr": "0x57", "dev_type": "24c02"}, + "dev_attr": {"access_mode": "BLOCK"}, + "attr_list": [ + {"attr_name": "eeprom"} + ] + } + }, + + "MUX1": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1", "dev_addr":"0x77", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x2"}, + "channel": + [ + { "chn":"0", "dev":"MUX2" }, + { "chn":"1", "dev":"MUX3" }, + { "chn":"1", "dev":"CPLD1" }, + { "chn":"1", "dev":"FAN-CTRL" } + ] + } + }, + + "MUX2": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2", "dev_addr":"0x71", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0xa"}, + "channel": + [ + { "chn":"0", "dev":"PSU1" }, + { "chn":"1", "dev":"PSU2" }, + { "chn":"4", "dev":"TEMP1" } + ] + } + }, + + "TEMP1" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_parent":"MUX2"}, + "dev_attr": { "display_name":"Temp_1"}, + "i2c": + { + "topo_info": { "parent_bus":"0xe", "dev_addr":"0x48", "dev_type":"lm77"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"}, + { "attr_name": "temp1_crit_hyst"}, + { "attr_name": "temp1_crit_alarm"}, + { "attr_name": "temp1_max_alarm"}, + { "attr_name": "temp1_min_alarm"}, + { "attr_name": "temp1_input"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_low_threshold", "drv_attr_name":"temp1_min"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_min_hyst"} + ] + } + }, + + "MUX3": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX3", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x70", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x12"}, + "channel": + [ + { "chn":"0", "dev":"PORT49" }, + { "chn":"1", "dev":"PORT50" }, + { "chn":"2", "dev":"PORT51" }, + { "chn":"3", "dev":"PORT52" }, + { "chn":"4", "dev":"PORT53" }, + { "chn":"5", "dev":"PORT54" }, + { "chn":"6", "dev":"TEMP2" }, + { "chn":"7", "dev":"TEMP3" } + ] + } + }, + + + "TEMP2" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_parent":"MUX3"}, + "dev_attr": { "display_name":"Temp_CPU"}, + + "i2c": + { + "topo_info": { "parent_bus":"0x18", "dev_addr":"0x4b", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + + "TEMP3" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_parent":"MUX3"}, + "dev_attr": { "display_name":"Temp_Fan"}, + "i2c": + { + "topo_info": { "parent_bus":"0x19", "dev_addr":"0x4a", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + + "CPLD1": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD1", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x60", "dev_type":"i2c_cpld"} + } + }, + + + "FAN-CTRL": + { + "dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x66", "dev_type":"fan_cpld"}, + "dev_attr": { "num_fantrays":"3"}, + "attr_list": + [ + { "attr_name":"fan1_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan2_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan3_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan1_direction", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"fan2_direction", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x20", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"fan3_direction", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x40", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"fan1_input", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"114", "attr_is_divisor":0}, + { "attr_name":"fan2_input", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x89", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"114" , "attr_is_divisor":0}, + { "attr_name":"fan3_input", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x8a", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"114", "attr_is_divisor":0}, + { "attr_name":"fan1_pwm", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1a", "attr_mask":"0x1F", "attr_len":"1"}, + { "attr_name":"fan2_pwm", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1a", "attr_mask":"0x1F", "attr_len":"1"}, + { "attr_name":"fan3_pwm", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1b", "attr_mask":"0x1F", "attr_len":"1"} + ] + } + }, + + + "SYS_LED": + { + "dev_info": { "device_type":"LED", "device_name":"SYS_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "7:5", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "bits" : "7:5", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "7:5", "descr" : "", "value" : "0x4", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_AMBER_BLINK", "bits" : "7:5", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "7:5", "descr" : "", "value" : "0x7", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"} + ] + } + }, + + + "PSU1_LED": + { + "dev_info": { "device_type":"LED", "device_name":"PSU_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "1:0", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "1:0", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "1:0", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"} + ] + } + }, + + "PSU2_LED": + { + "dev_info": { "device_type":"LED", "device_name":"PSU_LED"}, + "dev_attr": { "index":"1"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "7:6", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "7:6", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "7:6", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"} + ] + } + }, + + "FAN_LED": + { + "dev_info": { "device_type":"LED", "device_name":"FAN_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "3:2", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "3:2", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "3:2", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"} + ] + } + }, + + "PSU1": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX2"}, + "dev_attr": { "dev_idx":"1", "num_psu_fans": "1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU1-PMBUS" }, + { "itf":"eeprom", "dev":"PSU1-EEPROM" } + ] + + } + }, + + "PSU1-PMBUS": + { + "dev_info": { "device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xa", "dev_addr":"0x58", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "PSU1-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU1-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xa", "dev_addr":"0x50", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x20", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"12" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x40", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"19" } + ] + } + }, + + + "PSU2": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU2", "device_parent":"MUX2" }, + "dev_attr": { "dev_idx":"2", "num_psu_fans":"1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU2-PMBUS"}, + { "itf":"eeprom", "dev":"PSU2-EEPROM"} + ] + } + + }, + + "PSU2-PMBUS": + { + "dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU2-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info": { "parent_bus":"0xb", "dev_addr":"0x59", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "PSU2-EEPROM": + { + "dev_info": {"device_type":"PSU-EEPROM", "device_name":"PSU2-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info": { "parent_bus":"0xb", "dev_addr":"0x51", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x20", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"12" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"19" } + ] + } + }, + + "PORT49": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT49", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"49"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT49-EEPROM" }, + { "itf":"control", "dev":"PORT49-CTRL" } + ] + } + }, + "PORT49-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT49-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT49"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT49-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT49-CTRL", "device_parent":"MUX3", "virt_parent":"PORT49"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT50": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT50", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"50"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT50-EEPROM" }, + { "itf":"control", "dev":"PORT50-CTRL" } + ] + } + }, + "PORT50-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT50-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT50"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT50-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT50-CTRL", "device_parent":"MUX3", "virt_parent":"PORT50"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT51": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT51", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"51"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT51-EEPROM" }, + { "itf":"control", "dev":"PORT51-CTRL" } + ] + } + }, + "PORT51-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT51-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT51"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT51-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT51-CTRL", "device_parent":"MUX3", "virt_parent":"PORT51"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + "PORT52": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT52", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"52"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT52-EEPROM" }, + { "itf":"control", "dev":"PORT52-CTRL" } + ] + } + }, + "PORT52-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT52-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT52"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT52-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT52-CTRL", "device_parent":"MUX3", "virt_parent":"PORT52"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT53": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT53", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"53"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT53-EEPROM" }, + { "itf":"control", "dev":"PORT53-CTRL" } + ] + } + }, + "PORT53-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT53-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT53"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT53-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT53-CTRL", "device_parent":"MUX3", "virt_parent":"PORT53"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT54": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT54", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"54"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT54-EEPROM" }, + { "itf":"control", "dev":"PORT54-CTRL" } + ] + } + }, + "PORT54-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT54-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT54"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT54-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT54-CTRL", "device_parent":"MUX3", "virt_parent":"PORT54"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + } + +} diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pddf_support b/device/accton/x86_64-accton_as4630_54pe-r0/pddf_support new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as4630_54pe-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..61f624ee34c6 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/system_health_monitoring_config.json @@ -0,0 +1,17 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.voltage", + "psu.temperature", + "PSU1_FAN1.speed", + "PSU2_FAN1.speed" + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_AMBER", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN_BLINK" + } +} diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service new file mode 100644 index 000000000000..99bca2684f4d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-pddf-platform-monitor.service @@ -0,0 +1,16 @@ +[Unit] +Description=Accton AS4630-54PE Platform Monitoring service +Before=pmon.service +After=pddf-platform-init.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as4630_54pe_pddf_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service new file mode 120000 index 000000000000..0fd9f25b6c5e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service @@ -0,0 +1 @@ +../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/__init__.py new file mode 100644 index 000000000000..f0201e717796 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +# All the derived classes for PDDF +__all__ = ["platform", "chassis", "sfp", "psu", "thermal"] +from . import platform diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/chassis.py new file mode 100644 index 000000000000..1dfca24ab32b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/chassis.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Chassis API +# +############################################################################# + +try: + import sys + from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from .event import SfpEvent +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_COMPONENT = 2 + +class Chassis(PddfChassis): + """ + PDDF Platform-specific Chassis class + """ + + SYSLED_DEV_NAME = "SYS_LED" + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + self.__initialize_components() + self._sfpevent = SfpEvent(self.get_all_sfps()) + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_change_event(self, timeout=0): + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + + Returns: + An object derived from SfpBase representing the specified sfp + """ + sfp = None + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def initizalize_system_led(self): + return + + def get_status_led(self): + return self.get_system_led(self.SYSLED_DEV_NAME) + + def set_status_led(self, color): + return self.set_system_led(self.SYSLED_DEV_NAME, color) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py new file mode 100644 index 000000000000..22696341523d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the component information (such as CPLD, FPGA, BIOS etc) which are available in the platform +# +############################################################################# + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +#COMPONENT_NAME_LIST = ["CPLD1"] +COMPONENT_LIST = [ + ("CPLD1", "CPLD 1"), + ("BIOS", "Basic Input/Output System") +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + + def __init__(self, component_index): + self.index = component_index + self.name = self.get_name() + self.cpld_mapping = { + 0: ['3', '0x60'] + } + + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cmd = "i2cget -f -y {0} {1} 0x1".format(self.cpld_mapping[self.index][0], self.cpld_mapping[self.index][1]) + status, value = subprocess.getstatusoutput(cmd) + if not status: + fw_version = value.rstrip() + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/eeprom.py new file mode 100644 index 000000000000..a87ecc9f6feb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/eeprom.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +try: + from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(PddfEeprom): + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfEeprom.__init__(self, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/event.py new file mode 100644 index 000000000000..d5dac6d7f7e0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/event.py @@ -0,0 +1,60 @@ +try: + import time + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan.py new file mode 100644 index 000000000000..ef8deaffb6fa --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan import PddfFan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Fan(PddfFan): + """PDDF Platform-Specific Fan class""" + + def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0): + # idx is 0-based + PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten + # Since AS4630 psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'Exhaust' + def get_direction(self): + """ + Retrieves the direction of fan + + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if self.is_psu_fan: + direction = self.FAN_DIRECTION_EXHAUST + + else: + idx = (self.fantray_index-1)*self.platform['num_fans_pertray'] + self.fan_index + attr = "fan" + str(idx) + "_direction" + output = self.pddf_obj.get_attr_name_output("FAN-CTRL", attr) + if not output: + return False + + mode = output['mode'] + val = output['status'] + + val = val.rstrip() + vmap = self.plugin_data['FAN']['direction'][mode]['valmap'] + if val in vmap: + direction = vmap[val] + else: + direction = val + + return direction + diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/platform.py new file mode 100644 index 000000000000..406b1179ae1b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/platform.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + + +try: + from sonic_platform_pddf_base.pddf_platform import PddfPlatform +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PddfPlatform): + """ + PDDF Platform-Specific Platform Class + """ + + def __init__(self): + PddfPlatform.__init__(self) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/psu.py new file mode 100644 index 000000000000..f002f5e0394a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/psu.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# + + +try: + from sonic_platform_pddf_base.pddf_psu import PddfPsu +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Psu(PddfPsu): + """PDDF Platform-Specific PSU class""" + + PLATFORM_PSU_CAPACITY = 1200 + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_capacity(self): + """ + Gets the capacity (maximum output power) of the PSU in watts + + Returns: + An integer, the capacity of PSU + """ + return (self.PLATFORM_PSU_CAPACITY) + + def get_type(self): + """ + Gets the type of the PSU + + Returns: + A string, the type of PSU (AC/DC) + """ + ptype = "AC" + # Currently the platform supports only AC type of PSUs + #try: + #import sonic_platform.platform + #ch=sonic_platform.platform.Platform().get_chassis() + #e=ch.sys_eeprom.read_eeprom() + #ret, prod_name = ch.sys_eeprom.get_tlv_field(e,0x21) + #if ret: + #prod_name = prod_name[2] + ##print("Product name is {}".format(prod_name)) + #if '48V' in prod_name: + #ptype = 'DC' + #except Exception as e: + #print("Error while trying to read syseeprom to get PSU type") + + return ptype diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/sfp.py new file mode 100644 index 000000000000..c9fb07d6364f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/sfp.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +try: + from sonic_platform_pddf_base.pddf_sfp import PddfSfp +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Sfp(PddfSfp): + """ + PDDF Platform-Specific Sfp class + """ + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_position_in_parent(self): + """Retrieves 1-based relative physical position in parent device.""" + return self.port_index diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/thermal.py new file mode 100644 index 000000000000..5b829fc26caa --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/thermal.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_thermal import PddfThermal +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + + +class Thermal(PddfThermal): + """PDDF Platform-Specific Thermal class""" + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/watchdog.py new file mode 100644 index 000000000000..fe8554f6ec73 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/watchdog.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of platform specific watchdog API's +# +############################################################################# + +try: + from sonic_platform_pddf_base.pddf_watchdog import PddfWatchdog +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Watchdog(PddfWatchdog): + """ + PDDF Platform-specific Chassis class + """ + + def __init__(self): + PddfWatchdog.__init__(self) + self.timeout = 180 + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py new file mode 100644 index 000000000000..59dad237f3b4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py @@ -0,0 +1,25 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on Accton Platforms using PDDF', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + packages=['sonic_platform'], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py new file mode 100755 index 000000000000..d9299b96a3b2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py @@ -0,0 +1,332 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -* +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# HISTORY: +# mm/dd/yyyy (A.D.)# +# 10/24/2019:Jostar create for as4630_54pe thermal plan +# ------------------------------------------------------------------ + +try: + import os + import sys + import getopt + import subprocess + import logging + import logging.handlers + import time + from sonic_platform import platform +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as4630_54pe_pddf_monitor' + + + + + +# Temperature Policy +# If any fan fail , please set fan speed register to 16 +# The max value of fan speed register is 14 +# LM77(48)+LM75(4B)+LM75(4A) > 140, Set 10 +# LM77(48)+LM75(4B)+LM75(4A) > 150, Set 12 +# LM77(48)+LM75(4B)+LM75(4A) > 160, Set 14 +# LM77(48)+LM75(4B)+LM75(4A) < 140, Set 8 +# LM77(48)+LM75(4B)+LM75(4A) < 150, Set 10 +# LM77(48)+LM75(4B)+LM75(4A) < 160, Set 12 +# Reset DUT:LM77(48)>=70C +# +class switch(object): + def __init__(self, value): + self.value = value + self.fall = False + + def __iter__(self): + """Return the match method once, then stop""" + yield self.match + raise StopIteration + + def match(self, *args): + """Indicate whether or not to enter a case suite""" + if self.fall or not args: + return True + elif self.value in args: # changed for v1.5, see below + self.fall = True + return True + else: + return False + + +def as4630_54pe_set_fan_speed(pwm): + # This platform has 2 fans controlled by one register on CPLD and 3rd fan by another register + # Hence, we need to change the speed for all + if pwm < 0 or pwm > 100: + print("Error: Wrong duty cycle value %d" % (pwm)) + platform_chassis.get_fan(0).set_speed(pwm) + platform_chassis.get_fan(2).set_speed(pwm) + + return 0 + + +fan_policy_state = 0 +fan_fail = 0 +fan_fail_list = [0, 0, 0] +alarm_state = 0 # 0->default or clear, 1-->alarm detect +test_temp = 0 +simulate_temp_decline = 0 +test_temp_list = [0, 0, 0] +temp_test_data = 0 +test_temp_revert = 0 +platform_chassis = None +# Make a class we can use to capture stdout and sterr in the log + + +class device_monitor(object): + # static temp var + temp = 0 + new_pwm = 0 + pwm = 0 + ori_pwm = 0 + default_pwm = 0x4 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(asctime)-15s %(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler(address='/dev/log') + sys_handler.setLevel(logging.WARNING) + logging.getLogger('').addHandler(sys_handler) + + def get_state_from_fan_policy(self, temp, policy): + state = 0 + for i in range(0, len(policy)): + if (temp > policy[i][2]): # temp_down + if temp <= policy[i][3]: # temp_up + state = i + + return state + + def manage_fans(self): + global fan_policy_state + global fan_fail + global fan_fail_list + global test_temp + global simulate_temp_decline + global test_temp_list + global alarm_state + global temp_test_data + global test_temp_revert + global platform_chassis + NUM_FANS = 3 + LEVEL_FAN_MIN = 0 + LEVEL_FAN_NORMAL = 1 + LEVEL_FAN_MID = 2 + LEVEL_FAN_HIGH = 3 + LEVEL_TEMP_CRITICAL = 4 + fan_policy = { + LEVEL_FAN_MIN: [50, 8, 0, 140000], + LEVEL_FAN_NORMAL: [62, 10, 140000, 150000], + LEVEL_FAN_MID: [75, 12, 150000, 160000], + LEVEL_FAN_HIGH: [88, 14, 160000, 240000], + LEVEL_TEMP_CRITICAL: [100, 16, 240000, 300000], + } + temp = [0, 0, 0] + + #thermal = ThermalUtil() + #fan = FanUtil() + # Supposedly all the fans are set with same duty cycle + ori_duty_cycle = platform_chassis.get_fan(0).get_speed() + new_duty_cycle = 0 + + if test_temp == 0: + for i in range(0, 3): + temp[i] = platform_chassis.get_thermal(i).get_temperature() + if temp[i] == 0.0 or temp[i] is None: + + logging.warning("Get temp-%d fail", i) + return False + temp[i] = int(temp[i]*1000) + else: + if test_temp_revert == 0: + temp_test_data = temp_test_data+2000 + else: + if temp_test_data > 0: + temp_test_data = temp_test_data-2000 + else: + # Stop the simulation + sys.exit('Simulation Ends !') + + for i in range(0, 3): + temp[i] = test_temp_list[i]+temp_test_data + fan_fail = 0 + + temp_val = 0 + for i in range(0, 3): + if temp[i] is None: + break + temp_val += temp[i] + + # Check Fan status + for i in range(NUM_FANS): + if not platform_chassis.get_fan(i).get_status(): + if test_temp == 0: + fan_fail = 1 + if fan_fail_list[i] == 0: + fan_fail_list[i] = 1 + else: + if fan_fail_list[i] == 1: + fan_fail_list[i] = 0 + + if sum(fan_fail_list) == NUM_FANS: + # Critical: Either all the fans are faulty or they are removed, shutdown the system + logging.critical('Alarm for all fan faulty/absent is detected') + logging.critical("Alarm for all fan faulty/absent is detected, reset DUT") + cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" + time.sleep(2) + subprocess.getstatusoutput('sync; sync; sync') + subprocess.getstatusoutput(cmd_str) + elif sum(fan_fail_list) != 0: + # Set the 100% speed only for first fan failure detection + logging.warning('Fan_{} failed, set remaining fan speed to 100%'.format( + ' Fan_'.join(str(item+1) for item, val in enumerate(fan_fail_list) if val == 1))) + new_pwm = 100 + as4630_54pe_set_fan_speed(new_pwm) + else: + fan_fail = 0 + + ori_state = fan_policy_state + fan_policy_state = self.get_state_from_fan_policy(temp_val, fan_policy) + + if fan_policy_state > LEVEL_TEMP_CRITICAL or fan_policy_state < LEVEL_FAN_MIN: + logging.error("Get error fan current_state\n") + return 0 + + # Decision : Decide new fan pwm percent. + if fan_fail == 0 and ori_duty_cycle != fan_policy[fan_policy_state][0]: + new_duty_cycle = fan_policy[fan_policy_state][0] + as4630_54pe_set_fan_speed(new_duty_cycle) + if test_temp == 1: + time.sleep(3) + status, output = subprocess.getstatusoutput('pddf_fanutil getspeed') + logging.debug('\n%s\n', output) + + if temp[0] >= 70000: # LM77-48 + # critical case*/ + logging.critical('Alarm for temperature critical is detected') + logging.critical("Alarm-Critical for temperature critical is detected, reset DUT") + # Update the reboot cause file to reflect that critical temperature + # has been crossed. Upon next boot, the contents of this file will + # be used to determine the cause of the previous reboot + status, output = subprocess.getstatusoutput( + 'echo "Thermal Overload: Other" > /host/reboot-cause/reboot-cause.txt') + status, output = subprocess.getstatusoutput( + 'echo "System rebooted because alarm for critical temperature (70 C) is detected [Time: $(eval date)]" >> /host/reboot-cause/reboot-cause.txt') + if status: + logging.warning('Reboot cause file not updated. {}'.format(output)) + + cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" + subprocess.getstatusoutput('sync; sync; sync') + time.sleep(3) + subprocess.getstatusoutput(cmd_str) + + logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n', ori_state, fan_policy_state, temp_val) + + if ori_state < LEVEL_FAN_HIGH: + if fan_policy_state >= LEVEL_FAN_HIGH: + if alarm_state == 0: + logging.warning('Alarm for temperature high is detected') + alarm_state = 1 + # Add a mechanism to decrease the test_temp values + if simulate_temp_decline == 1: + logging.info('Temperature decline simulation is ON. Testing temperature will decrease now') + test_temp_revert = 1 + + if fan_policy_state < LEVEL_FAN_MID: + if alarm_state == 1: + logging.warning('Alarm for temperature high is cleared') + alarm_state = 0 + + return True + + +def main(argv): + # Check if PDDF mode is enabled + if not os.path.exists('/usr/share/sonic/platform/pddf_support'): + print("PDDF mode is not enabled") + return 0 + + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + global test_temp + global simulate_temp_decline + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv, 'hdlt:', ['lfile=']) + except getopt.GetoptError: + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + for opt, arg in opts: + if opt == '-h': + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + if sys.argv[1] == '-t': + if len(sys.argv) != 6: + print("temp test, need input temp decline option and three temp values") + return 0 + + i = 0 + simulate_temp_decline = int(sys.argv[2]) + for x in range(3, 6): + test_temp_list[i] = int(sys.argv[x])*1000 + i = i+1 + test_temp = 1 + log_level = logging.DEBUG + print(test_temp_list) + + global platform_chassis + platform_chassis = platform.Platform().get_chassis() + + as4630_54pe_set_fan_speed(50) + + monitor = device_monitor(log_file, log_level) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) # 10sec + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_post_device_create.sh new file mode 100755 index 000000000000..d820352ac7e0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_post_device_create.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "Setting LED MAC Mode.." +i2cset -y -f 3 0x60 0x2a 0xff +i2cset -y -f 3 0x60 0x2b 0xff +i2cset -y -f 3 0x60 0x86 0x89 +echo "Setting LED MAC Mode..DONE" +# Turn off STK1 and STK2 LED. Bit5:4 to 0x11 +#i2cset -y -f 3 0x60 0xb5 +stk_val=$(i2cget -y -f 3 0x60 0x31) +new_val=$((${stk_val}|0x30)) +i2cset -y -f 3 0x60 0x31 ${new_val} +echo "STK LEDs are turned off successfully" + diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py new file mode 100755 index 000000000000..5a505e19f19b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# Script to stop and start the respective platforms default services. +# This will be used while switching the pddf->non-pddf mode and vice versa + +import commands + +def check_pddf_support(): + return True + +def stop_platform_svc(): + status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor-fan.service") + if status: + print "Disable as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor-fan.service") + if status: + print "Stop as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor-psu.service") + if status: + print "Disable as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor-psu.service") + if status: + print "Stop as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor.service") + if status: + print "Disable as4630-54pe-platform-monitor.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor.service") + if status: + print "Stop as4630-54pe-platform-monitor.service failed %d"%status + return False + + status, output = commands.getstatusoutput("/usr/local/bin/accton_as4630_54pe_util.py clean") + if status: + print "accton_as4630_54pe_util.py clean command failed %d"%status + return False + + # HACK , stop the pddf-platform-init service if it is active + status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + if status: + print "Stop pddf-platform-init.service along with other platform serives failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-pddf-platform-monitor.service") + if status: + print "Stop as4630-54pe-pddf-platform-monitor.service along with other platform serives failed %d"%status + return False + + return True + +def start_platform_svc(): + status, output = commands.getstatusoutput("/usr/local/bin/accton_as4630_54pe_util.py install") + if status: + print "accton_as4630_54pe_util.py install command failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor-fan.service") + if status: + print "Enable as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor-fan.service") + if status: + print "Start as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor-psu.service") + if status: + print "Enable as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor-psu.service") + if status: + print "Start as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor.service") + if status: + print "Enable as4630-54pe-platform-monitor.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor.service") + if status: + print "Start as4630-54pe-platform-monitor.service failed %d"%status + return False + + return True + +def start_platform_pddf(): + status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + if status: + print "Start pddf-platform-init.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-pddf-platform-monitor.service") + if status: + print "Start as4630-54pe-pddf-platform-monitor.service failed %d"%status + return False + + return True + +def stop_platform_pddf(): + status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + if status: + print "Stop pddf-platform-init.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-pddf-platform-monitor.service") + if status: + print "Stop as4630-54pe-pddf-platform-monitor.service failed %d"%status + return False + + return True + +def main(): + pass + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install new file mode 100644 index 000000000000..4ba26bed2625 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install @@ -0,0 +1 @@ +as4630-54pe/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as4630_54pe-r0/pddf diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst new file mode 100644 index 000000000000..23bebd3b295c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst @@ -0,0 +1,8 @@ +# Special arrangement to make PDDF mode default +# Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) +# Enable pddf-platform-monitor +depmod -a +systemctl enable pddf-platform-init.service +systemctl start pddf-platform-init.service +systemctl enable as4630-54pe-pddf-platform-monitor.service +systemctl start as4630-54pe-pddf-platform-monitor.service