63
63
('grpc.http2.max_pings_without_data' , 0 )
64
64
]
65
65
66
+ DEFAULT_PORT_IDS = [0 , 1 ]
67
+
66
68
SYSLOG_IDENTIFIER = "y_cable_helper"
67
69
68
70
helper_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
501
503
502
504
503
505
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 ])
505
507
if stub is None :
506
508
helper_logger .log_notice ("stub is None for getting admin port forwarding state RPC port {}" .format (port ))
507
509
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
1212
1214
read_y_cable_and_update_statedb_port_tbl (
1213
1215
logical_port_name , y_cable_tbl [asic_index ])
1214
1216
post_port_mux_info_to_db (
1215
- logical_port_name , mux_tbl [asic_index ])
1217
+ logical_port_name , mux_tbl [asic_index ], 'active-standby' )
1216
1218
post_port_mux_static_info_to_db (
1217
1219
logical_port_name , static_tbl [asic_index ])
1218
1220
else :
@@ -1526,7 +1528,7 @@ def check_identifier_presence_and_update_mux_info_entry(state_db, mux_tbl, asic_
1526
1528
helper_logger .log_info ("Could not retreive fieldvalue pairs for {}, inside config_db table {}" .format (logical_port_name , port_tbl [asic_index ].getTableName ()))
1527
1529
return
1528
1530
1529
- elif cable_status and cable_type == "active-standby" :
1531
+ elif cable_status is True :
1530
1532
# Convert list of tuples to a dictionary
1531
1533
mux_table_dict = dict (fvs )
1532
1534
if "state" in mux_table_dict :
@@ -1535,7 +1537,7 @@ def check_identifier_presence_and_update_mux_info_entry(state_db, mux_tbl, asic_
1535
1537
1536
1538
if mux_tbl .get (asic_index , None ) is not None :
1537
1539
# 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 )
1539
1541
1540
1542
else :
1541
1543
# 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_
1544
1546
asic_id = multi_asic .get_asic_index_from_namespace (namespace )
1545
1547
mux_tbl [asic_id ] = swsscommon .Table (state_db [asic_id ], MUX_CABLE_INFO_TABLE )
1546
1548
# 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 )
1548
1550
else :
1549
1551
helper_logger .log_warning (
1550
1552
"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):
2038
2040
return mux_static_info_dict
2039
2041
2040
2042
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 ):
2042
2044
2043
2045
physical_port_list = logical_port_name_to_physical_port_list (logical_port_name )
2044
2046
if physical_port_list is None :
@@ -2051,7 +2053,7 @@ def post_port_mux_info_to_db(logical_port_name, table):
2051
2053
2052
2054
for physical_port in physical_port_list :
2053
2055
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' :
2055
2057
helper_logger .log_warning ("Error: trying to post mux info without presence of port {}" .format (logical_port_name ))
2056
2058
mux_info_dict = get_muxcable_info_without_presence ()
2057
2059
else :
@@ -3082,7 +3084,7 @@ def handle_show_hwmode_state_cmd_arg_tbl_notification(fvp, port_tbl, xcvrd_show_
3082
3084
3083
3085
helper_logger .log_debug ("Y_CABLE_DEBUG:before invoking RPC fwd_state read_side = {}" .format (read_side ))
3084
3086
# 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 ])
3086
3088
helper_logger .log_debug (
3087
3089
"Y_CABLE_DEBUG:calling RPC for getting cli forwarding state read_side portid = {} Ethernet port {}" .format (read_side , port ))
3088
3090
@@ -3187,7 +3189,7 @@ def handle_fwd_state_command_grpc_notification(fvp_m, hw_mux_cable_tbl, fwd_stat
3187
3189
read_side = mux_port_dict .get ("read_side" )
3188
3190
helper_logger .log_debug ("Y_CABLE_DEBUG:before invoking RPC fwd_state read_side = {}" .format (read_side ))
3189
3191
# 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 ])
3191
3193
helper_logger .log_notice (
3192
3194
"calling RPC for getting forwarding state port = {} portid {} peer portid {} read_side {}" .format (port , read_side , 1 - int (read_side ), read_side ))
3193
3195
0 commit comments