From 9ae551fd6c57465b8f2f30896c8327233c69a47d Mon Sep 17 00:00:00 2001 From: vdahiya12 <67608553+vdahiya12@users.noreply.github.com> Date: Fri, 28 Oct 2022 13:52:29 -0700 Subject: [PATCH] [ycabled] add support for detach mode in 'active-active' topology (#309) This PR adds a support for taking detach mode into consideration as a valid CONFIG_DB state for muxcable. If 'detach' mode is configured it will be treated as a valid and appropriate RPC's will be serviced by ycabled. Description Motivation and Context How Has This Been Tested? UT and deploying changes on testbed Signed-off-by: vaibhav-dahiya --- .../ycable/ycable_utilities/y_cable_helper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py b/sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py index e51806b0f42d..34bc9b733a3e 100644 --- a/sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py +++ b/sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py @@ -64,6 +64,8 @@ ('grpc.http2.max_pings_without_data', 0) ] +CONFIG_MUX_STATES = ["active", "standby", "auto", "manual", "detach"] + DEFAULT_PORT_IDS = [0, 1] SYSLOG_IDENTIFIER = "y_cable_helper" @@ -297,7 +299,7 @@ def check_mux_cable_port_type(logical_port_name, port_tbl, asic_index): val = mux_table_dict.get("state", None) cable_type = mux_table_dict.get("cable_type", None) - if val in ["active", "standby", "auto", "manual"]: + if val in CONFIG_MUX_STATES: if cable_type == "active-active": helper_logger.log_debug("Y_CABLE_DEBUG:check_mux_cable_port_type returning True active-active port {}".format(logical_port_name)) return (True , "active-active") @@ -670,7 +672,7 @@ def check_identifier_presence_and_setup_channel(logical_port_name, port_tbl, hw_ soc_ipv4 = soc_ipv4_full.split('/')[0] cable_type = mux_table_dict.get("cable_type", None) - if val in ["active", "standby", "auto", "manual"] and cable_type == "active-active": + if val in CONFIG_MUX_STATES and cable_type == "active-active": # import the module and load the port instance y_cable_presence[:] = [True] @@ -1191,7 +1193,7 @@ def check_identifier_presence_and_update_mux_table_entry(state_db, port_tbl, y_c val = mux_table_dict.get("state", None) - if val in ["active", "auto", "manual", "standby"]: + if val in CONFIG_MUX_STATES: # import the module and load the port instance physical_port_list = logical_port_name_to_physical_port_list( @@ -1631,7 +1633,7 @@ def check_identifier_presence_and_update_mux_info_entry(state_db, mux_tbl, asic_ mux_table_dict = dict(fvs) if "state" in mux_table_dict: val = mux_table_dict.get("state", None) - if val in ["active", "auto", "manual", "standby"]: + if val in CONFIG_MUX_STATES: if mux_tbl.get(asic_index, None) is not None: # fill in the newly found entry