Skip to content

Commit

Permalink
fix tables
Browse files Browse the repository at this point in the history
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
  • Loading branch information
vdahiya12 committed Jun 6, 2022
1 parent dc96d95 commit 70bcfd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 8 additions & 8 deletions show/muxcable.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,13 @@ def create_table_dump_per_port_config(db ,print_data, per_npu_configdb, asic_id,
port_list.append(ipv4_value)
ipv6_value = get_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "server_ipv6", "MUX_CABLE")
port_list.append(ipv6_value)
cable_type = get_optional_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "cable_type", "MUX_CABLE")
if cable_type is not None:
port_list.append(cable_type)
soc_ipv4_value = get_optional_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "soc_ipv4", "MUX_CABLE")
if soc_ipv4_value is not None:
port_list.append(soc_ipv4_value)
is_dualtor_active_active[0] = True
cable_type = get_optional_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "cable_type", "MUX_CABLE")
if cable_type is not None:
port_list.append(cable_type)
print_data.append(port_list)


Expand All @@ -492,12 +492,12 @@ def create_json_dump_per_port_config(db, port_status_dict, per_npu_configdb, asi
port_status_dict["MUX_CABLE"]["PORTS"][port_name]["SERVER"]["IPv4"] = ipv4_value
ipv6_value = get_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "server_ipv6", "MUX_CABLE")
port_status_dict["MUX_CABLE"]["PORTS"][port_name]["SERVER"]["IPv6"] = ipv6_value
soc_ipv4_value = get_optional_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "soc_ipv4", "MUX_CABLE")
if soc_ipv4_value is not None:
port_status_dict["MUX_CABLE"]["PORTS"][port_name]["SERVER"]["soc_ipv4"] = soc_ipv4_value
cable_type = get_optional_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "cable_type", "MUX_CABLE")
if cable_type is not None:
port_status_dict["MUX_CABLE"]["PORTS"][port_name]["SERVER"]["cable_type"] = cable_type
soc_ipv4_value = get_optional_value_for_key_in_config_tbl(per_npu_configdb[asic_id], port, "soc_ipv4", "MUX_CABLE")
if soc_ipv4_value is not None:
port_status_dict["MUX_CABLE"]["PORTS"][port_name]["SERVER"]["soc_ipv4"] = soc_ipv4_value


@muxcable.command()
Expand Down Expand Up @@ -714,7 +714,7 @@ def config(db, port, json_output):
print_peer_tor.append(peer_tor_data)
click.echo(tabulate(print_peer_tor, headers=headers))
if is_dualtor_active_active[0]:
headers = ['port', 'state', 'ipv4', 'ipv6', 'soc_ipv4', 'cable_type']
headers = ['port', 'state', 'ipv4', 'ipv6', 'cable_type', 'soc_ipv4']
else:
headers = ['port', 'state', 'ipv4', 'ipv6']
click.echo(tabulate(print_data, headers=headers))
Expand Down Expand Up @@ -766,7 +766,7 @@ def config(db, port, json_output):
print_peer_tor.append(peer_tor_data)
click.echo(tabulate(print_peer_tor, headers=headers))
if is_dualtor_active_active[0]:
headers = ['port', 'state', 'ipv4', 'ipv6', 'soc_ipv4', 'cable_type']
headers = ['port', 'state', 'ipv4', 'ipv6', 'cable_type', 'soc_ipv4']
else:
headers = ['port', 'state', 'ipv4', 'ipv6']
click.echo(tabulate(print_data, headers=headers))
Expand Down
3 changes: 3 additions & 0 deletions tests/mock_tables/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1740,11 +1740,14 @@
"MUX_CABLE|Ethernet32": {
"state": "auto",
"server_ipv4": "10.1.1.1",
"cable_type": "active-active",
"soc_ipv4": "10.1.1.2",
"server_ipv6": "fc00::75"
},
"MUX_CABLE|Ethernet16": {
"state": "standby",
"server_ipv4": "10.1.1.1",
"cable_type": "active-standby",
"server_ipv6": "fc00::75"
},
"MUX_CABLE|Ethernet28": {
Expand Down

0 comments on commit 70bcfd7

Please sign in to comment.