diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/pcisysfs.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/pcisysfs.py index 047618e057..1ca22db926 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/pcisysfs.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/pcisysfs.py @@ -20,23 +20,23 @@ from os import * from mmap import * def usage(): - ''' This is the Usage Method ''' + ''' This is the Usage Method ''' - print '\t\t pcisysfs.py --get --offset --res ' - print '\t\t pcisysfs.py --set --val --offset --res ' - sys.exit(1) + print('\t\t pcisysfs.py --get --offset --res ') + print('\t\t pcisysfs.py --set --val --offset --res ') + sys.exit(1) def pci_mem_read(mm,offset): mm.seek(offset) read_data_stream=mm.read(4) - print "" + print("") reg_val=struct.unpack('I',read_data_stream) - print "reg_val read:%x"%reg_val + print("reg_val read:%x"%reg_val) return reg_val def pci_mem_write(mm,offset,data): mm.seek(offset) - print "data to write:%x"%data + print("data to write:%x"%data) mm.write(struct.pack('I',data)) def pci_set_value(resource,val,offset): @@ -63,7 +63,7 @@ def main(argv): try: opts, args = getopt.getopt(argv, "hgsv:" , \ ["val=","res=","offset=","help", "get", "set"]) - + except getopt.GetoptError: usage() diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py index 76e9a4b364..629f4e73f7 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py @@ -303,15 +303,15 @@ class Chassis(ChassisBase): return (self.REBOOT_CAUSE_NON_HARDWARE, None) if reboot_cause & 0x1: - return (self.REBOOT_CAUSE_POWER_LOSS, None) + return (self.REBOOT_CAUSE_POWER_LOSS, "Power on reset") elif reboot_cause & 0x2: return (self.REBOOT_CAUSE_NON_HARDWARE, None) elif reboot_cause & 0x4: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "PSU Shutdown") elif reboot_cause & 0x8: - return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, None) + return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, "Thermal overload") elif reboot_cause & 0x10: - return (self.REBOOT_CAUSE_WATCHDOG, None) + return (self.REBOOT_CAUSE_WATCHDOG, "Watchdog reset") elif reboot_cause & 0x20: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "BMC Shutdown") elif reboot_cause & 0x40: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py index 347d1bd7fb..45669199a3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py @@ -22,21 +22,21 @@ from mmap import * def usage(): ''' This is the Usage Method ''' - print '\t\t pcisysfs.py --get --offset --res ' - print '\t\t pcisysfs.py --set --val --offset --res ' + print('\t\t pcisysfs.py --get --offset --res ') + print('\t\t pcisysfs.py --set --val --offset --res ') sys.exit(1) def pci_mem_read(mm,offset): mm.seek(offset) read_data_stream=mm.read(4) - print "" + print("") reg_val=struct.unpack('I',read_data_stream) - print "reg_val read:%x"%reg_val + print("reg_val read:%x"%reg_val) return reg_val def pci_mem_write(mm,offset,data): mm.seek(offset) - print "data to write:%x"%data + print("data to write:%x"%data) mm.write(struct.pack('I',data)) def pci_set_value(resource,val,offset): diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py index 250983d805..1f85dd80b2 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py @@ -262,6 +262,7 @@ class Chassis(ChassisBase): An integer represences the number of SFPs on the chassis. """ return self._num_sfps + def get_reboot_cause(self): """ Retrieves the cause of the previous reboot @@ -279,15 +280,15 @@ class Chassis(ChassisBase): return (self.REBOOT_CAUSE_NON_HARDWARE, None) if reboot_cause & 0x1: - return (self.REBOOT_CAUSE_POWER_LOSS, None) + return (self.REBOOT_CAUSE_POWER_LOSS, "Power on reset") elif reboot_cause & 0x2: return (self.REBOOT_CAUSE_NON_HARDWARE, None) elif reboot_cause & 0x4: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "PSU Shutdown") elif reboot_cause & 0x8: - return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, None) + return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, "Thermal overload") elif reboot_cause & 0x10: - return (self.REBOOT_CAUSE_WATCHDOG, None) + return (self.REBOOT_CAUSE_WATCHDOG, "Watchdog reset") elif reboot_cause & 0x20: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "BMC Shutdown") elif reboot_cause & 0x40: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py index 30a79744ca..41f985a173 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py @@ -39,6 +39,7 @@ class Chassis(ChassisBase): oir_fd = -1 epoll = -1 + REBOOT_CAUSE_PATH = "/host/reboot-cause/platform/reboot_reason" pci_res = "/sys/bus/pci/devices/0000:04:00.0/resource0" sysled_offset = 0x0024 SYSLED_COLOR_TO_REG = { @@ -290,15 +291,15 @@ class Chassis(ChassisBase): return (self.REBOOT_CAUSE_NON_HARDWARE, None) if reboot_cause & 0x1: - return (self.REBOOT_CAUSE_POWER_LOSS, None) + return (self.REBOOT_CAUSE_POWER_LOSS, "Power on reset") elif reboot_cause & 0x2: return (self.REBOOT_CAUSE_NON_HARDWARE, None) elif reboot_cause & 0x4: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "PSU Shutdown") elif reboot_cause & 0x8: - return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, None) + return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, "Thermal overload") elif reboot_cause & 0x10: - return (self.REBOOT_CAUSE_WATCHDOG, None) + return (self.REBOOT_CAUSE_WATCHDOG, "Watchdog reset") elif reboot_cause & 0x20: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "BMC Shutdown") elif reboot_cause & 0x40: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py index 047618e057..45669199a3 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py @@ -20,23 +20,23 @@ from os import * from mmap import * def usage(): - ''' This is the Usage Method ''' + ''' This is the Usage Method ''' - print '\t\t pcisysfs.py --get --offset --res ' - print '\t\t pcisysfs.py --set --val --offset --res ' - sys.exit(1) + print('\t\t pcisysfs.py --get --offset --res ') + print('\t\t pcisysfs.py --set --val --offset --res ') + sys.exit(1) def pci_mem_read(mm,offset): mm.seek(offset) read_data_stream=mm.read(4) - print "" + print("") reg_val=struct.unpack('I',read_data_stream) - print "reg_val read:%x"%reg_val + print("reg_val read:%x"%reg_val) return reg_val def pci_mem_write(mm,offset,data): mm.seek(offset) - print "data to write:%x"%data + print("data to write:%x"%data) mm.write(struct.pack('I',data)) def pci_set_value(resource,val,offset): @@ -63,7 +63,7 @@ def main(argv): try: opts, args = getopt.getopt(argv, "hgsv:" , \ ["val=","res=","offset=","help", "get", "set"]) - + except getopt.GetoptError: usage()