Skip to content

Commit

Permalink
[show]fix for show muxcable status by replacing "hostname" to "peer_s…
Browse files Browse the repository at this point in the history
…witch" for deriving tor ipv4_address (sonic-net#1360)

This PR provides the support for fixing the show muxcable config.
There was a change in the Config_DB schema where there was an addition of key-value pair
"peer_switch:tor_name" in DEVICE_METADATA|localhost table which actually gives the other TOR's name (hostname).
This TOR name is then utilized in PEER_SWITCH|switchname table which has "address_ipv4: IPv4 address" key-value pair,
which correctly gives the ip address for displaying on the show mux config

What is the motivation for this PR?
To add the fix the working for show muxcable config

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
  • Loading branch information
vdahiya12 authored and anand-kumar-subramanian committed Mar 2, 2021
1 parent cc2f788 commit 0065d08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion show/muxcable.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_switch_name(config_db):
info_dict = config_db.get_entry("DEVICE_METADATA", "localhost")
#click.echo("{} ".format(info_dict))

switch_name = get_value_for_key_in_dict(info_dict, "localhost", "hostname", "DEVICE_METADATA")
switch_name = get_value_for_key_in_dict(info_dict, "localhost", "peer_switch", "DEVICE_METADATA")
if switch_name is not None:
return switch_name
else:
Expand Down
1 change: 1 addition & 0 deletions tests/mock_tables/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@
"hwsku": "Mellanox-SN3800-D112C8",
"mac": "1d:34:db:16:a6:00",
"platform": "x86_64-mlnx_msn3800-r0",
"peer_switch": "sonic-switch",
"type": "ToRRouter"
},
"DEVICE_NEIGHBOR|Ethernet4": {
Expand Down

0 comments on commit 0065d08

Please sign in to comment.