Skip to content

Commit

Permalink
Fix everflow tests for active-active dualtor (#12506)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekverma-arista authored Apr 24, 2024
1 parent 97c6e4b commit b6a6390
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
20 changes: 20 additions & 0 deletions tests/everflow/test_everflow_ipv6.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def everflow_direction(self, setup_info): # noqa F811
yield direction

def test_src_ipv6_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on Source IPv6 addresses."""
test_packet = self._base_tcpv6_packet(
Expand All @@ -101,6 +102,7 @@ def test_src_ipv6_mirroring(self, setup_info, setup_mirror_session, ptfadapter,
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_dst_ipv6_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on Destination IPv6 addresses."""
test_packet = self._base_tcpv6_packet(
Expand All @@ -118,6 +120,7 @@ def test_dst_ipv6_mirroring(self, setup_info, setup_mirror_session, ptfadapter,
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_next_header_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on the Next Header field."""
test_packet = self._base_tcpv6_packet(everflow_direction, ptfadapter, setup_info, next_header=0x7E)
Expand All @@ -130,6 +133,7 @@ def test_next_header_mirroring(self, setup_info, setup_mirror_session, ptfadapte
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_l4_src_port_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on the L4 Source Port."""
test_packet = self._base_tcpv6_packet(everflow_direction, ptfadapter, setup_info, sport=9000)
Expand All @@ -142,6 +146,7 @@ def test_l4_src_port_mirroring(self, setup_info, setup_mirror_session, ptfadapte
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_l4_dst_port_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on the L4 Destination Port."""
test_packet = self._base_tcpv6_packet(everflow_direction, ptfadapter, setup_info, dport=9001)
Expand All @@ -155,6 +160,7 @@ def test_l4_dst_port_mirroring(self, setup_info, setup_mirror_session, ptfadapte

def test_l4_src_port_range_mirroring(self, setup_info, setup_mirror_session, # noqa F811
ptfadapter, everflow_dut, everflow_direction,
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on a range of L4 Source Ports."""
test_packet = self._base_tcpv6_packet(everflow_direction, ptfadapter, setup_info, sport=10200)
Expand All @@ -168,6 +174,7 @@ def test_l4_src_port_range_mirroring(self, setup_info, setup_mirror_session,

def test_l4_dst_port_range_mirroring(self, setup_info, setup_mirror_session, # noqa F811
ptfadapter, everflow_dut, everflow_direction,
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on a range of L4 Destination Ports."""
test_packet = self._base_tcpv6_packet(everflow_direction, ptfadapter, setup_info, dport=10700)
Expand All @@ -180,6 +187,7 @@ def test_l4_dst_port_range_mirroring(self, setup_info, setup_mirror_session,
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_tcp_flags_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on TCP Flags."""
test_packet = self._base_tcpv6_packet(everflow_direction, ptfadapter, setup_info, flags=0x1B)
Expand All @@ -192,6 +200,7 @@ def test_tcp_flags_mirroring(self, setup_info, setup_mirror_session, ptfadapter,
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_dscp_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match on DSCP."""
test_packet = self._base_tcpv6_packet(everflow_direction, ptfadapter, setup_info, dscp=37)
Expand All @@ -204,6 +213,7 @@ def test_dscp_mirroring(self, setup_info, setup_mirror_session, ptfadapter, ever
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_l4_range_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match from a source port to a range of destination ports and vice-versa."""
test_packet = self._base_tcpv6_packet(
Expand Down Expand Up @@ -241,6 +251,7 @@ def test_l4_range_mirroring(self, setup_info, setup_mirror_session, ptfadapter,
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_tcp_response_mirroring(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match a SYN -> SYN-ACK pattern."""
test_packet = self._base_tcpv6_packet(
Expand Down Expand Up @@ -277,6 +288,7 @@ def test_tcp_response_mirroring(self, setup_info, setup_mirror_session, ptfadapt

def test_tcp_application_mirroring(self, setup_info, setup_mirror_session, # noqa F811
ptfadapter, everflow_dut, everflow_direction,
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match a TCP handshake between a client and server."""
test_packet = self._base_tcpv6_packet(
Expand Down Expand Up @@ -317,6 +329,7 @@ def test_tcp_application_mirroring(self, setup_info, setup_mirror_session,

def test_udp_application_mirroring(self, setup_info, setup_mirror_session, # noqa F811
ptfadapter, everflow_dut, everflow_direction,
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match UDP traffic between a client and server application."""
test_packet = self._base_udpv6_packet(
Expand Down Expand Up @@ -355,6 +368,7 @@ def test_udp_application_mirroring(self, setup_info, setup_mirror_session,
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_any_protocol(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that the protocol number is ignored if it is not specified in the ACL rule."""
test_packet = self._base_tcpv6_packet(
Expand Down Expand Up @@ -405,6 +419,7 @@ def test_any_protocol(self, setup_info, setup_mirror_session, ptfadapter, everfl

def test_any_transport_protocol(self, setup_info, setup_mirror_session, # noqa F811
ptfadapter, everflow_dut, everflow_direction,
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that src port and dst port rules match regardless of whether TCP or UDP traffic is sent."""
test_packet = self._base_tcpv6_packet(
Expand Down Expand Up @@ -442,6 +457,7 @@ def test_any_transport_protocol(self, setup_info, setup_mirror_session,
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_invalid_tcp_rule(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that the ASIC does not reject rules with TCP flags if the protocol is not TCP."""
pass
Expand All @@ -452,6 +468,7 @@ def test_invalid_tcp_rule(self, setup_info, setup_mirror_session, ptfadapter, ev
# suite + loganaylzer + the sanity check to fail.

def test_source_subnet(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match packets with a Source IPv6 Subnet."""
test_packet = self._base_tcpv6_packet(
Expand All @@ -472,6 +489,7 @@ def test_source_subnet(self, setup_info, setup_mirror_session, ptfadapter, everf
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_dest_subnet(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match packets with a Destination IPv6 Subnet."""
test_packet = self._base_tcpv6_packet(
Expand All @@ -492,6 +510,7 @@ def test_dest_subnet(self, setup_info, setup_mirror_session, ptfadapter, everflo
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_both_subnets(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match packets with both source and destination subnets."""
test_packet = self._base_tcpv6_packet(
Expand All @@ -512,6 +531,7 @@ def test_both_subnets(self, setup_info, setup_mirror_session, ptfadapter, everfl
dest_ports=EverflowIPv6Tests.tx_port_ids)

def test_fuzzy_subnets(self, setup_info, setup_mirror_session, ptfadapter, everflow_dut, # noqa F811
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
everflow_direction, toggle_all_simulator_ports_to_rand_selected_tor): # noqa F811
"""Verify that we can match packets with non-standard subnet sizes."""
test_packet = self._base_tcpv6_packet(
Expand Down
29 changes: 5 additions & 24 deletions tests/everflow/test_everflow_testbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

from tests.ptf_runner import ptf_runner
from .everflow_test_utilities import TARGET_SERVER_IP, BaseEverflowTest, DOWN_STREAM, UP_STREAM, DEFAULT_SERVER_IP

from tests.common.dualtor.dual_tor_utils import config_active_active_dualtor_active_standby # noqa F401
from tests.common.dualtor.dual_tor_utils import validate_active_active_dualtor_setup # noqa F401
from tests.common.dualtor.dual_tor_common import active_active_ports # noqa F401

# Module-level fixtures
from tests.common.fixtures.ptfhost_utils import copy_ptftests_directory # noqa: F401
from tests.common.fixtures.ptfhost_utils import copy_acstests_directory # noqa: F401
Expand Down Expand Up @@ -85,20 +80,6 @@ class EverflowIPv4Tests(BaseEverflowTest):
DEFAULT_DST_IP = "30.0.0.1"
MIRROR_POLICER_UNSUPPORTED_ASIC_LIST = ["th3", "j2c+", "jr2"]

@pytest.fixture
def setup_active_active_ports(self, active_active_ports, rand_selected_dut, rand_unselected_dut, # noqa F811
config_active_active_dualtor_active_standby, # noqa F811
validate_active_active_dualtor_setup): # noqa F811
if active_active_ports:
# for active-active dualtor, the upstream traffic is ECMPed to both ToRs, so let's
# config the unselected ToR as standby to ensure all ethernet type packets are
# forwarded to the selected ToR.
logger.info("Configuring {} as active".format(rand_selected_dut.hostname))
logger.info("Configuring {} as standby".format(rand_unselected_dut.hostname))
config_active_active_dualtor_active_standby(rand_selected_dut, rand_unselected_dut, active_active_ports)

return

@pytest.fixture(params=[DOWN_STREAM, UP_STREAM])
def dest_port_type(self, setup_info, setup_mirror_session, tbinfo, request): # noqa F811
"""
Expand Down Expand Up @@ -149,7 +130,7 @@ def add_dest_routes(self, setup_info, tbinfo, dest_port_type): # noqa F811
def test_everflow_basic_forwarding(self, setup_info, setup_mirror_session, # noqa F811
dest_port_type, ptfadapter, tbinfo,
toggle_all_simulator_ports_to_rand_selected_tor, # noqa F811
setup_active_active_ports):
setup_standby_ports_on_rand_unselected_tor_unconditionally): # noqa F811
"""
Verify basic forwarding scenarios for the Everflow feature.
Expand Down Expand Up @@ -250,7 +231,7 @@ def test_everflow_basic_forwarding(self, setup_info, setup_mirror_session,
def test_everflow_neighbor_mac_change(self, setup_info, setup_mirror_session, # noqa F811
dest_port_type, ptfadapter, tbinfo,
toggle_all_simulator_ports_to_rand_selected_tor, # noqa F811
setup_active_active_ports):
setup_standby_ports_on_rand_unselected_tor_unconditionally): # noqa F811
"""Verify that session destination MAC address is changed after neighbor MAC address update."""

everflow_dut = setup_info[dest_port_type]['everflow_dut']
Expand Down Expand Up @@ -320,7 +301,7 @@ def test_everflow_neighbor_mac_change(self, setup_info, setup_mirror_session,
def test_everflow_remove_unused_ecmp_next_hop(self, setup_info, setup_mirror_session, # noqa F811
dest_port_type, ptfadapter, tbinfo,
toggle_all_simulator_ports_to_rand_selected_tor, # noqa F811
setup_active_active_ports):
setup_standby_ports_on_rand_unselected_tor_unconditionally): # noqa F811
"""Verify that session is still active after removal of next hop from ECMP route that was not in use."""

everflow_dut = setup_info[dest_port_type]['everflow_dut']
Expand Down Expand Up @@ -412,7 +393,7 @@ def test_everflow_remove_unused_ecmp_next_hop(self, setup_info, setup_mirror_ses
def test_everflow_remove_used_ecmp_next_hop(self, setup_info, setup_mirror_session, # noqa F811
dest_port_type, ptfadapter, tbinfo,
toggle_all_simulator_ports_to_rand_selected_tor, # noqa F811
setup_active_active_ports):
setup_standby_ports_on_rand_unselected_tor_unconditionally): # noqa F811
"""Verify that session is still active after removal of next hop from ECMP route that was in use."""

everflow_dut = setup_info[dest_port_type]['everflow_dut']
Expand Down Expand Up @@ -524,7 +505,7 @@ def test_everflow_dscp_with_policer(
config_method,
tbinfo,
toggle_all_simulator_ports_to_rand_selected_tor, # noqa F811
setup_active_active_ports
setup_standby_ports_on_rand_unselected_tor_unconditionally, # noqa F811
):
"""Verify that we can rate-limit mirrored traffic from the MIRROR_DSCP table.
This tests single rate three color policer mode and specifically checks CIR value
Expand Down

0 comments on commit b6a6390

Please sign in to comment.