From c58eabaee80bca183f444550616f60602e2723fa Mon Sep 17 00:00:00 2001 From: xwjiang-ms <96218837+xwjiang-ms@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:07:22 +0800 Subject: [PATCH] Support pc lag member test in KVM (#16379) --- .azure-pipelines/pr_test_scripts.yaml | 4 ++-- ...ests_mark_conditions_skip_traffic_test.yaml | 9 +++++++++ tests/pc/test_lag_member_forwarding.py | 18 ++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/pr_test_scripts.yaml b/.azure-pipelines/pr_test_scripts.yaml index d8ad15b7a61..7871350841f 100644 --- a/.azure-pipelines/pr_test_scripts.yaml +++ b/.azure-pipelines/pr_test_scripts.yaml @@ -238,6 +238,7 @@ t0: - qos/test_pfc_counters.py - qos/test_pfc_pause.py - qos/test_qos_dscp_mapping.py + - pc/test_lag_member_forwarding.py t0-2vlans: - dhcp_relay/test_dhcp_relay.py @@ -459,6 +460,7 @@ t1-lag: - bgp/test_bgp_command.py - qos/test_pfc_counters.py - qos/test_qos_dscp_mapping.py + - pc/test_lag_member_forwarding.py multi-asic-t1-lag: @@ -496,7 +498,6 @@ onboarding_t0: - lldp/test_lldp_syncd.py # Flaky, we will triage and fix it later, move to onboarding to unblock pr check - dhcp_relay/test_dhcp_relay_stress.py - - pc/test_lag_member_forwarding.py - generic_config_updater/test_mgmt_interface.py - qos/test_pfc_counters.py - qos/test_pfc_pause.py @@ -504,7 +505,6 @@ onboarding_t0: onboarding_t1: - - pc/test_lag_member_forwarding.py - bgp/test_bgp_bbr_default_state.py - generic_config_updater/test_mgmt_interface.py - qos/test_pfc_counters.py diff --git a/tests/common/plugins/conditional_mark/tests_mark_conditions_skip_traffic_test.yaml b/tests/common/plugins/conditional_mark/tests_mark_conditions_skip_traffic_test.yaml index b5a28d7c6e2..caaed7337c7 100644 --- a/tests/common/plugins/conditional_mark/tests_mark_conditions_skip_traffic_test.yaml +++ b/tests/common/plugins/conditional_mark/tests_mark_conditions_skip_traffic_test.yaml @@ -285,6 +285,15 @@ ipfwd/test_nhop_group.py: conditions: - "asic_type in ['vs']" +####################################### +##### pc ##### +####################################### +pc/test_lag_member_forwarding.py: + skip_traffic_test: + reason: "Skip traffic test for KVM testbed" + conditions: + - "asic_type in ['vs']" + ####################################### ##### qos ##### ####################################### diff --git a/tests/pc/test_lag_member_forwarding.py b/tests/pc/test_lag_member_forwarding.py index d6dea34e233..d0eeb5e3c29 100644 --- a/tests/pc/test_lag_member_forwarding.py +++ b/tests/pc/test_lag_member_forwarding.py @@ -2,12 +2,15 @@ import json import pytest import time +import logging from tests.common import config_reload from ptf.mask import Mask import ptf.packet as scapy import ptf.testutils as testutils from tests.common.helpers.assertions import pytest_assert +logger = logging.getLogger(__name__) + pytestmark = [ pytest.mark.topology('any') ] @@ -123,14 +126,17 @@ def built_and_send_tcp_ip_packet(expected): pkt, exp_pkt = build_pkt(rtr_mac, ip_route, ip_ttl) testutils.send(ptfadapter, send_port, pkt, 10) if expected: - (_, recv_pkt) = testutils.verify_packet_any_port(test=ptfadapter, pkt=exp_pkt, - ports=recv_port) + result = testutils.verify_packet_any_port(test=ptfadapter, pkt=exp_pkt, ports=recv_port) + if isinstance(result, bool): + logger.info("Using dummy testutils to skip traffic test, skip following verify steps.") + return + + (_, recv_pkt) = result assert recv_pkt # Make sure routing is done pytest_assert(scapy.Ether(recv_pkt).ttl == (ip_ttl - 1), "Routed Packet TTL not decremented") else: - testutils.verify_no_packet_any(test=ptfadapter, pkt=exp_pkt, - ports=recv_port) + testutils.verify_no_packet_any(test=ptfadapter, pkt=exp_pkt, ports=recv_port) if peer_device_dest_ip: ptfadapter.dataplane.flush() @@ -160,6 +166,10 @@ def built_and_send_tcp_ip_packet(expected): ptfadapter.dataplane.flush() built_and_send_tcp_ip_packet(False) + if duthost.facts['asic_type'] == "vs": + logger.info("KVM could not perform actual asic actions, skip following verify steps.") + return + # make sure ping should fail for ip in peer_device_ip_set: if ipaddress.IPNetwork(ip).version == 4: