Skip to content

Commit 833f0be

Browse files
committed
Fix test_bgp_suppress_fib.py for t1-f2-d10u8 topo
Update packet verification and port handling to support portchannels with multiple ethernet interfaces on T0 VMs in t1-f2-d10u8 topology Signed-off-by: markxiao <[email protected]>
1 parent 017ba13 commit 833f0be

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tests/bgp/bgp_helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,10 @@ def get_ptf_recv_port(duthost, vm_name, tbinfo):
597597
"""
598598
Get ptf receive port
599599
"""
600-
port = duthost.shell("show lldp table | grep -w {} | awk '{{print $1}}'".format(vm_name))['stdout']
600+
ports_output = duthost.shell("show lldp table | grep -w {} | awk '{{print $1}}'".format(vm_name))['stdout']
601+
ports = [line.strip() for line in ports_output.split('\n') if line.strip()]
601602
mg_facts = duthost.get_extended_minigraph_facts(tbinfo)
602-
return mg_facts['minigraph_ptf_indices'][port]
603+
return [mg_facts['minigraph_ptf_indices'][port] for port in ports]
603604

604605

605606
def get_eth_port(duthost, tbinfo):

tests/bgp/test_bgp_suppress_fib.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,9 @@ def send_and_verify_packet(ptfadapter, pkt_list, exp_pkt_list, tx_port, rx_ports
447447
rx_port = rx_ports[ip_ver] if ip_ver else rx_ports
448448
testutils.send(ptfadapter, pkt=pkt, port_id=tx_port)
449449
if exp_action == FORWARD:
450-
testutils.verify_packet(ptfadapter, pkt=exp_pkt, port_id=rx_port, timeout=TRAFFIC_WAIT_TIME)
450+
testutils.verify_packet_any_port(ptfadapter, pkt=exp_pkt, ports=rx_port, timeout=TRAFFIC_WAIT_TIME)
451451
else:
452-
testutils.verify_no_packet(ptfadapter, pkt=exp_pkt, port_id=rx_port, timeout=TRAFFIC_WAIT_TIME)
452+
testutils.verify_no_packet_any(ptfadapter, pkt=exp_pkt, ports=rx_port, timeout=TRAFFIC_WAIT_TIME)
453453

454454

455455
def send_and_verify_loopback_packets(ptfadapter, pkt_list, exp_pkt_list, tx_port, rx_ports, exp_action_list):
@@ -469,7 +469,8 @@ def send_and_verify_bulk_traffic(tcpdump_helper, ptfadapter, ip_ver_list, pkt_li
469469
"""
470470
Send packet with ptfadapter and verify if packet is forwarded or dropped as expected
471471
"""
472-
tcpdump_helper.in_direct_ifaces = rx_ports if isinstance(rx_ports, list) else rx_ports.values()
472+
tcpdump_helper.in_direct_ifaces = rx_ports if isinstance(rx_ports, list) else \
473+
[port for port_list in rx_ports.values() for port in port_list]
473474
tcpdump_helper.start_sniffer()
474475
logger.info("Start sending traffic")
475476
ptfadapter.dataplane.flush()
@@ -816,7 +817,8 @@ def bgp_route_flap_with_stress(duthost, tbinfo, nbrhosts, ptf_ip, ipv4_route_lis
816817

817818
def perf_sniffer_prepare(tcpdump_sniffer, duthost, nbrhosts, mg_facts, recv_port):
818819
eths_to_t2_vm = get_port_connected_with_vm(duthost, nbrhosts, vm_type='T2')
819-
eths_to_t0_vm = get_eth_name_from_ptf_port(mg_facts, [port for port in recv_port.values()])
820+
eths_to_t0_vm = get_eth_name_from_ptf_port(mg_facts, [port for port_list in recv_port.values()
821+
for port in port_list])
820822
tcpdump_sniffer.out_direct_ifaces = [random.choice(eths_to_t2_vm)]
821823
tcpdump_sniffer.in_direct_ifaces = eths_to_t0_vm
822824
tcpdump_sniffer.tcpdump_filter = BGP_FILTER

0 commit comments

Comments
 (0)