Skip to content

Commit

Permalink
[show]: Use TCP Connection For Muxcable Commands (sonic-net#1371)
Browse files Browse the repository at this point in the history
Unix domain sockets require privileged access while show command
could be run by ro user. Switch muxcable show command to use TCP
connection to work with ro user.

signed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>
  • Loading branch information
tahmed-dev committed Jan 20, 2021
1 parent 8119ba2 commit 37695c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions show/muxcable.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def status(port, json_output):
namespaces = multi_asic.get_front_end_namespaces()
for namespace in namespaces:
asic_id = multi_asic.get_asic_index_from_namespace(namespace)
per_npu_statedb[asic_id] = swsscommon.SonicV2Connector(use_unix_socket_path=True, namespace=namespace)
per_npu_statedb[asic_id] = swsscommon.SonicV2Connector(use_unix_socket_path=False, namespace=namespace)
per_npu_statedb[asic_id].connect(per_npu_statedb[asic_id].STATE_DB)

port_table_keys[asic_id] = per_npu_statedb[asic_id].keys(
Expand Down Expand Up @@ -233,7 +233,7 @@ def config(port, json_output):
# TO-DO replace the macros with correct swsscommon names
#config_db[asic_id] = swsscommon.DBConnector("CONFIG_DB", REDIS_TIMEOUT_MSECS, True, namespace)
#mux_tbl_cfg_db[asic_id] = swsscommon.Table(config_db[asic_id], swsscommon.CFG_MUX_CABLE_TABLE_NAME)
per_npu_configdb[asic_id] = ConfigDBConnector(use_unix_socket_path=True, namespace=namespace)
per_npu_configdb[asic_id] = ConfigDBConnector(use_unix_socket_path=False, namespace=namespace)
per_npu_configdb[asic_id].connect()
mux_tbl_cfg_db[asic_id] = per_npu_configdb[asic_id].get_table("MUX_CABLE")
peer_switch_tbl_cfg_db[asic_id] = per_npu_configdb[asic_id].get_table("PEER_SWITCH")
Expand Down

0 comments on commit 37695c8

Please sign in to comment.