-
Notifications
You must be signed in to change notification settings - Fork 1k
Enhance qos tests to support single-asic, multi-asic, and multi-dut testing #6946
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
Changes from all commits
242d2bc
1ab6892
eed7090
d5a6072
b9819ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -506,24 +506,34 @@ def ptf_test_port_map_active_active(ptfhost, tbinfo, duthosts, mux_server_url, d | |
| # Loop ptf_map of each DUT. Each ptf_map maps from ptf port index to dut port index | ||
| disabled_ptf_ports = disabled_ptf_ports.union(set(ptf_map.keys())) | ||
|
|
||
| router_macs = [duthost.facts['router_mac'] for duthost in duthosts] | ||
| router_macs = [] | ||
| all_dut_names = [duthost.hostname for duthost in duthosts] | ||
| for a_dut_name in tbinfo['duts']: | ||
| if a_dut_name in all_dut_names: | ||
| duthost = duthosts[a_dut_name] | ||
| router_macs.append(duthost.facts['router_mac']) | ||
| else: | ||
| router_macs.append(None) | ||
|
|
||
| logger.info('active_dut_map={}'.format(active_dut_map)) | ||
| logger.info('disabled_ptf_ports={}'.format(disabled_ptf_ports)) | ||
| logger.info('router_macs={}'.format(router_macs)) | ||
|
|
||
| asic_idx = 0 | ||
| ports_map = {} | ||
| for ptf_port, dut_intf_map in list(tbinfo['topo']['ptf_dut_intf_map'].items()): | ||
| if str(ptf_port) in disabled_ptf_ports: | ||
| # Skip PTF ports that are connected to disabled VLAN interfaces | ||
| continue | ||
| asic_idx = 0 | ||
| dut_port = None | ||
|
|
||
| if len(list(dut_intf_map.keys())) == 2: | ||
| # PTF port is mapped to two DUTs -> dualtor topology and the PTF port is a vlan port | ||
| # Packet sent from this ptf port will only be accepted by the active side DUT | ||
| # DualToR DUTs use same special Vlan interface MAC address | ||
| # DualToR DUTs use same special Vlan interface MAC addres | ||
| target_dut_indexes = list(map(int, active_dut_map[ptf_port])) | ||
| target_dut_port = int(list(dut_intf_map.values())[0]) | ||
| target_hostname = duthosts[target_dut_indexes[0]].hostname | ||
| ports_map[ptf_port] = { | ||
| 'target_dut': target_dut_indexes, | ||
| 'target_dest_mac': tbinfo['topo']['properties']['topology']['DUT']['vlan_configs']['one_vlan_a'] | ||
|
|
@@ -533,30 +543,39 @@ def ptf_test_port_map_active_active(ptfhost, tbinfo, duthosts, mux_server_url, d | |
| } | ||
| else: | ||
| # PTF port is mapped to single DUT | ||
| dut_index_for_pft_port = int(dut_intf_map.keys()[0]) | ||
| if router_macs[dut_index_for_pft_port] is None: | ||
| continue | ||
| target_dut_index = int(list(dut_intf_map.keys())[0]) | ||
| target_dut_port = int(list(dut_intf_map.values())[0]) | ||
| router_mac = router_macs[target_dut_index] | ||
|
||
| dut_port = None | ||
| if len(duts_minigraph_facts[duthosts[target_dut_index].hostname]) > 1: | ||
| for list_idx, mg_facts_tuple in enumerate(duts_minigraph_facts[duthosts[target_dut_index].hostname]): | ||
| target_hostname = tbinfo['duts'][target_dut_index] | ||
|
|
||
| if len(duts_minigraph_facts[target_hostname]) > 1: | ||
| # Dealing with multi-asic target dut | ||
| for list_idx, mg_facts_tuple in enumerate(duts_minigraph_facts[target_hostname]): | ||
| idx, mg_facts = mg_facts_tuple | ||
| if target_dut_port in list(mg_facts['minigraph_port_indices'].values()): | ||
| router_mac = duts_running_config_facts[duthosts[target_dut_index].hostname][list_idx][1]\ | ||
| router_mac = duts_running_config_facts[target_hostname][list_idx][1]\ | ||
| ['DEVICE_METADATA']['localhost']['mac'].lower() | ||
| asic_idx = idx | ||
| for a_dut_port, a_dut_port_index in list(mg_facts['minigraph_port_indices'].items()): | ||
| if a_dut_port_index == target_dut_port and "Ethernet-Rec" not in a_dut_port and \ | ||
| "Ethernet-IB" not in a_dut_port and "Ethernet-BP" not in a_dut_port: | ||
| dut_port = a_dut_port | ||
| break | ||
|
|
||
| ports_map[ptf_port] = { | ||
| 'target_dut': [target_dut_index], | ||
| 'target_dest_mac': router_mac, | ||
| 'target_src_mac': [router_mac], | ||
| 'dut_port': dut_port, | ||
| 'asic_idx': asic_idx | ||
| } | ||
|
|
||
| _, asic_mg_facts = duts_minigraph_facts[target_hostname][asic_idx] | ||
| for a_dut_port, a_dut_port_index in asic_mg_facts['minigraph_port_indices'].items(): | ||
| if a_dut_port_index == target_dut_port and "Ethernet-Rec" not in a_dut_port and \ | ||
| "Ethernet-IB" not in a_dut_port and "Ethernet-BP" not in a_dut_port: | ||
| dut_port = a_dut_port | ||
| break | ||
|
|
||
| ports_map[ptf_port]['dut_port'] = dut_port | ||
|
|
||
| logger.debug('ptf_test_port_map={}'.format(json.dumps(ports_map, indent=2))) | ||
|
|
||
| ptfhost.copy(content=json.dumps(ports_map), dest=PTF_TEST_PORT_MAP) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the rpc ports have conflict for multi-dut?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tunnel is created based on combination of DUT's mgmt_ip and port that is unique. So, no conflict for multi-dut.