Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sonic-mgmt: Fix namespace issues for qos tests on T2 single ASIC #15708

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tests/qos/qos_sai_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ def dutConfig(
dutPortIps[src_dut_index][src_asic_index] = {}
sysPortMap[src_dut_index][src_asic_index] = {}
active_ips = src_asic.get_active_ip_interfaces(tbinfo)
src_namespace_prefix = src_asic.namespace + '|' if src_asic.namespace else f'Asic{src_asic.asic_index}|'
for iface, addr in active_ips.items():
if iface.startswith("Ethernet") and ("Ethernet-Rec" not in iface):
portIndex = src_mgFacts["minigraph_ptf_indices"][iface]
Expand All @@ -1091,7 +1092,7 @@ def dutConfig(
# Map port IDs to system port for dnx chassis
if 'platform_asic' in get_src_dst_asic_and_duts["src_dut"].facts and \
get_src_dst_asic_and_duts["src_dut"].facts['platform_asic'] == 'broadcom-dnx':
sys_key = src_asic.namespace + '|' + iface if src_asic.namespace else iface
sys_key = src_namespace_prefix + iface
if sys_key in src_system_port:
system_port = src_system_port[sys_key]['system_port_id']
sysPort = {'port': iface, 'system_port': system_port, 'port_type': iface}
Expand All @@ -1108,7 +1109,7 @@ def dutConfig(
if 'platform_asic' in get_src_dst_asic_and_duts["src_dut"].facts and \
get_src_dst_asic_and_duts["src_dut"].facts['platform_asic'] == 'broadcom-dnx':
for portName in src_mgFacts["minigraph_portchannels"][iface]["members"]:
sys_key = src_asic.namespace + '|' + portName if src_asic.namespace else portName
sys_key = src_namespace_prefix + portName
port_Index = src_mgFacts["minigraph_ptf_indices"][portName]
if sys_key in src_system_port:
system_port = src_system_port[sys_key]['system_port_id']
Expand All @@ -1126,6 +1127,7 @@ def dutConfig(
dutPortIps[dst_dut_index] = {}
testPortIds[dst_dut_index] = {}
sysPortMap[dst_dut_index] = {}
dst_system_port = {}
if 'platform_asic' in get_src_dst_asic_and_duts["src_dut"].facts and \
get_src_dst_asic_and_duts["src_dut"].facts['platform_asic'] == 'broadcom-dnx':
dst_system_port = dst_dut.config_facts(host=dst_dut.hostname, source='running')[
Expand All @@ -1135,6 +1137,7 @@ def dutConfig(
dst_system_port = src_system_port
dutPortIps[dst_dut_index][dst_asic_index] = {}
sysPortMap[dst_dut_index][dst_asic_index] = {}
dst_namespace_prefix = dst_asic.namespace + '|' if dst_asic.namespace else f'Asic{dst_asic.asic_index}|'
active_ips = dst_asic.get_active_ip_interfaces(tbinfo)
for iface, addr in active_ips.items():
if iface.startswith("Ethernet") and ("Ethernet-Rec" not in iface):
Expand All @@ -1144,7 +1147,7 @@ def dutConfig(
# Map port IDs to system port IDs
if 'platform_asic' in get_src_dst_asic_and_duts["src_dut"].facts and \
get_src_dst_asic_and_duts["src_dut"].facts['platform_asic'] == 'broadcom-dnx':
sys_key = dst_asic.namespace + '|' + iface if dst_asic.namespace else iface
sys_key = dst_namespace_prefix + iface
if sys_key in dst_system_port:
system_port = dst_system_port[sys_key]['system_port_id']
sysPort = {'port': iface, 'system_port': system_port, 'port_type': iface}
Expand All @@ -1161,7 +1164,7 @@ def dutConfig(
if 'platform_asic' in get_src_dst_asic_and_duts["src_dut"].facts and \
get_src_dst_asic_and_duts["src_dut"].facts['platform_asic'] == 'broadcom-dnx':
for portName in dst_mgFacts["minigraph_portchannels"][iface]["members"]:
sys_key = dst_asic.namespace + '|' + portName if dst_asic.namespace else portName
sys_key = dst_namespace_prefix + portName
port_Index = dst_mgFacts["minigraph_ptf_indices"][portName]
if sys_key in dst_system_port:
system_port = dst_system_port[sys_key]['system_port_id']
Expand Down
7 changes: 3 additions & 4 deletions tests/saitests/py3/sai_qos_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3965,10 +3965,9 @@ def runTest(self):
self.dst_client, asic_type, port_list['dst'][dst_port_id])
# for t2 chassis
if platform_asic and platform_asic == "broadcom-dnx":
if dst_port_id in dst_sys_port_ids:
for port_id, sysport in dst_sys_port_ids.items():
if dst_port_id == port_id:
dst_sys_port_id = int(sysport)
assert dst_port_id in dst_sys_port_ids, \
"dst_port_id does not have a sys port id configured"
dst_sys_port_id = int(dst_sys_port_ids[dst_port_id])
log_message("actual dst_sys_port_id: {}".format(dst_sys_port_id), to_stderr=True)
voq_list = sai_thrift_get_voq_port_id(self.src_client, dst_sys_port_id)
voq_queue_counters_base = sai_thrift_read_port_voq_counters(self.src_client, voq_list)
Expand Down
Loading