Skip to content

Commit

Permalink
Support pc lag member test in KVM (sonic-net#16379)
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjiang-ms authored Jan 10, 2025
1 parent a1f35d8 commit c58eaba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/pr_test_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -496,15 +498,13 @@ 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
- qos/test_qos_dscp_mapping.py


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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####
#######################################
Expand Down
18 changes: 14 additions & 4 deletions tests/pc/test_lag_member_forwarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
]
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c58eaba

Please sign in to comment.