Skip to content

Commit d1e260a

Browse files
authored
[show]fix for show muxcable status by replacing "hostname" to "peer_switch" for deriving tor ipv4_address (#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>
1 parent 69e2cc3 commit d1e260a

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

show/muxcable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_switch_name(config_db):
6363
info_dict = config_db.get_entry("DEVICE_METADATA", "localhost")
6464
#click.echo("{} ".format(info_dict))
6565

66-
switch_name = get_value_for_key_in_dict(info_dict, "localhost", "hostname", "DEVICE_METADATA")
66+
switch_name = get_value_for_key_in_dict(info_dict, "localhost", "peer_switch", "DEVICE_METADATA")
6767
if switch_name is not None:
6868
return switch_name
6969
else:

tests/mock_tables/config_db.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@
666666
"hwsku": "Mellanox-SN3800-D112C8",
667667
"mac": "1d:34:db:16:a6:00",
668668
"platform": "x86_64-mlnx_msn3800-r0",
669+
"peer_switch": "sonic-switch",
669670
"type": "ToRRouter"
670671
},
671672
"DEVICE_NEIGHBOR|Ethernet4": {

0 commit comments

Comments
 (0)