@@ -244,6 +244,37 @@ def strip_unit_and_beautify(value, unit):
244
244
return str (value )
245
245
246
246
247
+ def notify_system_ready (fail_status = False , fail_reason = '-' ):
248
+ key = 'FEATURE|pmon'
249
+ statusvalue = {}
250
+
251
+ try :
252
+ state_db = swsscommon .SonicV2Connector (host = '127.0.0.1' )
253
+ state_db .connect (state_db .STATE_DB )
254
+ except Exception :
255
+ helper_logger .log_error ('Failed to connect STATE_DB to report '
256
+ f'{ SYSLOG_IDENTIFIER } ready status' )
257
+ return
258
+
259
+ if fail_status :
260
+ statusvalue ['up_status' ] = 'false'
261
+ statusvalue ['fail_reason' ] = fail_reason
262
+ else :
263
+ statusvalue ['up_status' ] = 'true'
264
+
265
+ if getattr (notify_system_ready , 'reported' , False ):
266
+ helper_logger .log_debug (
267
+ f'{ SYSLOG_IDENTIFIER } ready status already reported. Tried to '
268
+ f'report status: { statusvalue } ' )
269
+ return
270
+
271
+ state_db .delete (state_db .STATE_DB , key )
272
+ state_db .hmset (state_db .STATE_DB , key , statusvalue )
273
+ helper_logger .log_info (f'Report { SYSLOG_IDENTIFIER } ready status: '
274
+ f'{ statusvalue } ' )
275
+ notify_system_ready .reported = True
276
+
277
+
247
278
def _wrapper_get_presence (physical_port ):
248
279
if platform_chassis is not None :
249
280
try :
@@ -2357,6 +2388,11 @@ def retry_eeprom_reading(self):
2357
2388
# Update retry EEPROM set
2358
2389
self .retry_eeprom_set -= retry_success_set
2359
2390
2391
+ # If we were here and now retry_eeprom_set is empty, then we can state
2392
+ # that all SFPs accessible
2393
+ if not self .retry_eeprom_set :
2394
+ notify_system_ready ()
2395
+
2360
2396
2361
2397
#
2362
2398
# Daemon =======================================================================
0 commit comments