6363 ('grpc.http2.max_pings_without_data' , 0 )
6464]
6565
66+ DEFAULT_PORT_IDS = [0 , 1 ]
67+
6668SYSLOG_IDENTIFIER = "y_cable_helper"
6769
6870helper_logger = logger .Logger (SYSLOG_IDENTIFIER )
@@ -501,7 +503,7 @@ def put_init_values_for_grpc_states(port, read_side, hw_mux_cable_tbl, hw_mux_ca
501503
502504
503505 stub = grpc_port_stubs .get (port , None )
504- request = linkmgr_grpc_driver_pb2 .AdminRequest (portid = [ int ( read_side ), 1 - int ( read_side )] , state = [0 , 0 ])
506+ request = linkmgr_grpc_driver_pb2 .AdminRequest (portid = DEFAULT_PORT_IDS , state = [0 , 0 ])
505507 if stub is None :
506508 helper_logger .log_notice ("stub is None for getting admin port forwarding state RPC port {}" .format (port ))
507509 fvs_updated = swsscommon .FieldValuePairs ([('state' , 'unknown' ),
@@ -1212,7 +1214,7 @@ def check_identifier_presence_and_update_mux_table_entry(state_db, port_tbl, y_c
12121214 read_y_cable_and_update_statedb_port_tbl (
12131215 logical_port_name , y_cable_tbl [asic_index ])
12141216 post_port_mux_info_to_db (
1215- logical_port_name , mux_tbl [asic_index ])
1217+ logical_port_name , mux_tbl [asic_index ], 'active-standby' )
12161218 post_port_mux_static_info_to_db (
12171219 logical_port_name , static_tbl [asic_index ])
12181220 else :
@@ -1526,7 +1528,7 @@ def check_identifier_presence_and_update_mux_info_entry(state_db, mux_tbl, asic_
15261528 helper_logger .log_info ("Could not retreive fieldvalue pairs for {}, inside config_db table {}" .format (logical_port_name , port_tbl [asic_index ].getTableName ()))
15271529 return
15281530
1529- elif cable_status and cable_type == "active-standby" :
1531+ elif cable_status is True :
15301532 # Convert list of tuples to a dictionary
15311533 mux_table_dict = dict (fvs )
15321534 if "state" in mux_table_dict :
@@ -1535,7 +1537,7 @@ def check_identifier_presence_and_update_mux_info_entry(state_db, mux_tbl, asic_
15351537
15361538 if mux_tbl .get (asic_index , None ) is not None :
15371539 # fill in the newly found entry
1538- post_port_mux_info_to_db (logical_port_name , mux_tbl [asic_index ])
1540+ post_port_mux_info_to_db (logical_port_name , mux_tbl [asic_index ], cable_type )
15391541
15401542 else :
15411543 # first create the state db y cable table and then fill in the entry
@@ -1544,7 +1546,7 @@ def check_identifier_presence_and_update_mux_info_entry(state_db, mux_tbl, asic_
15441546 asic_id = multi_asic .get_asic_index_from_namespace (namespace )
15451547 mux_tbl [asic_id ] = swsscommon .Table (state_db [asic_id ], MUX_CABLE_INFO_TABLE )
15461548 # fill the newly found entry
1547- post_port_mux_info_to_db (logical_port_name , mux_tbl [asic_index ])
1549+ post_port_mux_info_to_db (logical_port_name , mux_tbl [asic_index ], cable_type )
15481550 else :
15491551 helper_logger .log_warning (
15501552 "Could not retreive active or auto value for state kvp for {}, inside MUX_CABLE table" .format (logical_port_name ))
@@ -2038,7 +2040,7 @@ def get_muxcable_static_info(physical_port, logical_port_name):
20382040 return mux_static_info_dict
20392041
20402042
2041- def post_port_mux_info_to_db (logical_port_name , table ):
2043+ def post_port_mux_info_to_db (logical_port_name , table , cable_type ):
20422044
20432045 physical_port_list = logical_port_name_to_physical_port_list (logical_port_name )
20442046 if physical_port_list is None :
@@ -2051,7 +2053,7 @@ def post_port_mux_info_to_db(logical_port_name, table):
20512053
20522054 for physical_port in physical_port_list :
20532055
2054- if not y_cable_wrapper_get_presence (physical_port ):
2056+ if not y_cable_wrapper_get_presence (physical_port ) or cable_type == 'active-active' :
20552057 helper_logger .log_warning ("Error: trying to post mux info without presence of port {}" .format (logical_port_name ))
20562058 mux_info_dict = get_muxcable_info_without_presence ()
20572059 else :
@@ -3082,7 +3084,7 @@ def handle_show_hwmode_state_cmd_arg_tbl_notification(fvp, port_tbl, xcvrd_show_
30823084
30833085 helper_logger .log_debug ("Y_CABLE_DEBUG:before invoking RPC fwd_state read_side = {}" .format (read_side ))
30843086 # TODO state only for dummy value in this request MSG remove this
3085- request = linkmgr_grpc_driver_pb2 .AdminRequest (portid = [ int ( read_side ), 1 - int ( read_side )] , state = [0 , 0 ])
3087+ request = linkmgr_grpc_driver_pb2 .AdminRequest (portid = DEFAULT_PORT_IDS , state = [0 , 0 ])
30863088 helper_logger .log_debug (
30873089 "Y_CABLE_DEBUG:calling RPC for getting cli forwarding state read_side portid = {} Ethernet port {}" .format (read_side , port ))
30883090
@@ -3187,7 +3189,7 @@ def handle_fwd_state_command_grpc_notification(fvp_m, hw_mux_cable_tbl, fwd_stat
31873189 read_side = mux_port_dict .get ("read_side" )
31883190 helper_logger .log_debug ("Y_CABLE_DEBUG:before invoking RPC fwd_state read_side = {}" .format (read_side ))
31893191 # TODO state only for dummy value in this request MSG remove this
3190- request = linkmgr_grpc_driver_pb2 .AdminRequest (portid = [ int ( read_side ), 1 - int ( read_side )] , state = [0 , 0 ])
3192+ request = linkmgr_grpc_driver_pb2 .AdminRequest (portid = DEFAULT_PORT_IDS , state = [0 , 0 ])
31913193 helper_logger .log_notice (
31923194 "calling RPC for getting forwarding state port = {} portid {} peer portid {} read_side {}" .format (port , read_side , 1 - int (read_side ), read_side ))
31933195
0 commit comments