Skip to content

Commit 9ae551f

Browse files
authored
[ycabled] add support for detach mode in 'active-active' topology (sonic-net#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 <[email protected]>
1 parent 82fc7a6 commit 9ae551f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
('grpc.http2.max_pings_without_data', 0)
6565
]
6666

67+
CONFIG_MUX_STATES = ["active", "standby", "auto", "manual", "detach"]
68+
6769
DEFAULT_PORT_IDS = [0, 1]
6870

6971
SYSLOG_IDENTIFIER = "y_cable_helper"
@@ -297,7 +299,7 @@ def check_mux_cable_port_type(logical_port_name, port_tbl, asic_index):
297299
val = mux_table_dict.get("state", None)
298300
cable_type = mux_table_dict.get("cable_type", None)
299301

300-
if val in ["active", "standby", "auto", "manual"]:
302+
if val in CONFIG_MUX_STATES:
301303
if cable_type == "active-active":
302304
helper_logger.log_debug("Y_CABLE_DEBUG:check_mux_cable_port_type returning True active-active port {}".format(logical_port_name))
303305
return (True , "active-active")
@@ -670,7 +672,7 @@ def check_identifier_presence_and_setup_channel(logical_port_name, port_tbl, hw_
670672
soc_ipv4 = soc_ipv4_full.split('/')[0]
671673
cable_type = mux_table_dict.get("cable_type", None)
672674

673-
if val in ["active", "standby", "auto", "manual"] and cable_type == "active-active":
675+
if val in CONFIG_MUX_STATES and cable_type == "active-active":
674676

675677
# import the module and load the port instance
676678
y_cable_presence[:] = [True]
@@ -1191,7 +1193,7 @@ def check_identifier_presence_and_update_mux_table_entry(state_db, port_tbl, y_c
11911193

11921194
val = mux_table_dict.get("state", None)
11931195

1194-
if val in ["active", "auto", "manual", "standby"]:
1196+
if val in CONFIG_MUX_STATES:
11951197

11961198
# import the module and load the port instance
11971199
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_
16311633
mux_table_dict = dict(fvs)
16321634
if "state" in mux_table_dict:
16331635
val = mux_table_dict.get("state", None)
1634-
if val in ["active", "auto", "manual", "standby"]:
1636+
if val in CONFIG_MUX_STATES:
16351637

16361638
if mux_tbl.get(asic_index, None) is not None:
16371639
# fill in the newly found entry

0 commit comments

Comments
 (0)