@@ -219,7 +219,7 @@ def muxcable():
219
219
platform_sfputil = platform_sfputil_helper .platform_sfputil
220
220
221
221
222
- def lookup_statedb_and_update_configdb (per_npu_statedb , config_db , port , state_cfg_val , port_status_dict ):
222
+ def lookup_statedb_and_update_configdb (db , per_npu_statedb , config_db , port , state_cfg_val , port_status_dict ):
223
223
224
224
muxcable_statedb_dict = per_npu_statedb .get_all (per_npu_statedb .STATE_DB , 'MUX_CABLE_TABLE|{}' .format (port ))
225
225
configdb_state = get_value_for_key_in_config_tbl (config_db , port , "state" , "MUX_CABLE" )
@@ -228,15 +228,17 @@ def lookup_statedb_and_update_configdb(per_npu_statedb, config_db, port, state_c
228
228
229
229
state = get_value_for_key_in_dict (muxcable_statedb_dict , port , "state" , "MUX_CABLE_TABLE" )
230
230
231
+ port_name = platform_sfputil_helper .get_interface_alias (port , db )
232
+
231
233
if str (state_cfg_val ) == str (configdb_state ):
232
- port_status_dict [port ] = 'OK'
234
+ port_status_dict [port_name ] = 'OK'
233
235
else :
234
236
config_db .set_entry ("MUX_CABLE" , port , {"state" : state_cfg_val ,
235
237
"server_ipv4" : ipv4_value , "server_ipv6" : ipv6_value })
236
238
if (str (state_cfg_val ) == 'active' and str (state ) != 'active' ) or (str (state_cfg_val ) == 'standby' and str (state ) != 'standby' ):
237
- port_status_dict [port ] = 'INPROGRESS'
239
+ port_status_dict [port_name ] = 'INPROGRESS'
238
240
else :
239
- port_status_dict [port ] = 'OK'
241
+ port_status_dict [port_name ] = 'OK'
240
242
241
243
242
244
# 'muxcable' command ("config muxcable mode <port|all> active|auto")
@@ -248,7 +250,7 @@ def lookup_statedb_and_update_configdb(per_npu_statedb, config_db, port, state_c
248
250
def mode (db , state , port , json_output ):
249
251
"""Config muxcable mode"""
250
252
251
- port = platform_sfputil_helper .get_interface_alias (port , db )
253
+ port = platform_sfputil_helper .get_interface_name (port , db )
252
254
253
255
port_table_keys = {}
254
256
y_cable_asic_table_keys = {}
@@ -292,7 +294,7 @@ def mode(db, state, port, json_output):
292
294
if logical_key in y_cable_asic_table_keys :
293
295
port_status_dict = {}
294
296
lookup_statedb_and_update_configdb (
295
- per_npu_statedb [asic_index ], per_npu_configdb [asic_index ], port , state , port_status_dict )
297
+ db , per_npu_statedb [asic_index ], per_npu_configdb [asic_index ], port , state , port_status_dict )
296
298
297
299
if json_output :
298
300
click .echo ("{}" .format (json .dumps (port_status_dict , indent = 4 )))
@@ -318,7 +320,7 @@ def mode(db, state, port, json_output):
318
320
for key in port_table_keys [asic_id ]:
319
321
logical_port = key .split ("|" )[1 ]
320
322
lookup_statedb_and_update_configdb (
321
- per_npu_statedb [asic_id ], per_npu_configdb [asic_id ], logical_port , state , port_status_dict )
323
+ db , per_npu_statedb [asic_id ], per_npu_configdb [asic_id ], logical_port , state , port_status_dict )
322
324
323
325
if json_output :
324
326
click .echo ("{}" .format (json .dumps (port_status_dict , indent = 4 )))
@@ -419,7 +421,7 @@ def hwmode():
419
421
def state (db , state , port ):
420
422
"""Configure the muxcable mux state {active/standby}"""
421
423
422
- port = platform_sfputil_helper .get_interface_alias (port , db )
424
+ port = platform_sfputil_helper .get_interface_name (port , db )
423
425
424
426
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_CONFIG_HWMODE_DIR_CMD" )
425
427
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_CONFIG_HWMODE_DIR_RSP" )
@@ -437,6 +439,8 @@ def state(db, state, port):
437
439
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_CONFIG_HWMODE_DIR_CMD" )
438
440
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_CONFIG_HWMODE_DIR_RSP" )
439
441
442
+ port = platform_sfputil_helper .get_interface_alias (port , db )
443
+
440
444
if rc == 0 :
441
445
click .echo ("Success in toggling port {} to {}" .format (port , state ))
442
446
else :
@@ -484,6 +488,8 @@ def state(db, state, port):
484
488
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_CONFIG_HWMODE_DIR_CMD" )
485
489
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_CONFIG_HWMODE_DIR_RSP" )
486
490
491
+ port = platform_sfputil_helper .get_interface_alias (port , db )
492
+
487
493
if rc == 0 :
488
494
click .echo ("Success in toggling port {} to {}" .format (port , state ))
489
495
else :
@@ -500,7 +506,7 @@ def state(db, state, port):
500
506
def setswitchmode (db , state , port ):
501
507
"""Configure the muxcable mux switching mode {auto/manual}"""
502
508
503
- port = platform_sfputil_helper .get_interface_alias (port , db )
509
+ port = platform_sfputil_helper .get_interface_name (port , db )
504
510
505
511
506
512
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_CONFIG_HWMODE_SWMODE_CMD" )
@@ -520,6 +526,8 @@ def setswitchmode(db, state, port):
520
526
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_CONFIG_HWMODE_SWMODE_CMD" )
521
527
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_CONFIG_HWMODE_SWMODE_RSP" )
522
528
529
+ port = platform_sfputil_helper .get_interface_alias (port , db )
530
+
523
531
if rc == 0 :
524
532
click .echo ("Success in switch muxcable mode port {} to {}" .format (port , state ))
525
533
else :
@@ -566,6 +574,8 @@ def setswitchmode(db, state, port):
566
574
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_CONFIG_HWMODE_SWMODE_CMD" )
567
575
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_CONFIG_HWMODE_SWMODE_RSP" )
568
576
577
+ port = platform_sfputil_helper .get_interface_alias (port , db )
578
+
569
579
if rc == 0 :
570
580
click .echo ("Success in toggling port {} to {}" .format (port , state ))
571
581
else :
@@ -588,7 +598,7 @@ def firmware():
588
598
def download (db , fwfile , port ):
589
599
"""Config muxcable firmware download"""
590
600
591
- port = platform_sfputil_helper .get_interface_alias (port , db )
601
+ port = platform_sfputil_helper .get_interface_name (port , db )
592
602
593
603
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_DOWN_FW_RSP" )
594
604
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_DOWN_FW_CMD" )
@@ -605,6 +615,8 @@ def download(db, fwfile, port):
605
615
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_DOWN_FW_RSP" )
606
616
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_DOWN_FW_CMD" )
607
617
618
+ port = platform_sfputil_helper .get_interface_alias (port , db )
619
+
608
620
if rc == 0 :
609
621
click .echo ("Success in downloading firmware port {} {}" .format (port , fwfile ))
610
622
else :
@@ -652,6 +664,8 @@ def download(db, fwfile, port):
652
664
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_DOWN_FW_RSP" )
653
665
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_DOWN_FW_CMD" )
654
666
667
+ port = platform_sfputil_helper .get_interface_alias (port , db )
668
+
655
669
if rc == 0 :
656
670
click .echo ("Success in downloading firmware port {} {}" .format (port , fwfile ))
657
671
else :
@@ -668,7 +682,7 @@ def download(db, fwfile, port):
668
682
def activate (db , port , fwfile ):
669
683
"""Config muxcable firmware activate"""
670
684
671
- port = platform_sfputil_helper .get_interface_alias (port , db )
685
+ port = platform_sfputil_helper .get_interface_name (port , db )
672
686
673
687
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_ACTI_FW_RSP" )
674
688
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_ACTI_FW_CMD" )
@@ -685,6 +699,8 @@ def activate(db, port, fwfile):
685
699
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_ACTI_FW_RSP" )
686
700
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_ACTI_FW_CMD" )
687
701
702
+ port = platform_sfputil_helper .get_interface_alias (port , db )
703
+
688
704
if rc == 0 :
689
705
click .echo ("Success in activate firmware port {} fwfile {}" .format (port , fwfile ))
690
706
else :
@@ -731,6 +747,8 @@ def activate(db, port, fwfile):
731
747
732
748
rc = res_dict [0 ]
733
749
750
+ port = platform_sfputil_helper .get_interface_alias (port , db )
751
+
734
752
if rc == 0 :
735
753
click .echo ("Success in activate firmware port {} fwfile {}" .format (port , fwfile ))
736
754
else :
@@ -747,7 +765,7 @@ def activate(db, port, fwfile):
747
765
def rollback (db , port , fwfile ):
748
766
"""Config muxcable firmware rollback"""
749
767
750
- port = platform_sfputil_helper .get_interface_alias (port , db )
768
+ port = platform_sfputil_helper .get_interface_name (port , db )
751
769
752
770
delete_all_keys_in_db_table ("STATE_DB" , "XCVRD_ROLL_FW_RSP" )
753
771
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_ROLL_FW_CMD" )
@@ -763,6 +781,9 @@ def rollback(db, port, fwfile):
763
781
delete_all_keys_in_db_table ("APPL_DB" , "XCVRD_ROLL_FW_CMD" )
764
782
765
783
rc = res_dict [0 ]
784
+
785
+ port = platform_sfputil_helper .get_interface_alias (port , db )
786
+
766
787
if rc == 0 :
767
788
click .echo ("Success in rollback firmware port {} fwfile {}" .format (port , fwfile ))
768
789
else :
@@ -809,6 +830,8 @@ def rollback(db, port, fwfile):
809
830
810
831
rc = res_dict [0 ]
811
832
833
+ port = platform_sfputil_helper .get_interface_alias (port , db )
834
+
812
835
if rc == 0 :
813
836
click .echo ("Success in rollback firmware port {} fwfile {}" .format (port , fwfile ))
814
837
else :
0 commit comments