@@ -48,6 +48,16 @@ def log_error(msg):
48
48
syslog .syslog (syslog .LOG_ERR , msg )
49
49
syslog .closelog ()
50
50
51
+ #
52
+ # Load asic_type for further use
53
+ #
54
+
55
+ try :
56
+ version_info = sonic_device_util .get_sonic_version_info ()
57
+ asic_type = version_info ['asic_type' ]
58
+ except KeyError , TypeError :
59
+ raise click .Abort ()
60
+
51
61
#
52
62
# Helper functions
53
63
#
@@ -314,13 +324,16 @@ def _abort_if_false(ctx, param, value):
314
324
ctx .abort ()
315
325
316
326
def _stop_services ():
327
+ # on Mellanox platform pmon is stopped by syncd
317
328
services_to_stop = [
318
329
'swss' ,
319
330
'lldp' ,
320
331
'pmon' ,
321
332
'bgp' ,
322
333
'hostcfgd' ,
323
334
]
335
+ if asic_type == 'mellanox' and 'pmon' in services_to_stop :
336
+ services_to_stop .remove ('pmon' )
324
337
325
338
for service in services_to_stop :
326
339
try :
@@ -358,6 +371,7 @@ def _reset_failed_services():
358
371
raise
359
372
360
373
def _restart_services ():
374
+ # on Mellanox platform pmon is started by syncd
361
375
services_to_restart = [
362
376
'hostname-config' ,
363
377
'interfaces-config' ,
@@ -369,6 +383,8 @@ def _restart_services():
369
383
'lldp' ,
370
384
'hostcfgd' ,
371
385
]
386
+ if asic_type == 'mellanox' and 'pmon' in services_to_restart :
387
+ services_to_restart .remove ('pmon' )
372
388
373
389
for service in services_to_restart :
374
390
try :
@@ -1350,8 +1366,7 @@ def asymmetric(ctx, interface_name, status):
1350
1366
def platform ():
1351
1367
"""Platform-related configuration tasks"""
1352
1368
1353
- version_info = sonic_device_util .get_sonic_version_info ()
1354
- if (version_info and version_info .get ('asic_type' ) == 'mellanox' ):
1369
+ if asic_type == 'mellanox' :
1355
1370
platform .add_command (mlnx .mlnx )
1356
1371
1357
1372
#
0 commit comments