diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/eeprom.py b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/eeprom.py index 1faeff9d18bf..c06a1899fc3c 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/eeprom.py +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/eeprom.py @@ -74,6 +74,7 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): + RETRIES = 30 def __init__(self, name, path, cpld_root, ro): @@ -88,7 +89,16 @@ def __init__(self, name, path, cpld_root, ro): self.eeprom_path = EEPROM_SYMLINK super(board, self).__init__(self.eeprom_path, 0, '', True) - self.eeprom_init() + + for attempt in range(self.RETRIES + 1): + if not self.eeprom_init(): + time.sleep(1) + else: + break + + if attempt == self.RETRIES: + raise RuntimeError("Could not initialize syseeprom") + def thrift_setup(self): global thrift_server, transport, pltfm_mgr @@ -109,9 +119,12 @@ def thrift_teardown(self): def eeprom_init(self): global pltfm_mgr - self.thrift_setup() - eeprom = pltfm_mgr.pltfm_mgr_sys_eeprom_get() - self.thrift_teardown() + try: + self.thrift_setup() + eeprom = pltfm_mgr.pltfm_mgr_sys_eeprom_get() + self.thrift_teardown() + except: + return False eeprom_params = "" for attr, val in eeprom.__dict__.iteritems(): @@ -143,3 +156,5 @@ def eeprom_init(self): sys.stdout = orig_stdout eeprom_base.EepromDecoder.write_eeprom(self, new_e) + return True + diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/psuutil.py b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/psuutil.py index 734901c2adfa..2c0e2fdb224e 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/psuutil.py +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/psuutil.py @@ -63,9 +63,13 @@ def get_psu_status(self, index): return False global pltfm_mgr - self.thrift_setup() - psu_info = pltfm_mgr.pltfm_mgr_pwr_supply_info_get(index) - self.thrift_teardown() + + try: + self.thrift_setup() + psu_info = pltfm_mgr.pltfm_mgr_pwr_supply_info_get(index) + self.thrift_teardown() + except: + return False return (psu_info.ffault == False) @@ -80,9 +84,13 @@ def get_psu_presence(self, index): return False global pltfm_mgr - self.thrift_setup() - status = pltfm_mgr.pltfm_mgr_pwr_supply_present_get(index) - self.thrift_teardown() + + try: + self.thrift_setup() + status = pltfm_mgr.pltfm_mgr_pwr_supply_present_get(index) + self.thrift_teardown() + except: + return False return status