@@ -663,7 +663,7 @@ def process_loopback_interface_and_get_read_side(loopback_keys):
663
663
return - 1
664
664
665
665
666
- def check_identifier_presence_and_setup_channel (logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , y_cable_presence ):
666
+ def check_identifier_presence_and_setup_channel (logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , mux_tbl , y_cable_presence ):
667
667
668
668
global grpc_port_stubs
669
669
global grpc_port_channels
@@ -702,6 +702,7 @@ def check_identifier_presence_and_setup_channel(logical_port_name, port_tbl, hw_
702
702
return
703
703
704
704
channel , stub = setup_grpc_channel_for_port (logical_port_name , soc_ipv4 )
705
+ post_port_mux_info_to_db (logical_port_name , mux_tbl , asic_index , hw_mux_cable_tbl , 'pseudo-cable' )
705
706
if channel is not None :
706
707
grpc_port_channels [logical_port_name ] = channel
707
708
helper_logger .log_notice (
@@ -733,6 +734,7 @@ def setup_grpc_channels(stop_event):
733
734
loopback_keys = {}
734
735
hw_mux_cable_tbl = {}
735
736
hw_mux_cable_tbl_peer = {}
737
+ mux_tbl = {}
736
738
737
739
namespaces = multi_asic .get_front_end_namespaces ()
738
740
for namespace in namespaces :
@@ -748,6 +750,8 @@ def setup_grpc_channels(stop_event):
748
750
state_db [asic_id ], swsscommon .STATE_HW_MUX_CABLE_TABLE_NAME )
749
751
hw_mux_cable_tbl_peer [asic_id ] = swsscommon .Table (
750
752
state_db [asic_id ], "HW_MUX_CABLE_TABLE_PEER" )
753
+ mux_tbl [asic_id ] = swsscommon .Table (
754
+ state_db [asic_id ], "MUX_CABLE_INFO" )
751
755
752
756
if read_side == - 1 :
753
757
read_side = process_loopback_interface_and_get_read_side (loopback_keys )
@@ -772,7 +776,7 @@ def setup_grpc_channels(stop_event):
772
776
773
777
if logical_port_name in port_table_keys [asic_index ]:
774
778
check_identifier_presence_and_setup_channel (
775
- logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , y_cable_presence )
779
+ logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , mux_tbl , y_cable_presence )
776
780
else :
777
781
# This port does not exist in Port table of config but is present inside
778
782
# logical_ports after loading the port_mappings from port_config_file
@@ -1399,7 +1403,7 @@ def init_ports_status_for_y_cable(platform_sfp, platform_chassis, y_cable_presen
1399
1403
if status and cable_type == "active-active" :
1400
1404
grpc_port_stats [logical_port_name ] = {}
1401
1405
check_identifier_presence_and_setup_channel (
1402
- logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , y_cable_presence )
1406
+ logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , mux_tbl , y_cable_presence )
1403
1407
else :
1404
1408
# This port does not exist in Port table of config but is present inside
1405
1409
# logical_ports after loading the port_mappings from port_config_file
@@ -1469,7 +1473,7 @@ def change_ports_status_for_y_cable_change_event(port_dict, y_cable_presence, st
1469
1473
state_db , port_tbl , y_cable_tbl , static_tbl , mux_tbl , asic_index , logical_port_name , y_cable_presence )
1470
1474
if status and cable_type == "active-active" :
1471
1475
check_identifier_presence_and_setup_channel (
1472
- logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , y_cable_presence )
1476
+ logical_port_name , port_tbl , hw_mux_cable_tbl , hw_mux_cable_tbl_peer , asic_index , read_side , mux_tbl , y_cable_presence )
1473
1477
elif value == SFP_STATUS_REMOVED :
1474
1478
helper_logger .log_info ("Got SFP deleted ycable event" )
1475
1479
check_identifier_presence_and_delete_mux_table_entry (
@@ -2232,7 +2236,7 @@ def post_port_mux_info_to_db(logical_port_name, mux_tbl, asic_index, y_cable_tbl
2232
2236
2233
2237
for physical_port in physical_port_list :
2234
2238
2235
- if not y_cable_wrapper_get_presence (physical_port ):
2239
+ if not y_cable_wrapper_get_presence (physical_port ) or cable_type == 'pseudo-cable' :
2236
2240
mux_info_dict = get_muxcable_info_without_presence ()
2237
2241
elif cable_type == 'active-active' :
2238
2242
helper_logger .log_warning ("Error: trying to post mux info without presence of port {}" .format (logical_port_name ))
0 commit comments