From 905d203176c698ca43b76c37967d5d61544adbb9 Mon Sep 17 00:00:00 2001 From: echuawu Date: Wed, 4 Jun 2025 11:20:02 +0300 Subject: [PATCH] Enhance msft srv6 test cases 1.Add more timeout for ptf to handle a large scale of bgp packets after config reload/bgp restart/reboot 2.Add BGP route sync check --- tests/srv6/srv6_utils.py | 4 +++- tests/srv6/test_srv6_dataplane.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/srv6/srv6_utils.py b/tests/srv6/srv6_utils.py index 6b583ce9ef8..6bd918fe6f4 100755 --- a/tests/srv6/srv6_utils.py +++ b/tests/srv6/srv6_utils.py @@ -240,12 +240,14 @@ def runSendReceive(pkt, src_port, exp_pkt, dst_ports, pkt_expected, ptfadapter): @param pkt_expected: Indicated whether it is expected to receive the exp_pkt on one of the dst_ports @param ptfadapter: The ptfadapter fixture """ + ptfadapter.dataplane.flush() + ptfadapter.dataplane.set_qlen(1000000) # Send the packet and poll on destination ports testutils.send(ptfadapter, src_port, pkt, 1) logger.debug("Sent packet: " + pkt.summary()) time.sleep(1) - (index, rcv_pkt) = testutils.verify_packet_any_port(ptfadapter, exp_pkt, dst_ports) + (index, rcv_pkt) = testutils.verify_packet_any_port(ptfadapter, exp_pkt, dst_ports, timeout=60) received = False if rcv_pkt: received = True diff --git a/tests/srv6/test_srv6_dataplane.py b/tests/srv6/test_srv6_dataplane.py index 765050ba0b7..1478421128d 100644 --- a/tests/srv6/test_srv6_dataplane.py +++ b/tests/srv6/test_srv6_dataplane.py @@ -275,6 +275,7 @@ def test_srv6_dataplane_after_config_reload(setup_uN, ptfadapter, ptfhost, with_ assert wait_until(20, 5, 0, verify_asic_db_sid_entry_exist, duthost, sonic_db_cli), \ "ASIC_STATE:SAI_OBJECT_TYPE_MY_SID_ENTRY entries are missing in ASIC_DB after config reload" + pytest_assert(wait_until(60, 5, 0, is_bgp_route_synced, duthost), "BGP route is not synced") # verify the forwarding works after config reload run_srv6_traffic_test(duthost, dut_mac, ptf_src_port, neighbor_ip, ptfadapter, ptfhost, with_srh) @@ -304,6 +305,7 @@ def test_srv6_dataplane_after_bgp_restart(setup_uN, ptfadapter, ptfhost, with_sr assert wait_until(20, 5, 0, verify_asic_db_sid_entry_exist, duthost, sonic_db_cli), \ "ASIC_STATE:SAI_OBJECT_TYPE_MY_SID_ENTRY entries are missing in ASIC_DB after BGP restart" + pytest_assert(wait_until(60, 5, 0, is_bgp_route_synced, duthost), "BGP route is not synced") # verify the forwarding works after BGP restart run_srv6_traffic_test(duthost, dut_mac, ptf_src_port, neighbor_ip, ptfadapter, ptfhost, with_srh) @@ -329,6 +331,7 @@ def test_srv6_dataplane_after_reboot(setup_uN, ptfadapter, ptfhost, localhost, w assert wait_until(20, 5, 0, verify_asic_db_sid_entry_exist, duthost, sonic_db_cli), \ "ASIC_STATE:SAI_OBJECT_TYPE_MY_SID_ENTRY entries are missing in ASIC_DB after reboot" + pytest_assert(wait_until(60, 5, 0, is_bgp_route_synced, duthost), "BGP route is not synced") # verify the forwarding works after reboot run_srv6_traffic_test(duthost, dut_mac, ptf_src_port, neighbor_ip, ptfadapter, ptfhost, with_srh)