Skip to content

Commit

Permalink
[VXLAN ECMP] DUT to PTF port mapping fix (sonic-net#5105)
Browse files Browse the repository at this point in the history
- What is the motivation for this PR?
To get correct t0 and t2 ports and make the test work. The test was failing with KeyError.

- How did you do it?
Reworked logic of getting ports. Now it takes them from correct dictionary.

- How did you verify/test it?
Ran test in a loop

- Any platform specific information?
No

- Supported testbed topology if it's a new test case?
T1
  • Loading branch information
Ihor Chekh authored Feb 13, 2022
1 parent 7039ce0 commit 8b81dc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
11 changes: 2 additions & 9 deletions ansible/roles/test/files/ptftests/vxlan_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,16 @@ def runTest(self):
# find the list of neigh addresses for the t0_ports. For each neigh address(Addr1):
# for each destination address(Addr2) in the same Vnet as t0_intf,
# send traffic from Add1 to it. If there
# are multiple nexthops for the Addr2, then send that many different
# are multiple nexthops for the Addr2, then send that many different
# streams(different tcp ports).
neighbors = [self.config_data['neighbors'][t0_intf]]
ptf_port = self.get_ptf_port(t0_intf)
ptf_port = self.topo_data['minigraph_facts']['minigraph_ptf_indices'][t0_intf]
vnet = self.config_data['vnet_intf_map'][t0_intf]
vni = self.config_data['vnet_vni_map'][vnet]
for addr in neighbors:
for destination,nh in self.config_data['dest_to_nh_map'][vnet].iteritems():
self.test_encap(ptf_port, vni, addr, destination, nh, test_ecn=TEST_ECN)

def get_ptf_port(self, dut_port):
m = re.search('Ethernet([0-9]+)', dut_port)
if m:
return self.topo_data['tbinfo']['topo']['ptf_dut_intf_map'][m.group(1)]['0']
else:
raise RuntimeError("dut_intf:{} doesn't match 'EthernetNNN'".format(dut_port))

def cmd(self, cmds):
process = subprocess.Popen(cmds,
shell=False,
Expand Down
16 changes: 8 additions & 8 deletions tests/vxlan/test_vxlan_ecmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,15 @@ def get_t2_ports(duthost, minigraph_data):
'''
list_of_portchannels_to_T2 = get_portchannels_to_neighbors(duthost, "T2", minigraph_data)
list_of_interfaces = []
for pc_name in list_of_portchannels_to_T2:
list_of_interfaces.extend(list_of_portchannels_to_T2[pc_name])

ret_list = [int(x[8:]) for x in list_of_interfaces]
if ret_list:
return ret_list
if list_of_portchannels_to_T2:
for pc_name in list_of_portchannels_to_T2:
list_of_interfaces.extend(list_of_portchannels_to_T2[pc_name])
else:
list_of_interfaces = get_ethernet_to_neighbors("T2", minigraph_data)

list_of_ethernet_to_T2 = get_ethernet_to_neighbors("T2", minigraph_data)
ret_list.extend([int(x[8:]) for x in list_of_ethernet_to_T2])
ret_list = []
for iface in list_of_interfaces:
ret_list.append(minigraph_data["minigraph_ptf_indices"][iface])
return ret_list

def bgp_established(duthost):
Expand Down

0 comments on commit 8b81dc8

Please sign in to comment.