Skip to content

Commit 71150d8

Browse files
markx-aristaabhishek-nexthop
authored andcommitted
Fix test_bgp_suppress_fib.py for t1-f2-d10u8 topo (sonic-net#22116)
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]> Signed-off-by: Abhishek <[email protected]>
1 parent 88c1e7b commit 71150d8

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

tests/bgp/bgp_helpers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,10 @@ def get_ptf_recv_port(duthost, vm_name, tbinfo):
611611
"""
612612
Get ptf receive port
613613
"""
614-
port = duthost.shell("show lldp table | grep -w {} | awk '{{print $1}}'".format(vm_name))['stdout']
614+
ports_output = duthost.shell("show lldp table | grep -w {} | awk '{{print $1}}'".format(vm_name))['stdout']
615+
ports = [line.strip() for line in ports_output.split('\n') if line.strip()]
615616
mg_facts = duthost.get_extended_minigraph_facts(tbinfo)
616-
return mg_facts['minigraph_ptf_indices'][port]
617+
return [mg_facts['minigraph_ptf_indices'][port] for port in ports]
617618

618619

619620
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
@@ -456,9 +456,9 @@ def send_and_verify_packet(ptfadapter, pkt_list, exp_pkt_list, tx_port, rx_ports
456456
rx_port = rx_ports[ip_ver] if ip_ver else rx_ports
457457
testutils.send(ptfadapter, pkt=pkt, port_id=tx_port)
458458
if exp_action == FORWARD:
459-
testutils.verify_packet(ptfadapter, pkt=exp_pkt, port_id=rx_port, timeout=TRAFFIC_WAIT_TIME)
459+
testutils.verify_packet_any_port(ptfadapter, pkt=exp_pkt, ports=rx_port, timeout=TRAFFIC_WAIT_TIME)
460460
else:
461-
testutils.verify_no_packet(ptfadapter, pkt=exp_pkt, port_id=rx_port, timeout=TRAFFIC_WAIT_TIME)
461+
testutils.verify_no_packet_any(ptfadapter, pkt=exp_pkt, ports=rx_port, timeout=TRAFFIC_WAIT_TIME)
462462

463463

464464
def send_and_verify_loopback_packets(ptfadapter, pkt_list, exp_pkt_list, tx_port, rx_ports, exp_action_list):
@@ -478,7 +478,8 @@ def send_and_verify_bulk_traffic(tcpdump_helper, ptfadapter, ip_ver_list, pkt_li
478478
"""
479479
Send packet with ptfadapter and verify if packet is forwarded or dropped as expected
480480
"""
481-
tcpdump_helper.in_direct_ifaces = rx_ports if isinstance(rx_ports, list) else rx_ports.values()
481+
tcpdump_helper.in_direct_ifaces = rx_ports if isinstance(rx_ports, list) else \
482+
[port for port_list in rx_ports.values() for port in port_list]
482483
tcpdump_helper.start_sniffer()
483484
logger.info("Start sending traffic")
484485
ptfadapter.dataplane.flush()
@@ -835,7 +836,8 @@ def bgp_route_flap_with_stress(duthost, tbinfo, nbrhosts, ptf_ip, ipv4_route_lis
835836

836837
def perf_sniffer_prepare(tcpdump_sniffer, duthost, tbinfo, nbrhosts, mg_facts, recv_port):
837838
eths_to_t2_vm = get_port_connected_with_vm(duthost, tbinfo, nbrhosts, vm_type='T2')
838-
eths_to_t0_vm = get_eth_name_from_ptf_port(mg_facts, [port for port in recv_port.values()])
839+
eths_to_t0_vm = get_eth_name_from_ptf_port(mg_facts, [port for port_list in recv_port.values()
840+
for port in port_list])
839841
tcpdump_sniffer.out_direct_ifaces = [random.choice(eths_to_t2_vm)]
840842
tcpdump_sniffer.in_direct_ifaces = eths_to_t0_vm
841843
tcpdump_sniffer.tcpdump_filter = BGP_FILTER

0 commit comments

Comments
 (0)